adbrown85 / gloop

Lightweight C++ wrapper for OpenGL
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Add a quaternion implementation #3

Closed adbrown85 closed 12 years ago

adbrown85 commented 12 years ago

We need a quaternion implementation to support smooth rotations.

The core methods we will need right away are:

We may want to make rotate a top-level function though.

In the future it would also be nice to have:

adbrown85 commented 12 years ago

The rotate method should probably just be rotate(Quaternion) instead of rotate(Vec3, float).

adbrown85 commented 12 years ago

Not sure if the default constructor should be setting the scalar component to zero or not, since a quaternion doesn't necessarily have to be a rotation. Which also brings up whether there should really be a separate class for rotations. It could be called either Rotation or maybe Versor. It would keep the components normalized, which also means keeping them private. This might be a little overkill though.

adbrown85 commented 12 years ago

If Quaternion isn't necessarily a rotation, we should probably replace rotated with operator* and operator*=. That also makes it a little easier to specify the order of the operation, although it's backwards from what one might expect so that might be a little confusing.

adbrown85 commented 12 years ago

Also want magnitude, normalize, and conjugate.