Search code examples
matheigen

finding the rotation axis


I'm using eigen library to rotate a plane to be parallel to the ground plane.

  • The ground plane is defined using the normal vector (0,0,1)
  • The target plane is a set of 3D points and a normal
  • The rotation angle is known

The normal vector of the plane as well as every point on that plane has to be rotated to be parallel to the ground plane.

I'd like to use affine transformation from http://eigen.tuxfamily.org/api/TutorialGeometry.html (archive.org link) - something like this:

Transform<float,N,Affine> t = AngleAxisf(a,axis); <br/>

axis in this case is a matrix representing an arbitary axis, along which the rotation takes place.

How to find this axis?


Solution

  • Making two planes parallel can be done by making their normals parallel, so you just need to find the axis to rotate the target plane normal about. This is just the axis that is perpendicular to both your ground plane normal and your target plane normal which can be found using the cross product. In your case, if your target plane has a normal of [x,y,z], then the rotation axis is [y,-x,0].