How to translate the vertices according to the new position

Hello Three js team,

I am working on deep translation , i have a circle that i created using the circleGeometry and after creating a circle i position it to a new place but what i see that after positioning it the position changes but the geometry.vertices are not updating means they are always like near to origin. So i want to update them too please any one help me in this

You need to show some code… best would be a jsFiddle.

@Fluqz thanks for your attention
var geometry = new THREE.CircleGeometry(1, 64 );
var mesh = new THREE.Mesh(geometry,material)
mesh.position.set(pointofintersection)

Here pointofintersection is basically the point i am getting while hitting a click on the plane and my mesh is successfully shifted to this position but
when i am doing mesh.geometry.vertices so they array is not updated to the new location i want it to be updated according to new location

Here by default it takes scene origin as the center of the circle but i want to update the center means it should be the point where i click , so that once the circle geometry created its vertices are calculated according to the new center please let me know how is it possible?

is pointofintersection a vector3? You cannot pass a vec3 to position.set(). Either you have to set each value mesh.position.set(pointofintersection.x, pointofintersection.y, pointofintersection.z) or you copy the vector to position like so mesh.position.copy(pointofintersection)

Every obj in Three has a matrixAutoUpdate flag (boolean). When set to true, the new matrix of position will be calculated with the next draw call. if set to false you have to update it manually everytime the position, rotation or scale properties change. You update like so mesh.updateMatrix()

Also Im not sure if you just wanna position the object (as described above) or offset the actual pivot point (the origin of the obj)?

No,
@Fluqz i already position the circle here in the curveLine mesh if we do
curveLine.geometry.vertices we got an array of vertices i want to update that array according to the new position.

If updation of the array is not possible so i think we i change the center of the circle that is by default origin than it create the circular geometry that have the vertices according to the new center

Here is the fiddle https://jsfiddle.net/v7sawf6u/ i added the two console log statement each printing the vertices of the circle geometry i want after we change the position it should update the vertices array according to the new position is that possible.
Here after change the position in the fiddle it is not updating the vertices array

Maybe you want Geometry.translate

So instead of

mesh.position.set(3, 1, 4);

you would do

mesh.geometry.translate( 3, 1, 4 );
1 Like

This give me some weired position of the circle but i really appreciate your attention is there any other way i think you understand my need sir

@Alex
If you move vertices of a geometry, be prepared to get weird/strange/undesired results, when you apply some transfomations to a mesh with that geometry.

If you want to find positions of vertices in global coordinates, then do something like this, without .translate():

mesh.geometry.vertices.forEach(v => {
    let globalVert = v.clone();
    mesh.localToWorld(globalVert);
    console.log(globalVert);
});