I have a point cloud, all the points lie on a plane in 3D Space. I need to convert each point to 2D Coordinates and vice versa.
(x,y,z) in Coordinate System A => Transformation Matrix (T1) => (x,y) in Coordinate System B
(x,y) in Coordinate System B => Transformation Matrix (T2) => (x,y,z) in Coordinate System A
I need T1 and T2. The coordinate system B can be any arbitrary reference frame.
To help clarify the process of moving from 3d to 2d and back from 2d to 3d in Visual Studio flavor and DxMath to transform 3d coordinates on a plane to 2d coordinates. For example, to help use 2d triangulation algorithms in the 3d world.
As far as I understand, all points lie in the same plane, and you want to reduce dimension and later restore coordinates.
Get three non-collinear points A, B, C. Make vectors AB and AC.
Normal to that plane is
Now normalize vectors AB and N getting unit
U = uAB
anduN
. Build the second base vector (it is unit and lies in the plane)Now you have four basis points
A, u=A+U, v=A+V, n=A+uN
Tranformation should map these points into quadruplet
(0,0,0), (1,0,0), (0,1,0), (0,0,1)
correspondingly.Now about affine transformation matrix to make this mapping:
or
So calculate inverse matrix for
S=[Ax ux...]
and get needed matrix M.Application of M to any point in the plane gives new coordinates with zero z-component.
Application of inverse of M to (x,y,0) results 3D coordinates in given plane.
Maple sheet with points
A=1,1,1 B=2,1,1 C=1,1,2 (in plane Y=1)
new coordinates AA, BB, CC have zero z-component.
For arbitrary point in the same plane z-component after mapping is zero too.