title: Transform an object so its normal vector align z axis
body: <p>I want to transform 3d mesh surface in a way that normal vector is parallel to z axis.</p>
  <p><img src="https://i.stack.imgur.com/JDrAy.png" alt="example of mesh surface and normal vector" /></p>
  <p>I try the following steps:</p>
  <p>1- find the rotation angle using</p>
  <p>atan2d(norm(cross(n,z)),dot(n,z));
  where n is the normal vector and z is the z-axis</p>
  <p>2- find axis of rotation using cross product of n and z</p>
  <p>3- create rotation matrix</p>
  <p>however the resulted transformation is wrong.</p>
  <p>Thanks for your help</p>