14 ms·
Quaternions
- po1nt 5y agoI've seen dozen of tutorials trying to explain quaternions in multiple analogies and methods. But finally after this tutorial I can finally conclude that I'm dumb.
- h2odragon 5y agoVery nice thats a reference to keep and come back to thanks.
- akeck 5y agoI've been teaching myself geometric algebra which is apparently isomorphic to quaternion algebra. Some people prefer GA for 3D modeling work.
- W0lf 5y agoComputing in higher dimensions is nice, although pretty difficult to implement efficiently. Hence, Quaternions are mostly used nowadays, I think.
- Chabsff 5y agoI've been out of the games sphere for a long time, but is slerp() really the default idiomatic interpolation approach in modern games nowadays? There are a vanishingly small number of scenarios where lerp() + normalize() doesn't work perfectly well enough and it is drastically faster and SIMD-friendly. That used to be the case at least.
- an1sotropy 5y agoas for why lerp+normalize isn't enough: it all depends on the distance between things being blended, no? With far away end points, the apparent speed of the rotation would be fast, slow, fast, at the beginning, middle, end, which could be a bummer.
- Chabsff 5y agoThe two aspects that slerp() addresses over lerp() + normalize() are 1) it can deal with pole-to-pole interpolation 2) It always takes the shortest path. In practice, the former is often provably never going to happen, and the later doesn't actually matter from a qualitative standpoint: Quaternion interpolation will always look a bit weird over large angles, especially if there's a roll component to one of the orientations. As far as having a constant interpolation speed: again, this is rarely perceptible, and truly linear transitions from one orientation to another looks janky so some amount of filtering happens anyways (an ease-in-ease-out for example). But yeah, for very large interpolations, it can create a slight authoring/runtime skew. My rule of thumb used to be: use slerp() when the orientations can be at least 120 degrees apart, or when lerp() yields weird results. However, it's really rare to be interpolating over such a large orientation change, you almost always have a few keyframes or dead-reckoning syncs in between. Again: This might be an outdated perspective though.
- gugagore 5y agoYou can see what's wrong with that approach by considering the difference between traveling at constant speed along the arc of a circle versus traveling at constant speed along a chord, and projecting the point (out from the center) onto the arc. It works great if the chord is far away from the center (and also the angle is less than a half turn). If the chord goes through the center, it doesn't work at all.
- Chabsff 5y ago10-12 years ago, the consensus used to be that this singularity simply does not show up in the wild in the vast majority of scenarios, and the performance hit of using `slerp()` is just not worth it unless truly needed. It was essentially the same reasoning as for using `-ffast-math`. Yeah it's not "correct", but users can't tell the difference and it has a measurable performance benefit. To be clear, I'm not questioning using slerp() at all, it definitely has a role to play. I'm just wondering about using it by default as implied by the post.
- gugagore 5y agoYeah, I understand. I just wanted to show that one can understand the exact nature of the approximation in 2D geometry. I think it's useful to think of it as a separate category of "wrong" than -ffast-math, which is "wrong" because two expressions that are mathematically equivalent over real numbers, like a + (b + c) and (a + b) + c, are not equivalent over floating-point numbers. Using lerp in place of slerp is like using x in place of sin(x). (The small-angle approximation) They're not equivalent over the real numbers.
- Chabsff 5y agoMy apologies. I thought you were providing an explanation as to why slerp() is preferred in general. The circle example is a really good way to frame the distinction.
- dahart 5y agoI don’t think the scenarios where uniform steps of angle is vanishingly small. There are plenty of cases where it matters to animators, on character rigs, on cameras The amount that it matters depends on the angle between keys. Suggesting it rarely matters means you’re claiming nobody ever animates large angles, which I can confidently say I’ve seen plenty of counter-examples in game development. I also wouldn’t be so sure that lerp+normalize is that much faster on today’s GPUs. Normalize takes a sqrt and reciprocal or divide, while slerp takes a few sin evaluations and a recip or divide. These special functions these days execute in a separate pipeline from linear (FMA) type instructions, and can be had for “free” as long as you can mix enough independent linear math in between the special functions. It used to be that sin() was very slow, but these days you can often mix a couple calls in without affecting your perf at all.
- Jun8 5y ago3B1B is also informative, especially in explaining why C was not extended using triplets but 4-tuples were needed: https://youtu.be/d4EgbgTm0Bg https://youtu.be/d4EgbgTm0Bg. Here’s a Math SE answer on why: https://math.stackexchange.com/questions/1784166/why-are-there-no-triernions-3-dimensional-analogue-of-complex-numbers-quate/1784171 https://math.stackexchange.com/questions/1784166/why-are-the..., here’s a more ELI5 discussion: https://www.reddit.com/r/math/comments/9urjyx/why_there_is_no_complex_numbers_in_3_dimension/ https://www.reddit.com/r/math/comments/9urjyx/why_there_is_n.... I especially like this very intuitive comment in that thread : https://www.reddit.com/r/math/comments/9urjyx/comment/e96j4lg/ https://www.reddit.com/r/math/comments/9urjyx/comment/e96j4l... Left as an exercise to reader: prove that no such n-tuples exist for n>4.
- deleted 5y ago[deleted]
- pdonis 5y ago> prove that no such n-tuples exist for n>4. It depends on how you define "such" n-tuples. The octonions (n = 8) aren't associative, but they have all the other relevant properties.
- Jun8 5y agoYou’re absolutely right, forgot to mention associativity: https://en.m.wikipedia.org/wiki/Frobenius_theorem_(real_division_algebras) https://en.m.wikipedia.org/wiki/Frobenius_theorem_(real_divi...
- MayeulC 5y agoThis comment is about ℂ the set of complex numbers, not the progamming language. It left me confused for a moment.
- ivanstojic 5y agoInteresting thing to remember: quaternions are a special application of rotors, a concept which may be easier to understand as a base: https://marctenbosch.com/quaternions/ https://marctenbosch.com/quaternions/
- marcodiego 5y agotldr: Simply explained without demonstrations: Quaternions are hypercomplex numbers of the form w + xi + yj + zk Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j. Being u = (x, y, z) = xi + yj + zk a unitary vector, it is possible rotate any vector q by an angle theta around u by doing: pqp' where p = cos(theta/2) + sin(theta/2)u and p' = cos(theta/2) - sin(theta/2)u .
- coldacid 5y agoI don't believe that most people will consider that "simply explained".
- marcodiego 5y agoMaybe succinctly?
- coldacid 5y agoYes, it is certainly succinct. But only simple and explained for math majors. :D
- deleted 5y ago[deleted]
- handrous 5y ago> Quaternions are hypercomplex numbers of the form I'm gonna guess "hypercomplex" means "involves imaginary numbers" due to the rest of this. > Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j. Why even use different letters for i, j, and k, if they're all the same thing? Which thing appears to be i, as in, the square root of -1, that is to say, the most well-known and basic imaginary number, if I'm reading this right. As for the second part, I can't even begin to unravel the significance. I know it must not be, but it just seems like arbitrary rules added for... some unknown reason. > Being u = (x, y, z) = xi + yj + zk a unitary vector, it is possible rotate any vector q by an angle theta around u by doing: > pqp' > where p = cos(theta/2) + sin(theta/2)u and p' = cos(theta/2) - sin(theta/2)u . Oooooh kay... 1) Where'd w go? Is this one of those things where there's a (situationally-defined) constant in the formula but we just pretend it doesn't exist most of the time (until it comes time to actually use the math to, like, do anything real)? Would we need to bring it back in to apply the rest of this? 2) "u =" is just defining something, fine, but (x, y, z) doesn't seem to equal the thing after it at all—I suppose this is a shorthand function notation, though it seems really weird to me to use equality to relate that. Am I right, or is this something else?, 3) A quaternion is... a point, then? Since we're rotating around it? 4) I've got a feeling that theta needs a direction in this hypercomplex space but don't see where it's coming from. Somewhere "off screen", in this explanation? Or is it there but I'm not seeing it?
- pixelpoet 5y agoSmallest of small notes: in TeX, "cos" is rendered as a product of 3 italicised variables c, o and s, whereas the escaped literal "\cos" is rendered as the cosine function.
- the_origami_fox 5y agoAuthor here: thanks for the tip. Definitely think this looks better
- pixelpoet 5y agoGreat, it certainly does look better :) Note that this also applies to log, exp and other functions. Also, some images seem to be missing in part 2. Anyway it's a great writeup, even though I know the material it was a good read.
- jodrellblank 5y ago> although a lecturer once eluded to them during a class in my masters Would be more amusing if "they eluded a lecturer" or "a lecturer once elided them". ("alluded to them").
- anentropic 5y agoalso: gimbol -> gimbal
- naikrovek 5y agoyeah that one drove me nuts for some reason.
- the_origami_fox 5y agoAuthor here: these typos totally eluded me. Will fix them.
- naikrovek 5y agotpyos elide us all
- w0mbat 5y agoI came here to report the same two typos. Thanks.
- an1sotropy 5y agoDavid Eberly has written a huge amount of great and free intro mathematical papers. The "Mathematics/Algebra" section of [1] has a few things on quaternions, including a nice self-contained linear algebra-based derivation of why it makes sense to represent a rotation with four numbers, which ends up being a sneaky introduction to quaternions [2] [1] https://www.geometrictools.com/Documentation/Documentation.html https://www.geometrictools.com/Documentation/Documentation.h... [2] https://www.geometrictools.com/Documentation/LinearAlgebraicQuaternions.pdf https://www.geometrictools.com/Documentation/LinearAlgebraic...
- jcun4128 5y agoNice I will learn these for IMU stuff, I'm still a noob currently.
- steve_adams_86 5y agoI remember the first time I encountered quaternions, and it was in a similar context. I was using PiQT 3d to move models in a simulation. At first it really bothered me that quaternions were a black box to me, yet so easy to use in so many contexts. What kind of magic was happening? I had to know. My math is terrible. I spent actual days revisiting YouTube videos explaining quaternions but my limited brain cells were failing to properly grasp it. I had to know though, I’d go crazy writing so much code that depends on something I couldn’t understand. It took a long time. This would have been very helpful. Quaternions are very cool, and well worth reading about if you do anything in the digital 3d world. I think I can still hear my brain sizzling as I tried to absorb this stuff.
- dilawar 5y agoTry reading it up again. My experience is that with age theory gets easier.
- analog31 5y agoAsk HN: Do quaternions have any interesting properties, akin to those of complex numbers, when calculus is applied? The only application I've ever seen is for doing rotations in computer graphics.
- Chabsff 5y agoStill mostly relevant to their use as encoding for transformations, but the fact that a unit quaternion's conjugate is also its inverse is extremely useful from a computational performance point of view.
- AnimalMuppet 5y agoIf I understand correctly, yes, calculus on quaternions is a useful thing. I'm not sure whether or not you have an equivalent of the residue theorem from the calculus of complex variables, but I'm pretty sure that you can do path integrals and stuff...
- mathgenius 5y agoJohn Baez was tweeting about this recently: https://twitter.com/johncarlosbaez/status/1467204133262446599 https://twitter.com/johncarlosbaez/status/146720413326244659...
- fault1 5y agoper wikipedia (hence the interest in twistors, spin spaces and clifford algebras in physics): Quaternions also capture the spinorial character of rotations in three dimensions. For a three-dimensional object connected to its (fixed) surroundings by slack strings or bands, the strings or bands can be untangled after two complete turns about some fixed axis from an initial untangled state. Algebraically, the quaternion describing such a rotation changes from a scalar +1 (initially), through (scalar + pseudovector) values to scalar −1 (at one full turn), through (scalar + pseudovector) values back to scalar +1 (at two full turns). This cycle repeats every 2 turns. After 2n turns (integer n > 0), without any intermediate untangling attempts, the strings/bands can be partially untangled back to the 2(n − 1) turns state with each application of the same procedure used in untangling from 2 turns to 0 turns. Applying the same procedure n times will take a 2n-tangled object back to the untangled or 0 turn state. The untangling process also removes any rotation-generated twisting about the strings/bands themselves. Simple 3D mechanical models can be used to demonstrate these facts.
- smcameron 5y agoThis page is a little more information dense, but it's what I learned quaternions from (after bashing my head against it for a couple of weeks) and it's good as a refresher because it is so dense. http://www.tutis.ca/Rotate/7quaternions.htm http://www.tutis.ca/Rotate/7quaternions.htm One thing I didn't see in the OP's linked article is how to transform a quaternion into a different coordinate system defined by another quaternion. For example, suppose you have a spaceship in a game at an arbitrary orientation defined by Q1 which is a rotation away from a conventional "unrotated" orientation, and you want to input say 5 degrees of yaw to the right. Well, you just construct a quaternion Q2 that is 5 degrees yaw to the right from this conventional unrotated orientation, and you can use quaternion conjugation to transform Q2 into the orientation of Q1 where it can then be applied to the spaceship's orientation. OP's link mentioned quaternion conjugation, but didn't really mention what it was good for. It is described in section IV of the 7quaternions link.
- trylfthsk 5y agoW.R Hamilton's discovery of the Quaternions is semi-famous itself, with the story being that after the critical flash of insight he carved the equation describing quaternion multiplication into a bridge in Ireland with a penknife. A interesting read is this letter [0] written the following day, where he explains his ideas in his own words. It's a great (and accessible!) look into his thought process. [0] https://www.maths.tcd.ie/pub/HistMath/People/Hamilton/QLetter/QLetter.pdf https://www.maths.tcd.ie/pub/HistMath/People/Hamilton/QLette...
- ww520 5y agoThe story goes that he was with his wife going to a dinner. On the way he got the flash of insight after years of working on the problem but he had no paper to write it down. When passing a bridge, he carved the equation on the side of the bridge to remind himself on the way back after the dinner.
- newpavlov 5y agoIn my opinion, Geometric Algebra and bivectors (https://bivector.net https://bivector.net) in particular is a much better (both practically and pedagogically) approach compared to quaternions and significantly more elegant. It's a real shame that people continue to focus so much on quaternions in this day and age.
- kilovoltaire 5y agoCame here to say this! I always felt like quaternions weren't a perfect fit for 3d rotation, and when I finally learned about bivectors my faith in the elegance of mathematics was restored :D I liked this article: https://marctenbosch.com/quaternions/ https://marctenbosch.com/quaternions/
- the__alchemist 5y ago> Why does i2=j2=k2=−1 and ij=k? Why do we take a vector and upgrade it to an "imaginary" vector in order to transform it, like q(xi+yj+zk)q∗? Who cares as long as it rotates vectors the right way, right? Yikes! This is the sort of thing that scares people away from complex numbers from a young age.
- deleted 5y ago[deleted]
- Twisol 5y agoAren't you doing a bit of an injustice to that article by cherry-picking that line? It's obviously written humorously; the very next words are: > 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. Clearly, "who cares as long as" is not the true belief of the author, but rather a mocking call-out of teachers who do think that way.
- wyager 5y ago
- deleted 5y ago[deleted]
- darkstarsys 5y agoThis is fine; there are lots of similar "intro to quaternions" pages around. One thing I haven't seen yet is someone showing how to interpolate between multiple quaternions over time, smoothly. (Hint: it's not slerp.) It's a non-trivial problem.
- JadeNB 5y ago> Hint: it's not slerp. What is slerp?
- chas 5y agoSpherical linear interpolation. (https://en.m.wikipedia.org/wiki/Slerp https://en.m.wikipedia.org/wiki/Slerp)
- chombier 5y agoSee "A General Construction Scheme for Unit Quaternion Curves with Simple High Order Derivatives" (Kim, 1995) for a simple extension of Hermite splines to Lie groups, including unit quaternions.
- dhosek 5y agoI first encountered quaternions in the concept of abstract algebra. It's interesting to think of it as part of a spectrum starting with reals and continuing to octonions (and beyond). Interestingly with each extension we lose something: Complex numbers (2-dimensional): No more ordering Quaternions (4-dimensional): No more commutative multiplication Octonions (8-dimensional): No more associative multiplication Sedenions (16-dimensional): We lose the alternative property, i.e., with octonions its still true that x(xy) = (xx)y but with sedenions it is not. We can continue this process indefinitely, although I know nothing of the characteristics of trigintaduonions or what comes later. I suspect that it might be the loss of the flexible identity next, a(ba) = (ab)a but I don't know for sure.
- galaxyLogic 5y agoHere's a short article that gave me some insight into the matter: https://nautil.us/blog/the-strange-numbers-that-birthed-modern-algebra https://nautil.us/blog/the-strange-numbers-that-birthed-mode... "Place your phone face-up on a flat surface, for example. Spin it 90 degrees to the left, and then flip it away from you. Note which way the camera points. Returning to the original position, flip it away from you first and then turn it to the left second. See how the camera points to the right instead? This initially alarming property, known as non-commutativity, turns out to be a feature the quaternions share with reality "
- dhosek 5y agoIt's worth noting that one of the early finite groups that is taught in abstract algebra are the dihedral groups which model exactly this sort of behavior (For your phone example this would be D₄. Knowing that mattress flipping is modeled with D₂ makes it trivial to prove that that there is no combination of flip and rotate that will allow you to always do the same move to your mattress to get it into the four possible positions for optimal wear.
- galaxyLogic 5y agoInteresting Applied Mathematics
- adamnemecek 5y agoYou should check out the bivector community dedicated to geometric algebra https://bivector.net/ https://bivector.net/. Check out a demo https://observablehq.com/@enkimute/animated-orbits https://observablehq.com/@enkimute/animated-orbits Join the discord https://discord.gg/vGY6pPk https://discord.gg/vGY6pPk. Enki (the guy behind bivector) also gave a talk on GA at SIGGRAPH 2019 https://www.youtube.com/watch?v=tX4H_ctggYo https://www.youtube.com/watch?v=tX4H_ctggYo
- matsemann 5y agoAbout rotation and interpolation, I once had a bug in animated CSS transforms of all things, in which IE decided to rotate the element around another axis but still end up at the correct position. That one made me raise my eyebrows. No idea if IE actually was in the wrong, though, but in my head interpolating the xyz value I'm changing feels like the correct way to do it.
- dang 5y agoOngoing related thread: Let's remove Quaternions from every 3D Engine (2018) - https://news.ycombinator.com/item?id=29512302 https://news.ycombinator.com/item?id=29512302
- dr_orpheus 5y ago> I did not encounter quaternions in all my years of engineering, although a lecturer once alluded to them during a class in my masters. I know that I am not coming in with same perspective as a lot of the other software engineers/graphics developers, but I started learning about quaternions freshman year of college. For aerospace engineering quaternions are used almost exclusively for spacecraft attitude determination and control. For a very dynamic system they are very useful. There are some limitations that I have seen, and I have seen Rodrigues parameters (or modified Rodrigues parameters) used instead which are mentioned near the end of the article.
- 2143 5y agoI remember "quarternions" from my math-heavy computer graphics class. Today, I have zero recollection of what they were or why it was in my graphics class. Heck I barely remember anything from that class today, which is ironical considering it was a required class for me to graduate that semester. I wish my job had atleast a little more to do withwhat I learnt in college. (I'm a web developer, and I'd like to get closer to the machine.)
- btilly 5y agoQuaternion trivia. There was at one point a debate in physics about whether it was better to use quaternions or linear algebra for physics. With i, j, and k being the unit vectors, and the real numbers representing time. In the end, of course, linear algebra won. But we still use i, j, and k as the unit vectors. And in electrical engineering where i wound up hijacked for current, they use j as the square root of -1.
- Const-me 5y agoOne interesting thing about quaternions that’s almost never mentioned anywhere on the internets, there’re two conventions for them. The convention in that article is known as “Hamilton's quaternions”. There’s another incompatible one usually called “JPL quaternions”, for some American Jet Propulsion Laboratory. Authors of 99% articles about the quaternions, and software libraries implementing quaternions, are assuming exactly one of these conventions, and almost never mention which one that is. More info there: https://fzheng.me/2017/11/12/quaternion_conventions_en/ https://fzheng.me/2017/11/12/quaternion_conventions_en/
- fault1 5y agoyou also see the variations from the group structure; https://en.wikipedia.org/wiki/Quaternion_group https://en.wikipedia.org/wiki/Quaternion_group
- billforsternz 5y agoI remember reading some library quaternion code (sorry can't remember which library) that started out with a lovely quote from Hamilton on how the idea burst into his mind in a flash as he walked with his wife near the river Liffey I think it was in Dublin. So I guess they mentioned it, at least indirectly.
- thermistokles 5y agoThere are actually even more. You can actually have 12 different variations depending on certain choices. Though the other sources of differences are minor. https://arxiv.org/abs/1711.02508 https://arxiv.org/abs/1711.02508 This is actually a great source of frustration in the robotics state estimation community, as you have the influential University of Minnesota using JPL, and most other universities using Hamiltonian.
- imadr 5y agoVery nice interactive visualizations! I've made a similar article some time ago https://imadr.me/rotations-with-quaternions/ https://imadr.me/rotations-with-quaternions/
- gibsonf1 5y agoThe absolute best instruction on quaternions I've seen is the 3Blue1Brown series on your tube and their incredible live quaternion viewer: https://www.youtube.com/watch?v=zjMuIxRvygQ&t=24s https://www.youtube.com/watch?v=zjMuIxRvygQ&t=24s I was able to learn enough from this to then use quaternion matrix transformations extensively in my startup to incredible effect.
- scythe 5y agoI don't like this proof of the rotation formula. It seems like juggling formulas without providing any motivation as to how we get there. It does a great job of explaining the problems with other notations, but in demonstrating the formula for quaternion rotation we just pull conjugation out of a hat. First, let's ask what it means to rotate around an axis. If you consider rotation of a vector v in a plane A around the unit normal n, you can decompose v as follows: v = proj_n(v) + proj_A(v) = vn + vA Now a 90 degree rotation of v about n is rot_n(90,v) = vn + n >< vA = vn + vR = (v•n)n + v >< n So if we consider v rotated by an angle S around n, we can infer that vn is preserved and the image rot_n(S,vA) can be projected onto vA and vR according to the usual cosine rule for projection: rot_n(S, vA) = cos(S)vA + cos(s-90)vR = cos(S)vA + sin(S)vR Likewise, rot_n(S, v) = cos(S)v + sin(S)rot_n(90, v) = cos(S)v + sin(S)((v•n)n + v >< n) Okay, now what's wrong with this formula? What if we want to combine rotations? We're stuck, because this "multiplication" isn't associative. So we can turn this into a linear transformation and use the matrix representation, which gives a nine-dimensional algebra, although with symmetry you can make it five-dimensional. (The fifth dimension comes from the requirement that both the determinant and the L2 norm of the matrix coefficients are constant, 1 and 3 respectively.) But we have perhaps heard about the quaternions, which are associative. And we might have noticed that Im(v*n), where * denotes quaternion multiplication and Im() discards the real part, is equal to v >< n, viewed as vectors. But multiplication under Im() isn't associative either. But we can also define Im() another way, using the apostrophe for conjugation: Im(v*n) = (v*n - (v*n)')/2 = (v*n - n*v)/2 since (v*n)' = n'*v' = (-n)*(-v) = n*v for pure imaginary v,n, where we recall that conjugation distributes over products of quaternions at the cost of reversing the order. Now what if we try to construct the rotation again: rot_n(S,v) = cos(S)v + sin(S)(v*n - n*v)/2 = (v*(cos(S)+ sin(S)n) - (-cos(S) + sin(S))*v)/2 = (v*q(n,S) + q(n,S)'*v)/2 Here q(n,S) = cos(S) + sin(S)n is a perfectly reasonable quaternion, and we call it a rotation quaternion. This is now almost associative but not quite. If we combine rotations q and p, we end up with terms like q'*v*p. How annoying. But it feels like we're getting closer, so let's see if we can learn anything else about these "sandwich" products. Geometrically, if we rotate the vector forwards and backwards, we should get the same vector. But q(n,-S) = q(n,S)', so we must find (we drop the arguments since there is only one q and we are sick of parentheses): ((v*q + q'*v)*q' + q*(v*q + q'*v))/4 = (v*q*q' + q*q'*v + q'*v*q' + q*v*q)/4 = v Now it's not so hard to verify that q*q' = q'*q = 1, so we can subtract v/2 from both sides and clear the denominator to find the curious-looking lemma: q*v*q + q'*v*q' = 2v Now (q'*v*q')' = q*v'*q = -q*v*q, the last equality being established because v is imaginary. Therefore: q*v*q - (q*v*q)' = 2Im(q*v*q) = 2v so Im(qvq) = v, for arbitrary rotation vectors q. Evidently a multiplication by q on the right undoes a multiplication by q on the left, at least when we are talking about imaginary parts, which we were interested in already. So what happens when we take q'*v*q — the missing sandwich in the above equation? This should give us two rotations in the same direction, since switching sides inverts the rotation and conjugation inverts it again to leave us with the same rotation. But what's the use of writing rot_n(2S, v) = Im(q'*v*q)? Just try it: Im(q'*v*q) = (q'*v*q - (q'*v*q)')/2 = (q'*v*q - q'*v'*q)/2 = (q'*v*q + q'*v*q)/2 = q'*v*q! So we now have a formula where everything is in one product. It turns out that the ugly "sandwiches" (we also call this conjugation, which can be confusing) are useful after all. (Explicitly verifying that q'vq = rot_n(2S, v) is left as an exercise for the reader. See hint [1]. ) Now if we consider a rotation by a second quaternion p, we find: p'*q'*v*q*p = (q*p)'*v*(q*p) by inverting the distributive property for conjugation. So we only need to take one product to combine rotations. Finally, an associative structure! There is only one sticking point left. Evidently q(n,S) corresponds to the transformation rot_n(2S,v). So in order to get rot_n(S, v) we need: Q(n,S) = q(n,S/2) But there is one more thing. What happens when S = 360? We all know that a rotation of 360 degrees doesn't change the geometry. So shouldn't we have Q(n,360) = 1? But in fact: Q(n,360) = q(n,180) = cos(180) + sin(180)n = -1! Of course (-1)'v(-1) = v. Evidently Q has a period of 720 degrees under rotations S rather than the usual 360, i.e., Q is a spinor. This is sometimes called a "double cover". In fact, we could also represent rotations and positions with the Pauli spin matrices and complex 2-vectors respectively, although (as in quantum mechanics) we pick up a meaningless global phase, and translation is weird. [1]: Consider various ways of writing parentheses on the expression Im(q*q'*v*q*q), and show that q(n,S)*q(n,S) = q(n,2S).
- alanh 5y agoIs there a reason why, for me, this post contains `[math processing error]` numerous times instead of math symbols? Update: It’s due to incompatibility with the Dark Reader extension, which causes MathJax to find unexpected nulls in `classList`