Rotation matrix from an inertia tensor

I have a set of weighted points in 3D space (in fact, a molecule) and I'm trying to align the principal axes of this set with the $x$, and $y$ and $z$ axes. To do so, I've first translated my points so their barycenter coincides with the origin. Then, I've calculated the moment of inertia tensor $I$ and its eigenvalues ($\lambda_i$) and eigenvectors ($V_i$).

Then, I need to build the rotation matrix associated with the rotation bringing my vectors $V_i$ onto $(x,y,z)$. I assumed that would be the inverse of the matrix formed by the vectors $V_i$ in columns, but it is not. So, how would you write this matrix from what I have already calculated?

-

We have $I V_i = \lambda_i V_i$, where $\lambda_i$ is real. Let $M$ be the matrix whose columns are the normalized eigenvectors of $I$. Then $M$ is orthogonal, $M^T M = M M^T = \mathbb{I}$. Thus, $M^T I M = D = \mathrm{diag}(\lambda_1,\lambda_2,\lambda_3)$ and $M^T M_i = e_i$. Notice that the last equation implies, for example, that $M^T M_1 = e_1 = (1\ 0\ 0)^T$. That is, the transpose of $M$ brings the principal axes to the Cartesian axes.
The simplest way to remember how the various objects transform is to look at the kinetic energy, for example, $$\begin{eqnarray*} \frac{1}{2}\omega^T I \omega &=& \frac{1}{2}\underbrace{\omega^T M}_{\xi^T} \underbrace{M^T I M}_D \underbrace{M^T \omega}_\xi \\ &=& \frac{1}{2} \sum_{i=1}^3 \lambda_i\xi_i^2, \end{eqnarray*}$$ where $\omega$ is the angular velocity in the original frame and $\xi$ is the angular velocity with respect to the principal axes.
I don't understand… Are you saying M is the rotation matrix bringing the principal axes to the cartesian axes? Because it doesn't work… and I've tried more than once! PS: My eigenvectors are already normalized. PPS: I don't know what you define as $\omega$ or $\xi$ or $D$ –  F'x May 14 '12 at 20:59