Just a placeholder for this topic. Let’s see what happens when we try to expend imaginary numbers to cover 3d rotations.
Use Steve Lehar’s Clifford Algebra as an intro / another way to explain them:
References:
Also: why do we need 4d? Problem of a gimbal lock. When at North Pole, every direction looks South. Need to rotate in 4d space in order to have a smooth (direct) path without some weird jagged motion. (That you might get in 3d software).
Can we create a gimbal lock scenario with our own heads, looking up a certain way?
Euler Angles don’t work the way we need. More advantage/disadvantage discussion:http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation
http://run.usc.edu/cs520-s12/assign2/p245-shoemake.pdf
- interpolate 3 euler angles independently… not smooth. try to simulate this.
- gimbal lock… show this happening.
euler’s rotation theorem and book example from paper.
4d - vector axis and angle we spin around.
quaternions computationally simpler than 9-element matrix.
"A central message of this paper is that
quaternlon coordinates are best for interpolating
orientations. For comparison, imagine using spherical
coordinates for translations! Quaternions represent
orientation as a single rotation, just as rectangular
coordinates represent position as a single vector.
Translations combine by adding vectors; rotations, by
multiplying quaternions. The separate axes of
translations don’t interact; the axes of rotations must.
Quaternions preserve this interdependence naturally;
Euler’s angle coordinates ignore it. "
euler angles, x-y-z order of rotations matters. quaternions are like a “vector position” for rotation, independent axes taken in any order.
and how do you combine two rotations with euler angles?
quaternions exist in 4d space, do a straight-line interpolation between them. imagine the 4th amount [angle] is a color or similar, interpolate that smoothly as well [same rate of change].
四元数肝得健德fine a new axis which represents the rotation and is easy to rotate around. euler angles try to use fixed axis and you try to interpolate 3 simultaneously.
set keyframes for a camera and interpolate smoothly between them in 4d space.
spherical bezier curves. remember the implicit interpolation.
Unity - Scripting API: Quaternion-
“not easy to understand intuitively”, shows core use cases.
Yet another video:
SLERP equation and percentages… see how to intuit that percentage of sine used. what percent of each are we using?
everyone says they are impossible to visualize, unintuitive, etc. think of the path we take as a vector, not a set of rotations. the vector is the axis-independent summary.
one quaternion represents the rotation. multiplying means you are CHANGING the rotation to a new one.
Remember, they aren’t commutative so when you are doing the algebra and switch the order of multiplication, sign reverses.
Argh this makes me want to smash things:Understanding Quaternions | 3D Game Engine Programming
"The imaginary number has the form:
$$i^2$$
Don’t try to actually understand this term as there is no logical reason why it exists. We just have to accept that is just something that squares to ."
See i as a quaternion that rotates around the axis coming out of the paper.
Quaternion is like a “super complex number” where the complex part (a + bi) can be 3 dimensional. It gives you 3 axes to rotate your number around, not just 1 (out of the page).
Video of an apple:iCloud Photo Sharing
Slide 32/100: Each of the rotations can independently find the axis (similar to law of sines, each finding the greater circle). The rotations draw great circles which are parallel to each other. Take the cross product to find the axis they all spin around. (Neat! All the motion is around the same axis). Get angle in radians based on percentage of full circular path it traveled. Get axis, angle representation. Rotate TWICE in order take the cross product and get that axis. Got it. Need 3 points to make a circle: start, position after first rotation, position after next rotation.
Note how Euler angles must be applied in a certain order, prioritizing one axis. Using (x, y, z) to represent orientation makes everything equal. Make vector’slengththe angle (i.e. the number of radians we go). Whoa.
Hrm. Does the quaternion HAVE to represent half the angle? Clearly for 90 degree case not necessary. Just use the smaller component and normalize it out.
Another Video:Math for Game Developers - Rotation Quaternions - YouTube
This is like $\cos(\theta) + i \sin(\theta)$ – get two perpendicular vectors (real and imaginary). In the video, they have $\vec{e}$ and $\vec{f}$ . Imagine making a mini axis right there, the e-f axis, and we are picking points on that. Using the standard $\cos(\theta) + i \sin(\theta)$ trick but on the e/f axis.
- at 5:54 - e is the rejection vector (v minus the projection)
- Also, remember that $cos(\theta)$ is a PERCENTAGE of how much we are going to use of that vector.
- Cross product to find vector that is perpendicular to the ones we have.
Realize that a rotation can be represented by 1) the vector you are turning around and 2) the amount you turn. The real part is the amount you turn [scalar] the “imaginary” part is the vector you turn around.
when doing [0, i] we are saying “we are just facing in the i direction, no implied spin yet.” (is this right?)
Axis/angle: $(\theta, \vec{n})$
Quaternion: $w = \cos(\theta/2)$ [so w is the percentage we are using? The /2 is because of two turns to get the plane.], next part is $\vec{n} \sin(\theta/2)$ – axis is scaled (but points same way).
unit quaternion… item on a 4d sphere.
complex number represents a 2d rotation [esp. if normalized, euler’s theorem].
quaternion represents a 3d rotation [and amount].
The quaternion represents the ROTATION we are making but nothing about the object we have. This is the tricky thing, separating the discussion of the rotation from the object which is rotating.
Object has initial orientation and we can describe changes to that.
Identity quaternion is (1, 0) which means… w = 1, which means we haven’t rotated about the axis at all? Which means theta was 0, $\cos(0/2) = \cos(0) = 1$ . We don’t change the axis, just decide not to rotate around it at all.
the notation $q q^{-1} = (1, 0)$ means ‘if we rotate, then rotate again, the result is 0 rotation’ [around an empty axis though?].
to flip the direction of a twist, either flip the vector, or the angle. not both. $(w, v)^{-1} = (-w, v) = (w, -v)$
car wheel axis analogy, spin car around backwards to have axis negative relative to original position.
w is amount of rotation, from -100% to 100%
Key insight from euler: result of ANY number of rotations can be simplified into a SINGLE one. So we can have both effects together [order matters] to get one final result.
记住,乘法适用num之一ber to another.
ORDER MATTERS. eat a banana, peel a banana different from peel a banana, eat it.
multiplying quaternions, the new angle: multiply the previous angles, subtract the dot product of the vectors.
学会解决与c旋转问题omplex numbers [as intermediaries]. Then scale it up to quaternions. Get practice with complex numbers first.
OOOH, the point we want to rotate is going to be a quaternion $(0, \vec{p})$ which is really $1 \cdot (0, \vec{p})$ or, we started with 1, and rotated it to BECOME the point we’re interested in. We always start with 1, implicitly!
Rotated point is $p’ = qpq^{-1}$ … and that’s why we have the double angle stuff?
Well, $pqq^{-1}$ have the cancel out, but this isn’t what’s happening. GOTCHA. Remember that order matters. And you rotate halfway, then the rest of the way.
Great analogy with the 4d space and the 1, 2, 3 dimensions otherwise:
![](//www.i494.com/aha/uploads/default/77/55e53e365e3ed14b.png)
Why does the $q q^{-1}$ not bring us back though? Right vs left multiplying? Sort of like the complex conjugate but that will still scale us… left multiply vs. right still works and everything cancels except the rotation?
Walk through actual examples of where you are facing. Quaternion rotations are ABSOLUTE directions [external]. Turn 90 degrees to the left. The x-axis is still facing forward, so when you turn, you start looking up. No gimbal lock problem, you can ALWAYS turn in any direction.
Order matters, where we have q2 * q1 [apply the 2nd rotation to the first]. Implicitly, q2 * q1 * x.
If we want a 90-degree rotation, we need two 45s. So look for .707 as the w value. To actually rotate the vectors you need this (can simplify it for performance):
![](//www.i494.com/aha/uploads/default/79/8a6f65d7dddb9cf9.png)
With quaternions, 1 means no rotation, we still have our original value after multiplying, and 0 means lots of rotation [90 degrees so the value disappears in our dimension!].
GOTCHA: I keep mixing up the angle value we want to rotate and the -1 to 1 value that the w component can take.
That compound rotation [happened in 2 steps] can be done in a single rotation on one axis to get you from looking straight ahead to being tilted left, looking up. Imagine a single head swivel that can point you in that direction.
Think of quaternion as a big bag that represents all the data about the rotation, and we want to interpolate between the bags. These are plotted in a higher dimension. Linear interpolation in that higher dimension.
Algebra of quaternions is different, so need to find the quaternion d which takes us from q [current] to r [desired]. $dq = r$, so $d = rq^{-1}$
We want to scale the quaternion, but can’t change magnitude. Hrm… we are going to scale the ANGLE amount but keep the same direction. That $\frac{\theta}{2}$ portion can be $t\frac{\theta}{2}$.
Becomes exponent… because of Euler’s formula? $d^t q$. Take this and apply a partial rotation to q.
1:33 in this video shows the euler angle dip vs. the quaternion smooth change.
Cool compare/contrast. Quaternions are just for the rotation part of coordinate space.
Quaternions have a 2:1 ness built into them, similar to rational trig.
Rotation problem: how to EFFECTIVELY describe rotations in 3d space. We can have a few systems but they have flaws. Quaternions are great for the pure rotation part.
Also: rotation determined by initial position and final position, don’t think [yet] about intermediates?
Planar rotation can be seen as pair of reflections. !!! Yes, key insight that the rotation we did, we can see it as 2 reflections which are half the size. Oh, hrm, maybe the amount isn’t the same on each… but we have rotation = 2 reflections. Ah. It’s a rotation of twice the wedge angle.
Can compose two rotations [as reflections] into a single rotation. Also though… product of two rotations can be a translation in the planar setting [when they lines are parallel].
Define things in terms of the north/south pole of the axis, even though we turn along the equator. Connect a vector between the north poles of the two planes we are going to reflect through.
- Scenario: I have two rotations for you. Apply them in order. But avoid gimbal lock problems. Need quaternions. The rotations are not independent when dealing with Euler angles.
IDEA: make a quaternion demo. Let people play and predict. I want to do the rotations in my head. Visualize with Matchbox or three.js etc.
“The quaternions are a number system with a noncommutative multiplication denoted here by *. They can be represented in various ways: as pairs of complex numbers, as four-dimensional vectors with real components, or as the sum of a real scalar and a real three-dimensional vector, as is done in this Demonstration. The scalar part of the quaternion is shown on a line and the vector part is shown in 3D.”
Consider difference between pure i and 1 + i [as a quaternion] where the 1 represents a rotation around the i axis.
Gimbal Lock
When you get to a certain position, you can’t rotate it. Have to tip down in order to spin.
With euler angles you can REPRESENT any position but you can’t easily MOVE between any two positions. (The motion may involve these funky twists in order to “untangle” yourself).
“I should always be able to tilt left”. But when you are at the North pole, you can’t tilt left anymore (with the Gimbal) since both axes point “down”.
Can we simulate gimbal lock for ourselves? Feel it vs. seeing it in an object?
Internal vs. external rotations
In order to prepare for quaternions
- Gimbal lock problem
- Try to model rotations with 2d complex numbers
- how many dimensions do we need?
- Solved with a redundant degree of freedom (4d even though we only need 3d).http://math.stackexchange.com/questions/1838/why-is-gimbal-lock-an-issue
“Some coordinate systems in mathematics behave as if there were real gimbals used to measure the angles, notably Euler angles.”
Euler angles behave as IF they were gimbaled.
Show the 2d gimbal lock example. Fly straight overhead, get the telescope aligned upward, then take a sharp right turn. It can’t follow you! (not instantly, anyway). It has to dip down, swivel, then keep tracking. And it has to do this FAST.
Imagine a gunner in a WW2 fighter pilot.
That’s the problem, we have the rotations “internal” to the system and we get trapped here.
Axes move with the object, vs. being universal/external/absolute.
Key problem:
- One axis depends on the others to reach certain spots
- The left/right axis can’t move if the up/down axis is maxed out. So need to move the other in order to track the new position. Imagine the telescope. People intuitively adjust for this but twisting as you go (not just looking up and craning your neck).
- Find equivalence between Euler angle and gimbals (gimbal is a PHYSICAL system that has this problem, Euler angles are a MATH system that have this problem. They are analogous but not identical, there are no actual Gimbals, are there?)
Good explanation of gimbal problem: the telescope
- intuitively, we know to “step back” (out of the frame), like adding a dimension. Need that “wiggle room” so to speak.
- We don’t want to snap our heads around just because it changes a small angle. When it’s moving slowly, and smoothly, and predictably, we should have a slow, smooth, predictable way to track it. Snapping your head around 180-degrees just to follow it as it moves 5 feet doesn’t make sense. Imagine it going back and forth overhead. We want to rotate from “outside the system” in order to avoid this problem.
- Imagine a sphere on a roller. Camera is looking at anything. We just spin the sphere around, like a trackpad. No problems with gambling! We can rotate around ANY axis we pick (even diagonals) and it SMOOTH.
- Difference: Person INSIDE the sphere try to spin around vs. person OUTSIDE the sphere trying to spin it around.
![](//www.i494.com/aha/uploads/default/81/2ead878d7f0b9806.png)
Intuition about rotations:
Euler angles are like being inside with a telescope
矩阵是像汽车在外面和你rning them [rotating]. Intrinsic and external (http://en.wikipedia.org/wiki/Rotation_matrix). For x-y-z only that’s 3 external numbers. But… for rotation about an任意的axis (a diagonal) then we need a 3x3 or 9-element matrix. Ouch! 9 terms to keep track of.
. Need to specify the axis $(u_x, u_y, u_z)$ and then the amount to turn around it. Still technically 4 unique pieces of data, but “over-specified” in that we need a giant matrix to convert that into rotations for our external motors to do. Under the hood, convert quaternions into this computable format.
Can we simplify? Yes!
Quaternions is like sticking a pole through an axis and rotating. (axis-angle)
I want to stick a pole through the sphere (x, y, z) and then turn it (scalar).
http://www.gamedev.net/page/resources/_/technical/math-and-physics/do-we-really-need-quaternions-r1199
https://www.cs.iastate.edu/~cs577/handouts/quaternion.pdf
What does multiplying one quaternion by another do?
It composes the rotations. Similar to multiplying one complex number by another. Get a new number which has both rotations.
Why do we use the $(qv)q^*$? We just want to use v as an axis but not use its actual rotation. So…
$qvq^* = (qv)q^$ which is “compose rotation of v, then rotation of q”. We apply this to $q^$ so we have "compose rotation of $q^*$ with rotation of $v$ then rotation of $q$.
Difference between multiplication (apply i, then apply i again) vs the $qvq^*$ where we are trying to rotate v around q.
Big aha! moment: the quaternion format can be CONVERTED to axis/angle:
- Quaternion has a percentage (between -1 and 1) which represents how much we are rotating given the angle that was put in. The quaternion for $i = 0 + (1, 0, 0)$… the first 0 means the angle put in must be 90 degrees since $\cos(90) = 0$. is a 90-degree rotation around the i-axis, in other words. Put another way, “i means we are using an angle where nothing (0, zilch) is appears to us after use.” Think of the quaternion as showing “how much is still showing in the real dimension after use?”. Got it!!!
http://www.flipcode.com/documents/matrfaq.html#Q47
Quaternions are NOT the same as axis/angle but can be easily converted to them.
Whoa. Remember, sine/cosine trig talk about percentages. Quaternions tell us “What percentage of our original value is remaining after we do a spin around the (x, y, z) axis?)”. We are thinking in terms ofresults(how much is left) vs the angle itself.
For quaternions, composition (applying one, then the other) is multiplication.
The rotation problem and Hamilton's discovery of quaternions (II) | Famous Math Problems 13b - YouTubestarting at 19:00. A quaternion, when applied, will rotate by double its angle. So use half-angled quaternions so the net result works out.
Proof 2 reflections are a rotation.Link 1And a better one:http://math.stackexchange.com/questions/487100/composition-of-two-reflections-is-a-rotation
The rules of quaternion algebra have it so $ij$ will point in the $k$ direction (due to cross products, etc.).Quaternion– ah, multiplying $p$ by $q$ doesn’t necessarily keep length of vector. Multiply by inverse $q^{-1}$ to eliminate scaling factor… but the angles still accumulate. Hrm. That’s the main confusion there.
“The primary diff erence between the two representations is that a quaternion’s axis of rotation is scaled by the sine of the half angle of rotation, and instead of storing the angle in the fourth component of the vector, we store the cosine of the half angle.”
“It means that if you, for example, want to make a 180deg rotation around the Z axis (0,0,1), then the quaternion’s real part will be cos(180deg/2)=0, and its imaginary part will be sin(180deg/2)(0,0,1)=(0,0,1). That’s q=0+0i+0j+1k. 90-degree rotation will give you q=cos(90deg/2)+sin(90deg/2)(0i+0j+1k)=sqrt(2)/2+0i+0j+sqrt(2)/2*k, and so on.”
Complex numbers: we take the idea of $e^{ix} = cos(x) + i*sin(x)$ and have explicit parts. Rotation around an axis.
Quaternions: take the idea of $e^{\vec{u} \theta} = cos(\theta) + sin(\theta) \vec{u}$. Now, usually we want the half quaternions b/c we’ll be applying them twice.
So a 90-degree rotation around (1, 0, 0), i, is really $1/\sqrt(2) + 1/\sqrt(2) * (1, 0, 0)$
Complex numbers and quaternions are different beasts.
Problem with matrices: interpolation. How do you interpolate a rotation matrix? It just shows the final endpoint you’ll be jumped to, but doesn’t have a clear function about where you’ll be halfway through.
Confusion: $i^2 = -1$ for quaternions, yet $i$ represents a 180-degree rotation? Or is it that it’s always a 90-degree rotation (cosine of 0) but when used to convert to axis-angle we have to use that half-angle stuff. i.e., if we used this quaternion in a rotation it would end up being double.
Quaternion multiplication: when we have $ i = 0 + (1, 0, 0)$ times $j = 0 + (1, 0, 0)$, theonly交互是叉乘!即., the scalars aren’t there, zero out, and there is no dot product/self-interaction, so we are left with the $i \times j = k$.
Quaternion multiplication: think of successivelyapplyingthese rotations to the other? Confusion: are we applying rotations in series or saying “all the work that $i$ did, we are going to change it now, like so…”
Thinking about quaternions:
- Euler angles have gimbal lock
- Axis-angle is a nice representation of what we want to do. Unfortunately, it’s a description but not computable (how do we spin things?)
- Rotation matrices are an option, but 1) cumbersome to specify 2) lots of extra computations 3) can’t interpolate (how do you apply a matrix “partway”?)
- Quaternions are easily converted from axis-angle andmostlymatch up. They have an axis, the angle is a cosine [the percent you see] and their arithmetic has rotation “built-in” just like complex numbers do. When in quaternion land, you never see trig functions, you are just multiplying components and the vectors are being rotated. But, you can convert into linear algebra at the end.
- Quaternionscanbe intuitive…
- They are a direct description of an axis, and a slightly indirect description of an angle
- Multiplication gives a result (c = a*b) which is the result of applying a, then applying b. This is similar to a matrix. c is a shortcut to apply both.
- We can represent a position vector as a quaternion and rotate it with another, using ($v’ = qvq^*$). This returns a nice vector back. Again qv is the result of applying q and v, and we don’t want toapplyv, we want it to be rotated to a new position. We’re cheating a bit, quaternions are all ready to tell us how to use this new rotation item, but we aren’t concerned with how $v’$ will rotate something else, we’re just going to steal its vector components for the final measurement.
- We can visualize some of these 4d quaternions because we know they have a 0 component in one dimension, and because they’re normalized, are on the surface of a sphere (not all of 3d space). Theycanbe intuitive.
Create a quaternion FAQ:
- What does quaternion multiplication do? How is it different from regular? Q mult uses piece-by-piece distribution (Hamilton product) which results in a cross-product for perpendicular parts [by the rules of quaternions, perpendicular imaginary components create a CROSS PRODUCT].
- Why is this helpful? This built-in cross product behavior mirrors how actual rotations work! We can do a regular rotation using cross products (cross product makes perpendicular, another makes perpendicular again, and in the line of the original…). Quaternions are an algebra which have cross products built in nicely.
- We “convert to quaternions” for the purpose of the rotation. Similar to converting a decimal number to binary in order to easily round to nearest multiple of 16, or divide by 2, etc. Eventually, you start thinking in binary. Similarly, you start thinking with quaternions (axis + “amount showing”).
SLERP vs Euler:
SLERP vs昆虫蜜。旋转矩阵的角度来考虑问题(x, y, z) coordinates and take the shortest path between them (a line). Quaternions think with angle/axis so only move via spinning (the white line). We WANT things to move by spinning there, not straight-lining there.
And Euler angles have the weird wobble since they effect each other as they move.
You want a simple interpolation vs. having to re-run the rotation over and over. You have the final position, now find (easily, just by scaling) where the position should be halfway through.
http://unity3d.com/learn/tutorials/modules/intermediate/scripting/quaternions
Gimbal lock - prevents INCREMENTAL rotations from working.
Guide to quaternions
- I’m a game developer
Quaternions let you specify the axis of rotation and the amount to turn around it [from -100% to 100%]. For math reasons, you specify half the amount that is remaining. So if you want to turn 180 degrees around the 1, 2, 3 axis, your quaternion would be
0 + (1, 2, 3)
Learn to go back and forth with the axis/angle and quaternion representation.
SLERP or not… yes, youcaninterpolate with matrices (http://stackoverflow.com/questions/5580283/interpolating-between-rotation-matrices?rq=1) but you are basically re-deriving quaternions to do so. Like staring with decimal, converting to binary, then converting back.
A quaternion represents an orientation: learn to recognize what orientation it’s referring to. i represents a 180-degree orientation, assuming we did i * rotation * i’.
In our head, think “the quaternion we specify is going to be used TWICE”. Imagine two workers. You give them the same command (one is forward turner, one is backward turner). So need to implicitly figure out what to do.
Oh… ok, we have the quaternion (the command we wrote down) and the rotation (the RESULT of the command).
If I see a rotation orientation I like, I can figure out what command would get me there. Imagine two gears and you are putting in the settings for them.
Q: Have to do the conversion between the quaternion and the rotation orientation. This quaternion represents an orientation, just like 0xFF0000 represents red. We want to get comfortable going back and forth.
The quaternion i represents the position after rotating around i twice. Yes, even though i is 90-degrees to the real axis, we aren’t concerned with what happens to a single real number, we want to know how another quaternion (our vector) would be changed. What is happening INSIDE the quaternion bubble?
SLERP equation
$$\text{SLERP}(q_1, q_2) = q_1(q_1^{-1}q_2)^t$$
We start at $q_1$. The term $q_1^{-1}q_2$ represents fully canceling $q_1$ and fully applying $q_2$. We can “partially apply” them using the exponent (again because of Euler’s formula… square root of $i$ is partially applying $i$).
Let’s learn to SLERP in 2d then apply it to 3d after. (Show difference in rotation matrix vs. complex numbers for 2d scenario.)
Analogy: Quaternions are like using binary numbers instead of decimal. Or like using a slide rule to make multiplication easier. (“Quaternions are a rotation-based slide rule.”)
Real part of quaternion is the same when you have qp or pq… only the cross product changes sign:
This can show that qvq* will keep the real part to 0. Therefore v must be rotated and stays unit (just another unit vector). Rotated about the origin somehow.
Imagine twisting up and back down [around the quaternion]. So i [90 degrees] would be 90 + 90 or all the way around when we use it. Twist up, twist down. Imagine the quaternion has an energy meter. We twist until we reach it, then we use q* [opposite twist] and twist it back down again. Want the angle in the real world to be all gone.
The green angle is how much we use in the quaternion world vs. the real world. We can “ease off” the quaternion, so to speak, by only using 10% of the quaternion and the rest in the real world [no rotation]. We have non-rotation and rotation, and we pick how much of each we use [THAT is the real/complex angle] then within the rotation world, we pick the axis we want to use.
In quaternion world, even a single qv multiplication will start giving us the cross product… 2 cross products can rotate use back to start or continue the rotation. Yes, the single multiplication is like the start of the twist.
visualize switching domains :http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/transforms/derivations/vectors/quaternionReflection.png
http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/transforms/
Nice description/diagram for Gimbal Lock:http://www.chrobotics.com/library/understanding-euler-angles
Another summary:http://www.geometrictools.com/Documentation/Quaternions.pdf
Complex numbers/quaternions from linear algebra:Complex numbers and Quaternions as Matrices
Suggestion:Humane Rigging 03 - 3D Bouncy Ball 05 - Quaternion Rotation - YouTube
- EXCELLENT video, shares the tradeoffs.
Key Insights
- For rotations, don’t describe the final position. Describe theinputthat would have spun our initial position into the final one. (Represent thetwistwe’re going to apply, not where the thing is pointing! The change we are going to have, not the thing itself!)
- Quaternions describe aninputwe’ll use for rotation (we still need to do work to figure out what the final orientation will be). We use them to compute an output. Like thinking about ln(x) not x (interest rate vs. final amount you have). Quaternions are like describing the “interest rate” we’re going to use. (Isn’t it better to describe the interest rate instead of “If you start with $100, you’ll end up with with 153.73 after 5 years.”
- You can interpolate by only applying a fraction of the quaternion, and it smoothly interpolates as you want (half the dose). The full dose represents a final orientation.
- They are NOT vectors in the following sense: Rot(q1) + Rot(q2) is not the same as applying Rot(q1 + q2). They are log inputs so need to be multiplied to be added. (And use powers to scale.). Quaternions are the log of a rotation just like interest is the log of growth.
- Extend the analogies from 2d complex numbers to 3d.
Unity 3D has axes: Y, X, Z … so that is the order you use. You can get gimbal lock based on the internal angles AND the ordering. The ordering is what causes the issue. You getintoa position just fine, buttransitioningbetween them is what causes problems.
A quick analogy: Just like logarithms describe “interest rate” behind observed growth, quaternions describe the “twist” behind an orientation. Focusing on the inputs, not the final result (the actual monetary value or actual orientation) makes certain problems easier, especially around interpolation. It’s much easier to “partially apply” a twist than the actual orientation. (Linearly interpolating between final positions doesn’t give the effect we want.)
TODO: work out SLERP formula myself. Be able to compute this by hand as well.