- Hands-On C++ Game Animation Programming
- Gabor Szauer
- 238字
- 2021-06-30 14:46:00
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.
- 數(shù)據(jù)科學(xué)實戰(zhàn)手冊(R+Python)
- 軟件架構(gòu)設(shè)計:大型網(wǎng)站技術(shù)架構(gòu)與業(yè)務(wù)架構(gòu)融合之道
- Python爬蟲開發(fā)與項目實戰(zhàn)
- Spring+Spring MVC+MyBatis整合開發(fā)實戰(zhàn)
- C#開發(fā)案例精粹
- ASP.NET程序開發(fā)范例寶典
- PHP編程基礎(chǔ)與實踐教程
- Java并發(fā)編程之美
- Node.js區(qū)塊鏈開發(fā)
- 深入分析GCC
- 高效使用Greenplum:入門、進(jìn)階與數(shù)據(jù)中臺
- Python Machine Learning Cookbook
- HTML5與CSS3權(quán)威指南
- Java面向?qū)ο蟪绦蛟O(shè)計教程
- Microsoft Windows Identity Foundation Cookbook