ArcBall Rotation

This topic is 3552 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hi Friends, I want to do arcball rotation , i found that most of implementations are using quaternions for rotation . (For the arbitary axis in the source sphere). It is also possible with matrices to rotate around arbitary axis. Then why quaternions are popular ? (since here we don't need any interpolation stuffs) Any nice thoughts ? KD Hard work never fails.

Share on other sites
Quaternions have a lot of nice properties. Quaternions only require 4 floats, which is a lot less than the 16 floats required for a 4x4 matrix (or 9 for a 3x3 matrix). Quaternions are also a lot faster, since a quaternion multiplication is far simpler and faster than a matrix multiplication.

Quaternions, like matrices, aren't very prone to gimbal locks. And, as you mentioned, they're useful when interpolating. The only downside to quaternions is that the math behind them can be a bit difficult to understand for some people.

Share on other sites
One of the more important operations involved in arcball rotation is the calculation of the rotation to perform a rotation across shortest arc between two vectors. The calculation of this value for quaternions can look something like:
d = a <dot> b;s = sqrt((1 + d) * 2)c = a <cross> b;q = Quaternion(s / 2, c.x / s, c.y / s, c.z / s)

(This is missing things like error checks and special handling for when a and b are parallel.) The equivalent code for matrices is a little more involved.

Also, since arcball rotations involve storing the successive results of applied rotations, orientation is subject to numerical instability thats easier to compensate for with quaternions than with matrices.

Neither of these things are impossible with matrices, it's just easier with quaternions.

Share on other sites
Thank you all for the replies.. It makes things more clear.

Share on other sites

This topic is 3552 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

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

• Forum Statistics

• Total Topics
628714
• Total Posts
2984353

• 23
• 11
• 10
• 13
• 14