Quaternion Basics

Started by
13 comments, last by alvaro 10 years ago

Though, as mentioned above, the material you discuss can be found elsewhere, I find your article a nice summation of aspects of quaternions applicable to game programming.

A comment on your description of SLERP: although you define the range of t, you do not mention the intent of a SLERP with regard to t. In the context of interpolating rotations, IMHO, you should add something like "With t varying linearly, SLERP provides..."

Good call. I've added a short paragraph commenting on this property.

Ming-Lun "Allen" Chou

Physics / Graphics / Procedural Animation
http://allenchou.net

Advertisement

About SLERP, this article is usually worth looking: http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/

By the way, the thing about SLERP is not that it interpolates through the shortest path, but the fact that it ensures constant angular velocity.

In fact using the formula of your explanation alone you are NOT ensuring that you take the shortest path. For SLERP to ensure the minimal path the interpolation must be done between quaternions in the same hyperhemisphere. In order to do that, you need to test whether the dot product of both quaternions is negative and then, if so, negate one of them. And you can do that whether you use SLERP or NLERP.

“We should forget about small efficiencies, say about 97% of the time; premature optimization is the root of all evil” - Donald E. Knuth, Structured Programming with go to Statements

"First you learn the value of abstraction, then you learn the cost of abstraction, then you're ready to engineer" - Ken Beck, Twitter

About SLERP, this article is usually worth looking: http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/

By the way, the thing about SLERP is not that it interpolates through the shortest path, but the fact that it ensures constant angular velocity.

In fact using the formula of your explanation alone you are NOT ensuring that you take the shortest path. For SLERP to ensure the minimal path the interpolation must be done between quaternions in the same hyperhemisphere. In order to do that, you need to test whether the dot product of both quaternions is negative and then, if so, negate one of them. And you can do that whether you use SLERP or NLERP.

Thanks for the info. I edited the article a little bit to add that info in.

Ming-Lun "Allen" Chou

Physics / Graphics / Procedural Animation
http://allenchou.net

They are basically the usual stuff you can found everywhere without any proof/explanation. I have a few observations:

  • The dot product is not part of quaternion algebra. Since quaternions are 4D vectors you can clearly define it in the usual way, but it is an additional structure.
  • You have defined the conjugate as an "optimization" for the inverse in the unit quaternion case, but it is very important in quaternion algebra, They are for example used to define the norm of a quaternion |q| = sqrt( q * conjugate(q)) and to define multiplicative inverses q^-1 = conjugate(q)/(q*conjugate(q)). Indeed we have that q*conjugate(q) is the real number |q|^2 and thus q*(conjugate(q)/(q*conjugate(q)) = 1.

Whether the dot product is an additional structure or not is debatable. As you point out, q * conjugate(q) is an important quantity (the square of the norm). This is a positive-definite quadratic form in the R-vector space of quaternions, and it naturally defines an inner product by writing

norm_squared(q + w) = norm_squared(q) + norm_squared(w) + 2 * inner_product(q, w)

The inner product defined that way is the same as the dot product of q and w as elements of R^4. So I wouldn't say it's an additional structure.

how would you derive this quaternion inner product using only quaternion arithmetic though?

how would you derive this quaternion inner product using only quaternion arithmetic though?


The post you are responding to has the definition. But I'll make it explicit, to be more clear:

norm_squared(a) := a * conjugate(a)

inner_product(q,w) := (norm_squared(q + w) - norm_squared(q) - norm_squared(w)) / 2

This topic is closed to new replies.

Advertisement