Notifications
Clear all

[Closed] Rotate orthonormal basis

Hi

If there is an orthonormal basis and some vector. I want to rotate basis so it’s Z axis matches that vector. The angle of rotation is known.

How can one perform that rotation?
How can one find the direction of two other basis axes?

Please see the picture:

3 Replies

it’s Rotation matrix from axis and angle. Are you looking for Math or MAX solution?
Math is http://en.wikipedia.org/wiki/Rotation_matrix
MAX is[b] preRotate <matrix3> <quat>

[/b]when you rotate the matrix it’s easy to get its axis. X,Y,Z are row1, row2, row3 respectively.

let’s say we have:
original transform – tm
new Z vector: zvector
the tm after rotation will be:


-- angle of rotation:
ang = acos (dot [b]zvector  [/b]tm.row3)
-- axis of rotation:
axis = normalize (cross [b]zvector [/b]tm.row3)
-- rotate about pos of [b]tm:[/b]
rot_tm = preRotate [b]tm  [/b](quat ang axis)
-- new X and Y axis:
X = rot_tm.row1
Y = rot_tm.row2

It works like a dream!

Thanks a lot!