[HN Gopher] Let's remove Quaternions from every 3D Engine (2018)
       ___________________________________________________________________
        
       Let's remove Quaternions from every 3D Engine (2018)
        
       Author : lelf
       Score  : 489 points
       Date   : 2020-01-31 09:23 UTC (13 hours ago)
        
 (HTM) web link (marctenbosch.com)
 (TXT) w3m dump (marctenbosch.com)
        
       | duke360 wrote:
       | quaternions (<3) are extremely useful and not so hard to learn as
       | other have pointed out. it's just a matter of lazyness and
       | intesrest in solving a problem
        
         | wccrawford wrote:
         | Learning to _use_ Quaternions is easy. Learning how they work
         | is much, much harder.
         | 
         | Likewise, IMO, learning to use Rotors is easy, but learning how
         | they work is much harder... It's just that it's easier than
         | learning how Quaternions work.
         | 
         | And, also IMO, you don't need to know how either of them work
         | to use them in gamedev. It's fine to use a library that
         | understands them and just continue making the important parts
         | of your game.
        
           | K0SM0S wrote:
           | > _"It 's fine to use a library that understands them and
           | just continue making the important parts of your game."_
           | 
           | Oh that's indeed absolutely what a _game dev_ should do.
           | 
           | A 3D engine dev however, might do well to eat the math
           | leading to the understanding of quaternions, and by extension
           | Clifford algebras (the underlying/original theoretical
           | structure leading to geometric algebra). You get to
           | understand how particular variations in _n_ -dimensions of
           | this structural framework are isomorphic to all numbers like
           | R, C, H and much more. (hyperbolic! dual!)
           | 
           | It really paints a whole arch-picture, a meta-framework to
           | unify _all possibly kinds of numbers_ in one 's mind
           | (including the geometry of these numbers and ring operations,
           | with a 1:1 equivalence between geom and algebra).
           | 
           | Note that this is why, I think, some strong proponents of GA
           | (which I find myself agreeing with in that regard) would have
           | it enshrined in K-12 education in lieu of linear algebra --
           | because the intuition of GA is really great / second-to-none,
           | and _intuition_ is _all that most math students in high
           | school will ever retain_ afterwards (they won 't do math
           | again, ever, not really). The argument being that people who
           | need _more_ (from linear algebra for calculations notably)
           | can learn that complicated and non-intuitive stuff _later_
           | (university), building on top of a good base intuition
           | nurtured in GA  / Clifford.
           | 
           | So, the 3D engine maker, people in robotics, anyone working
           | with spatial representations of any kind (even abstract, like
           | research with multilinear models) would do themselves a
           | fantastic favor for a lifetime to learn these topics. It's a
           | no-brainer, really, from the other side.
           | 
           | It's _delicious_ math!
        
       | radarsat1 wrote:
       | Hm. I don't claim to fully understand quaternions, but I simply
       | think of them as an obfuscated version of axis-angle
       | representation, which seems to serve me well in reasoning about
       | operations on them.
        
       | bwidlar wrote:
       | Geometric Algebra in 2D - Fundamentals and Another Look at
       | Complex Numbers:
       | 
       | https://www.youtube.com/watch?v=PNlgMPzj-7Q&list=PLpzmRsG7u_...
        
       | pauljurczak wrote:
       | In order to make geometric algebra really nice, you have to go
       | 5D, see versor.mat.ucsb.edu. This imposes a significant
       | computational overhead. Nice things are expensive.
        
         | gugagore wrote:
         | I think that's a different point. To get rotations in 3D you
         | don't need to go to 5D conformal GA.
         | 
         | To be able to unify many geometric objects, like lines and
         | spheres and point pairs and represent the duality e.g. the
         | "meet" of two lines constructs a point (possibly a point at
         | infinity) and the "join" of two points constructs a line (not
         | sure what happens if the two points are identical), .... then
         | you need 5D which is really like 2^5 = 32D in my mind.
         | 
         | But if all you're trying to do is stop being confused by two
         | different things that both look like vectors, but transform
         | differently under spatial transformations (i.e. any vector that
         | is the result of the cross-product is really a different type
         | of vector than the argument vectors, or e.g. normal vectors)
         | then 3D GA is fine. Though really it's more like 2^3 = 8D (1
         | scalar, 3 regular basis vectors, 3 "axial" basis vectors, and
         | one pseudo scalar).
         | 
         | An efficient implementation would likely need to use a type
         | system avoid representing 8 dimensions directly. Like the cross
         | product of two vectors will produce an element where only the
         | "axial" components are non-zero.
        
       | o_p wrote:
       | Maybe the blog poster should try to learn how imaginary numbers
       | work instead of trying to stick with reals, as an EE im probably
       | biased but rotations -> complex numbers, as they make it much
       | easier to work with it
        
         | BlueTemplar wrote:
         | Rotations in 2D - absolutely !
         | 
         | Rotations in 3D are a whole different beast...
        
       | ChrisLomont wrote:
       | Having written engines using both GA and matrices+quats, as well
       | as writing articles on GA (one intro one in an old Games Gems
       | book), I'd say GA is a terrible idea for 3D engines. GA is
       | inherently slower to manipulate, as items require more storage
       | and more memory touches. They add almost zero benefit.
       | 
       | If the idea is use a higher, more pure math structure, then one
       | can go to even more abstract math formalisms, such as coord-free
       | calculus and bigger algebras, but these, like GA, add more
       | computational overhead to solve problems that don't exist.
       | 
       | Hestenes et. al., the main popularizes of GA in the
       | math/programming intersection, have papers on writing raytracers
       | in both, and they too clearly demonstrate loss of performance
       | using GA.
        
       | Epskampie wrote:
       | Previous discussion:
       | https://news.ycombinator.com/item?id=18365433
        
       | crubier wrote:
       | I am impressed at the number of people reacting with << Euler
       | angles are fine >> or << quaternions are fine, we always did this
       | way >>. Having worked extensively with them it is obvious that
       | Euler angles are broken beyound repair (singularities, 12
       | competing variations...) and quaternion are too (they only work
       | in 3D). This article is extremely interesting and absolutely
       | true. If geometric algebra had been discovered earlier we would
       | never have needed a lot of these unnatural constructs.
        
       | diegoperini wrote:
       | Putting content aside (it's great actually), I love the format
       | used for the article. Each header is also a link to a time point
       | in the accompanying video. There are interactive canvases that
       | are also used in the video. The only missing part is a teacher AI
       | which I can ask questions to (just kidding).
        
       | VikingCoder wrote:
       | While we're at it, can we please move the homogeneous coordinate
       | to be the first value in memory? That way, a vector or a point,
       | if they're represented sparsely in the data structure, just work.
       | 
       | [1], a point at the origin, is the same as [1 0] - a point at the
       | origin in 1 dimension, or as [1 0 0], a point at the origin in 2
       | dimensions, or [1 0 0 0], a point at the origin in 3 dimensions.
       | 
       | Similarly, [0] is a zero vector. [0 0 0 0] is a zero vector in 3
       | dimensions.
       | 
       | Having to know [0 0 1] is a point at the origin in 2 dimensions
       | (with a homogeneous coordinate), while [0 0 1] is a z vector in 3
       | dimensions (without the homogeneous coordinate), is just silly.
       | 
       | Why did we do this to ourselves?
        
         | joppy wrote:
         | It's puzzling - even in most of the mathematical literature,
         | x_0 is used for the homogeneous coordinate.
        
       | ColinWright wrote:
       | I've only skimmed the article, but it seems to be saying this:
       | 
       | > _Instead of using this thing you don 't understand and
       | investing the time to understand it, why don't you use this other
       | thing you don't understand, and invest the time to learn that
       | instead._
       | 
       | Indeed, later in the article the author says:
       | 
       | > _We can notice that 3D Rotors look a lot like Quaternions ...
       | In fact the code /math is basically the same! The main difference
       | is that i, j, and k get replaced by y[?]z, x[?]z and x[?]y, but
       | they work mostly the same way._
       | 
       | Have I got that right?
        
         | xg15 wrote:
         | Your opinionated summary implies that both concepts are equally
         | hard to understand, but the whole point of the author is that
         | rotors are potentially a lot easier to understand and reason
         | about than quaternions.
         | 
         | He also gives a concrete reason: For 3D objects, rotors operate
         | fully in 3D, whereas quaternions are in 4D. This means you can
         | visualize rotors and imagine "how they work" whereas with
         | quaternions, you have to more or less blindly trust the
         | formulas.
        
           | ChrisLomont wrote:
           | >rotors are potentially a lot easier to understand and reason
           | about than quaternions
           | 
           | Quats are quite easy to reason about: a unit quat holds a
           | rotation about an axis: rotation about angle theta an axis
           | given by direction (x,y,z) is quat q = sin(t/2) +
           | cos(t/2)(xi+yj+zk).
           | 
           | Composing quats q1 * q2 is the rotation you get by applying
           | q2 then q1 to an item.
           | 
           | So think of the scalar as holding info about the angle
           | rotated, and the vector part as the direction of the axis.
           | 
           | I don't see how with rotors or quats you can easily visualize
           | composition or more complex actions (and I've used both
           | extensively). "Blindly" trusting the formulas can be replaced
           | by working through a proof enough times until you feel how
           | they work, just like linear algebra, algebra, quadratic
           | formula, etc.
        
           | lonelappde wrote:
           | That's not true. Rotations in 3D space are 4D objects: a 3D
           | orientation and a 1D magnitude.
           | 
           | Rotors use a.b with aXb, and quaternions use magnitude and 3D
           | direction vector.
        
             | aratakareigen wrote:
             | SO(3) is definitely three-dimensional, and rotations don't
             | involve magnitudes.
        
               | papln wrote:
               | I miswrote. Rotation calculations are represented (in
               | quaternions and in geometric algebra calculations) as a
               | 3D subspace of R^4, with the "extra" dimension accounted
               | for by constraining quaternions to the unit hypersphere.
               | 
               | Rotations do involve magnitudes when interpreted as an
               | axis (2 dimensional manifold embedded in R^3) and a
               | magnitide (0 to 2pi)
               | 
               | https://en.wikipedia.org/wiki/Axis%E2%80%93angle_represen
               | tat...
               | 
               | SO(3) is a coordinate-free abstraction that isn't
               | relevant to the topic of GA vs Quaternions for
               | calculating concrete values in computer graphics
        
           | ptero wrote:
           | > rotors operate fully in 3D, whereas quaternions are in 4D.
           | This means you can visualize rotors ... whereas with
           | quaternions, you have to ... trust the formulas.
           | 
           | This is a bit of a stretch -- by the same logic any operation
           | on more than three numbers means I have to trust the
           | formulas. We have many methods to understand, visualize,
           | develop intuition, etc. in such cases, such as "fix a, look
           | at what happens when you vary b, c and d". When I am working
           | to understand dynamics of an object with three variables in
           | MATLAB or similar, I seldom (probably never) plot it in 3D
           | (which gets projected on the surface of a flat monitor
           | anyway). Instead I usually play with numerous 2D and even 1D
           | plots. My 2c.
        
             | mlatu wrote:
             | > rotors operate fully in 3D
             | 
             | By this, the author means: you can visualize a rotor FULLY
             | in 3D, no extra dimension neccessary.
             | 
             | I suspect you never have tried to think about how
             | quaternions work mechanically, I suggest this neat video:
             | 
             | https://www.youtube.com/watch?v=d4EgbgTm0Bg
        
               | ptero wrote:
               | Thank you for the link, very cool video!
               | 
               | I do get the theory part -- I know how quaternions and
               | rotors work (and have a PhD in "pure" math). My objection
               | (and a pretty firm one) is with the "if a phenomenon has
               | more than three variables we cannot visualize it" logic.
               | While lower dimensions make things a little easier to
               | understand and develop an intuition for, a convenient
               | abstraction or a model is much more important. Most
               | engineers work with things described by multiple
               | variables all the time and "reduce dimension to three" is
               | seldom the main goal.
               | 
               | If the claim is that rotor is a better model, more
               | convenient for software engineering, we can examine (and
               | debate) that. But we should not recommend switching just
               | because it has one less variable. For someone with an
               | algebraic rather than geometric view, the ability to
               | multiply quaternions on a piece of paper may be a strong
               | benefit. Double-checking, say the result (1+i)*(j-k) by
               | hand takes 10 seconds and a piece of paper; try mentally
               | computing the rotor composition -- you would probably
               | fall back on algebra (I certainly would).
        
               | Gene_Parmesan wrote:
               | No math degree here, but personally I think the author's
               | main point was not purely that they could be visualized
               | without resorting to 4D. Instead I think it was that the
               | concept of rotors can be explained from first principles,
               | whereas he feels that currently, programmers look at
               | quaternions as black boxes for which they have no
               | intuition. Here's the relevant quote from the video:
               | 
               | > But instead of defining Quaternions out of nowhere and
               | trying to explain how they work retroactively, it is
               | possible to explain Rotors almost entirely from scratch.
               | This obviously takes more time, but I find it is very
               | much worth it because it makes them much easier to
               | understand!
               | 
               | I can't speak to his argument really as, when it comes to
               | 3D game dev, I'm purely a hobbyist. I do believe though
               | that in the end, programmers want to program. They want
               | to be handed a library with an API that makes sense. The
               | ones who care deeply about the whys and hows of the math
               | will always take the time to learn it; others just want
               | to know how to write the code. For those people, I'm not
               | sure the rotor equations I saw are any more intuitive at
               | first blush than the quaternion equations.
               | 
               | In short, I feel like by the time you're at the point
               | where you're explaining the details of a topic like
               | geometric algebra, you've likely already lost the people
               | who just want to code, even if the description you
               | provide is more intuitive.
               | 
               | Having said that, I still found the video fascinating.
        
             | kybernetikos wrote:
             | > When I am working to understand dynamics of an object
             | with three variables in MATLAB or similar, I seldom
             | (probably never) plot it in 3D (which gets projected on the
             | surface of a flat monitor anyway). Instead I usually play
             | with numerous 2D and even 1D plots. My 2c.
             | 
             | This is a very interesting point. Have you tried VR? Do you
             | think this preference for 2d and 1d is just because 3d
             | display technology is still inconvenient or is it something
             | deeper than that?
        
             | xg15 wrote:
             | I think different people have different approaches. I can
             | only say that, for me, I usually need _some_ kind of visual
             | understanding of what an object represents - which may be
             | 2D, 3D, a graph structure or whatever else, depending on
             | the task at hand.
             | 
             | In this case, a 3D visualisation is the right tool because
             | the problem is all about objects in 3D space. So rotors let
             | you mentally work with the same objects you're thinking
             | about anyway instead of switching to some other concept or
             | representation.
             | 
             | I don't see that "it's technically 2D anyway because it's
             | projected to the surface of my monitor" is a valid
             | argument. My visual system knows pretty well how to deal
             | with pseudo-3D objects, thank you very much.
        
           | omaranto wrote:
           | I don't understand the phrase "rotors operate fully in 3D".
           | What does operating in 3D mean?
           | 
           | If it means rotors can be used to give a simple formula for
           | rotations in 3D space, then it also applies to quaternions.
           | 
           | If it means the space of rotors is three-dimensional, then
           | it's false: rotors have 4 coordinates, a + b x^y + c y^z + d
           | x^z, just like quaternions.
           | 
           | Does it mean something else? Something that applies only to
           | rotors and not to quaternions?
        
             | wbhart wrote:
             | It means the things in the basis, x^y, y^z and x^z have an
             | easy to understand interpretation in ordinary 3D space,
             | namely the parallelogram between x and y (in the case of
             | x^y), for example.
             | 
             | It's also easy (after reading the article) to understand
             | the operations that can be performed on these things.
             | 
             | It's not as obvious what i, j and k in the quaternions
             | correspond to, or why they have the multiplication table
             | that they do. It's an algebraic construction, not a
             | geometric one and hence more difficult to visualise.
        
               | omaranto wrote:
               | You're probably right, that's probably what was meant. I
               | guess I'm so used to thinking geometrically about
               | quaternions, I don't see much advantage to geometric
               | algebra for 3D rotations (but geometric algebra does have
               | other advantages, like working in any number of
               | dimensions!).
        
             | aratakareigen wrote:
             | The space of rotors and rotation quaternions are both three
             | dimensional because the coordinates are restricted to unit
             | magnitude.
             | 
             | Quaternions and rotors are exactly the same in practice,
             | but the intuitions are very different. The intuition behind
             | rotors involves planes and lines in 3D, whereas the
             | intuition behind quaternions typically involves a unit
             | hypersphere; there's a 3B1B video on quaternions where you
             | can learn more about them.
        
               | omaranto wrote:
               | You're right that the space of rotations is
               | 3-dimensional. When I said 4, I meant without restricting
               | to the unit hypersphere. This causes no problem for
               | rotations because replacing q by a multiple tq leaves the
               | formula x --> qxq^(-1) unchanged --although of course
               | q^(-1) invloves dividing by the square of the norm so
               | it's nice if the norm is 1.
               | 
               | Note that even if you do restrict q to have unit norm, q
               | and -q still denote the same rotation! (In other words,
               | the space of rotations isn't really S^3, but projective
               | space RP^3.)
               | 
               | I'll be sure to check out the 3B1B video, I keep seeing
               | them recommended and I think they might a good resource
               | to recommend to my students.
        
         | onedognight wrote:
         | Yes, you have that right. The underlying operations are the
         | same. What you are missing is that the ideas from geometric
         | algebra work in any dimension! Quaternions are a "trick" that
         | only works in 3D.
         | 
         | You can write down Maxwell's equations using the geometric
         | algebra easily, and it will make them better! They will be
         | obviously coordinate independent.
         | 
         | Pretty much _anything_ with a cross product will be better
         | written using geometric algebra.
        
           | papln wrote:
           | But 3D is the D that matters for 3D games. video games are
           | concrete mathematics, not abstract mathematics.
        
           | BlueTemplar wrote:
           | Maxwell's equations : much more consistent without the god
           | damned pseudo-vectors that are vectors except when they
           | aren't ! http://www.av8n.com/physics/maxwell-ga.htm
        
           | uulu wrote:
           | I got me intrigued. Thanks! Could you point to a source that
           | explains geometric algebra from this angle? Book, article,
           | web source, anything?
        
             | BlueTemplar wrote:
             | Here you go : http://www.av8n.com/physics/clifford-
             | intro.htm
        
           | solinent wrote:
           | The exterior/wedge product is actually very closely related
           | to the cross product, and works to generalize the cross
           | product to n dimensions. You can read Spivak or Munkres,
           | "Calculus on Manifolds" and "Analysis on Manifolds"
           | respectively.
           | 
           | One of their main uses is to prove the generalized Stokes
           | theorem in n dimensions.
           | 
           | 3D rotors are isomorphic to quaternions, so go ahead and
           | rename your variables :).
        
             | msla wrote:
             | > The exterior/wedge product is actually very closely
             | related to the cross product, and works to generalize the
             | cross product to n dimensions.
             | 
             | So, to be as opinionated as the g'parent comment:
             | 
             | The cross product is a hack which only works in certain
             | dimensionalities, whereas the wedge product is the
             | underlying idea, which works in all circumstances.
             | 
             | To be less opinionated:
             | 
             | The cross product is inconvenient because what it gives you
             | aren't the "usual" vectors, they're axial vectors, which
             | behave differently under mirror reflection than all of your
             | other vectors do.
        
               | solinent wrote:
               | This is incorrect, if you read Spivak, you can define and
               | (n-1)-ary product which generalizes the cross product.
               | You give it (n-1) vectors and it gives you a vector
               | orthogonal to all of them.
               | 
               | Whether you call it the cross product or not is just
               | semantics, but it does exist in terms of the exterior
               | product.
               | 
               | It's difficult to find online, but it's constructed
               | directly in Spivak. A quote:
               | 
               | "It is uncommon in mathematics to have a "product" that
               | depends on more than two factors. In the case of two
               | vectors v,w in R^3, we obtain a more conventional looking
               | product, v X w in R^3. For this reason it is sometimes
               | maintained that the cross product. can be defined only on
               | R^3" - Calculus on Manifolds, pg.84
               | 
               | Most graduate students read this (or did five years ago).
        
               | msla wrote:
               | > This is incorrect, if you read Spivak, you can define
               | and (n-1)-ary product which generalizes the cross
               | product. You give it (n-1) vectors and it gives you a
               | vector orthogonal to all of them.
               | 
               | I never said the wedge was the _only_ way to generalize
               | the cross product, I just said the cross product itself
               | _wasn 't_ general.
        
               | solinent wrote:
               | It's just semantics: what you call the generalized cross
               | product, I call the cross product.
               | 
               | We used to think as negative numbers being a
               | generalization of the integers, so that's some food for
               | thought. I'm sure once quantum mechanics dominates
               | solving eigenvalue problems will be a high-school level
               | problem, so we'll end up having complex numbers losing
               | their complexity. We don't call them "real" numbers
               | outside of math circles anymore.
               | 
               | To say that the cross product itself is a hack is a bit
               | of a stretch though, it can easily be generalized and I
               | think it's quite natural.
        
         | LanceH wrote:
         | The best 3d location/vector method I've used allowed rotations
         | using normal x,y,z coordinates, but you could do rotate an
         | object in the xyz of the engine itself, the object, or the
         | object that object was currently attached to. This made things
         | like shooting a lob from a forward facing gun easy, since you
         | could raise the shot from the gun rather than the world and no
         | quaternions were involved. I don't know if quaternions were
         | used underneath.
        
           | gugagore wrote:
           | I don't understand what you mean, but I think you're
           | describing exponential coordinates, or said another way,
           | choosing an angular velocity and getting a rotation by
           | following that angular velocity for a unit of time. https://e
           | n.m.wikipedia.org/wiki/Rotation_formalisms_in_three...
        
         | ianai wrote:
         | That's a notational change that incurs unneeded, increased
         | cognitive load. That's admittedly a mile high view.
        
         | mcnamaratw wrote:
         | Sure, people who are happy customers of quaternions and don't
         | feel driven to understand what's under the hood, why change?
         | 
         | The pitch in the OP is (I think) intended for people who feel
         | pressure to understand why it works. Geometric algebra can be
         | built up yourself by picturing actual rotations, one dimension
         | at a time. It's physical from the start. Quaternions are a
         | finished math system that you have to reverse-engineer to
         | understand. Some people like one approach or the other better.
         | 
         | Some geometric algebra people are kind of true believers.
         | That's probably not helping the notation get traction.
        
           | friendlybus wrote:
           | It's possible to plot the rotation of planets around the
           | earth using very complex systems. Why didn't we stay with
           | that?
           | 
           | Why not change? Comfort?
        
         | Certhas wrote:
         | That's not correct. Mathematically as they describe the same
         | thing they have to be translatable into each other. But one is
         | a natural mathematical definition, the other exploits a
         | completely unintuitive incidental mathematical isomorphism.
         | 
         | If you would read a few sentences on from where you quote, this
         | becomes evident.                   ij = k
         | 
         | is arbitrary, needs to be memorized and just happens to do what
         | you want for reasons that require a lot of working out.
         | (xy)(yz)=x(yy)z=xz
         | 
         | On the other hand requires zero memorization.
        
           | ColinWright wrote:
           | > _ij = k is arbitrary, ..._
           | 
           | It's probably my mathematical background speaking, but I find
           | this _far_ from arbitrary. Quaternions don 't spring from
           | nothing. It seems to me that (xy)(yz)=x(yy)z=xz needs just as
           | much justification and memorisation ... why should y^2=1?
           | 
           | I guess my point is this. If people put in as much effort to
           | understand quaternions as has been expended in this article,
           | then quaternions would probably be just as easy to grasp and
           | the system being described.
        
             | yiyus wrote:
             | > If people put in as much effort to understand quaternions
             | as has been expended in this article, then quaternions
             | would probably be just as easy to grasp and the system
             | being described.
             | 
             | You can do anything you do with our numbers with roman
             | numerals. You could argue that our base-10 system is as
             | arbitrary as roman numerals, or that knowing how to do
             | arithmetic in one system will allow you to do arithmetic in
             | the other one. But that does not mean that learning
             | arithmetic with roman numerals has the same difficulty as
             | with base-10 numbers, and the only reason we find it more
             | difficult is because we do not put enough effort.
             | 
             | I have introduced a few grad students to quaternions and
             | GA. We eventually use quaternions most of the time, but
             | they do not understand quaternions until they see GA (the
             | same as someone may need some base-10 theory before
             | completely understanding roman numerals arithmetic).
        
               | BlueTemplar wrote:
               | From the complex abacus the romans left us, it would seem
               | that they used both base 10 and base 12 (for fractions -
               | 360deg in a circle is an extension of that). Base 12
               | seems to be slightly better than 10, but switching over
               | would be WAY harder to "finishing" algebra... (and we
               | wouldn't have the quite important these days 10^3~2^10
               | approximation.)
        
             | Certhas wrote:
             | I disagree, but then I used bivectors extensively in the
             | geometric part of my mathematical research (back when) so I
             | would. ;)
             | 
             | y^2 = 1 is because it's a unit vector. The fact that
             | bivectors are the correct way to view rotations is evident
             | if you look at higher dimensions. Bivectors work just the
             | same way as described here when you want to work in R^n,
             | you just add basis vectors beyond x, y, z. But the algebra
             | they describe no longer forms an associative division
             | algebra over the reals. There is no way to get to the
             | algebra of the (generators of) rotations in higher
             | dimensions from the quaternions.
             | 
             | This is why i would say the quaternions (as built up from
             | the complex numbers) are a non-sequitur and incidental to
             | the structure of rotations.
             | 
             | Then again, I would always argue that one should use
             | complex numbers to think of rotations in R^2, so.... :)
        
               | bonzini wrote:
               | > I would always argue that one should use complex
               | numbers to think of rotations in R^2, so.... :)
               | 
               | That's not so strange, it's basically e^i*theta isn't it?
        
             | wbhart wrote:
             | y^2 = 1 because it is the sum of the dot product (1) and
             | the outer product (0). The latter is because the
             | parallelogram between y and y has zero area. The former is
             | just the length of the vector y.
             | 
             | Some memorisation is required, but it is in terms of things
             | that are easily visualised.
        
               | bonzini wrote:
               | But why would the area be expressed as a length? This
               | always struck me as a coincidence, and having read on
               | bivectors it just makes sense that it would be (because a
               | vector represents a distance on a line, a bivector
               | represents an area on plane, a trivector represents a
               | volume on a 3D space and so on).
        
               | defen wrote:
               | Area is not expressed as a length. In general you can't
               | simplify an expression that is a sum of an area and a
               | length (this is one of the features of geometry that GA
               | handles for you algebraically). e.g. "one meter plus one
               | meter" can be simplified to "two meters", but "one square
               | meter plus one meter" cannot be simplified. However if
               | one of the terms is zero you can remove it, so "zero
               | square meters plus one meter" is "one meter".
               | 
               | So x2 = xx = x^x + x*x = 0 (area) + 1 (length)
               | 
               | xy = x^y + x*y = x^y (unit area) + 0 (length)
        
             | HelloNurse wrote:
             | ij=k means that the product of two of the three unit
             | vectors must equal the third, which is a fundamental, non-
             | arbitrary property, and without loss of generality the
             | signs can be chosen so that ij=k (rather than ij=-k).
             | Adding ii=-1,jj=-1,kk=-1 it's easy to deduce ijk=-1, j=ki,
             | and i=jk, and ij=-ji, ik=-ki, jk=-kj.
             | 
             | Having to remember, out of the six possible permutations,
             | that one of the three correct formulas is the one with the
             | symbols in alphabetical order is much better than
             | remembering the "right hand rule" (or was it "left hand
             | rule"?).
        
               | Certhas wrote:
               | But why would you remember a right hand or left hand
               | rule? bivectors don't require you to.
               | 
               | x ^ y = x y - y x^T is the generator of the rotation that
               | rotates a vector in the direction y into the direction of
               | x. There is absolutely nothing to remember, and you can
               | work this out immediately from just multiplying out the
               | matrices:
               | 
               | exp(epsilon x ^ y) v ~ v + epsilon x ^ y * v = v +
               | epsilon x (y,v) - epsilon y (x,v)
               | 
               | We add a little bit in the x direction and remove a bit
               | in the y direction.
               | 
               | The whole view of rotations happening round an axis is
               | just a coincidence of 3d space, it doesn't make sense in
               | higher dimensions. On the other hand rotations always do
               | (compose into ones that) happen on planes.
        
               | papln wrote:
               | In my college in Antarctica we were taught
               | x ^ y = y x^T - x y               exp(e x ^ y) v ~ v + e
               | x ^ y * v       = e y (x,v) - v + e x (y,v)
               | 
               | because we use the left-hand rule down under.
        
               | HelloNurse wrote:
               | That's my point, you need to remember "ijk" in order
               | (i.e. i=jk or ij=k) in a purely algebraic definition
               | instead of a meaningless and complicated "handedness"
               | rule involving rotations.
        
             | bonzini wrote:
             | But they wouldn't extend to 4D.
             | 
             | You can treat complex numbers as 2D rotors (a 2D rotor is
             | cos alpha + xy sin alpha, so xy can be replaced with i) and
             | quaternions as 3D rotors. But if you build Cayley numbers
             | from quaternions they don't have the same geometric meaning
             | as 4D rotors.
        
         | zupatol wrote:
         | I haven't read that particular article, but from other sources
         | I've read quaternions appear to be mysterious/magical even to
         | people who know them, while the rotors have a very concrete
         | geometrical interpretation in geometric algebra.
         | 
         | Geometric algebra also addresses much more than just rotating
         | stuff, it's just that when you want to do rotations it leads
         | naturally to something very similar to quaternions.
        
       | stared wrote:
       | Quaternions are 3D rotations (plus, possibly, rescaling). The
       | author notes that they have the same API (I like this term used
       | in mathematical context).
       | 
       | So, the actual point is that the word _quaternions_ (and  "these
       | strange i, j, k") is confusing. Rightfully (at least for anyone
       | without a background in maths or physics).
       | 
       | "Let's remove Quaternions from every 3D Engine" -> "Let's remove
       | the word 'quaternion' from every 3D Engine"
       | 
       | (Nice explanations and visualization, anyway!)
        
         | cuspycode wrote:
         | I agree, it's mostly a matter of words. But just for the
         | record, quaternions in general are 4D isoclinic rotations (with
         | optional scaling). Left-multiplication by a unit quaternion
         | corresponds to a left-isoclinic rotation, and right-
         | multiplication corresponds to a right-isoclinic one. By
         | combining them you can produce any 4D rotation. A subset of
         | this is the set of 3D rotations that rotate ix+jy+kz into
         | ix'+jy'+kz'.
        
         | BlueTemplar wrote:
         | API stands for Application Programming Interface. What _is_
         | exactly an  "API"? Why not just "interface" ? (One should
         | generally avoid acronyms...)
        
           | paulddraper wrote:
           | Yes, it should be interface.
           | 
           | No need to distinguish here between API/CLI/GUI.
        
       | Koshkin wrote:
       | They say Geometric Algebra is "the new language of physics" and
       | whatever else; my problem with this is that, unlike, say the
       | calculus of differential forms (or tensors), it does not make
       | sense in more general manifolds which are at the heart of the
       | modern theoretical physics. Geometric Algebra, therefore, is more
       | like something that, sure, could be taught in high school in an
       | attempt, for example, to streamline elementary vector algebra and
       | thus eliminate some nasty questions (should they arise); yet,
       | there is some mental load to it that may make it not worth the
       | effort...
        
         | 6gvONxR4sf7o wrote:
         | I found that learning geometric algebra in a nice flat space
         | made differential forms much more intuitive for me. I don't
         | think they're so at odds, and teaching one then the other may
         | benefit both.
        
         | moultano wrote:
         | Can you elaborate on that or provide a link? The OP made it
         | seem like it was strictly more general, and I was getting
         | excited to dive in through that route.
        
         | BlueTemplar wrote:
         | Uh, getting rid of pseudo-vectors ? Maxwell's Equations?
         | 
         | http://www.av8n.com/physics/maxwell-ga.htm
        
       | OliverJones wrote:
       | As we kiss these quaternions goodbye, let's remember how they
       | came to be, and their role in building the discipline: Ivan
       | Sutherland's early hardware graphics pipelines.
        
       | spacedome wrote:
       | Amusingly the discovery of Quaternions by Hamilton was also
       | followed by arguments within the mathematical community as to
       | whether mathematics should be rewritten in the language of
       | quaternions, as Hamilton proposed to do and subsequently spent
       | the rest of his life pursuing. Initially many mathematicians
       | found them confusing, Hamilton's book is unusually difficult to
       | read and there were no others. The work of Grassmann was somewhat
       | neglected at the time, and eventually the Gibbs/Heaviside notion
       | of vectors (essentially what we use today) emerged as a
       | competitor to the quaternions. It seems it was a particularly
       | bitter mathematical divide, up there with Newton vs Leibniz. Here
       | is a quote by Tait, one of the "quaternionists":
       | 
       | "Even Prof. Willard Gibbs must be ranked as one of the retarders
       | of quaternion progress, in virtue of his pamphlet on Vector
       | Analysis, a sort of hermaphrodite monster, compounded of the
       | notations of Hamilton and of Grassman"
       | 
       | See "History of Vector Analysis" by Crowe or "Hamilton,
       | Rodrigues, and the Quaternion Scandal" by Altmann. Nice to see
       | the author cites these!
       | 
       | The Geometric Algebra comes from Clifford Algebras, which where
       | an attempt to combine Hamilton's Quaternions and Grassmann's
       | forms, and in fact contains both as sub-algebras. In the case of
       | 3D rotations calling them Rotors or Quaternions seems mostly like
       | a different way of thinking about the same thing.
       | 
       | I think this would be more kindly put as "reimagining"
       | quaternions and not "removing" them. The additional geometric
       | intuition from GA does seem useful, and even as someone who has
       | used quaternions extensively (though in a very different
       | context), I would also choose to work with Geometric Algebra as a
       | framework for geometry over Quaternions.
       | 
       | The visualizations are quite good here, it is a good way to
       | understand bi-vectors, you can wiggle them about a bit in 3D
       | instead of just staring at parallelograms on a page. The only
       | criticism I have is that they say quaternions and the cross
       | product come "out of nowhere", but then the way they present the
       | geometric product is equally "out of nowhere".
        
       | adamnemecek wrote:
       | Check out http://bivector.net, a new community on geometric
       | algebra.
       | 
       | Check out the demo https://observablehq.com/@enkimute/animated-
       | orbits
       | 
       | Join the discord https://discord.gg/vGY6pPk
        
         | yantrams wrote:
         | Never heard of this before. Thanks for the share.
        
       | pflats wrote:
       | I'm a pure math dude at heart, even if I don't get to do it much
       | any more.
       | 
       | Two years ago, my wife asked me, "If you had to get a math
       | equation tattooed on your body, what would it be?" I answered,
       | "i^2 = j^2 = k^2 = ijk = -1".
       | 
       | I felt a brief flush of anger when I saw this headline.
       | 
       | This is an extraordinarily good article that should be read by
       | pretty much anyone doing graphics programming.
        
         | logfromblammo wrote:
         | Mine would be the Fano plane mnemonic for octonion
         | multiplication, using two curves of constant width instead of
         | the triangle and the circle. That's got the quaternions covered
         | with the inside curve.
         | 
         | It can go next to the skeletal formula for benzaldehyde on my
         | imaginary nerd canvas.
        
         | Koshkin wrote:
         | She probably hoped for a different answer.
        
           | tudelo wrote:
           | No, I bet this was exactly the answer they were looking for.
           | After all, it was love at first sight.
        
         | xg15 wrote:
         | > _I answered, "i^2 = j^2 = k^2 = ijk = -1"._
         | 
         | Could you explain why? For someone without a math background,
         | it seems indeed like a pretty arbitrary thing to define.
         | 
         | (I can understand the idea behind complex numbers and how the
         | multiplication rules followed from the desire to define the
         | square root of a negative number - however, so far, I don't get
         | the motivation of introducing even more "special" elements)
        
           | davidgl wrote:
           | I'm not a mathematician, but I think it's about extending the
           | idea of a scalar and a single rotation (Complex numbers) into
           | a scalar + 3 rotations (Quaternions). The idea can be
           | extended further to a scalar with 7 rotations -
           | https://en.wikipedia.org/wiki/Octonion, but no further, for
           | reasons I don't understand.
        
             | paulddraper wrote:
             | You can actually go as far as you want to with the Cayley-
             | Dickson construction [1] of algebras.
             | 
             | 1. Complex numbers have associativity and communitivity of
             | multiplication. (That is, (ab)c=a(bc) and ab=ba).
             | 
             | 2. Quaternions have associativity but not communitivity.
             | 
             | 3. Octonions have neither.
             | 
             | 4. Sedenions [2], trigintaduonions, and not associative,
             | commutative, nor even alternative [3]. (Alternative is
             | associative specifically when the middle value is equal to
             | one of the other's; i.e. a(ab)=(aa)b.)
             | 
             | [1] https://en.wikipedia.org/wiki/Cayley%E2%80%93Dickson_co
             | nstru...
             | 
             | [2] https://en.wikipedia.org/wiki/Sedenion
             | 
             | [3] https://en.wikipedia.org/wiki/Alternative_algebra
        
               | pflats wrote:
               | Thanks for writing this! I referenced it in a reply
               | upthread for why I like the equation.
               | 
               | https://news.ycombinator.com/item?id=22204995
        
           | jjoonathan wrote:
           | > the multiplication rules followed from the desire to define
           | the square root of a negative number
           | 
           | That's a bit reductionist. You don't just get the square root
           | of a negative number, you get the Fundamental Theorem of
           | Algebra (an Nth degree polynomial has N roots), which is a
           | mathematical power tool if ever there was one.
           | 
           | Complex numbers dramatically simplify a bunch of proofs in
           | linear algebra, give us tons of nifty integration techniques
           | in complex analysis (the techniques are relevant for real
           | numbers, they just _use_ C), provide a representation of 2D
           | rotations that can be manipulated using the rules of algebra
           | (this is the most relevant to the thread), and give
           | physicists, electrical engineers, and signal processing
           | people an abstraction to represent oscillations (energy
           | sloshing between two buckets = two elements of a complex
           | number, which you can then do algebra with). They 're a
           | workhorse.
           | 
           | Quaternions are an attempt to do that in 3D. The dot and
           | cross product of vector calculus are other pieces of those
           | efforts. Unfortunately, vector calculus escaped the "math
           | lab" before it was complete and got written into other fields
           | and engineering books, so even though the underlying concepts
           | were eventually sorted out (it's called Geometric Algebra),
           | everybody just uses the half-baked abstractions (quaternions,
           | dot product, cross product) which are Good Enough. It's a
           | perfect example of "worse is better" affecting something
           | other than software engineering.
        
             | SkyBelow wrote:
             | >Quaternions are an attempt to do that in 3D.
             | 
             | I guess the question is, why does it then stop. Why not a
             | 4D alternative. Or if you look at it going by scalars
             | needed in a single value, it goes from 1 to 2 to 4. Why not
             | 8 or 16 (or some other growth)? Why does it stop there?
             | 
             | Also, is there as easy of a problem to understand
             | introducing the 3D technique (be it quarternions or be it
             | Gemoetric Algebra) that works as well as using sqrt(-1) for
             | imaginary numbers?
        
               | nitrogen wrote:
               | I still haven't wrapped my head around quaternions, but
               | 3Blue1Brown on Youtube has a good series of videos
               | justifying and explaining the complex numbers and
               | quaternions in terms not of sqrt(-1) but of
               | transformations of space.
        
               | nilkn wrote:
               | It can be generalized, but doing so requires some
               | subtlety. The naive approach (the Cayley-Dickson
               | construction) can be repeated ad infinitum, but it
               | doesn't continue to yield useful results for representing
               | geometric interactions like rotations in high dimensions.
               | 
               | Thankfully, this is a solved problem. The correct
               | generalized structure for doing geometry is called a
               | Clifford algebra. For n-space and any nonnegative
               | integers p,q satisfying p+q=n, there is a corresponding
               | real Clifford algebra Cl(R,p,q). Cl(R,0,1) turns out to
               | be isomorphic to C (the complex numbers), and Cl(R,0,2)
               | is a four-dimensional algebra that turns out to be
               | isomorphic to Q (the quaternions).
               | 
               | This is actually not that surprising, because the
               | signature (p,q) more or less means the algebra is built
               | by adjoining p generators that square to +1 and q
               | generators that square to -1 in the base field. This is
               | formalized by taking a quotient of the tensor algebra of
               | the field. You might wonder though why we have (p,q) =
               | (0,2) for the quaternions. That's because if the two
               | generators that square to -1 are i and j, then we can
               | build the third as k = ij, so we get it for free.
               | 
               | A real Clifford algebra is known as a geometric algebra,
               | and these give rise to objects called rotors. Rotations
               | in an arbitrarily high-dimensional space can then be
               | written as conjugation by a rotor.
        
               | lanstin wrote:
               | You can't get the associative property in higher
               | dimensions. There is something called octonions (which is
               | not associative but has some similar tho weaker
               | properties) https://en.wikipedia.org/wiki/Octonion There
               | is a sequence of such structures, but after the Octonions
               | you get non-zero numbers that multiply to zero: https://e
               | n.wikipedia.org/wiki/Cayley%E2%80%93Dickson_constru...
        
               | jjoonathan wrote:
               | > I guess the question is, why does it then stop. Why not
               | a 4D alternative.
               | 
               | It doesn't stop. That's what motivated geometric algebra,
               | which works in any dimension. Quaternions are a sub-
               | algebra of geometric algebra. They represent 3D
               | rotations, which makes them interesting in their own
               | right.
               | 
               | Asterisk: I believe there's a sign convention issue in
               | mapping between quaternions and the even subalgebra of
               | the 3D geometric algebra, so they aren't identical, just
               | isomorphic.
               | 
               | > Also, is there as easy of a problem to understand
               | introducing the 3D technique (be it quarternions or be it
               | Gemoetric Algebra) that works as well as using sqrt(-1)
               | for imaginary numbers?
               | 
               | That's an extraordinarily high bar. I don't believe
               | anything reaches it. Part of the problem is that complex
               | numbers are one of the most successful concepts in all of
               | mathematics. The other part of the problem is that most
               | of the useful facets of geometric algebra escaped the
               | field of abstract mathematics under their own name before
               | the unifying structure was discovered. The dot and cross
               | product, quaternions, differential forms and the general
               | Stokes' theorem are all examples. The remaining value
               | proposition of geometric algebra lies mostly in getting
               | rid of minor annoyances that come from this half-baked
               | nature of traditional vector calculus tools:
               | 
               | * Cross products break in more than 3 dimensions and they
               | break if you reflect them (see: pseudovectors). Bivectors
               | have no such issues. They represent rotations in any
               | dimension, reflected or not.
               | 
               | * Vector algebra with dot and cross products involves
               | memorizing lots of new identities and applying creativity
               | to work around the absence of division, while geometric
               | algebra just has division and the same bunch of algebra
               | tricks you already know. The geometric product isn't
               | commutative, so it isn't perfect in this sense, but
               | learning to deal with non-commutative algebra is a much
               | more fundamentally useful thing than learning a bunch of
               | 3D-specific identities.
               | 
               | * Dot and Cross with one argument fixed "destroy
               | information" mapping from their input to their output. If
               | you put them into an equation, the equation does not
               | fully constrain the free vector, so you are often going
               | to need more than one equation to represent any single
               | geometric concept. Not so with geometric algebra. Many
               | concepts map to a single equation. Including Maxwell's
               | Equation (I use the singular intentionally)!
        
               | uryga wrote:
               | > geometric algebra just has division
               | 
               | do you have a good reference for this? i've looked into
               | GA bit but don't remember seeing anything like this. e.g.
               | what would dividing a bivector by a vector mean?
        
               | gugagore wrote:
               | I think the answer to that question is that it doesn't
               | "stop", but I'll try to offer a reason that isn't
               | "octonions exist", but instead goes in a different
               | direction.
               | 
               | Geometric Algebra can capture the structure of both
               | complex numbers and quaternions, and also the structure
               | of the dot products, cross products, and the different
               | kinds of vectors that arise from those operations.
               | 
               | To be clear, matrix multiplication can also capture the
               | structure of complex numbers [1] and quaternions [2].
               | There might also be a concise reference to matrix
               | representations of some geometric algebras, but I didn't
               | find one. So matrices are kind of one way to not "stop at
               | 3D", but the structure is almost too uniform (which on
               | one hand makes it too general, and on the other hand
               | makes it not general enough), I'd say). Sure, with a
               | matrix you can represent rotations in 4D, but you still
               | need to operate on vectors only. Geometric algebra, if it
               | does have a matrix representation, gives names to special
               | kinds of matrices and special kinds of vectors.
               | 
               | [1] https://en.wikipedia.org/wiki/Complex_number#Matrix_r
               | epresen... and [2] https://en.wikipedia.org/wiki/Quaterni
               | on#Matrix_representati...
        
               | JackFr wrote:
               | 8 https://en.wikipedia.org/wiki/Octonion
               | 
               | 16 https://en.wikipedia.org/wiki/Sedenion
               | 
               | 32 https://arxiv.org/pdf/0907.2047.pdf <-
               | Trigintaduonions
        
           | pflats wrote:
           | I got busy, so I wanna say thanks to everyone who tagged in
           | for me. So many great answers. I'll link a few that speak the
           | most to my own feelings.
           | 
           | Why do I like it? I am, as klodolph notes [1], a dyed-in-the-
           | wool algebraist. It's where I find the most beauty and joy in
           | mathematics.
           | 
           | [1] https://news.ycombinator.com/item?id=22202606
           | 
           | This invention/discovery is a fundamental development in
           | abstract algebra, not a terminal one. Quaternions are just a
           | jumping-off point, and I've always found the Caley-Dickenson
           | construction that pauldraper explains[2] absolutely
           | beautiful.
           | 
           | [2] https://news.ycombinator.com/item?id=22202513
           | 
           | Why would I want it specifically as a tattoo? jfengel points
           | out the special history of that specific equation[3]: it was
           | (allegedly) carved into a bridge in Dublin when Hamilton
           | stumbled onto it, but the carving is gone. Kinda fitting to
           | give it new permanence.
           | 
           | [3] https://news.ycombinator.com/item?id=22202513
           | 
           | So, putting it all together: it's a fundamental development
           | in abstract algebra, which is my jam. It's could have been
           | permanently inscribed in a bridge, but that's been lost to
           | time, so giving it new permanency seems fitting.
           | 
           | Also, it's practical. My first thought was actually the
           | Cayley table for the Klein four-group[4], but that would be a
           | lot harder to get tattooed in a nice visible way. How I went
           | from there to Hamilton's quaternion equation is left as an
           | exercise to the reader. (If you're new to Cayley tables,
           | they're just fancy times tables. Replace "e" with 1.)
           | 
           | [4] https://en.wikipedia.org/wiki/Klein_four-
           | group#Presentations
        
           | jfengel wrote:
           | As other replies have said, the math is kind of important.
           | The idea of a tattoo harkens to the story of the discovery of
           | quaternions: Rowan Hamilton was out for a walk in Dublin,
           | trying to figure out how to generalize complex numbers. He
           | was walking under a bridge when he came up with that
           | equation, and carved the equation on the bridge.
           | 
           | His carving, if it ever existed, is gone. But there is a
           | plaque on the bridge commemorating the event. It reads:
           | 
           | Here as he walked by on the 16th of October 1843 Sir William
           | Rowan Hamilton in a flash of genius discovered the
           | fundamental formula for quaternion multiplication i2 = j2 =
           | k2 = ijk = -1 & cut it on a stone of this bridge.
        
             | GlenTheMachine wrote:
             | My PhD advisor was a stickler for citing original sources.
             | Really, _really_ original sources. He made me cite some
             | papers written by Lagrange in the 17th century in French,
             | when neither he nor I nor nearly anyone else who would ever
             | read my dissertation could speak French.
             | 
             | I got to the point where I needed to cite an original
             | source for the quaternion equations, so I cited the bridge.
             | 
             | He got the message.
        
             | pflats wrote:
             | Thanks for writing this. It was indeed a large part of why
             | I like it. I added more detail in a reply to the parent
             | post.
             | 
             | https://news.ycombinator.com/item?id=22204995
        
             | kens wrote:
             | For a summary of William Rowan Hamilton's life (including
             | the bridge story), see this amazingly clever video based on
             | the song from _Hamilton_ :
             | https://www.youtube.com/watch?v=SZXHoWwBcDc
        
           | Koshkin wrote:
           | See, for example,
           | https://math.stackexchange.com/questions/911807/what-is-
           | the-...
        
           | nilkn wrote:
           | By the Frobenius theorem, there are only three possible
           | structures for a real finite-dimensional associative division
           | algebra. Those structures correspond to the real numbers, the
           | complex numbers, and what are called the quaternions. So
           | essentially the above definition is not arbitrary because
           | it's the only other possible way (besides R and C) to get
           | that sort of algebraic system. Of course, this is not obvious
           | at all. C famously is algebraically closed as a field, which
           | makes it a ripe playground for much of topology, algebraic
           | geometry, and analysis. There are some nonobvious
           | generalizations of algebraic closure for the quaternions.
           | (Naively, the quaternions are not algebraically closed in the
           | classic sense because, evidently, ix + xi - j has no root.)
           | 
           | As for why one might want to consider such a noncommutative
           | division algebra in the first place, the answer I suppose is
           | just that it manages to pop up in a variety of areas in
           | mathematics. We've already seen the connection with rotations
           | in 3-space (the topic of this post). Here's another. The
           | 3-sphere (that is, a sphere in 4-dimensional space whose
           | surface is itself 3-dimensional) can be realized as the
           | multiplicative group of unit quaternions spanned by
           | {1,i,j,k}. Consider the circle H = {cos(theta) + i *
           | sin(theta)} for real values of theta; H is a subset of the
           | 3-sphere. If r is any unit quaternion, then the coset rH is
           | another circle. But given a subgroup H of any group G, the
           | left cosets of H in G form a partition of G. Therefore, these
           | circles just described form a partition of all of the
           | 3-sphere (the Hopf fibration).
           | 
           | Speaking of rotations, the involvement of quaternions should
           | not be surprising. Indeed, complex numbers are intimately
           | involved in rotations in 2-space (multiplication by a unit
           | complex number e^(i*theta) corresponds to rotation about the
           | origin by theta). Quaternions can similarly express rotations
           | in 3-space, but one cannot just left- or right-multiply but
           | must instead use conjugation. In general, one can generalize
           | this using the techniques of geometric algebra.
        
             | JackFr wrote:
             | When I took abstract algebra as an undergrad, we did a
             | brief bit on the quaternions. Bursting with curiosity I
             | asked the professor if 8 and 16 dimensional structures
             | existed. "Of course! But just as you lose commutivity with
             | Q, when you go to the octonions, you lose associativity,
             | and the sedonions lack "alternativity" (had to look that up
             | -- I didn't remember) and they're basically algebraic
             | novelties with out any application."
        
               | bonzini wrote:
               | Right, but while the Cayley-Dickson construction mostly
               | provides novelties (though I remember reading something
               | about octonions and string theory[1]), Clifford algebras
               | are derived differently; they are isomorphic to complex
               | numbers and quaternions for two and three base vectors
               | respectively, but they produce something else after
               | quaternion. This "something different" can be used to
               | represent, you guessed it, reflections and rotations in a
               | 4D space. Because they are not obtained from the Cayley-
               | Dickson construction they are not division algebras,
               | however.
               | 
               | [1] https://www.quantamagazine.org/the-octonion-math-
               | that-could-...
        
         | s_dev wrote:
         | https://en.wikipedia.org/wiki/Broom_Bridge
         | 
         | You're like this Irish bridge that has the notation inscribed
         | on it as well.
         | 
         | I would like to own an OpenGL kettle with the expression on it.
        
           | andybak wrote:
           | > I would like to own an OpenGL kettle
           | 
           | Do you mean the Utah Teapot?
        
             | s_dev wrote:
             | Yes -- I don't even know why I had the word kettle in my
             | head.
        
               | war1025 wrote:
               | I knew what you meant and didn't even consider that it
               | was the wrong name, for what it's worth.
               | 
               | Kettle and teapot are synonyms as far as I'm concerned.
        
               | bmn__ wrote:
               | These are different equipment.
               | 
               | A kettle is used for heating water. In earlier times, it
               | was made out of metal and put onto a heat source (fire,
               | stovetop). Nowadays it is almost entirely displaced by
               | the electric kettle, which is commonly made out of
               | plastic and contains a metal heating plate or spiral on
               | the inside.
               | 
               | A teapot is a ceramic pitcher where you put the boiling
               | water and tea leaves to brew the tea.
        
               | scott_s wrote:
               | Earlier-time kettles may be more common than you think.
        
               | war1025 wrote:
               | Either way, a water kettle is super useful, often
               | surprisingly so.
               | 
               | Definitely a kitchen gadget I'd recommend to anyone.
        
               | DonHopkins wrote:
               | They're both called black.
               | 
               | https://en.wiktionary.org/wiki/pot,_meet_kettle
               | 
               | https://en.wiktionary.org/wiki/pot_calling_the_kettle_bla
               | ck#...
        
               | jfengel wrote:
               | Kettles go on the stove (or have a built in heater), and
               | are used for boiling water.
               | 
               | You pour the boiling water into a teapot, usually made of
               | ceramic, which holds the tea leaves.
               | 
               | Not that it's important, but now ya know.
        
           | kleer001 wrote:
           | Hahaha! That reminds me of the time I couldn't recall the
           | name for "leaf blower" and called them an "air rake".
           | 
           | If anyone's curious the story is here:
           | https://en.wikipedia.org/wiki/Utah_teapot
        
           | CountHackulus wrote:
           | I explicitly made a detour when I was in Dublin to take a
           | picture of it the plaque on that bridge. Worth it.
        
           | jchallis wrote:
           | Friesland (formerly part of Melitta) sells the kettle for
           | about 37 euro. If you have a way to add the messaging, you
           | are well on your way.
           | 
           | https://frieslandversand.de/teekanne-1-4l-weiss-utah-teapot
        
           | chadcmulligan wrote:
           | If you ever happen to be near a Siggraph the render man guys
           | hand out little walking Utah teapots - a tradition going back
           | many years apparently. Worth the price of admission :-)
        
           | Isamu wrote:
           | Any idea why the name Hamilton appears to be deliberately
           | defaced on the inscription?
        
           | bregma wrote:
           | When I visited Dublin that was the one spot I absolutely had
           | to visit. For some folks it was the Temple Bar, for others
           | the James Joyce trail. For me, it was the plaque on the
           | Broombridge and the Trinity College Library.
        
         | DonHopkins wrote:
         | Then you could dress up for Halloween as Broome Bridge!
        
         | tzs wrote:
         | It's nice to see something other than e^(i)=-1.
         | 
         | If I had to get a math tattoo, I think I'd go for lim n-[?]
         | Q_n^(1/n) = e^(^2/(12 log 2)).
         | 
         | That comes from a theorem proved by Khinchin and Levy. Khinchin
         | proved that for almost all real numbers if you take the
         | sequence of convergents of their continued fraction expansion,
         | {P_1/Q_1, P_2/Q_2, ...}, then the sequence {Q_1, Q_2^(1/2),
         | Q_3^(1/3), ...} approaches a limit, which is the same limit for
         | almost all real numbers. Then Levy determined the value of that
         | limit, which is now called either Levy's constant or the
         | Khinchin-Levy constant.
         | 
         | If not that, then this (in standard math notation rather than
         | the verbose notation I'm using here):
         | 
         | Line 1: Let H_n = sum i=1 to n 1/n
         | 
         | Line 2: Hypothesis: sum d|n d < H_n + e^H_n log(H_n) for all n
         | > 1
         | 
         | That's neat because that hypothesis is true if and only if the
         | Riemann hypothesis [1] is true [2].
         | 
         | The Riemann hypothesis is a conjecture about complex numbers,
         | and is widely considered to be the most important unsolved
         | problem in pure mathematics. That it turns out to be equivalent
         | to a such a simple conjecture involving just integers and a
         | couple real functions from pre-calculus is a surprise.
         | 
         | [1] https://en.wikipedia.org/wiki/Riemann_hypothesis
         | 
         | [2] https://arxiv.org/abs/math/0008177
        
         | pastrami_panda wrote:
         | I love quaternions, but I have to ask: you'd rather have that
         | formula than Euler's identity tattooed?
        
           | FisDugthop wrote:
           | As another algebraist (category theory and computational
           | complexity), this makes a lot of sense. Euler's identity is
           | capricious and Euclidean to me, and far from the most
           | beautiful equation, although it is still remarkably elegant.
           | I don't have any tattoos, but I might consider some
           | categorical diagram; I don't know how I'd pick just one!
           | Perhaps there is some cool way to draw the Snake Lemma with a
           | realistic-looking snake.
        
             | uryga wrote:
             | > I don't know how I'd pick just one!
             | 
             | picking one up to unique isomorphism should be good enough
             | ;)
        
           | klodolph wrote:
           | Today, mathematicians in the most general sense divide into
           | algebraists and analysts. Tattooing Euler's identity
           | identifies you as a member of the analyst tribe, you live and
           | breathe limits, sequences, and measures. A tattoo of
           | Hamilton's i^2 = j^2 = k^2 = ijk = -1 would identify you as a
           | member of the algebraist tribe, who lives and breathes
           | commutators, cohomologies, and quotients.
        
             | pflats wrote:
             | Thanks for writing this! It's spot on. I referenced it in a
             | post upthread[1].
             | 
             | [1] https://news.ycombinator.com/item?id=22204995
        
         | jayshua wrote:
         | I'd probably go with "e^pi*i = -1". Kinda cliched, but I really
         | love that equation.
        
           | Mathnerd314 wrote:
           | Then you would have worry about the tau-ists:
           | https://tauday.com/tau-manifesto
        
             | jayshua wrote:
             | lol. I'm actually one of them. "e^tau*i=0" is my preferred
             | form. I don't tend to bring it up because we're a little
             | crazy and I don't want to draw attention to myself.
        
               | evozer wrote:
               | shouldn't it be e^tau*i = 1 if tau is 2pi?
        
               | jayshua wrote:
               | Oops, typo. You're right. You could also write "e^tau*i =
               | 1 + 0" to relate the "5 most important numbers in math"
               | but that form always seemed a bit forced to me.
        
               | nybble41 wrote:
               | If you write "-1 * e^(tau * i) + 1 = 0" you can
               | reasonably claim to relate _six_ important numbers: -1,
               | e, tau, i, 1, and 0. IMHO that looks a bit less forced
               | than the version with  "1 + 0", though of course it's not
               | the simplest form. (I mean, that "+ 0" could have been
               | inserted almost anywhere...)
        
           | [deleted]
        
           | Koshkin wrote:
           | Or, better yet, e^pi*i + 1 = 0. (My personal preference is E
           | = mc^2.)
        
             | klodolph wrote:
             | Why not E^2 = m_0^2 c^4 + p^2 c^2?
        
           | pizza wrote:
           | Someone once showed me this _" big brain"_ version of the
           | equation: floor[pi] - ceil[e] = 0 :)
        
         | jtolmar wrote:
         | I'd probably pick the normal-normal conjugate prior, in
         | precision form.
        
         | [deleted]
        
       | epicgiga wrote:
       | Let's remove them from _one_ 3d engine first, and see how it
       | goes.
        
       | scythe wrote:
       | His criticism of the cross product seems more poignant than his
       | criticism of quaternions in computer programming. One might ask
       | -- why not teach bivectors in introductory math instead of cross
       | products?
       | 
       | Historically it seems like 3D geometry and particularly cross
       | products in the context of electromagnetism fomented the primary
       | demand in mathematics education for students to be taught
       | vectors. Unfortunately the mathematics curriculum (in Western
       | countries) has not really been updated in decades to better
       | prepare students for the jobs of today; we still enroll all
       | students in a sequence that culminates in differential equations
       | and particularly in second-order linear differential equations,
       | which just so happen to be crucial to control problems in
       | electrical and mechanical engineering. While many people's jobs
       | involve some kind of mathematics somehow, only a few jobs involve
       | the mathematics of electrical engineering, and I suspect that is
       | part of the reason why so many students are bored in math class.
        
       | martin-adams wrote:
       | I have no experience in this area. Would making a change like
       | this inside a 3D Engine have any impact on performance?
        
         | CrazyStat wrote:
         | No, they're mathematically exactly the same. Just a different
         | way of thinking about the same mathematics that the author
         | argues (probably correctly) makes more intuitive sense.
        
           | bordercases wrote:
           | The development environment would have to be set up such that
           | the part of the language that uses GA primitives could be
           | efficiently transpiled into their corresponding matrix
           | abstractions to prevent loss of performance on the GPU at
           | runtime.
        
             | earenndil wrote:
             | It's unclear that you really need to convert to matrices
             | before sending off to the GPU. [1] finds that quaternions
             | are faster; I find that questionable (does it scale?), but
             | it shows that the two are comparable.
             | 
             | 1: https://tech.metail.com/performance-quaternions-gpu/
        
       | pjbk wrote:
       | Reading some comments here...
       | 
       | * GA provides some nice savings when it comes to rotor/3D
       | calculations, provided that the underlying data structures and
       | architecture supports them. Check out the publications by Dietmar
       | Hildenbrand and his team for several examples:
       | 
       | - https://www.researchgate.net/profile/Dietmar_Hildenbrand
       | 
       | * Quaternions start to exhibit several limitations when dealing
       | with complex objects, even in 3D. It provides just the necessary
       | structure to store quadrature information to avoid the "gimball
       | lock" issue, for example. However the fact that it collapses the
       | scalar with the pseudoscalar presents several problems again in
       | calculations with dual quaternions and higher dimensions
       | (projections, for once), and it's not much different from the
       | hurdle of having to discriminate axial and polar vectors in
       | Vector Calculus. The main issue is that its handedness doesn't
       | scale well and has problems capturing the geometric nature and
       | physics of the world in several dimensions (ie symplectic
       | geometry).
       | 
       | * IMHO the real usefulness of GA is that, as it name implies,
       | it's an algebra. That is what Clifford, Ball, Lie and Klein
       | realized while extending the work of Grassmann on exterior
       | algebras, screw theory, vector spaces and differential forms.
       | Matrices, quaternions and some forms have awkward behaviors when
       | they are treated symbolically as algebraic objects, being "leaky"
       | on information or having singularities just because they are not
       | the best representation. GA fixes that allowing you to formulate
       | problems symbolically, and then you can almost blindly solve the
       | equations with high confidence that the result will be sound. You
       | can then convert the objects back to your favorite
       | representation. For good examples, check out Terje Vold papers
       | on:
       | 
       | - Rigid body dynamics:
       | https://www.researchgate.net/publication/241273951_An_Introd...,
       | and
       | 
       | - Electrodynamics:
       | https://www.researchgate.net/publication/245345681_An_introd...)
       | 
       | [Note: Watch out for some typos]. For comparison, take a look at
       | Featherstone's 6D Spatial Vector representation, which is similar
       | to screws and I think shows the best you could do with Vector
       | Calculus objects:
       | 
       | -
       | http://bleyer.org/files/A%20Beginner's%20Guide%20to%206-D%20....
        
       | DreamScatter wrote:
       | Check out my geometric algebra software
       | 
       | https://grassmann.crucialflow.com
       | 
       | The Grassmann.jl package provides tools for doing computations
       | based on multi-linear algebra, differential geometry, and spin
       | groups using the extended tensor algebra known as Leibniz-
       | Grassmann-Clifford-Hestenes geometric algebra. Combinatorial
       | products included are [?], [?], [?], *, [?], ', ~, d, [?] (which
       | are the exterior, regressive, inner, and geometric products;
       | along with the Hodge star, adjoint, reversal, differential and
       | boundary operators). The kernelized operations are built up from
       | composite sparse tensor products and Hodge duality, with high
       | dimensional support for up to 62 indices using staged caching and
       | precompilation. Code generation enables concise yet highly
       | extensible definitions. The DirectSum.jl multivector parametric
       | type polymorphism is based on tangent bundle vector spaces and
       | conformal projective geometry to make the dispatch highly
       | extensible for many applications. Additionally, the universal
       | interoperability between different sub-algebras is enabled by
       | AbstractTensors.jl, on which the type system is built.
        
         | skratlo wrote:
         | Holy cow, dude, I'm going to use this one to make people feel
         | dumb. Craziest cryptononsense I've ever read!
        
         | ComplexSystems wrote:
         | What does the differential operator do and how does it relate
         | to geometric algebra?
        
       | Zenst wrote:
       | Bit like arguing that another keyboard layout would be better and
       | it would if your starting from scratch, but people tend to go
       | with what they know and that propergates as accepted and good
       | enough, a standard. Hence, whilst there are better layouts for
       | keyboard, we still have QWERTY.
       | 
       | Much the same with argument here, sure GA would be better, and
       | maybe that may well come about, but alas quaternions are somewhat
       | known by the many over the few and a bit of a QWERTY situation
       | plays out.
        
       | wbl wrote:
       | Yes, the even Clifford algebra is the quaternions. So what?
        
       | randName wrote:
       | I wonder if this has anything to do with the 4D game that he is
       | working on. Do quaternions work in 4D space?
        
       | mcphage wrote:
       | I'm confused--the author keeps referring to rotations. The very
       | first sentence is "To represent 3D rotations graphics programmers
       | use Quaternions", even. But I don't think you don't need
       | quaternions to represent 3D rotations. You need quaternions to
       | represent translations, because translations aren't linear
       | functions in 3D. (To be a linear function, v * 0 = 0, but that
       | isn't true for translations). My understanding was that the extra
       | dimension was to be able to represent translations. Am I
       | mistaken?
        
         | matt-noonan wrote:
         | Yes, you are mistaken. You need 3 dimensions to represent a 3D
         | rotation (2 for picking an axis, plus one for picking an
         | angle). To represent translations and rotations together, you
         | need 6 dimensions.
         | 
         | This also shows that the talk of needing to visualize 4d to
         | understand quaternions is disingenuous. The formula for using a
         | quaternion to rotate a vector is q _v_ q^-1, from which it is
         | immediate that changing the length of a quaternion does not
         | change the rotation it represents. So you can just deal with
         | unit-length quaternions, which form a 3D space.
        
           | mcphage wrote:
           | Hmm, I seem to be mixing up using 4d linear operations (ie, a
           | 4x4 matrix) to represent translation, rotation, scaling, etc,
           | with their combinations, with representing a rotation itself.
           | Thanks for your help--I'll dig more into this.
        
         | gugagore wrote:
         | I wonder if you're getting confused with what is called "a dual
         | quaternion" which has 8 basis elements, and can represent both
         | a translation and a rotation.
        
           | mcphage wrote:
           | Doing some reading, I seem to be mixing this up with
           | https://gamedev.stackexchange.com/questions/72044/why-do-
           | we-.... The later bit I understand, but I think it shows I
           | don't really get what _this_ article is all about. I 'll have
           | to read it further. Thank you :-)
        
         | heyitsguay wrote:
         | You don't need to restrict yourself to mathematically-nice
         | algebras of operations or whatever if you're doing 3d graphics
         | though. If you want to represent a translation of x by vector v
         | in 3D, just do x+v.
        
           | mcphage wrote:
           | Well, linear functions have the nice ability to be composed
           | together, resulting in another linear function (which can
           | then be composed, etc).
        
             | heyitsguay wrote:
             | Computable functions have that same property, and that's
             | the space that programs work in. It doesn't matter if the
             | composition elements are linear, only that they can be
             | computed on your hardware within some time budget.
        
       | cambalache wrote:
       | This article suffers from the syndrome -I learned what a hammer
       | is, everything now looks like a nail- .
        
         | friendlybus wrote:
         | In what way? The blanket application?
        
         | DonHopkins wrote:
         | I learned what math is, everything now looks like a number.
        
           | rytill wrote:
           | I learned what a relation is, everything looks like it can be
           | compared to other things.
           | 
           | I learned what a function is, everything looks like a mapping
           | between two sets.
           | 
           | Wait...
        
             | DonHopkins wrote:
             | It all boils down the fight between King Azaz -vs- The
             | Mathemagician.
             | 
             | https://thephantomtollbooth.fandom.com/wiki/King_Azaz
             | 
             | >King Azaz, ruler of Dictionopolis: King Azaz the
             | Unabridged is the ruler of words. His law is that words are
             | much more important than numbers. He is the brother of the
             | Mathemagician who is the ruler of mathematics. They came in
             | agreement that numbers and words are equally important in
             | the end. King Azaz is a lot like his brother, only the
             | ruler of words. However, unlike his brother, Azaz is more
             | like a stereotypical ruler. He takes the title of king, he
             | lives in a palace, and he encourages his subjects to attend
             | banquets.
             | 
             | https://thephantomtollbooth.fandom.com/wiki/The_Mathemagici
             | a...
             | 
             | >The Mathemagician, ruler of Digitopolis: The Mathemagician
             | is the brother of King Azaz and ruler of Digitopolis. His
             | law in Digitopolis is that numbers are far more important
             | than words, while King Azaz's law is that words are more
             | important than numbers. The Mathemagician is pretty much
             | polite but gets really mad whenever somebody mentions that
             | numbers aren't that important or valuable, since numbers
             | mean so much to him.
        
       | [deleted]
        
       | graphpapa wrote:
       | This seems to be an excellent introduction to geometric algebra,
       | a topic I have had difficulty picking up so far.
        
         | yiyus wrote:
         | As someone who has to teach GA, may I ask what you tried and
         | what you found difficult? I see problems with the non-standard
         | notation, for example. I also think that it is much easier to
         | understand 3D-GA starting with 2D or even 1D, and of course
         | using a non-formal approach (as we do with vectors). It is also
         | hard to find nice examples between the very obvious and very
         | difficult stuff.
        
         | K0SM0S wrote:
         | I suggest you look at Mathoma's videos1 on the topic on
         | YouTube. His explaining is so simple (even _too_ simple, some
         | would say) that GA becomes a no-brainer. The magic really
         | happens with this teacher (for me). A lot like Khan, for
         | comparison.
         | 
         | [1]:
         | https://www.youtube.com/playlist?list=PLpzmRsG7u_gqaTo_vEseQ...
        
       | dahart wrote:
       | > As a side note, Geometric Algebra contains more than just
       | Rotors, and is a very useful tool to have in one's toolbox.
       | 
       | I worked in a game engine where a pair of mathy programmers fell
       | in love with Geometric Algebra, and use this same argument that
       | quarternions ought to be replaced to overhaul all of the math
       | code in the engine using Geometric Algebra. The character rigging
       | system removed matrices and used GA instead.
       | 
       | This caused several large problems in the code base:
       | 
       | For one, it slowed the code down a little because the GPU
       | interface is all matrices, so there were conversions to matrices
       | all over the place, rigging in particular.
       | 
       | And only two guys in the studio knew Geometric Algebra, and they
       | didn't invest time in teaching it or helping people understand
       | it, they just hoisted it on everyone. All the rest of the
       | programmers knew matrix math but not Geometric Algebra, so they
       | would end up avoiding touching any of the GA code, i.e., any code
       | that dealt in transformations. The two guys ended up with a lot
       | of support of their own creation, but they were short with their
       | answers, in part because they got so many questions, so the
       | problem never went away.
       | 
       | The third problem is this whole rewrite was unnecessary. Fixing
       | gimbal lock with quaternions is a _tiny_ corner of the game
       | engine, whereas using GA throughout is a massive rewrite.
       | Matrices work really well for 98% of the code, and it's not
       | really a huge problem to have one or two routines that convert to
       | quaternions and back while they do a rotation. It is a problem
       | when any transform at all involves bivectors and rotors and you
       | have no idea what the hell those are nor do you have time in your
       | schedule to take a math class at work.
       | 
       | Personally, I'm intrigued by GA and have wanted to learn it for a
       | while, but having used it in production, I'm mildly against
       | replacing quaternions with GA, and very wildly against replacing
       | matrices with GA.
        
         | ur-whale wrote:
         | The wikipedia page for GA, and in particular the introduction,
         | is an absolutely perfect example of the horrible quality of
         | math pages on wikipedia.
        
           | GeorgeTirebiter wrote:
           | Thanks for saying this. On other math topics on wikipedia,
           | I've read, re-read, and re-read them and still felt like I
           | didn't understand. Maybe it wasn't all my fault.
        
         | earenndil wrote:
         | GPUs don't have dedicated matrix hardware anymore, making it
         | questionable whether you really need to convert your GA
         | structures to matrices first. [1] finds that quaternions are
         | _faster_ than matrices on modern hardware; I find that
         | questionable, but it at least shows that they are comparable.
         | 
         | 1: https://tech.metail.com/performance-quaternions-gpu/
        
           | dahart wrote:
           | The APIs (D3D, etc.) do use matrices, and that's all that
           | matters from the point of view of an engine developer.
           | Composing quats together is certainly faster than composing
           | matrices, but quats are limited (no translation / skew /
           | perspectivce / etc.), so there is no direct apples-to-apples
           | comparison between quats and mats.
        
         | nautilus12 wrote:
         | Isn't the data structure that supports quaternions just one
         | dimension up from matrices? Why not continue using matrices and
         | retain that last dimension seperately somehow? Then it doesn't
         | require having to retool the GPU/matrix side of it. IE you will
         | have multiple matrices where you would have had one otherwise.
        
         | jessermeyer wrote:
         | These problems are not inherent of GA, but of (flawed)
         | implementation details and deeper social problems. GA code
         | boils down to essentially the same computations as 'raw' Linear
         | Algebra, and should be implemented as such. Your math centered
         | programmers fell in love with the idea without ever figuring
         | out how to really use it.
        
           | noobermin wrote:
           | Right, as a physicist, this may be super naive but matrices
           | are just representations of the underlying algebraic
           | structure so I'm not sure why it isn't possible to merely do
           | both once you've decided on a way to convert between the two.
        
             | joppy wrote:
             | Rotors in geometric algebra form a "double cover" of
             | rotations, for example using unit quaternions there are two
             | different quaternions (q and -q) which will map to the same
             | rotation matrix. This means that mapping from rotation
             | matrices to quaternions is a bit fraught - you need to pick
             | a "side", and if that side happens to be opposite to what
             | another part of the code (perhaps the part only using
             | quaternions) chose, you'll get some whacky stuff happening.
             | The same idea applies for geometric algebra.
        
           | [deleted]
        
           | dahart wrote:
           | I completely agree it wasn't inherent to GA, but I wouldn't
           | summarize it as they didn't figure out how to use it. They
           | were fluent, the problem is the rest of us weren't.
           | 
           | The problem with what they did, and what this article is
           | doing, is suggesting we "fix" something that takes 2 or 3
           | math classes to understand by replacing it with something
           | that takes an entire semester to understand.
           | 
           | I honestly believe that GA has insights to offer, but I don't
           | believe it will save any time to upgrade the use of
           | quaternions in any 3d engine.
        
             | jessermeyer wrote:
             | Without knowing more context it's a bit hard to respond,
             | but from what you said, it sounds like they wrote an
             | abstraction layer above matrices that observed GA
             | semantics, which required a lot of run-time conversion.
             | This is a flawed implementation, especially for a game
             | engine. It's like writing a v-table for matrices to support
             | every general case when you only need 3 or 4 specific
             | instances anywhere in your code.
             | 
             | Time spent -- You're probably right. For new technology,
             | it's probably worth the research to see if code clarity is
             | worthwhile...
        
               | sdenton4 wrote:
               | Not necessarily on top of matrices... I can easily
               | imagine a part of an engine working with GA and then
               | having to translate back or forth to matrices whenever it
               | needs to interact with another (outside) part of the
               | system.
        
               | jessermeyer wrote:
               | Translations like this are probably not a great idea in a
               | game engine but I'm willing to be shown an example where
               | it's the Thing You Want To Do.
        
               | sdenton4 wrote:
               | Oh, yeah, it's a terrible thing to do, absolutely. All
               | I'm saying is that you can have a perfectly consistent
               | /component/ using GA, but if it's living in a larger
               | ecosystem of matrix-based code, you're going to have to
               | do these translations somewhere. (eg, we rewrote the
               | camera compoent in GA, but the dudes doing grass modeling
               | haven't converted.) You get an all-or-nothing problem:
               | it's efficient if the whole codebase is using the same
               | abstraction, but converting around between a bunch of
               | abstractions will come with a cost.
        
               | jessermeyer wrote:
               | Yeah, I don't work on codebases of that scale so I can't
               | really comment knowingly of what cost it would take to
               | move the whole parcel over the GA. Probably highly
               | dependant on code / social org.
        
             | quatquatquat wrote:
             | I'm not sure you are fully understanding the situation.
             | What jessermeyer is saying is that it's possible to use GA
             | as a language for describing geometric operatiins while
             | continuing to implement them under the hood using old-
             | fashioned vector algebra.
             | 
             | The major proponents of GA don't suggest doing this. I'm
             | not an expert so I can't rule out the possibility that
             | somebody, somewhere has done it successfully. Computer
             | implementation of GA is still a research topic:
             | http://geometry.mrao.cam.ac.uk/2016/11/ga-2016-lecture-7/
             | 
             | There is a very strong flavour in the computational GA
             | literature of directly implementing the GA operations--not
             | translating to vector algebra. jessermyers is expressing a
             | minority opinion when he says "don't do that".
             | 
             | Finally (and this might be a bit rude) I'm dubious about
             | your assessment of your coworkers fluency in GA. Maybe they
             | seemed totally facile with the bits they knew. In general,
             | though, non-speakers can't assess fluency (in any language,
             | right?). Similarly, what are you actually saying when you
             | say that you "believe" GA has insights to offer? What is
             | that confidence/assessment based on?
             | 
             | Applying GA is an active research field--it's not something
             | people attain practical mastery in, just yet.
        
               | jessermeyer wrote:
               | For the record, I'm not saying everyone should not
               | implement GA this way. The major proponents of GA are
               | typically academic, who are interested in its abstract
               | properties of computation. In this setting, it's probably
               | a reasonable approach. But this is a completely different
               | problem than engineering a game-engine which strongly
               | encodes constraints into its solution. It's more like
               | plumbing than math.
               | 
               | In fact, the datapoint here is an argument against
               | implementing GA in its general form to perform
               | computations.
               | 
               | There is a world of difference between understanding the
               | properties of a computation and wanting to turn a wrench.
        
               | bordercases wrote:
               | It sounds like one shouldn't have expected much of these
               | coworkers, or rather should have expected their error,
               | given that the academics studying GA haven't found
               | efficient compile-time translations for GA into a
               | performant solution with matricies?
        
               | sdenton4 wrote:
               | Yeah, beating implementations of matrices is a tall order
               | at this point in history...
               | 
               | Similar to how electric engines are superior to ICE in
               | many ways, but ICE has a century of optimization work
               | already done to catch up to.
               | 
               | From my gloriously irrelevant position in this arm chair,
               | I wonder whether there's enough extra oomph that comes
               | from GA to justify the conversion cost and catch up to
               | the existing optimized linear algebra environment.
        
               | dahart wrote:
               | > I'm dubious about your assessment of your coworkers
               | fluency in GA.
               | 
               | I wouldn't call that rude so much as you making incorrect
               | assumptions and jumping to conclusions on top of my story
               | that is incomplete on details. It certainly would be
               | better left out of your comment, as there's nothing to be
               | gained from cross-examining my ability to assess whether
               | they knew more GA than I did. They did, in fact, know
               | more GA than I did. And while I'm framing myself as a GA
               | noob, I've dabbled enough to know a bit about what I
               | don't know.
               | 
               | > it's possible to use GA as a language for describing
               | geometric operatiins while continuing to implement them
               | under the hood using old-fashioned vector algebra.
               | 
               | You're missing my point. They did implement GA using
               | linear algebra. They built classes for bivectors and
               | rotors that use dot products and cross products under the
               | hood.
               | 
               | Once there are classes for GA objects, and they get used
               | in the code, then everyone else has to use them and know
               | how to use them. You can't use GA without knowing the
               | algebra of GA types.
               | 
               | The implementation of the GA objects is not the question
               | here at all.
        
         | oppositelock wrote:
         | I'm a former game engine lead from many years ago, from around
         | the time that quaternions were becoming popular, since we never
         | used them before the early 2000's, really, as 3D was young and
         | rotation matrices sufficed.
         | 
         | Quaternions came into favor to solve the problem of gimbal lock
         | in composed Euler rotation matrices. This happens when you
         | create a rotation which rotates one axis into another, and end
         | up with a matrix that loses one axis (it loses an eigenvector),
         | and you become "trapped" in the new rotated frame and can't
         | ever rotate out of it. Quaternions don't suffer from this
         | problem, but they're also tricky to work with and reason about,
         | and their rotations can become funny when composed - instead of
         | rotating from orientation A to B, they'll go through a C in a
         | very different place. You need to create heuristics to keep
         | rotations looking sane with quaternions. In the games that I've
         | worked on, we took other precautions to avoid gimbal lock in
         | rotations and stuck to Euler matrices. For example, in a flight
         | simulator, you always computed the final rotation matrix for
         | the plane location directly from its heading, pitch and roll,
         | and so, you'd never suffer gimbal lock.
         | 
         | Why stick to Euler matrices and not some better Geometric
         | Algebra or Quaternions? Because it's really easy to
         | interpolate, and think about plain old rotations about a
         | vector, and you can teach anyone to avoid gimbal lock. It's
         | easier to avoid that problem than to train a bunch of junior
         | engineers on higher level math.
        
           | pfedak wrote:
           | Could you elaborate more on interpolation and weirdness of
           | composing quaternions? I thought a big selling point for
           | quaternions was the ease and naturalness of just using slerp,
           | whereas with euler angles a similar approach gives bad
           | results. When you mention rotations about a vector, do you
           | mean you decompose the desired rotation matrix into
           | axis/angle? Otherwise I'm very impressed by your ability to
           | visualize compositions of arbitrary rotations.
        
             | jacobolus wrote:
             | Quaternions (a.k.a. rotors) are by far the easiest
             | representation to interpolate and compose.
             | 
             | Matrices and Euler angles are both horrific to interpolate.
        
             | oppositelock wrote:
             | You can't solve the problem of avoiding gimbal lock in
             | arbitrary rotations, so you rig the game not to ever have
             | arbitrary rotations. You cheat, basically. Gimbal lock is a
             | huge problem in software where free form rotations are
             | allowed, such as 3D modeling packages, CAD, but in games,
             | since we control the world, we can set it up not to have
             | these problems.
             | 
             | Quaternion interpolation works well, but it introduces
             | twist, which is sometimes not what you expect. When you
             | start composing many quaterions, you get some wild
             | rotations, going the long way, or doing an additional 360
             | twist, and whatnot. Mind you, I'm digging 20 years back in
             | my brain here, I don't remember many specifics anymore.
        
               | banachtarski wrote:
               | There are a number of problems with your assessment in
               | modern day engine design I think.
               | 
               | First, because of IK, we _cannot_ control orientations
               | exactly. Newer techniques like motion matching /IK can
               | generate new orientations on-the-fly, depending on what a
               | character is doing and the character's environment.
               | Gimbal lock matters for camera movement as well. Looking
               | up with Euler angles is a great way to induce a seizure
               | if not done correctly.
               | 
               | Second, the "wild rotations" you mention has a very
               | simple solution employed by every engine I've worked
               | with. Basically, you just constrain the real part to be
               | positive which fixes your interpolation on one half of
               | the Lie-manifold which ensures the arc taken is as short
               | as possible.
        
           | ErotemeObelus wrote:
           | > instead of rotating from orientation A to B, they'll go
           | through a C in a very different place.
           | 
           | This is because H double-covers SO_3, not just simply covers.
        
           | salty_biscuits wrote:
           | Gimbal lock is a problem for euler angle representation of
           | rotations, not rotation matrices themselves. You can fix it
           | for euler angles the same way they used to for old mechanical
           | gimbal gyroscopes. By having a fourth rotation of the frame
           | that points the singularity out of the way. This is a typical
           | solution in navigation for dealing with the poles of the
           | earth (a wander angle frame).
        
         | notduncansmith wrote:
         | Thank you for the anecdote! Sorry to leave such a small comment
         | but I believe you meant "foisted it on everyone", not
         | "hoisted".
        
           | dahart wrote:
           | Foisted is indeed a better choice there, whatever I thought I
           | meant. Thanks! I thought about editing, but I'll leave it so
           | as not to disturb your comment.
        
           | mrspuratic wrote:
           | I'm sure everyone's been in a situation where so much sh*t
           | was dropped on them that a hoist must have been involved ;-)
        
         | smcameron wrote:
         | > Fixing gimbal lock with quaternions
         | 
         | Huh? I thought quaternions don't have any problem with gimbal
         | lock. That's a problem with Euler angles and matrices.
         | 
         | Edit: I think you meant using quaternions to fix gimbal lock
         | problems with matrices, which makes sense.
        
         | moralestapia wrote:
         | This is more or less the thing with "Category Theory".
         | 
         | Very fancy and neatly structured code but in the end you
         | accomplish pretty much the same; and now nobody on the team
         | understands a bit about what you're doing.
        
           | asdfman123 wrote:
           | You mean there's a way to establish yourself as an arcane
           | code wizard _and_ make yourself irreplaceable? Sign me up!
        
             | moralestapia wrote:
             | It's more like:
             | 
             | "Why would we use a framework that nobody understands but
             | you, to accomplish the same stuff a few SQL statements can
             | do?"
             | 
             | The former option never wins.
        
           | crimsonalucard wrote:
           | That just means the concept is ahead of its time. People
           | scoff at things they don't understand before that thing takes
           | over the world.
        
         | agumonkey wrote:
         | Although the fact that GPUs are not ready for GA .. forcing a
         | model that cannot fit onto hardware is quite a massive naive
         | mistake.
        
           | janoc wrote:
           | That's not about "not being ready", the GPU really doesn't
           | care whether the numbers it is multiplying are coefficients
           | of a matrix or a bivector.
           | 
           | The problem is that all libraries, drivers, etc. use
           | matrices, quaternions and vectors. So you would have to
           | constantly convert back and forth, which is both error-prone
           | and a non-trivial performance problem.
           | 
           | Of course, you could build your own libraries for everything,
           | but that's just crazy. Who has time for doing that?
           | 
           | Not to mention that writing a mathematical library like that
           | is a highly non-trivial task. Not just the algebra part but
           | also numerical stability and accuracy are a big deal. That
           | requires a very skilled person, naive implementations will
           | rapidly blow up in your face.
           | 
           | And doing all this what for, exactly? So that the GA
           | explanation of rotations doesn't require 4 dimensions while
           | the math complexity of rotor algebra ends up being the same
           | as with quaternions? So there isn't really a performance
           | benefit neither.
        
         | BlueTemplar wrote:
         | The main issue here is that they tried to port what sounds like
         | a mature code base. Imagine changing programming languages!
         | They should have restarted from scratch, and with a team fluent
         | in Geometric Algebra...
        
         | SkyBelow wrote:
         | I feel like this requires the same concern when replacing any
         | system. Even if the new tool is better in theory, does it have
         | enough people using it/experts working on it that it is better
         | in practice and does the costs of replacing it justify the
         | improvement.
         | 
         | Just look at something like a 50 year old IBM mainframe vs. the
         | newest Sql Server with .Net Core running on the server of your
         | choice. Is the latter the better choice for a new application?
         | Yes. Yet many very successful businesses don't replace their
         | mainframes because the benefits do not justify the costs.
        
         | madrox wrote:
         | As an engineering manager who's had to push adoption of new
         | technologies, I feel this argument in my bones.
         | 
         | That said, taking your argument to the extreme, we all probably
         | should've stuck with PHP, since everyone understood it and,
         | well, was it really worth the switching cost? Naturally that's
         | dumb, so there's a certain amount of "how do we get there?"
         | with any new technology that's probably a good idea.
         | 
         | That's probably not going to get answered by the principal
         | engineer who says This Tech Is The Future. It's going to get
         | answered by people like you who think about switching costs and
         | the impact new tech has on people.
        
           | [deleted]
        
           | Chirono wrote:
           | I would hope any good principal engineer spends a decent
           | amount of time considering switching costs and impacts of new
           | technology. Sounds like this isn't your experience though?
        
           | jaw wrote:
           | > taking your argument to the extreme, we all probably
           | should've stuck with PHP, since everyone understood it and,
           | well, was it really worth the switching cost?
           | 
           | There are multiple paths for honing a new technology, without
           | dumping it on a large group of developers while it's in its
           | experimental stages:
           | 
           | - Use it for a series of side-projects
           | 
           | - Use it in a startup or startup-like team in which all the
           | developers are bought into it, and happy to work through the
           | obstacles
           | 
           | - Use it at an organization that's both able and willing to
           | devote a large amount of resources to making it work (e.g.
           | devoting a full-time team to its development & support &
           | related training)
           | 
           | Once the kinks have been sufficiently worked out in one of
           | those contexts, and a solid ecosystem with good documentation
           | exists, then there's a much better chance that the benefits
           | will be worth the switching costs for the average project.
        
             | pfranz wrote:
             | I haven't worked on large gaming projects, but I've worked
             | on large CG feature films. I was a little horrified about
             | how aggressively they adopted some technologies. The theory
             | was that Pixar proved a lot of their technologies in their
             | short films (Disney a bit of that, too, in previous years).
             | The studio I was at didn't do that and both Disney and
             | Pixar seem to have moved away from that at least a decade
             | ago. Very very rarely, they'd repurpose old projects or
             | chose a sequence or specific department for releasing
             | something--that often was a mess (resources spent at the
             | "boundaries" instead of shoring up the new tech).
             | 
             | I imagine AAA games are similar. You have 4 years and ship
             | one monolithic game. Maybe you could prove out this idea in
             | a small area like artist's tools or an engine fork (similar
             | to the approaches above). Trying to incrementally adopt
             | something would take 2 or 4 games (10+ years) and I just
             | don't see technology roadmaps like that. Especially if it's
             | not a huge win.
        
         | BlueTemplar wrote:
         | IIRC matrices are still required in Geometric Algebra ? Maybe
         | by "matrix math" you mean "Vector Algebra? "
        
           | gugagore wrote:
           | I'm not the grandparent. I'm not sure what you mean by
           | "required", but, no, I don't think so.
           | 
           | You can represent a lot of algebraic objects and operations
           | using matrices and linear algebra operations. The most
           | accessible example of that is probably complex numbers: https
           | ://en.wikipedia.org/wiki/Complex_number#Matrix_represen...
           | 
           | and I wouldn't say that "matrices are still required in
           | complex numbers" any more than I'd say "matrices are still
           | required in geometric algebra".
        
             | BlueTemplar wrote:
             | OK, after refreshing my memory on GA, it seems that one of
             | the nice things about it is that you don't have to think
             | about the "row" vs "column" vectors present in "Vector
             | Algebra". Which are usually represented in the form of
             | matrices. But you don't "need" them in GA, since you can
             | directly work with vectors (= arrays) ! (Which makes it
             | even more curious as to why matrices would be more
             | efficient for 3D work ??)
        
               | gugagore wrote:
               | I think I understand roughly what you mean when you
               | distinguish row and column vectors. For example, let [x,
               | y] represent a row vector and [x, y]^T represent a column
               | vector. If you have a function f that maps [x, y]^T -> z,
               | (you might write it z=f(x,y)), then the gradient(f) is a
               | function [x, y]^T -> [x, y]. That is to say, the gradient
               | is a _row_ vector. It 's a different kind of vector than
               | the input to f. And it transforms different (c.f.
               | https://math.stackexchange.com/a/3200912/)
               | 
               | So using that kind of thinking, the cross product of two
               | column vectors is a row vector:
               | https://www.youtube.com/watch?v=BaM7OCEm3G0
               | 
               | As you say, Geometric Algebra doesn't talk about row
               | vectors and column vectors. For example, in 3D GA,you can
               | choose a representation in R^8. That's 1 scalar, 1
               | pseudo-scalar, 3 column-y components, and 3 row-y
               | components.
        
               | aspaceman wrote:
               | From reading a lot of comments it seems like
               | misinformation. One thing worth keeping in mind is that
               | game developers are highly risk averse. For good reason.
        
       | nbulka wrote:
       | "We just accept their odd multiplication tables."
       | 
       | What is odd about the quaternions' multiplication tables? Is it
       | the fact that the commutative property of multiplication is
       | violated? For the sake of argument, let me assert that it is.
       | 
       | What if at the highest level of abstraction x * y had no
       | obligation to equal y * x?
        
         | rytill wrote:
         | So what else does this operator do? It's not commutative. Does
         | (x * y) * z still equal x * (y * z)?
        
         | yiyus wrote:
         | The geometric and exterior products used in GA are non-
         | commutative too.
        
         | timerol wrote:
         | It is definitely not that, since the article shows that a^b =
         | -b^a. I suppose that it's the choice that ij = k as opposed to
         | -k?
         | 
         | I'm not sure, but the article's implication that nobody else
         | cares why things work to be distracting and insulting.
         | 
         | > Personally, I have always found it important to actually
         | understand the things I am using.
        
       | alpineidyll3 wrote:
       | The author is missing a huge very real advantage of quaternions,
       | that they are smooth functions of thier parameters and don't
       | suffer from gymbal lock singularities. All 3d representions do,
       | as can be shown with the math this guy is too lazybrained to do.
       | 
       | That really matters for defining smooth paths, quaternions simply
       | have the right topology and rotations don't.
        
         | eigenspace wrote:
         | The author is using geometric algebra to create mathematical
         | objects with all the same properties as quaternions, but to
         | explain and understand them in a more comprehensive, sensible
         | way. These things have all the same rotational properties as
         | quaternions.
         | 
         | In particular, he's explaining that quaternions are not
         | vectors, they're actually oriented planes and showing how their
         | multiplication rules arise in a way that's not 'out of thin
         | air'.
        
         | nmca wrote:
         | Did you read the article? Irrc you can lerp rotors and the
         | results are smooth and interpretable...
        
         | moultano wrote:
         | You should read the article before commenting.
        
       | moron4hire wrote:
       | You don't need to understand the root construction of Quaternions
       | to use them in game code anymore than you need to understand the
       | root construction of the Reals to be able to do arithmetic in
       | game code. Just treat them as opaque values that have certain
       | operations you can perform to get certain results and be done
       | with it.
        
         | nine_k wrote:
         | Not knowing what's behind the hood in floating point numbers
         | and their limited precision leads to all kinds of surprises.
        
           | moron4hire wrote:
           | Rarely
        
             | gvjddbnvdrbv wrote:
             | Often. Often missed though.
        
               | moron4hire wrote:
               | Almost every component of a game is built on the premise
               | of leaky abstractions that go unnoticed. Texture
               | compression, lighting techniques, physics, audio filters,
               | network latency filters.
        
               | Fredej wrote:
               | There are other uses of 3D than games. 3D Engine != Game
               | engine.
        
             | friendlybus wrote:
             | Try building a space game at real-world scale on 32 bit
             | floats. Star Citizen tore apart Cryengine to make it have
             | 64 bit positioning for this very reason.
        
               | kaibee wrote:
               | Kerbal Space Program manages it.
               | 
               | (by moving the world around the origin)
        
               | friendlybus wrote:
               | Yeah in singleplayer with lower fidelity that is
               | passable.
        
         | rikroots wrote:
         | I added quaternions to my Javascript canvas library. They
         | scared the heck out of me - I coded up the functions from
         | scratch in JS, partly to try and 'understand' the concepts
         | behind quaternions, but mainly because I was stupid and over-
         | confident. I am not a math/physics genius!
         | 
         | I doubt using the concept of rotors in place of quaternions
         | would've made my experience any better. It's not the concepts
         | that really frighten me - I can read about them and nod my
         | head, pretending that the information is somehow sinking into
         | my brain; the things that scared me were the equations which,
         | the article implies, are pretty much the same.
         | 
         | In the end, the things (seem to) work as intended in my
         | library, and I can now sleep at night knowing I'll never have
         | to revisit quaternions (or rotors) again in my life.
        
         | Koshkin wrote:
         | That's not how it works in programming in general. Many - if
         | not most - abstractions turn out to be extremely leaky. (For
         | example, you _do_ want to know the difference between the
         | "root construction of Reals" as it is done in mathematics and
         | what is taken to be their representation in the computer.)
        
         | xg15 wrote:
         | The author is arguing against this exact mentality - and I
         | believe, this was one of the main motivations this article was
         | written:
         | 
         | > _Personally, I have always found it important to actually
         | understand the things I am using. I remember learning about
         | Cross Products and Quaternions and being confused about why
         | they worked this way, but nobody talked about it. Later on I
         | learned about Geometric Algebra and suddenly I could see that
         | the questions I had were legitimate, and everything became so
         | much clearer._
         | 
         | I tend to agree with the author. I find it a lot harder to work
         | with concepts I don't understand: I'm forced to "fly blind" and
         | just plug in formulas and hope everything works. At the latest
         | when you have to debug something, this can go horribly wrong
         | and leave you without a lot of options.
        
           | moron4hire wrote:
           | So you know exactly how everything in your computer works,
           | because otherwise it'd be too hard to use? I wager the exact
           | opposite is the case: it's much easier to use a computer
           | through heuristics of operation rather than any sense of
           | "deep" understanding.
           | 
           | Besides, your GPU shader code implements fast quaternions,
           | and you aren't going to get NVidia to replace them with
           | rotors. So the game is lost.
           | 
           | Oh, unless you don't mean "understand _everything_ " and are
           | going to draw your arbitrary line at the GPU.
        
             | baq wrote:
             | the math is the same so technically nvidia gpus already
             | implement rotors.
        
             | krajzeg wrote:
             | Shader languages do not include quaternions as primitives,
             | so if you do have quaternions in your GPU shaders, it's
             | your own code (or a library), not NVidia's. What is usually
             | done in shaders is encoding all transformations (rotation,
             | scale, translation) in 4x4 matrices, which are a primitive
             | in all shader languages I know of.
             | 
             | From my personal experience, it can pay off immensely to
             | understand the internal structure of the representation
             | you're working with. I can look at a 4x4 matrix and
             | immediately identify some stuff (does it include a
             | translation component? does it scale and is this scale
             | uniform? is it rotated and around which axis?).
             | 
             | Meanwhile, I can't do this with a quaternion. I know what
             | they do and can understand how, but I have no intuition for
             | what the four numbers mean.
        
             | gugagore wrote:
             | They didn't say "understand everything", but that's the
             | interpretation you're replying to, and it gives me some
             | thoughts.
             | 
             | Different people will be okay with different levels of
             | understanding. You put "deep" in quotes. You should also
             | put "heuristic" and "easier", and many more, because all of
             | these terms are up for analysis now.
             | 
             | A very heuristic operation of technology is "power
             | cycling"--"have you tried turning it off and on". Another
             | version is "factory resetting". This is very useful, but
             | without a slightly deeper understanding of what is _does_ ,
             | or how computers _work_ , it's easy to waste time doing it.
             | Like if I get a cloudflare message saying some website is
             | unavailable, I'm not going to log out and back in. I'm not
             | going to turn my computer off. I'm not going to do
             | anything. But that requires a slightly deep understanding.
             | 
             | I wouldn't try to argue what's easier and what's harder for
             | people so generally. There are lots of different kinds of
             | people. That's why both the quote and the grandparent are
             | explaining their personal motivations and describing
             | themselves. I mean, you kind of acknowledge this after the
             | fact when you talk about "arbitrary lines", but it still
             | sounds like you're dissing someone's "arbitrary"
             | personality. I mean, yeah, even if it were arbitrary drawn
             | at GPU---that's the sense in which we are individual
             | people...
        
         | bvda wrote:
         | > Personally, I have always found it important to actually
         | understand the things I am using. This article is aimed at
         | readers who do find understanding the constructions they use
         | important.
        
           | moron4hire wrote:
           | That is the point of my comparison to the Reals. No
           | accountant or mechanical engineer or architect need ever
           | read, let alone understand, any proofs that the Reals exist
           | or the fundamental construction of arithmetic. I know several
           | highly successful economists who don't know the
           | _construction_ of statistics, anymore than knowing that the
           | proofs exist and could be found somewhere, if it ever really
           | mattered (it doesn 't). As a developer, you are not a
           | theoretical mathematician. You _use_ math.
           | 
           | Game development is not fundamentally more hard than any
           | other field of applied engineering or mathematics. It isn't
           | theoretical mathematics. You just use the math.
           | 
           | Needing to "understand" root construction before "being able
           | to use" is just procrastination.
        
             | gugagore wrote:
             | > Needing to "understand" root construction before "being
             | able to use" is just procrastination.
             | 
             | since I feel personally attacked by that statement (I say
             | in jest), it's more charitably viewed as a risky
             | investment. Understanding now might help you use it more
             | efficiently later.
             | 
             | 3D Rotations are traditionally very tricky to represent in
             | a computer! It's only in "modern" times that basically
             | everyone has settled down on quaternions as the best
             | parameterization. I think the comparison to anything about
             | real numbers misses the point. It's not about rotors
             | themselves, or real numbers themselves, it's about how they
             | model something we care about. Money isn't a real number,
             | but we model a balance in an account using one. And an
             | accountant definitely needs to understand operations such
             | as "debiting", "crediting", "accruing interest". So they
             | need to understand addition, negative numbers _, and
             | multiplication. But that 's just because of the choice of
             | the model.
             | 
             | _funny enough, it seems like lots of accounting existed a
             | while before negative numbers were obvious, so there are
             | all sorts of to-me funny ways of representing negative
             | numbers, or subtraction (I don't have any clear evidence to
             | back this up). Everyone was doing accounting just fine
             | before, but really it just feels more obviously elegant to
             | use a negative number to represent a deficit.
        
             | BlueTemplar wrote:
             | Why then engineers _do_ get taught that?
             | 
             | Also :
             | 
             | You "can" be a "good" engineer while thinking the Earth is
             | flat. (Unless you're working on space-related projects of
             | course.)
             | 
             | You "can" be a "good" scientist without knowing anything
             | about epistemology, Popper, Kuhn...
             | 
             | (But can you, really, be a good one ?)
             | 
             | (Also IMHO most of today's economists are just charlatans
             | akin to the astrologers of old, misusing math because math
             | gets your more respect, and it's probably related...)
        
             | friendlybus wrote:
             | That's fine if you're building something that's already
             | been made. Games don't do that, when you push the
             | boundaries you need to know how your math works. You won't
             | get more performance than the competition without
             | understanding the tools you are using.
        
               | moron4hire wrote:
               | And here we see the other common conceit in the game
               | industry, that graphics make a game.
        
               | friendlybus wrote:
               | I didn't say that? There's more ways to push a game than
               | with graphics? That's not the words in my mouth.
               | 
               | Star citizen needed 64 bit positioning for real world
               | planet scales in game, that had to be hacked into
               | cryengine...
        
               | moron4hire wrote:
               | It didn't _need_ it. That was just the solution the devs
               | created. They could have done it with 32-bit floats, or
               | hell, 32-bit integers, if they wanted, given the right
               | representation. But _they_ chose 64-bit floats to solve
               | the problem, the problem did not choose 64-bit floats.
        
       | ArtWomb wrote:
       | When I was learning graphics, the reasoning around quaternions
       | was to avoid "gimbal lock". It was just taken as orthodoxy
       | without question.
       | 
       | I think going forward next gen 3D engines will have to account
       | for the improvements in GPU hardware realized by advances in
       | machine learning. Mixed precision matrix multiply at massively
       | parallel scale. As well as the demands of next-gen games. Things
       | like real time ray tracing of deformable meshes ;)
        
         | phlakaton wrote:
         | Same critique as I have for the article, though: just because
         | the subject is poorly taught doesn't necessarily mean that the
         | subject needs to be replaced. The key here is that gimbal lock
         | isn't a feature of quaternions, it's a feature of Euler angles:
         | https://math.stackexchange.com/questions/8980/euler-angles-a...
        
         | alejohausner wrote:
         | Quaternions can be normalized, thus eliminating numerical
         | errors than can accumulate if you multiply a rotation matrix
         | many times. These numerical errors make the matrix non-unitary,
         | and introduce weird stretches and skews into the
         | transformation.
        
       | iorrus wrote:
       | The reason many people have trouble understanding quaternions is
       | that they reason about them incorrectly.
       | 
       | Quaternions are actually a separate 'thing' when compared to
       | vectors (which is why their multiplication seems off and the
       | square is a negative number).
       | 
       | Quaternions should be considered a versor (a rotation around
       | great circles), that is a change in direction which is different
       | from a vector.
       | 
       | See this work: https://archive.org/details/cu31924001506769/
        
       | adam-a wrote:
       | This is a very cool article which has left me wanting more. It
       | seems to stop just short of the end though, there is no section
       | to actually explain the component values in a rotor, or an
       | interactive diagram deconstructing the component parts of a
       | rotor. Or did I miss it?
       | 
       | I'd also be really interested to see some more applications. I
       | wonder what rotor interpolation looks like for example? I know
       | I've had problems with quaternion interpolation in the past.
        
       | GlenTheMachine wrote:
       | A point that I don't think has been mentioned here: quaternions
       | _as a representation of attitude_ are really just a funky
       | parameterization of an Euler axis /angle representation.
       | Quaternions happen to be parameterized in a way that lets you
       | avoid the evaluation of trigonometric functions when expressing
       | their dynamics. This used to be important, e.g. in aircraft
       | control systems, because computing power was extremely limited
       | and you didn't want to have to evaluate sines and cosines in real
       | time.
       | 
       | The biggest disadvantage of using quaternions over Euler
       | axis/angle representations is that quaternions are basically
       | impossible for humans to visualize, whereas Euler axis/angle
       | representations are easier than transformation matrices, Euler
       | angles, or any other representation.
       | 
       | So why not just use Euler axis/angle representations instead?
       | Nobody cares any more about evaluating cosines at 1 kilohertz,
       | and there would be none of this complicated geometric algebra
       | stuff that nobody understands.
        
         | rationalfaith wrote:
         | Dude Le-performance is always important. Helper functions can
         | be added for readability but perf perf perf perf.
        
         | cygx wrote:
         | _So why not just use Euler axis /angle representations
         | instead?_
         | 
         | Composition of two rotations in axis/angle representation
         | basically proceeds via the quaternionic formula, ie in terms of
         | half-angles. So if you need to do that a lot, it makes sense to
         | go fully quaternionic to avoid having to work with both full
         | and half angles.
        
       | overgard wrote:
       | Worth noting that the author is the guy behind this extremely
       | interesting project to create a 4D puzzle game:
       | https://miegakure.com/
       | 
       | He's given a lot of talks on subjects like this. I imagine that
       | what he's doing mathematically is a lot more intricate than most
       | games need though.
        
       | DonHopkins wrote:
       | From the title, I was expecting to read an article by a crazy old
       | retro mathematician shaking his fist and yelling at clouds that
       | we should all go back to using Euler angles. But this was a much
       | better article than the title suggested!
        
       | danmg wrote:
       | Those who don't understand quaternions are condemned to reinvent
       | it, poorly.
       | 
       | I work in a research field that uses rotations heavily, and
       | trying to use things like Euler angles (with 4 or 5 competing
       | representations) and axis angles has created nothing but
       | confusion among people. If people used quaternions from day one,
       | it probably would have saved, cumulatively, the time of several
       | dozen phds.
        
         | jessaustin wrote:
         | What research field is this? Why hasn't one of the researchers
         | made the conceptual leap you propose?
        
           | danmg wrote:
           | It has to do with metallurgy. Some people do use them, but
           | most work is done with euler angles.
        
         | 6gvONxR4sf7o wrote:
         | I think you misunderstand the article. It's not saying to
         | replace them with euler angles or axis angles or anything
         | analogous. GA is among other things a more intuitive mental
         | model of quaternions.
        
       | thrower123 wrote:
       | Nice thought, perhaps, but I doubt anything would come of it.
       | Quaternions came into vogue because the problems of Euler angles
       | were very apparent in practice, but we still think, at best, in
       | yaw/pitch/roll, and for a lot of people, roll is a little on the
       | sketchy side.
       | 
       | Now we have twenty, twenty-five years of code and resources that
       | make use of quaternions. In some ways, game development is
       | incredibly hide-bound and conservative, and for the most part
       | eschews rigid correctness for performance, convenience, and a
       | loosey-goosey good 'nuff feel.
        
         | edflsafoiewq wrote:
         | He's not actually proposing any change. He just gives a
         | different construction of the usual quaternions.
        
       | playing_colours wrote:
       | What is a good book you can advise for someone with maths
       | background to dig into GA?
        
       ___________________________________________________________________
       (page generated 2020-01-31 23:00 UTC)