Quaternion or Matrix rotation for 3D Objects

Started by
1 comment, last by Guthur 15 years, 1 month ago
Hi, I am working on a game engine, and I have a quaternion based camera class, but for general object rotation should i use quaternions or just use matrices with vectors?
Advertisement
Quote:Hi, I am working on a game engine, and I have a quaternion based camera class, but for general object rotation should i use quaternions or just use matrices with vectors?
Either one would be fine.

The main thing to keep in mind is that matrices and quaternions have the same fundamental behavior when it comes to rotations, so it's not like picking one or the other will determine in some way what your objects are able to do.

Each representation does have its advantages and disadvantages, though. Quaternions require less memory (which may or may not matter, depending on the context). Concatenating rotations in quaternion form can be more efficient than the equivalent matrix operation, and certain operations (notably interpolation) are more efficient and elegant with quaternions than with matrices.

However, if you use quaternions you'll almost certainly end up converting them to matrix form at some point (both for access to the corresponding direction vectors, and for interoperability with external APIs), which can offset some of the efficiency gains you might pick up elsewhere.

If I were starting an engine from scratch right now, I'd probably use quaternions as the base representation, and then extract direction vectors and/or convert to matrix form as necessary. Again, though, either would be fine - there's really no one 'right' choice.
I would say stick to Matrices as I don't think there is any hardware support for quaternions.

If you are making a software engine then take your pick I suppose, they both seem to have advantages and disadvantages.

edit: ninja'd by a way better post :)
Innovation not reiterationIf at any point I look as if I know what I'm doing don't worry it was probably an accident.

This topic is closed to new replies.

Advertisement