![]() ![]() So most often, 3D game software will use quaternions, with all their imaginary number guts, as the way to store and track rotations. (For more info on the hazards of using the wrong rotation representation, see this case of compounding error, this example of interpolation, this example of orientation ranges, this issue with wraparounds, and gimbal lock) It turns out that manipulating rotations in this form has some major advantages over other ways we might try to represent them in 3D: $$q = \cos \frac \theta 2 + \sin \frac \theta 2 \cdot( xi + yj + zk)$$ ![]() Specifically, we can express a rotation around the unit vector \$(x, y, z)\$ by an angle \$\theta\$ as the unit quaternion: Similar to how the multiplication of unit complex numbers is equivalent to 2D rotations in geometry, multiplication of unit quaternions is equivalent to 3D rotations! Why would we work with such a torturous thing? It turns out this construction has a very useful isomorphism. \bf \times & \bf 1 & \bf i & \bf j & \bf k \\ But they also have special rules for how they multiply with each other: \$q = w + x\cdot i + y \cdot j + z \cdot k\$Įach of these imaginary units \$i, j, k\$ has the property \$i^2 = j^2 = k^2 = -1\$, just like the \$i\$ you might be used to in complex numbers. ![]() But instead of just one imaginary axis, quaternions have three! Like complex numbers \$z = a + b \cdot i\$, a quaternion consists of both a real part and an imaginary part. One place that imaginary numbers get a lot of use in video games is in the use of quaternions to represent orientations and rotations of 3D objects. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |