Skip to content

Commit

Permalink
use GLKBased calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
noppefoxwolf committed Dec 28, 2019
1 parent 186e1a2 commit 147f309
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 0 additions & 9 deletions Sources/VRMSceneKit/Extensions/SCNQuaternion+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@

import SceneKit

func * (left: SCNQuaternion, right: SCNQuaternion) -> SCNQuaternion {
SCNQuaternion(
left.w * right.w - left.x * right.x - left.y * right.y - left.z * right.z, // 1
left.w * right.x + left.x * right.w + left.y * right.z - left.z * right.y, // i
left.w * right.y - left.x * right.z + left.y * right.w + left.z * right.x, // j
left.w * right.z + left.x * right.y - left.y * right.x + left.z * right.w // k
)
}

/*
x, y, and z represent the imaginary values.
*/
Expand Down
4 changes: 4 additions & 0 deletions Sources/VRMSceneKit/Extensions/SceneKit+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ extension SCNQuaternion {
}
}

static func * (_ left: SCNQuaternion, _ right: SCNQuaternion) -> SCNQuaternion {
SCNQuaternionMultiply(left, right)
}

static func * (_ left: SCNQuaternion, _ right: SCNVector3) -> SCNVector3 {
SCNQuaternionRotateVector3(left, right)
}
Expand Down

0 comments on commit 147f309

Please sign in to comment.