4 ms·
Sounds like they're the gamedev equivalent of a Monad? Which I only vaguely understand as a result of a poster on this forum's "Everyone explains it wrong" styl
by alex_lav 3y ago
Sounds like they're the gamedev equivalent of a Monad? Which I only vaguely understand as a result of a poster on this forum's "Everyone explains it wrong" style post. Hoping you get a similar response with this.
- Animats 3y agoQuaternions tend to be over-complicated. Basic concept, 1 dimensional form: you want to represent a direction in a 2D plane. You can use one number, a heading angle, but at some point you reach a full circle and the number has to wrap. This creates annoying special cases. So another approach is to use a 2D vector, a point on a circle. Those are usually normalized so that x^2 + y^2 = 1. No angle is "special". You can average and filter such vectors without problems, for example. This is called a homogeneous representation, because it behaves the same everywhere in its space. Now upgrade to 2D - latitude and longitude. Near the poles, small positional changes cause huge latitude changes, and computation error increases. This is a serious problem in navigational systems. So it's common to represent latitude and longitude inside of GPS systems as a 3-component vector, a point on a sphere, in what's called "Earth-centered, earth fixed" form. Now you can average or difference measurements without special cases. (Yeah, WGS-84 to compensate for planet not being a perfect sphere, etc.) Now upgrade to 3D orientation. That's a quaternion. It's a point on a 4-dimensional hypersphere. This can be mapped to a 3D vector pointing in space and a roll around that vector, or to pitch-roll-yaw, etc. As above, a quaternion is a unit vector. It's hard to visualize this, so just shut up and calculate.
- andersa 3y agoWow, I had never seen this explanation before. That makes so much sense! Now I finally understand why we always normalize the quaternions and why that is a sensible operation...
- pclmulqdq 3y agoI am going to be the HN pedant here, and for that I apologize. Quaternions don't specifically need to be unit vectors or points on a 4-D hypersphere. They are any number with 3 imaginary parts and 1 real part. Being a unit operator is a property of a rotation (this holds true even if you aren't using quaternions or if you extend to n-dimensional rotations), not a property of quaternions.
- andersa 3y agoIn the context of game development, "quaternion" almost always refers to a normalized one that represents a rotation. Many engines aren't even capable of representing anything else with their quaternion types and enforce this automatically.
- pclmulqdq 3y agoThat's probably because pretty much all uses of quaternions in games are for rotations, which involve normalized vectors. As a mathematical concept, quatetnions are far broader and more applicable than just rotations. This is a generic mathematical concept, not something specific to graphics.