dot method

double dot(
  1. Quaternion other
)

Returns the 4D dot product of this quaternion and other.

The sign of the result indicates whether the two rotations point in the same hemisphere; values near 1 (or -1) mean the rotations are nearly identical.

Implementation

double dot(Quaternion other) {
  return x * other.x + y * other.y + z * other.z + w * other.w;
}