Comparison operations
Comparing two quaternions can be done component-wise. Two quaternions can represent the same rotation even if they are not identical on a component level. This happens because a quaternion and its inverse rotate to the same spot but they take different routes:
- Overload the
==
and!=
operators inquat.cpp
. Add the declaration for these functions toquat.h
:bool operator==(const quat& left, const quat& right) { return (fabsf(left.x - right.x) <= QUAT_EPSILON && fabsf(left.y - right.y) <= QUAT_EPSILON && fabsf(left.z - right.z) <= QUAT_EPSILON && fabsf(left.w - right.w) <= QUAT_EPSILON); } bool operator!=(const quat& a, const quat& b) { return !...