Swati Jain
Swati Jain

Reputation: 63

How to rotate a 3D plane?

I have a 3d plane (made up of number of points) which is rotated at weird angle. I want to make it flat i.e lie on xy-plane. I have plane equation but I think my calculated angles are not correct or might be using wrong rotation matrix. By wrong rotation matrix is that I meant that I am not sure about which axis should I rotate. attached is the picture of my plane:

this plane is rotated about  more then one axis

I tried to calculate by using following formulas:

  1. theta=-acosd((dot(n1,n2))/(norm(n1)*norm(n2)));
  2. Calculate spherical angles: theta and phi;

both methods are giving same angle, I rotated my plane first about z-axis and then about y-axis. The resulted plane is almost flat but it still has some anlge.

I tried both rotation matrix and Rodrigues' rotation matrix. It would be really helpful if someone could suggest how to rotate this plane to make it flat.

Upvotes: 4

Views: 3696

Answers (1)

coproc
coproc

Reputation: 6247

When a plane is not parallel to the xy-plane, then it's normal vector will not be parallel to the z-axis. So the cross product of the normal vector and the z-axis (unit) vector will be non-zero. This vector is in the plane and parallel to the xy-plane. Take it as rotation axis. The rotation angle to make the plane parallel to the xy-plane is the same as the angle between the normal vector and the z-axis.

Upvotes: 1

Related Questions