官术网_书友最值得收藏!

Chapter 4: Implementing Quaternions

In this chapter, you will learn about quaternions. Quaternions are used to encode rotations. A quaternion is a complex number in an xi + yj + zk + w form. Think of i, j,

and k as placeholders that each represent a three-dimensional axis. w is a real number. While quaternions don't directly encode an angle axis pair, it's easy to think of them

as just that—a rotation about an arbitrary axis.

By the end of this chapter, you should have a strong understanding of what quaternions are and how to use them and you will have implemented a robust quaternion class in code. This chapter will cover the following topics:

  • Different methods for creating quaternions
  • Retrieving the angle and axis of a quaternion
  • Basic component-wise operations
  • The length and dot product of two quaternions
  • Inverting quaternions
  • Combining quaternions
  • Transforming vectors by quaternions
  • Interpolating between quaternions
  • Converting quaternions and matrices

Why are quaternions important? Most humanoid animations are created using only rotations—no translation or scale is needed. Think about an elbow joint, for example. The natural motion of an elbow only rotates. If you want to translate the elbow through space, you rotate the shoulder. Quaternions encode rotations and they interpolate well.

Important information:

In this chapter, you will implement quaternions with an intuitive, code-first approach. If you are interested in the more formal math behind quaternions, check out https://gabormakesgames.com/quaternions.html.

主站蜘蛛池模板: 新余市| 尤溪县| 平度市| 涟源市| 济阳县| 三门县| 子洲县| 贵港市| 广东省| 彰化市| 石嘴山市| 色达县| 齐河县| 卢龙县| 永靖县| 崇明县| 山阳县| 逊克县| 绵竹市| 涞水县| 博爱县| 密山市| 光山县| 桐柏县| 花垣县| 大足县| 扎赉特旗| 濮阳县| 开封市| 应城市| 东明县| 江源县| 论坛| 凉山| 安塞县| 长武县| 涡阳县| 福安市| 漳浦县| 东台市| 张家口市|