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

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.

主站蜘蛛池模板: 玛纳斯县| 仁布县| 宣恩县| 札达县| 武隆县| 郑州市| 莆田市| 西平县| 河南省| 青田县| 建德市| 商丘市| 成武县| 抚宁县| 泸州市| 金乡县| 赤城县| 沙雅县| 色达县| 连平县| 扎赉特旗| 张掖市| 南丹县| 崇明县| 泸西县| 邵武市| 新津县| 池州市| 托里县| 洛宁县| 关岭| 大同市| 时尚| 乐昌市| 大关县| 滕州市| 诏安县| 梅州市| 米易县| 大邑县| 昌宁县|