I have a global coordinates system (X, Y, Z), and a triangle with points (A, B, C and Center). I know all coordinates of those points.
- I need to move global coordinates system from (0; 0; 0) to the triangle center, so that all the points: A, B, C and Center would have new coordinates where Z = 0. After that i need to know new coordinates of those points in the relation with new coordinates system. The orientation of new coordinate system is not important.
- Also, if there is a possibility to convert a 3D points (triangle points) to 2D plane without loosing its geometry (size). It shouldn’t be a projection to 2D plane.
>> A=[10.63307; -7.72528; 21.26636];
B=[4.06139; -12.49988; 21.26636];
C=[-6.57172; -20.22529; 13.14344];
Centr=[-4.38113; -13.48349; 18.55872];
>> V1=(B-A)/(norm(B-A))
V1 =
-0.8090
-0.5878
0
>> V2=((C-A)-(dot((C-A),V1)*V1))/(norm((C-A)-(dot((C-A),V1)*V1)))
V2 =
0.0000
-0.0000
-1.0000
>> V3=cross(V1,V2)
V3 =
0.5878
-0.8090
0.0000
>> M=[V1,V2,V3]
M =
-0.8090 0.0000 0.5878
-0.5878 -0.0000 -0.8090
0 -1.0000 0.0000
>> Anew=inv(M)*(A-Centr)
Anew =
-15.5313
-2.7076
4.1666
>> Bnew=inv(M)*(B-Centr)
Bnew =
-7.4083
-2.7076
4.1666
>> Cnew=inv(M)*(C-Centr)
Cnew =
5.7350
5.4153
4.1666
See Question&Answers more detail:os