![]() |
|
![]() |
| I've had a long work week and it's almost over and using the sliders to rotate this cow is exactly what I needed. I feel serene. Thank you. |
![]() |
| One advantage of quaternians from a computational perspective is that they are 4 numbers vs 9 for a 3x3 matrix (and applying the rotations has a similar reduction in flops) |
![]() |
| I had written a tangentially related comment a few days ago. Its related to rotation in a plane. In that case things become a lot simpler, especially if your programming environment support operations on complex numbers as a first class citizen.
https://news.ycombinator.com/item?id=40333541 The key intuition is that additions are translations and multiplications are rotations. So two model average translation one can use arithmetic mean, for average rotation the geometric mean. |
![]() |
| >Distances are canonically defined in the space of rotations
I am sorry, but this is simply not true. There are many distance/metric definitions that are applicable to the space of rotations, and the best choice of metric is defined by the application, which is why I asked that question. None of them is any more "canonical" than the other. See [1][2][3] for an introduction and comparison. [1] https://www.cs.cmu.edu/~cga/dynopt/readings/Rmetric.pdf [2] https://rotations.berkeley.edu/geodesics-of-the-rotation-gro... [3] https://lucaballan.altervista.org/pdfs/IK.pdf One will find there at least four "canonical" distance definitions, and applications ranging from optometry to computer graphics to IK (which is what you referred to). >The most widely-used concept of "average" is surely a point that minimizes the sum of squared distances...Of course, there are other senses of "average" (which generally do continue to apply to the space of rotations as well). I know this, not all of the readers may. What I don't know is what context the parent is coming from. Maybe all they need is interpolating between two camera positions - which is a much simpler problem than the paper they found (and what we're discussing) is addressing. >The application for this given by GreedCtrl's reference is to spline interpolation. It is not clear that the reference that they have found is actually the best for their application - they only said it was something they found, and that the article we're discussing looks "simpler" for their level of mathematics. The article we are discussing does not provide any means of "averaging" any more than two rotations, though, which motivated my question. |
![]() |
| Can confirm. Followed instructions, got the camera facing the same in both cases (left, with phone upside down). I interpreted the 180 part as flipping the phone around the horizontal axis. |
![]() |
| The 180 first part was right. Make sure you are rotating 90 degrees in the same direction both times from your frame of reference (clockwise looking from the top). |
![]() |
| This talks about one of my pet peeves with a lot of 3D software: they don't use Arcball[1] interface for rotation.
Autodesk products do (3DSmax, Maya), but Blender and OpenSCAD don't. And when I worked at Roblox, I couldn't convince the PM to let me implement it, because the users got by with whatever was there — and if they wanted more, they could use something else (...which they did, and Roblox stock reflected that in 2022). Arcball is based on quaternions[2] (using exp for interpolation). It's the only interface with these properties: 1. Any rotation can be accomplished with a single drag 2. No gimbal locks 3. Tracing a closed loop with a sequence of drags results in coming back to where you started Once you formalize this, you can prove it mathematically (ultimately, this comes from unit quaternions giving a 2-cover of SO(3) in the same way unit complex numbers giving exactly the rotations of a circle). For anyone interested, here is my reference implementation of Quaternions / Arcball that you can play with on the page: https://romankogan.net/math/arcball_js/index.html The code is very-commented Java (Processing library, running in JavaScript by the magic of ProcessingJS). It's one way you can feel the fancy math. Your hands and body will understand quaternions before your brain does. If you ever work on 3D software, please use this, and thanks in advance <3 [1] Arcball: http://courses.cms.caltech.edu/cs171/assignments/hw3/hw3-not... [2] Quaternions for rotations: https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotati... [3] Arcball in Processing: https://romankogan.net/math/arcball_js/index.html |
![]() |
| >any chance to make this work on mobile?
I wrote it a while ago with ProcessingJS, whose support for touch events was lacking. Will try to fix it and/or rewrite in P5JS, stay tuned :) |
![]() |
| > unit quaternions also don’t form a vector space
Unit quaternions are the lie group. If you want something you can add willy-nilly, you want the lie algebra of all quaternions, which represent rotational velocities, just as axis-angle represents rotational velocities. Comparing unit quaternions to axis-angle is a bit of a category error - it would be more appropriate to compare unit quaternions to rotation matrices, and all quaternions to axis-angle. > One advantage of using quaternions is how easy the exponential map is to compute—if you don’t need a rotation matrix, it’s a good option. You rarely need a rotation matrix at all when using quaternions. As mentioned in the article, you can compute rotations using `pqp^-1`. I think the easiest way to understand quaternions is just to read about geometric algebra. It took hundreds of years to invent quaternions, but once you understand geometric algebra (which is shockingly simple), you can invent quaternions in just a few minutes. I found this article to be a good intro several years ago: https://crypto.stanford.edu/~blynn/haskell/ga.html |
You take some totally abstract thing you want to work with[0], say 3D rotations, but totally avoiding any details of specific coordinates that might get you into trouble. That’s the lie group.
Then you can derive representations of it in coordinates that behave nicely. This is called the corresponding lie algebra. Then for free you get a way to go back and forth between the coordinates and the abstract thing[1], and ways to compose them and stuff. Turns out that this is the exponential map and the log map talked about in the article. What’s even cooler is that you can then compose them on either side, the abstract side or the coordinate side in a way that plays nicely. You get interpolation and averaging and all that in a fairly sensible way too in most cases you’ll deal with as an engineer. And best of all, when you can phrase your problem as a combination of lie groups, you can just google for what their algebras are and get lots of work for free that would be tons of time to do yourself.
[0] the thing has to be something with a notion of smooth change, plus a bit more structure it probably has.
[1] going back and forth has some ‘connected components’ issues sometimes, but that’s just another reason it’s great to piggyback on known results.