1
$\begingroup$

If I have a vector that starts at the origin, how can I find the transformation matrix that will align it with the positive y-axis. So it basically turns into a positive-y axis?

EDIT: I also forgot to mention this is in a 3d space

$\endgroup$

1 Answer 1

2
$\begingroup$

Use the Euler-Rodrigues formula to find the rotation matrix $\mathbf{R}$: $$ \mathbf{R} = \cos\theta (\mathbf{I} - \mathbf{a}^T \mathbf{a})+ \mathbf{a}^T \mathbf{a} + \sin\theta\,\mathbf{A} $$ where $\mathbf{a}$ is the axis of rotation and $\theta$ is the angle of rotation. $\mathbf{I}$ is the identity matrix. The matrix $\mathbf{A}$ is skew-symmetric and is related to $\mathbf{a}$ by its action of a vector $\mathbf{v}$ as $$ \mathbf{A}\cdot\mathbf{v} = \mathbf{a}\times\mathbf{v} \,. $$ To find the axis of rotation you will have to compute $\mathbf{a} = \mathbf{e}_y\times\mathbf{w}$ where $\mathbf{e}_y$ is the $y$-axis vector and $\mathbf{w}$ is your starting vector. The angle $\theta$ can be found from $\mathbf{e}_y\cdot\mathbf{w}$.

For an alternative approach see How to find the orthonormal transformation that will rotate a vector to the x axis?

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .