I want to transform 3d mesh surface in a way that normal vector is parallel to z axis.
I try the following steps:
1- find the rotation angle using
atan2d(norm(cross(n,z)),dot(n,z)); where n is the normal vector and z is the z-axis
2- find axis of rotation using cross product of n and z
3- create rotation matrix
however the resulted transformation is wrong.
Thanks for your help