implement adjugate via cross product of vectors

This commit is contained in:
Paul Zabelin
2016-02-21 14:41:53 -08:00
parent f367d5a648
commit 62e11bda7d
2 changed files with 8 additions and 20 deletions

View File

@@ -7,10 +7,11 @@ class HomogeneousInverseSpec: QuickSpec {
override func spec() {
describe("homogeneousInverse") {
context("multiply adj by vector") {
let m = Matrix3x3Type([-122, -152, 18544, 122, 0, 0, 0, 152, 0])
let expected = Matrix3x3Type([[0.0, 0.0, 1.0], [152.0, -0.0, 1.0], [-0.0, 122.0, 1.0]])
it("should match expected") {
let m = Matrix3x3Type([-122, -152, 18544, 122, 0, 0, 0, 152, 0])
let expected = Matrix3x3Type([[0.0, 0.0, 1.0], [152.0, -0.0, 1.0], [-0.0, 122.0, 1.0]])
expect(m.homogeneousInverse()).to(beCloseTo(expected))
expect(m.homogeneousInverse().zNormalized()).to(beCloseTo(expected))
}
}
}