refactor for readibility

This commit is contained in:
Paul Zabelin
2018-01-04 17:59:12 -08:00
parent 02f93ee249
commit 79cb6af227
2 changed files with 6 additions and 4 deletions

View File

@@ -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

View File

@@ -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 {