Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Euler angles are horrible, and so are quaternions #207

Closed
petaflot opened this issue Oct 21, 2022 · 2 comments
Closed

Euler angles are horrible, and so are quaternions #207

petaflot opened this issue Oct 21, 2022 · 2 comments

Comments

@petaflot
Copy link

Hi,

definitely not a bug report, not a feature either but rather a request for clarification.

I read your (Mike Boyle's) rant about Euler angles, and I'd like to point out that IMHO you really made your point clear. It also helped me understand that some of the answers I was seeking did not exist as such, and I had to make up my own mind in order to have consistent results throughout my code.

What I mean in the title by "so are quaternions"1 is that since they are basically impossible to visualize, they are a brainfuck on their own. Added to the fact that "there isn't even agreement on how to [...]" this definitely makes them even more confusing. My guess : maybe the time has come to write an RFC of some sort to at least try and achieve consensus on this matter? Not that I don't like this "quasi-absolute freedom" : it would definitely make some things easier at the expense of a little more memory usage.

Anyway I have at least one question : does it mean that w,x,y,z are interchangeable2? If yes, this is not obvious to me when reading Hamilton's formula or comparing to complex numbers.

However you feel like responding (like tagging this report as a nuisance? to me, the present meaning of nuisance seems to be a pretty good definition of trolling : the troll does not always know it's being a troll, yet it acts like one while trying to understand things beyond its comprehension) I'd like to thank you for your rant : I had a great time reading it and was reminded of two other texts34 which you might like if you have some time to spare.

Footnotes

  1. firefox's spellchecker says this word does not exist, and only suggests "consternation" ; this fact itself is a consternation.

  2. as in "provided my code is consistent with itself, can I use permutations on all the values and still get a coherent result? if this is the case, this would (or could ?) mean that the same applies to a complex' real and imaginary parts (and this is most confusing).

  3. https://james.hamsterrepublic.com/technomancy/

  4. https://mama.indstate.edu/users/bones/WhyIHateWebLogs.html

@moble
Copy link
Owner

moble commented Oct 21, 2022

IMHO you really made your point clear. It also helped me understand that some of the answers I was seeking did not exist as such, and I had to make up my own mind in order to have consistent results throughout my code.

Thanks! It did cost me the opportunity to have a better name for this package on PyPI (just quaternion instead of numpy-quaternion) because somebody took sincere offense to my rant. ¯\_(ツ)_/¯

What I mean in the title by "so are quaternions"1 is that since they are basically impossible to visualize, they are a brainfuck on their own.

I think they're actually pretty good for visualization — especially once you abandon any ideas left over from Euler angles. The vector part gives you the axis (and sense) of rotation, as well as some notion of the size of the rotation. And if you can deal with the log of a quaternion, that's literally just the axis-angle representation, which is pretty intuitive.

Added to the fact that "there isn't even agreement on how to [...]" this definitely makes them even more confusing.

Well, as long as you pick one set of conventions and stick with them, that doesn't really matter. It can be a little problematic when you want to consult various references that don't use the same conventions, but it's usually not too bad.

My guess : maybe the time has come to write an RFC of some sort to at least try and achieve consensus on this matter?

But where would you write such a thing? I don't know of any appropriate governing body. For now, at least, I figure it's best to just push sensible conventions [i.e., mine :)], and hope that people adopt them over time.

Anyway I have at least one question : does it mean that w,x,y,z are interchangeable2? If yes, this is not obvious to me when reading Hamilton's formula or comparing to complex numbers.

I'm not entirely sure what you mean, even with the footnote, but generally I would say no. So, I'll guess that you mean that you come up with some numbers w,x,y,z, and I would write that in quaternion form as quaternion(w,x,y,z), but you were to write it consistently as quaternion(z,y,x,w) for example. That wouldn't work for you because then even the quaternion 1 would square to -1 for you. So the scalar has to stay where it is. (This is because of how I coded up the quaternion object long ago; it would certainly be possible to write different code that would work correctly with w as the last element.) I believe it would work out fine for you if you were to leave the scalar where it is, and only cyclically permute the other three elements. That is, if you always write your quaternions as quaternion(w,x,y,z), quaternion(w,y,z,x), or quaternion(w,z,x,y), I think they should all work out fine. I also think that if you were to use a non-cyclic permutation — one of quaternion(w,y,x,z), quaternion(w,x,z,y), or quaternion(w,z,y,x) — you would run into problems with handedness, and would essentially have to conjugate your rotors to get consistent results.

I'd like to thank you for your rant : I had a great time reading it and was reminded of two other texts34 which you might like if you have some time to spare.

Sounds like you should write a rant about rants.

@moble moble closed this as completed Nov 8, 2022
@petaflot
Copy link
Author

petaflot commented Nov 9, 2022

Missed your reply. Thanks! You confirmed my feeling about rotations and permutations.

I'll consider your suggestion to rant ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants