Home > Blockchain >  Transform 3d triangle to new vertices
Transform 3d triangle to new vertices

Time:09-29

I have 3d triangle with vertices A, B, C and i want it to transform to new vertices A', B', C' with transformation matrix. Sorry for my bad english. Any ideas?

edit: I am working in godot and i am using multimesh, which require transformation matrix.

CodePudding user response:

If the 3D points A, B, and C are linearly independent, you can find a transformation matrix T such that when you multiply it by X consisting of the column vectors X = [A, B, C] you arrive at Y = [A', B', C'] as in:

T·X = Y

To find T, simply post multiply both sides by the inverse of X, X^(-1) as in:

T·X·X^(-1) = Y·X^(-1)
T = Y·X^(-1)

You can either code the math to find the inverse of a 3x3 matrix or you may be able to use a library in your particular language to find the inverse of a 3x3 matrix.

I don't know godot, so I recommend looking at the documentation to see if there is something that will help you calculate the inverse of a 3x3 matrix.

  • Related