I have one triangle in $3D$ space that I am tracking in a simulation. Between time steps I have the previous normal of the triangle and the current normal of the triangle along with both the current and previous $3D$ vertex positions of the triangles.
Using the normals of the triangular plane I would like to determine a rotation matrix that would align the normals of the triangles thereby setting the two triangles parallel to each other. I would then like to use a translation matrix to map the previous onto the current, however this is not my main concern right now.
I have found this website that says I must
- determine the cross product of these two vectors (to determine a rotation axis)
- determine the dot product ( to find rotation angle)
- build quaternion (not sure what this means)
- the transformation matrix is the quaternion as a $3 \times 3$ (not sure)
Any help on how I can solve this problem would be appreciated.
The quaternion is a $4$-dimensional complex number: http://en.wikipedia.org/wiki/Quaternion used to describe rotations in space. A quaternion (like a complex number) has a polar representation involving the exponential of the arguments (rotations), and a magnetude multiplier. Building the quaternion comes from the cross product (the product of the complex components), which will give you the argument in those $3$ dimensions, you'll then get a number from that in the form $A+Bi+Cj+Dk$, and write it out in the matrix form described in the article there.
An easier way would be to simply fingure out what your original vectors are in the $4$-space, and take the appropriate inverse operations to get your resultant quaternion (without going through the dot/cross product steps) but that requires a good foundation in hypercomplex algebra.