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

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.

主站蜘蛛池模板: 淳化县| 兰州市| 泉州市| 普安县| 鹤山市| 阳城县| 中西区| 博白县| 额济纳旗| 阿克苏市| 九江县| 延边| 延边| 正蓝旗| 兖州市| 禄丰县| 诸城市| 宁晋县| 响水县| 双辽市| 古丈县| 深水埗区| 溧水县| 炉霍县| 伊春市| 鹤壁市| 新郑市| 凌云县| 永顺县| 滨州市| 松溪县| 固镇县| 宁德市| 靖宇县| 定南县| 南汇区| 南涧| 得荣县| 长沙县| 青冈县| 宁武县|