-
-
Save slimlime/cb9ccc1c5c8ee10764d3b344e5960f1d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public func Cross(_ q1: SCNQuaternion, _ q2: SCNQuaternion) -> SCNQuaternion { | |
return SCNQuaternion( | |
q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y, | |
q1.w * q2.y - q1.x * q2.z + q1.y * q2.w + q1.z * q2.x, | |
q1.w * q2.z + q1.x * q2.y - q1.y * q2.x + q1.z * q2.w, | |
q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment