Why are quaternions used for rotations?

后端 未结 8 1029
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-07 07:42

I\'m a physicist, and have been learning some programming, and have come across a lot of people using quaternions for rotations instead of writing things in matrix/vector fo

8条回答
  •  一生所求
    2020-12-07 08:09

    Generally, we just want a mapping of a point X=(x,y,z) to a new point X'=(x',y',z') subject to the constraint that X^2 = X'^2. And there are lots of things that do this.

    We absolutely do not just want that. There is a very important subtlety that lots of people miss. The construction you're talking about (draw the triangles and use trig, etc.) will correctly rotate one vector into the other. But there are infinitely many rotations that will do this. In particular, I can come along after you've done your rotation, and then rotate the whole system around the X' vector. That won't change the position of X' at all. The combination of your rotation and mine is equivalent to another single rotation (since rotations form a group). In general, you need to be able to represent any such rotation.

    It turns out that you can do this with just a vector. (That's the axis-angle representation of rotations.) But combining rotations in the axis-angle representation is difficult. Quaternions make it easy, along with lots of other things. Basically, quaternions have all the advantages of other representations, and none of the drawbacks. (Though I'll admit that there may be specific applications for which some other representation may be better.)

提交回复
热议问题