- Hands-On C++ Game Animation Programming
- Gabor Szauer
- 107字
- 2021-06-30 14:46:02
Dot product
Like with vectors, the dot product measures how similar two quaternions are. The implementation is the same as the vector implementation. Multiply like components and sum the result.
Implement the quaternion dot product function in quat.cpp and add its declaration to quat.h:
float dot(const quat& a, const quat& b) {
return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;
}
Like vectors, the length of a quaternion is the dot product of the quaternion with itself. In the next section, you will learn how to find the squared length and length of a quaternion.
推薦閱讀
- 數(shù)據(jù)庫(kù)系統(tǒng)教程(第2版)
- Android Jetpack開(kāi)發(fā):原理解析與應(yīng)用實(shí)戰(zhàn)
- Java系統(tǒng)分析與架構(gòu)設(shè)計(jì)
- Reactive Programming With Java 9
- 實(shí)戰(zhàn)Java高并發(fā)程序設(shè)計(jì)(第3版)
- Learning Vaadin 7(Second Edition)
- Learning Unity 2D Game Development by Example
- 青少年信息學(xué)競(jìng)賽
- Unity 2018 Shaders and Effects Cookbook
- OpenCV with Python By Example
- Vue.js應(yīng)用測(cè)試
- Extending Unity with Editor Scripting
- Learning Unreal Engine Game Development
- Web前端測(cè)試與集成:Jasmine/Selenium/Protractor/Jenkins的最佳實(shí)踐
- Backbone.js Patterns and Best Practices