title: How to rotate a 3D plane?
body: <p>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:</p>
  
  <p><a href="https://i.stack.imgur.com/aMv2M.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aMv2M.jpg" alt="this plane is rotated about  more then one axis"></a></p>
  
  <p>I tried to calculate by using following formulas:</p>
  
  <ol>
  <li>theta=-acosd((dot(n1,n2))/(norm(n1)*norm(n2)));</li>
  <li>Calculate spherical angles: theta and phi;</li>
  </ol>
  
  <p>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.</p>
  
  <p>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.</p>