- 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.
推薦閱讀
- C#高級編程(第10版) C# 6 & .NET Core 1.0 (.NET開發經典名著)
- 流量的秘密:Google Analytics網站分析與優化技巧(第2版)
- 移動UI設計(微課版)
- ASP.NET Core 5.0開發入門與實戰
- 架構不再難(全5冊)
- Hands-On Data Structures and Algorithms with JavaScript
- OpenCV 3和Qt5計算機視覺應用開發
- Python程序設計案例教程
- CKA/CKAD應試教程:從Docker到Kubernetes完全攻略
- Python編程與幾何圖形
- Haskell Data Analysis Cookbook
- Android玩家必備
- SSM開發實戰教程(Spring+Spring MVC+MyBatis)
- Learning Apache Cassandra
- Visual Studio Code 權威指南