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

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.

主站蜘蛛池模板: 汶上县| 白玉县| 浪卡子县| 阜城县| 河北省| 大厂| 那曲县| 盐亭县| 石棉县| 凌云县| 莱阳市| 喀什市| 太原市| 东台市| 乌鲁木齐县| 喜德县| 荔浦县| 鸡东县| 德保县| 嘉鱼县| 宣武区| 贵阳市| 壤塘县| 慈利县| 鹤岗市| 淳化县| 博湖县| 定西市| 武穴市| 大庆市| 惠来县| 龙州县| 南部县| 讷河市| 徐州市| 田东县| 上犹县| 高碑店市| 澜沧| 黎川县| 定南县|