Sign in to follow this  
mathaig

Axis alignment math

Recommended Posts

Hello,
I have two arbitrary matrices M1 & M2 and I would like to Rotate M1 in such a way that any one of the axis (Up, At or Right ) of M1 aligns with any one of the axis of M2.

Eg:
Align X-of-M1 to Y-of-M2, or
Align Z-of-M1 to X-of-M2,

Is it just enough that I take the src and dst axis, find the cross, dot and generate a rotation nudge matrix (Mn) So,

M1 = M1 * Mn

Thanks & regards
Mat

Share this post


Link to post
Share on other sites
Quote:
Is it just enough that I take the src and dst axis, find the cross, dot and generate a rotation nudge matrix
Yes, that is a typical solution. (Just watch out for cases where the magnitude of the cross product is small, as normalization may fail in that case.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this