How to get the transformation matrix between two identical "Mesh"/BufferGeometry

Hello hello,

I’m struggling a specific question …

What I have :

  • Mesh A : 3 points (p0_A, p1_A, p2_A) are selected on mesh A
  • Mesh B : is the same mesh than mesh A, but in a different position

I’m looking for the transformation between A and B so I could applied this transformation to my points so I’ll have the corresponding coordinates of the points on Mesh B (with worldCoordinates)

My first idea (not accurate enought) : I compute the closest vertex from the points and get the attribute position of the vertex and then get the coordinates of vertex[i] on Mesh B as Mesh B = Mesh A.
But doing this is not accurate enough because the points are not ON vertices …

So I tried to compute (I’m quite beginner in these 3D manipulations) the RotationQuaternion creating planes from the points and using this method : https://stackoverflow.com/questions/25199173/how-to-find-rotation-matrix-between-two-vectors-in-three-js but it’s not helping me having the full transform …

So third I tried to implement this solution to get the transformation matrix : https://stackoverflow.com/questions/66060613/how-to-calculate-the-conversion-matrix-of-two-meshes

BUT something is strange … when I get MyObjectA.matrixWorld this is the same than MyObjectB.matrixWorld, but they’re not in the same position.

Let me illustrate the situation (my drawing skills are Basic Paint level … sorry) :

Thank’s for your help