how to calculate the transformation matrix for a rotation?


Can someone tell me how to calculate the transformation matrix by which a given vector can be rotated to a direction incident to another given vector (e.g. from (1, 1, 1) to (2, 7, 5)? Or is there a free library tool for this? If inside the OpenGL environment, I can use glRotate(), glGet(), etc. to get it very easily. But I often need it without the OpenGL support. Could you help? Thanks very much.


Try looking inside of NVidia SDK. There is a files called nv_algebra.cpp and nv_algebra.h. There’s a structures and functions for working with vectors and matrices!

Try googling for “matrix and quaternion FAQ”