[HN Gopher] Quaternions: A Practical Guide
       ___________________________________________________________________
        
       Quaternions: A Practical Guide
        
       Author : the__alchemist
       Score  : 87 points
       Date   : 2022-08-14 06:14 UTC (1 days ago)
        
 (HTM) web link (www.anyleaf.org)
 (TXT) w3m dump (www.anyleaf.org)
        
       | dang wrote:
       | I'm sure this is a fine article, but an article is not a valid
       | Show HN. Please see the rules:
       | https://news.ycombinator.com/showhn.html.
       | 
       | We've taken "Show HN" out of the title now.
        
       | kilovoltaire wrote:
       | Geometric Algebra provides a compelling alternative to
       | quaternions: https://marctenbosch.com/quaternions/
       | 
       | (HN discussion 8 months ago
       | https://news.ycombinator.com/item?id=29512302 )
        
       | ogogmad wrote:
       | Haven't dual quaternions taken over for their ability to
       | represent all rigid body motions?
       | 
       | Quaternions are still important for building intuition for dual
       | quaternions.
        
         | ajkjk wrote:
         | I don't think so? Most game engines for instance implement
         | quaternions for ie slerp, but wouldn't mention dual
         | quaternions, which are much more niche (used for translation +
         | rotation at the same time).
        
         | percentcer wrote:
         | As you pointed out, you still need regular ol' quaternions if
         | you're dealing with non-rigid transforms (e.g. in animation
         | where there's some scaling transform involved as well)
        
           | bodhiandpysics1 wrote:
           | which is very very very common (squatch and stretch)
        
         | bodhiandpysics1 wrote:
         | In graphics, dual quaternions are used in skinning, but rarely
         | for orientation and translation.
        
         | meheleventyone wrote:
         | Mostly in jointed hierarchies like robotics and skeletal
         | animation in my experience. Otherwise quaternions dominate for
         | representing rotation and translation and scale are kept
         | separately. Even further in an editor you might represent the
         | rotation as Euler angles.
        
         | mrjet wrote:
         | I can only answer for robotics:
         | 
         | Dual quaternions haven't really taken over. While there's no
         | universal way that people end up handling rigid body
         | transforms, SO(3) + R3 for rigid body transforms are the norm
         | in robotics.
         | 
         | Some robotics orgs choose a single representation for SO(3) --
         | usually quaternions or matrices -- and use it everywhere. Note
         | that quaternions are more space efficient and easier to
         | normalize, but require 2x more operations to rotate a vector
         | [1]. So you might see a quaternion shop use matrices in a hot
         | loop for transforming 3D points. And a matrix shop might use
         | quaternions in a hot loop for composing many transformations.
         | Usually you have many fewer rigid body links than points in an
         | e.g. pointcloud so it is performance favorable to use matrices.
         | 
         | A final comment: Most users in a codebase should interact with
         | rotations through a rotation library like Sophus or Manif. That
         | library should implement left/right lerp, splines, "rotate a
         | vector" and "compose a transformation". There is basically
         | never a need for a developer to know what rotation
         | representation is being used to compute the rotation.
         | 
         | If such a library is correctly implemented, you can even use
         | Euler Angles as the underlying representation and never
         | experience gimbal lock.
         | 
         | [1]
         | https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotati...
        
       | bob1029 wrote:
       | In the realm of (real-time) computer graphics, I have recently
       | developed a perspective that Quaternion representation is simply
       | another "space" that you have to spend finite resources
       | transforming to and from. I am not aware of a rasterizer that can
       | operate directly with quaternions, nor a way to apply perspective
       | or orthographic projections to them.
       | 
       | For all of my personal applications, I have found that good old
       | fashioned 4x4 homogeneous matrices are a really good way to deal
       | with all of the transforms I am concerned with. I do recognize
       | the utility of quaternions in dealing with certain specialized
       | transforms, but these are not applicable in my simple DIY/hobby
       | use cases (i.e. Q3A-tier graphics).
       | 
       | From a math perspective, I think quaternions are fantastic and
       | far more elegant way to do certain things. I did recently
       | discover Microsoft has all of this neatly wrapped up in
       | System.Numerics, a SIMD-accelerated library for .NET:
       | https://docs.microsoft.com/en-us/dotnet/api/system.numerics....
        
       | the__alchemist wrote:
       | I wrote this article over the past few weeks, while building a
       | structural chemistry model. I found most sources available either
       | dive into quaternion mathematics and reasoning without building
       | intuition useful in applications, or are documentation for
       | specific computer graphics libraries. I'm using this article as a
       | personal reference; perhaps others will find it useful too.
        
       | sxp wrote:
       | Whenever quaternions come up, I always recommend
       | https://acko.net/blog/how-to-fold-a-julia-fractal/ and
       | https://acko.net/tag/quaternions/
       | 
       | I never fully grokked complex numbers nor quaternions until I
       | read those articles
        
       | ajross wrote:
       | Quaternions are one of those subjects where the community sees a
       | steady stream of tutorial content, which really doesn't seem to
       | be adding much to the discourse to my eyes. It's like a "yet
       | another git tutorial" kind of thing.
       | 
       | In fact Ken Shoemake, who was responsible for originally
       | popularizing quaternions as a robust rotation/orientation
       | representation[1], _wrote his own tutorial_ of this stuff back in
       | the late 80 's sometime, and it's really, really great:
       | https://www.ljll.math.upmc.fr/~frey/papers/scientific%20visu...
       | 
       | Folks should start with that one before trying to rewrite it,
       | IMHO.
       | 
       | [1] Here's a copy of the 1985 paper:
       | https://www.cs.cmu.edu/~kiranb/animation/p245-shoemake.pdf
        
         | jacobolus wrote:
         | People should start with
         | http://geocalc.clas.asu.edu/pdf/OerstedMedalLecture.pdf
        
         | derjames wrote:
         | Ken Shoemake also has an article in Graphics Gems IV. Section
         | III.1 page 175. Theory and Sample program included. This is the
         | only thing I needed to read to understand quaternions.
        
         | keepquestioning wrote:
         | Add to the list
         | 
         | - Hidden Markov Models
         | 
         | - Kalman filters
         | 
         | Things which have tutorials that continually fail to explain
         | the tao of the thing.
        
           | pklausler wrote:
           | Don't forget monad tutorials!
        
       | ngvrnd wrote:
       | Want to read "Sedenions: a Practical Guide" ("Trigintaduonions",
       | anyone?)
        
         | ajkjk wrote:
         | They're not practical, no point! As this article alludes to,
         | `bivectors` are the useful abstraction of rotation to higher
         | dimensions, not octonions/sedenions.
        
           | ngvrnd wrote:
           | Yes, that was the joke.
        
             | ajkjk wrote:
             | oh cool
             | 
             | ...you never know with this stuff
        
       ___________________________________________________________________
       (page generated 2022-08-15 23:01 UTC)