3 ms·
My (poor) understanding of quaternions is they are like a vector with a rotation angle around the axis of the vector. This is probably incorrect on many levels.
by eestrada 3y ago
My (poor) understanding of quaternions is they are like a vector with a rotation angle around the axis of the vector. This is probably incorrect on many levels. But it was a simple enough explanation that it made sense to my brain why this would work better than simple SRT transform parameters for avoiding gimbal lock. It's been several years since I needed to deal with 3D transformations of any sort, so I'm a bit rusty on all this.
- xeonmc 3y agoUltimately, the “canonical” representation of rotation state is still axis-angles, thanks to Euler’s rotation theorem (any combo of rotation results in just one rotation around some final axis) (normalized) Quaternions are just the intermediate representation of axis-angles, they describe the component-wise algebra of combining axis-angle rotations [Euler-Rodrigues formula](https://en.wikipedia.org/wiki/Euler–Rodrigues_formula https://en.wikipedia.org/wiki/Euler–Rodrigues_formula) Game engines just leaves them as quaternions for performance reasons. A 2D analogy would be “angle” <-> [quaternion] “45deg” <-> [sqrt2 , sqrt2] The [ Re , Im ] form is convenient for manipulating by coordinates, but the “final” succinct representation is still “angle”, because the component-wise form has more degrees of freedom than necessary. Summary: Quaternion = sqrt( exp(axis_angle) ) = exp(axis_angle/2) = cos(angle/2) + axis*sin(angle/2) And (lw,lx,ly,lz)*(rw,rx,ry,rz) = (w,x,y,z) where w = ww-xx-yy-zz x = wx+xw+yz-zy y = wy+yw+zx-xz z = wz+zw+xy-yx where ww,wx,wy,wz = lw*rw,lw*rx,lw*ry,lw*rz xw,xx,xy,xz = lx*rw,lx*rx,lx*ry,lx*rz yw,yx,yy,yz = ly*rw,ly*rx,ly*ry,ly*rz zw,zx,zy,zz = lz*rw,lz*rx,lz*ry,lz*rz