mirror of
https://github.com/apple/swift-numerics
synced 2026-11-25 04:47:53 +00:00
Fix invalid multiplication of quaternions
This commit is contained in:
1 parent
7fb314a581
commit
57fc357bfc
1 file changed
+4
-4
@@ -55,10 +55,10 @@ extension Quaternion: AlgebraicField {
|
||||
@_transparent
|
||||
public static func * (lhs: Self, rhs: Self) -> Quaternion {
|
||||
|
||||
let rhsA = SIMD4(+rhs.components.w, +rhs.components.z, -rhs.components.y, +rhs.components.x)
|
||||
let rhsB = SIMD4(+rhs.components.x, -rhs.components.y, -rhs.components.z, -rhs.components.w)
|
||||
let rhsC = SIMD4(+rhs.components.y, +rhs.components.x, +rhs.components.w, -rhs.components.z)
|
||||
let rhsD = SIMD4(+rhs.components.z, -rhs.components.w, +rhs.components.x, +rhs.components.y)
|
||||
let rhsA = SIMD4(+rhs.components.x, -rhs.components.y, -rhs.components.z, -rhs.components.w)
|
||||
let rhsB = SIMD4(+rhs.components.y, +rhs.components.x, +rhs.components.w, -rhs.components.z)
|
||||
let rhsC = SIMD4(+rhs.components.z, -rhs.components.w, +rhs.components.x, +rhs.components.y)
|
||||
let rhsD = SIMD4(+rhs.components.w, +rhs.components.z, -rhs.components.y, +rhs.components.x)
|
||||
|
||||
let a = (lhs.components * rhsA).sum()
|
||||
let b = (lhs.components * rhsB).sum()
|
||||
|
||||
Reference in new issue
Block a user