rotate 3D plane to a new 2d coordinate system
Show older comments
Hello, I have been looking for this relatively simple issue but I haven't found a simple solution.
I have extracted a plane in 3D from a visualization software, so I have a matrix of coordinates: Coor_3D= [x1 x2 x3];.
As all the points are lying on the same plane, I was wondering how can I transform the above matrix to obtain a simple one in 2D, i.e = Coor_2D=[x1' x2' 0];
Thanks
Accepted Answer
More Answers (2)
Elena Figal
on 9 Jan 2018
1 vote
Hello, I tried to recover the original 3D points from the transformation by using the same matrix T and a set of 2D points with a rows of zero and a row of 1, but my new 3D points are different from the originals, could you please help me?
1 Comment
I want to know the same: Please open a new issue and let's see if someone finds the answer. Please let me know if you find something.
I am this far now:
Matt kindig does:
T = [unitx(:), unity(:), unitz(:), origin(:); 0 0 0 1];
C = [pnts, ones(N,1)]
Coor_2D = T \ C'
To recover pnts out of Coor_2D, you have to solve the equation for C and then extract pnts. I think it should be:
C = (T*Coor_2D)'
But this does not result in the correct points...any other idea?
Edit: I found the solution!
My mathematical solution was right, you just have to handle Coor_2D correctly to transform it backwards. Here's the code. You just need 2d-points (twoDpnts), the Transformation T and a row of zeros (zeros(size(twoDpnts,1)) and a row of ones (ones(size(twoDpnts,1),1)).
Coor_2D_backwards = [twoDpnts zeros(size(twoDpnts,1),1) ones(size(twoDpnts,1),1)]'
C = (T*Coor_2D_backwards)'
pnts = C(:,1:3)
Best regards
Categories
Find more on Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!