public static SCNVector3 Act(this SCNQuaternion self, SCNVector3 vector) { // Calculate the resulting vector using the Hamilton product // P' = RPR' // P = [0, p1, p2, p2] < -- vector // R = [w, x, y, z] < -- rotation // R' = [w, -x, -y, -z] var p = new SCNQuaternion(vector, 0f); var r = self; var rt = r; rt.Conjugate(); return(SCNQuaternion.Multiply(SCNQuaternion.Multiply(r, p), rt).Xyz); }
public static SCNQuaternion Divide(this SCNQuaternion left, SCNQuaternion right) { return(SCNQuaternion.Multiply(left, SCNQuaternion.Invert(right))); }