How to rotate entire 3d data with x,y,z values along a particular axis (say x axis)?
Show older comments
I need to rotate my 3d dataset defined by x,y,z coordinate along x axis at a specified angle (say 45 degree). This kinds of rotations are often needed when processing scanner and LIDAR data. MATLAB can do exactly what I want to do, but in graphic objects only i.e. using rotate(h,direction,alpha). However, this doesn't change the source data. I need to get the new rotated data, how can I retrieve the new rotated x,y,z data? Or, could you please suggest how to calculate in MATLAB?
Thank you,
Accepted Answer
More Answers (1)
Matt J
on 30 Mar 2014
2 votes
See Syntax 3 of this FEX file
7 Comments
It would be great, if you can provide similar formula for rotating around y and z axis as well.
XYZ=[X(:),Y(:),Z(:)].';
XYZnew = AxelRot(XYZ, angle, [0 1 0]); %rotation in y
XYZnew = AxelRot(XYZ, angle, [0 0 1]); %rotation in z
Matt J
on 31 Mar 2014
XYZ is expected to be 3xN. Without the transpose, it will be Nx3.
Sagar
on 31 Mar 2014
Matt J
on 31 Mar 2014
If you attach your VarName1,2,3 data in a .mat file, I'll take a look at it.
Matt J
on 31 Mar 2014
Sorry, never mind. The syntax needs to be
XYZnew = AxelRot(XYZ, angle, [1 0 0],[]);
Sagar
on 31 Mar 2014
Categories
Find more on Geometric Transformation and Image Registration 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!