diff --git a/Example/Tests/MatrixSpec.swift b/Example/Tests/MatrixSpec.swift index 776e6f0..a48aa85 100644 --- a/Example/Tests/MatrixSpec.swift +++ b/Example/Tests/MatrixSpec.swift @@ -51,6 +51,8 @@ class MatrixSpec: QuickSpec { let adjugate = before.adjugate() let inverse = before.inverse expect(adjugate.zNormalized()) == inverse.zNormalized() + expect(inverse.inverse) == before + expect(simd_quaternion(adjugate.zNormalized())) == simd_quaternion(inverse.zNormalized()) } } #endif diff --git a/Pod/Classes/Matrix3x3+3D.swift b/Pod/Classes/Matrix3x3+3D.swift index ca3ef2a..41cc34c 100644 --- a/Pod/Classes/Matrix3x3+3D.swift +++ b/Pod/Classes/Matrix3x3+3D.swift @@ -23,9 +23,9 @@ extension Matrix3x3Type { }() func to3d() -> Matrix4x4Type { - var result = Matrix3x3Type.addRow * self * Matrix3x3Type.addColumn - result[2,2] = 1 - return result + var stretch = Matrix3x3Type.addRow * self * Matrix3x3Type.addColumn + stretch[2,2] = 1 + return stretch } func zNormalized() -> Matrix3x3Type { @@ -50,7 +50,7 @@ extension Matrix3x3Type { } private func zNormalizedSafe() -> Matrix3x3Type { - return self[2,2]==0 ? self : zNormalizedUnsafe() + return self[2,2] == 0 ? self : zNormalizedUnsafe() } func adjugate()-> Matrix3x3Type {