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.
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
N = AB x AC //cross product
Now normalize vectors AB and N getting unit U = uAB
and uN
. Build the second base vector (it is unit and lies in the plane)
V = U x uN
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:
[Ax ux vx nx] [0 1 0 0]
M * [Ay uy vy ny] = [0 0 1 0]
[Az uz vz nz] [0 0 0 1]
[1 1 1 1 ] [1 1 1 1]
or
M * S = D
M * S * Sinv = D * Sinv
M = D * Sinv
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.
P:=vector([-2,1,7,1]);
> PP := multiply(M, P);
PP := [-3, 6, 0, 1]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With