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

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.

主站蜘蛛池模板: 白朗县| 海口市| 和静县| 鄂托克前旗| 鹤山市| 永福县| 东阿县| 丹阳市| 泽普县| 安阳市| 陈巴尔虎旗| 思南县| 抚顺县| 眉山市| 商河县| 陕西省| 会泽县| 黄浦区| 安丘市| 津市市| 右玉县| 奉化市| 平邑县| 嘉黎县| 丰台区| 穆棱市| 公安县| 长沙县| 崇阳县| 利辛县| 崇仁县| 宜丰县| 水城县| 即墨市| 隆化县| 岚皋县| 南宁市| 福鼎市| 宁陵县| 四子王旗| 格尔木市|