Let’s lift Quaternions from every 3D Engine (2018)

Let’s lift Quaternions from every 3D Engine (2018)

Let’s lift Quaternions from every 3D Engine (An Interactive Introduction to Rotors from Geometric Algebra) – Marc ten Bosch

YouTube video

(An Interactive Introduction to Rotors from Geometric Algebra)
Marc ten Bosch

The clearest explanation of 3D geometric algebra within 15 minutes that I’ve considered as a lot as now —BrokenSymmetry

I am offered. Whereas I can perceive quaternions to an extent, this formula of thinking is a critical extra intuitive and neat method. —Jack Rasksilver

This devices a high trendy for academic self-discipline matter, and is a vivid example of how we are in a position to give a boost to training with this day’s applied sciences. —Sebastien Pierre

When I changed into once in faculty, I requested one of my math professors why the spoiled product of two vectors leads to a perpendicular vector whose magnitude is the identical because the home of the parallelogram formed by the two vectors. Luxuriate in..what? Why? And what about 2D?

They blew me off, and that changed into once a substantial section of why I stopped taking math in faculty. […]

Anyway, I had rather critical given up on ever truly realizing the total jumble of apparently unrelated kinds which would per chance presumably perchance well be spoiled products. Nonetheless then I saw this: And…wow. Lawful 15 minutes and loads greater than aesthetic spoiled products without notice agree with critical extra sense. —Mason Remaley

To narrate 3D rotations graphics programmers use Quaternions. On the different hand, Quaternions are taught at face price. We aesthetic accept their irregular multiplication tables and diversified arcane definitions and use them as shaded packing containers that rotate vectors within the solutions we settle on. Why does $mathbf{i}^2=mathbf{j}^2=mathbf{k}^2=-1$ and $mathbf{i} mathbf{j} = mathbf{k}$? Why will we take a vector and give a boost to it to an “imaginary” vector in verbalize to rework it, admire $mathbf{q} (xmathbf{i} + ymathbf{j} + z mathbf{k}) mathbf{q}^{*}$? Who cares as long because it rotates vectors the honest method, honest?

For my section, I truly possess repeatedly stumbled on it crucial to truly perceive the issues I am using. I have in mind finding out about Unhealthy Merchandise and Quaternions and being harassed about why they worked this formula, but nobody talked about it. In a while I learned about Geometric Algebra and without notice I can also ogle that the questions I had had been legitimate, and all the pieces grew to alter into so critical clearer.

In Geometric Algebra there is a means to relate rotations called a Rotor that generalizes Quaternions (in 3D) and Complicated Numbers (in 2D) and even works in any preference of dimensions.

3D Rotors are in a means the honest invent of quaternions, or in diversified words Quaternions are an obfuscated version of Rotors. They are the same in that:

  • they’ve the identical preference of substances,
  • their API is the identical,
  • they are as efficient,
  • they are aesthetic for interpolation and warding off gimbal lock, and so a lot of others…
  • if fact be told, they are isomorphic,

so it’s imaginable to quit some math to turn a rotor correct into a quaternion, but doing so makes them much less general and no more intuitive (and loses further capabilites).

Nonetheless as a alternative of defining Quaternions out of nowhere and attempting to expose how they work retroactively, it’s imaginable to expose Rotors nearly entirely from scratch. This obviously takes extra time, but I gain it’s extraordinarily critical price it on narrative of it makes them critical more easy to realise!

Earth-Centric planetary motion

For example, Quaternions are launched as this mysterious four-dimensional object, but why introduce a fourth dimension of issue to visualise a 3D thought? By incompatibility 3D Rotors quit not require the use of a fourth dimension of issue in verbalize to be visualized.

Attempting to visualise quaternions as running in 4D aesthetic to expose 3D rotations is rather admire attempting to realise planetary motion from an earth-centric point of view i.e. overly advanced on narrative of you potentially can also presumably be taking a search at it from the nasty point of view.

It’d be mountainous if we are in a position to also start phasing out the use and instructing of Quaternions and change them with Rotors. The switch is easy and the code stays nearly the identical, but the realizing grows loads.

As a side shriek, Geometric Algebra contains greater than aesthetic Rotors, and is a extraordinarily well-known tool to possess in one’s toolbox. This article also serves as an introduction to it.

    (In listed right here, every map is interactive. The video follows the article, and also you potentially can also press the buttons to play the relevant section of video.
    Conversely, you potentially can also press the button to whisk to the section of the article that corresponds to what the video is taking half in at this moment. You would maximize your window to possess extra issue for the video, or you potentially can also press the button to space it to a set apart size.)

    Planes of Rotations

    Rotations occur in 2D planes

    In 3D, we usually remember of rotations as taking place round an axis, admire a wheel turning round its axle, but as a alternative of brooding in regards to the axle a extra honest method is to agree with of the aircraft that the wheel lies on, perpendicular to the axle.

    Old Lady shows off rotations

    This aged lady is spinning wheel within the $mathbf{xz}$ aircraft, perpendicular to the $mathbf{y}$ axis.

    This is on narrative of if we crash up a vector into two objects, one lying within the aircraft ($mathbf{v}_parallel$) and one lying start air the aircraft ($mathbf{v}_perp$), the rotation rotates the within section while keeping the beginning air section the identical.

    Rotation within the $yx$ aircraft [Drag anywhere to move the camera]

    In 2D there is entirely one single aircraft to rotate in (there is no start air section). Therefore pondering rotations to occur round a third axis (perpendicular to the 2D aircraft) is technically wrong, since we mustn’t need to introduce one other dimension to agree with rotations.

    When you occur to suggested a 2D “flatlander” (who lives inner a 2D aircraft and has entirely ever skilled 2D) about a perpendicular rotation axis they would detect at you and set apart apart a query to “which direction does the axis point alongside? I cannot picture it!”

    Explicit Sense of Rotation

    As well to, when brooding about rotation round an axis, the sense of the rotation is undefined, and so desires to be defined by convention (during the so-called “honest hand rule”).

    On the different hand, if we remember rotations as taking place inner planes, the sense is clear: rotation within the $mathbf{xy}$ aircraft method a rotation that takes the (unit) vector $mathbf{x}$ to the (unit) vector $mathbf{y}$, within the aircraft they invent together. Rotation within the $mathbf{yx}$ aircraft is the reverse rotation: it takes the vector $mathbf{y}$ to the vector $mathbf{x}$.


    The Outer Product

    To compute the axis of rotation to rotate one vector $mathbf{a}$ to 1 other vector $mathbf{b}$, we take the spoiled product of the two vectors to procure a vector that is perpendicular to every. Nonetheless why “leave” the aircraft, since a rotation is fundamentally a 2D thing?

    As an different we take what is known as the outer product (also usually called exterior, or wedge product) of the two vectors, constructing a fresh component called a bivector (or 2-vector) $mathbf{B}$ that represents the aircraft the two vectors invent together. If the spoiled product creates the trendy vector to a aircraft, the outer product creates the aircraft itself. Taking the trendy to the aircraft is extraneous.

    $$mathbf{B} = mathbf{a} wedge mathbf{b}$$

    $mathbf{B}$ can also furthermore be represented because the parallelogram constructed from the vectors $mathbf{a}$ and $mathbf{b}$, within the aircraft they invent together.

    The premise of a bivector can also seem rather distinctive before all the pieces, but they are rather critical as essential as vectors, as we can ogle. If a vector is admire a line, then a bivector is admire a aircraft… The properties of the outer product are generous to take the properties of planes.

    Foundation for Bivectors

    Bivectors possess substances, aesthetic admire vectors. Nonetheless they are defined when it involves basis planes as a alternative of basis traces admire vectors.

    The three orthogonal basis planes are $mathbf{x} wedge mathbf{y}$, $mathbf{x} wedge mathbf{z}$, and $mathbf{y} wedge mathbf{z}$, as considered on the map to the honest.

    Nonetheless first let’s detect on the extra supreme 2D case…

    2D Bivectors

    In 2D there is entirely one aircraft, the $mathbf{xy}$ aircraft. So a 2D bivector entirely has one side. For a bivector constructed from vectors $mathbf{a}$ and $mathbf{b}$, this amount $B_{xy}$ is the identical because the (signed) home of the parallelogram the two vectors invent together.

    $$mathbf{B}=mathbf{a} wedge mathbf{b} = B_{xy} (mathbf{x} wedge mathbf{y})$$

    You would play with a 2D bivector within the next interactive map, by adjusting the (unit) vectors it’s constituted of:

    You would ogle that by changing the angle between the vectors the home of the parallelogram modifications (in accordance to the sine of the angle).

    If the vectors are the identical, or if they are parallel, they don’t invent a aesthetic aircraft and the consequence is zero. This straightforward property defines what a bivector is:

    $$mathbf{a} wedge mathbf{a} = 0$$

    By taking a search on the sum of two vectors, we are in a position to ogle that this property implies the next:

    $$start{eqnarray}(mathbf{a}+mathbf{b}) wedge (mathbf{a}+mathbf{b}) &=& 0 \
    mathbf{a} wedge mathbf{a} + mathbf{b} wedge mathbf{a} + mathbf{a} wedge mathbf{b} + mathbf{b} wedge mathbf{b} &=& 0 \
    mathbf{b} wedge mathbf{a} + mathbf{a} wedge mathbf{b} &=& 0


    $$mathbf{a} wedge mathbf{b} = -mathbf{b} wedge mathbf{a}$$

    Lawful admire the sense of a rotation issues, the verbalize of the arguments to the outer product issues. Swapping the arguments modifications the signal of the consequence (right here’s called “anti-symmetric”).

    Within the map, the signal is represented using the colour, which modifications from blue to inexperienced. The signal modifications at any time when the rotation from $mathbf{a}$ to $mathbf{b}$ goes from being clockwise to being anticlockwise (i.e. if it suits the ($mathbf{x}$ to $mathbf{y}$) direction or the ($mathbf{y}$ to $mathbf{x}$) direction).

    You would ogle how the properties of the outer product are generous to take the properties of planes and rotations.

    2D Bivectors from non-unit vectors

    The vectors obviously don’t settle on to be unit lengths, and on this map the restriction is eliminated:

    The signed home of the parallelogram is proportional to the lengths of every vectors: $B_{xy} = sin(alpha)|a||b|$ the place $alpha$ is the angle between $mathbf{a}$ and $mathbf{b}$. So that you simply may perchance illustrate doubling the length of one vector doubles the home.

    We can procure the categorical price by plugging within the vectors in side invent:

    $$start{eqnarray}mathbf{a} wedge mathbf{b} &=& (a_x mathbf{x} + a_y mathbf{y}) wedge (b_x mathbf{x} + b_y mathbf{y}) \
    &=& a_x b_x (mathbf{x} wedge mathbf{x}) + a_x b_y (mathbf{x} wedge mathbf{y}) + a_y b_x (mathbf{y} wedge mathbf{x}) + a_y b_y (mathbf{y} wedge mathbf{y}) \
    &=& a_x b_y (mathbf{x} wedge mathbf{y}) + a_y b_x (mathbf{y} wedge mathbf{x}) \
    &=& a_x b_y (mathbf{x} wedge mathbf{y}) – a_y b_x (mathbf{x} wedge mathbf{y}) \
    &=& (a_x b_y – a_y b_x) (mathbf{x} wedge mathbf{y})

    $$B_{xy} = a_x b_y – b_x a_y$$

    3D Bivectors

    Lawful admire the coordinates of a vector $mathbf{v}$ can also furthermore be belief to be because the projections of the vector onto the three orthogonal basis axes ($mathbf{x},mathbf{y},mathbf{z}$), the coordinates of a bivector $mathbf{B}$ can also furthermore be belief to be because the projections of the exiguous aircraft onto the three orthogonal basis planes.

    The projections of the vector are the lengths of that vector alongside every basis vector, while the projections of the bivector are the areas of the aircraft on every basis aircraft.

    For a vector:

    $$mathbf{v} = bbox[5px,border-bottom:2px solid red]{v_x} mathbf{x} + bbox[5px,border-bottom:2px solid green]{v_y} mathbf{y} + bbox[5px,border-bottom:2px solid blue]{v_z} mathbf{z}$$

    For a bivector:

    $$mathbf{B} = bbox[5px,border-bottom:2px solid coral]{B_{xy}} (mathbf{x} wedge mathbf{y}) + bbox[5px,border-bottom:2px solid gold]{B_{xz}} (mathbf{x} wedge mathbf{z}) + bbox[5px,border-bottom:2px solid DarkViolet]{B_{yz}} (mathbf{y} wedge mathbf{z})$$

    The place $B_{xy}, B_{xz}, B_{yz}$ are aesthetic numbers admire $v_x, v_y, v_z$ (they are underlined to match the map colours).

    The substances of a 3D bivector are aesthetic the three 2D projections of the bivector onto the 2D basis planes.

    The usage of the identical method as before we gain that the categorical values of the substances detect loads admire the XY side from the 2D case, but applied to all three planes:

    $$B_{xy} = a_x b_y – b_x a_y$$

    $$B_{xz} = a_x b_z – b_x a_z$$

    $$B_{yz} = a_y b_z – b_y a_z$$

    You would play with a 3D bivector within the next interactive map:

    Does the beginning air product remind you of the leisure? In 3D, the definition of the outer product is extremely the same to that of the spoiled product. Genuinely, in 3D a vector that comes from a spoiled product (corresponding to a trendy vector) will possess three substances which are equal to the substances of the bivector (the numbers are the identical, but the basis is diversified).

    $$start{eqnarray}mathbf{a} wedge mathbf{b} &=& & (a_x b_y – b_x a_y)(mathbf{x} wedge mathbf{y}) \
    & & + & (a_x b_z – b_x a_z)(mathbf{x} wedge mathbf{z}) \
    & & + & (a_y b_z – b_y a_z)(mathbf{y} wedge mathbf{z}) \
    mathbf{a} occasions mathbf{b} &=& & (a_x b_y – b_x a_y) mathbf{z} \
    & & – & (a_x b_z – b_x a_z) mathbf{y} \
    & & + & (a_y b_z – b_y a_z) mathbf{x}live{eqnarray}$$

    The bivector definition is vivid geometrically, as a alternative of appearing out of thin air. I have in mind thinking when I changed into once finding out the spoiled product, why the hell does it return a vector that has length equal to the home of the parallelogram formed by the two vectors? That feels so arbitrary. And why would you be allowed to turn the home of the parallelogram into the length of the vector?

    Semantics of Vectors and Bivectors

    In 3D, a bivector has three coordinates, one per aircraft: ($mathbf{xy}$, $mathbf{xz}$, and $mathbf{yz}$). Vectors also possess three coordinates, one per axis ($mathbf{x}$, $mathbf{y}$ and $mathbf{z}$). Every aircraft is perpendicular to 1 axis. This is a twist of destiny that entirely happens in three dimensions […] and it’s why historically we have got been complex bivectors with vectors.

    In programming phrases, they every possess the identical memory structure, but diversified operations. The usage of a 3D vector as a alternative of a 3D bivector is admire “kind-casting” the bivector.

    This is an example: you potentially can also need considered how trendy vectors transform differently than traditional vectors, using the “inverse transpose” of the matrix $(mathbf{M}^{T})^{-1}$ as a alternative of the matrix itself. That is on narrative of they don’t appear to be truly vectors, but truly bivectors, which we have got “kind-forged” to vectors. In physics, there is a hack called an “axial vector,” which has been launched to distinguish vectors that method from spoiled products from traditional vectors. Bivector is the categorical “kind” of the article and it’ll easy be belief to be and manipulated as such.

    The Geometric Product

    Multiplying Vectors together

    The geometric product $mathbf{a b}$ (denoted and not using a image) is one other operation one can quit on vectors. The geometric product is defined so as that vectors possess inverses (i.e $mathbf{a} mathbf{a}^{-1}= 1$ the place 1 is aesthetic the amount $1$!) and possess high-quality properties admire associativity ($mathbf{a} (mathbf{b} mathbf{c}) = (mathbf{a} mathbf{b}) mathbf{c}$). The map is to be in a issue to multiply vectors together so as that —aesthetic admire for matrices— multiplication corresponds to geometric operations.

    To clarify the product, first shriek that it’s imaginable to crash up a product (or any characteristic that takes two arguments) into the sum of a bit that doesn’t switch if we swap the arguments and person that does switch, within the next method:

    $$start{eqnarray}mathbf{a} mathbf{b} &=& frac{1}{2} (mathbf{a} mathbf{b} + mathbf{a} mathbf{b} + mathbf{b} mathbf{a} – mathbf{b} mathbf{a}) \
    &=& frac{1}{2} (mathbf{a} mathbf{b} + mathbf{b} mathbf{a}) + frac{1}{2} (mathbf{a} mathbf{b} – mathbf{b} mathbf{a})live{eqnarray}$$

    The first term doesn’t rely on the verbalize of the arguments $mathbf{a}$ and $mathbf{b}$ anymore (it’s called the “symmetric” section), while the second term modifications signal when the arguments are swapped (it’s called the “antisymmetric” section).

    The dot product of two vectors (also usually called interior product) is symmetric and is a measure of distance ($mathbf{a} cdot mathbf{a} = |mathbf{a}|^2 $), so it sounds well-known geometrically to space it equal to the symmetric section:

    $$frac{1}{2} (mathbf{a} mathbf{b} + mathbf{b} mathbf{a}) = mathbf{a} cdot mathbf{b}$$

    Similarity, the outer product of two vectors is antisymmetric, so it sounds well-known geometrically to space it equal to the antisymmetric section:

    $$frac{1}{2} (mathbf{a} mathbf{b} – mathbf{b} mathbf{a}) = mathbf{a} wedge mathbf{b}$$

    As well to, the dot product contains the cosine of the angle between the two vectors ($mathbf{a} cdot mathbf{b} = |mathbf{a}||mathbf{b}|cos(alpha)$), while the outer product contains the sine of the angle. Together they absolutely listing the angle between the vectors, as effectively the aircraft they invent.

    So the geometric product is:

    $$mathbf{a} mathbf{b} = mathbf{a} cdot mathbf{b} + mathbf{a} wedge mathbf{b}$$

    It is distinctive on narrative of multiplying two vectors together supplies the sum of two diversified issues: a scalar and a bivector. On the different hand right here’s the same to how a fancy amount is the sum of a scalar and an “imaginary” amount, so that you simply potentially will be ancient to it already. Right here the bivector section corresponds to the “imaginary” section of the advanced amount. Aside from it’s not “imaginary,” it be aesthetic a bivector, which we have got a concrete picture of!

    Basically, by multiplying two vectors together we compute well-known properties about them (the “length of their projections onto every diversified” / “cosine of the angle” ($mathbf{a} cdot mathbf{b}$), and the “aircraft they invent together” / “sine of the angle” ($mathbf{a} wedge mathbf{b}$)), which we shield bundled together during the “plus” signal. The geometric product also supplies these “property bundles” operations that can also furthermore be applied to them, and these operations possess geometric interpretations (to illustrate: rotating and reflecting vectors), as we shall ogle now.

    Multiplication Table

    The multiplication desk helps agree with this product extra concrete: let’s ogle what happens if we take products of the basis vectors ($mathbf{x}$,$mathbf{y}$,$mathbf{z}$).

    For any basis vector, such because the $mathbf{x}$ axis, the consequence is $1$:

    $$mathbf{x} mathbf{x} = mathbf{x} cdot mathbf{x} + mathbf{x} wedge mathbf{x} = 1$$

    For any pair of basis vectors, such because the $mathbf{x}$ and $mathbf{y}$ axes, the consequence is aesthetic the bivector they invent together:

    $$mathbf{x} mathbf{y} = mathbf{x} cdot mathbf{y} + mathbf{x} wedge mathbf{y} = mathbf{x} wedge mathbf{y}$$

    (so we are in a position to name $mathbf{x} wedge mathbf{y}$ simply $mathbf{x} mathbf{y}$ since they are the identical thing! This is honest for basis vectors, as effectively vectors which are perpendicular i.e. possess their dot product equal to zero)

    This supplies the next desk:

    $mathbf{a} mathbf{b}$

    $mathbf{x}$ $mathbf{y}$ $mathbf{z}$
    $mathbf{a}$ $mathbf{x}$


    $mathbf{x} mathbf{y}$

    $mathbf{x} mathbf{z}$


    $-mathbf{x} mathbf{y}$


    $mathbf{y} mathbf{z}$


    $-mathbf{x} mathbf{z}$

    $-mathbf{y} mathbf{z}$


    It is usually trivial, unlike the quaternion desk to illustrate.

    The Reflection System (Aged Model)

    Reflection by a vector [you can move each vector]

    If we have got a unit vector $mathbf{a}$ and a vector $mathbf{v}$ we are in a position to replicate $mathbf{v}$ by the aircraft perpendicular to $mathbf{a}$.

    This is performed the identical outdated method: we decompose $mathbf{v}$ correct into a bit perpendicular to the aircraft $mathbf{v}_perp = (mathbf{v} cdot mathbf{a}) mathbf{a}$, and a bit parallel to the aircraft $mathbf{v}_parallel = mathbf{v} – mathbf{v}_perp = mathbf{v} – (mathbf{v} cdot mathbf{a})mathbf{a}$.

    Then, to replicate the vector, flip the perpendicular section while keeping the parallel section unchanged:

    $$start{eqnarray}R_{mathbf{a}}(mathbf{v}) &=& mathbf{v}_parallel – mathbf{v}_perp \
    &=& ( mathbf{v} – (mathbf{v} cdot mathbf{a})mathbf{a} ) – ((mathbf{v} cdot mathbf{a}) mathbf{a}) \
    &=&mathbf{v} – 2 (mathbf{v} cdot mathbf{a}) mathbf{a}live{eqnarray}$$

    The Reflection System (Geometric Product Model)

    At this point we are in a position to change the dot product $mathbf{v} cdot mathbf{a}$ by its geometric product version $frac{1}{2} (mathbf{v} mathbf{a} + mathbf{a} mathbf{v})$ to procure the next:

    $$start{eqnarray}R_{mathbf{a}}(mathbf{v}) &=& mathbf{v} – 2(frac{1}{2}( mathbf{v} mathbf{a} + mathbf{a} mathbf{v})) mathbf{a} \ &= & mathbf{v} – mathbf{v} mathbf{a}^2 – mathbf{a} mathbf{v} mathbf{a} \ &= & – mathbf{a} mathbf{v} mathbf{a}live{eqnarray}$$

    ($mathbf{a}^2 = mathbf{a} cdot mathbf{a} = 1$ since $mathbf{a}$ is a unit vector)

    This is asserting the categorical identical thing but in a certain notation. The usage of a straightforward product notation as a alternative of a formula to encode a essential operation corresponding to a reflection goes to display very well-known!

    Two Reflections is a Rotation: 2D case

    It appears to be like that if we be conscious two successive reflections to $mathbf{v}$ (using vector $mathbf{a}$ adopted by vector $mathbf{b}$) we procure a rotation by twice the angle between the vectors $mathbf{a}$ and $mathbf{b}$.

    You would be conscious every successive Reflection Step within the map below :

    You would also also switch the vectors $mathbf{a}$, $mathbf{b}$, and $mathbf{v}$, but the preliminary configuration of vectors within the map (click the “Reset Vector Positions” button) ought to easy agree with it especially certain why the rotation ends up being twice the angle. Another configuration that will not be faulty is to space $mathbf{a}$ and $mathbf{b}$ to the $mathbf{x}$ and $mathbf{y}$ axes.

    Two Reflections is a Rotation: 3D case

    Within the 3D case the vector $mathbf{v}$ can also furthermore be crash up into two diversified substances, one lying within the aircraft defined by $mathbf{a}$ and $mathbf{b}$, and one lying start air (perpendicular to) the aircraft. As considered within the next map, when the vector will get reflected by every aircraft its start air section stays the identical. So for the within section, we’re support to the 2D case, and it aesthetic will get turned around by twice the angle!


    In phrases of the Geometric Product, the two reflections simply correspond to:

    $$R_{mathbf{b}}(R_{mathbf{a}}(mathbf{v})) = – mathbf{b} (-mathbf{a} mathbf{v} mathbf{a}) mathbf{b} = mathbf{b} mathbf{a} : mathbf{v} : mathbf{a} mathbf{b}$$

    We name $mathbf{a} mathbf{b} = mathbf{a} cdot mathbf{b} + mathbf{a} wedge mathbf{b}$ a Rotor on narrative of by multiplying by $mathbf{a} mathbf{b}$ on either side of a vector we agree with a rotation ($mathbf{b} mathbf{a}$ the identical as $mathbf{a} mathbf{b}$ besides the bivector section is flipped).

    Making use of a Rotor $mathbf{a} mathbf{b}$ to either side of a vector rotates this vector within the aircraft of vectors $mathbf{a}$ and $mathbf{b}$ by twice the angle between $mathbf{a}$ and $mathbf{b}$.

    ✨⭐💖 That is all there is to it! 💖⭐✨

    3D Rotors vs Quaternions

    We can peek that 3D Rotors detect loads admire Quaternions:

    $$a + B_{xy} mathbf{x} wedge mathbf{y} + B_{xz} mathbf{x} wedge mathbf{z} + B_{yz} mathbf{y} wedge mathbf{z}$$

    $$a + b mathbf{i} + c mathbf{j} + d mathbf{k}$$

    Genuinely the code/math is mainly the identical! The most essential inequity is that $mathbf{i}$, $mathbf{j}$ and $mathbf{k}$ procure replaced by $mathbf{y} wedge mathbf{z}$, $mathbf{x} wedge mathbf{z}$ and $mathbf{x} wedge mathbf{y}$, but they work mostly the identical method. Right here is the code comparison. I did not consist of all the pieces, corresponding to log/exp for interpolation, but they are easy to agree with.

    Earth-Centric planetary motion

    On the different hand, as we have got considered, 3D Rotors are a 3D thought that doesn’t require the use of “4D double rotations” or “stereographic projection” to visualise. Attempting to visualise quaternions as running in 4D aesthetic to expose 3D rotations is rather admire attempting to realise planetary motion from an earth-centric point of view i.e. overly advanced on narrative of you potentially can also presumably be taking a search at it from the nasty point of view.

    As we have got considered, representing rotations as running inner planes as a alternative of round vectors helps loads. For example the basis bivectors sq. to $-1$, aesthetic admire the basis quaternions ($mathbf{i}^2=mathbf{j}^2=mathbf{k}^2 = -1$) :

    $$(mathbf{x} mathbf{y})^2 = (mathbf{x} mathbf{y}) (mathbf{x} mathbf{y}) = – (mathbf{y} mathbf{x}) (mathbf{x} mathbf{y}) = -mathbf{y} (mathbf{x} mathbf{x}) mathbf{y} = – mathbf{y} mathbf{y} = -1$$

    Multiplying two bivectors together supplies a third bivector, but right here’s usually trivial, and we don’t settle on to maintain in ideas how $mathbf{i} mathbf{j} = mathbf{k}$:

    $$(mathbf{x} mathbf{y}) (mathbf{y} mathbf{z}) = mathbf{x} (mathbf{y} mathbf{y}) mathbf{z} = mathbf{x} mathbf{z}$$

    (Voice that we have ancient $mathbf{x} wedge mathbf{y} = mathbf{x} mathbf{y}$)

    These properties are a extinguish consequence of the geometric product as a alternative of appearing out of thin air!

    Extra Learning

    (by the style, Geometric Algebra contains critical extra chilly stuff than rotors!)

    • Linear and Geometric Algebra by Macdonald [Amazon Link]

      Gargantuan on narrative of it’s extraordinarily certain and straightforward because it’s intended to interchange an undergraduate Linear Algebra Textbook.

    • Geometric Algebra For Laptop Science by Dorst et al. [Amazon Link]

      Gargantuan on narrative of programming one thing continuously makes it better.

      Voice: within the ebook the authors give the impression that Geometric Algebra is slower than Quaternions (and so a lot of others…). It truly ought to easy be nearly the identical right code (i.e. don’t write Geometric Algebra code by making a generic struct that can presumably perchance maintain all imaginable varieties of k-vectors, aesthetic write one struct per k-vector kind, as major. This method writing one Bivector struct, and one Rotor struct which is a Scalar + Bivector to interchange Quaternions).



    Hey! look, i give tutorials to all my users and i help them!