Rename invert method to inverse

This commit is contained in:
Brendan Zabarauskas 2012-12-04 08:12:22 +10:00
parent b2de264caf
commit 4fcd71be8e
2 changed files with 11 additions and 11 deletions

View file

@ -36,7 +36,7 @@ pub trait Matrix<T,V>: Dimensional<V>, ToPtr<T>, Eq, DefaultEq, Neg<self> {
pure fn determinant(&self) -> T;
pure fn trace(&self) -> T;
pure fn invert(&self) -> Option<self>;
pure fn inverse(&self) -> Option<self>;
pure fn transpose(&self) -> self;
pure fn is_identity(&self) -> bool;
@ -178,7 +178,7 @@ pub impl<T:Copy Float> Mat2<T>: Matrix<T, Vec2<T>> {
}
#[inline(always)]
pure fn invert(&self) -> Option<Mat2<T>> {
pure fn inverse(&self) -> Option<Mat2<T>> {
let _0 = cast(0);
let d = self.determinant();
if d.default_eq(&_0) {
@ -440,7 +440,7 @@ pub impl<T:Copy Float> Mat3<T>: Matrix<T, Vec3<T>> {
}
// #[inline(always)]
pure fn invert(&self) -> Option<Mat3<T>> {
pure fn inverse(&self) -> Option<Mat3<T>> {
let d = self.determinant();
let _0 = cast(0);
if d.default_eq(&_0) {
@ -799,7 +799,7 @@ pub impl<T:Copy Float Sign> Mat4<T>: Matrix<T, Vec4<T>> {
self[0][0] + self[1][1] + self[2][2] + self[3][3]
}
pure fn invert(&self) -> Option<Mat4<T>> {
pure fn inverse(&self) -> Option<Mat4<T>> {
let d = self.determinant();
let _0 = cast(0);
if d.default_eq(&_0) {

View file

@ -52,11 +52,11 @@ fn test_Mat2() {
assert a.transpose() == Mat2::new(1f, 2f,
3f, 4f);
assert option::unwrap(a.invert()) == Mat2::new(-2f, 1.5f,
assert option::unwrap(a.inverse()) == Mat2::new(-2f, 1.5f,
1f, -0.5f);
assert Mat2::new(0f, 2f,
0f, 5f).invert().is_none();
0f, 5f).inverse().is_none();
// exact_eq
// fuzzy_eq
@ -165,11 +165,11 @@ fn test_Mat3() {
4f, 5f, 6f,
7f, 8f, 9f);
assert a.invert().is_none();
assert a.inverse().is_none();
assert option::unwrap(Mat3::new(2f, 4f, 6f,
0f, 2f, 4f,
0f, 0f, 1f).invert())
0f, 0f, 1f).inverse())
== Mat3::new(0.5f, -1f, 1f,
0f, 0.5f, -2f,
0f, 0f, 1f);
@ -177,7 +177,7 @@ fn test_Mat3() {
// let ident: Mat3<float> = NumericMatrixNxN::identity(); // FIXME: there's something wrong with static functions here!
let ident: Mat3<float> = Mat3::identity();
assert option::unwrap(ident.invert()) == ident;
assert option::unwrap(ident.inverse()) == ident;
// exact_eq
// fuzzy_eq
@ -308,7 +308,7 @@ fn test_Mat4() {
9f, 10f, 11f, 12f,
13f, 14f, 15f, 16f);
assert option::unwrap(c.invert())
assert option::unwrap(c.inverse())
== Mat4::new( 5f, -4f, 1f, 0f,
-4f, 8f, -4f, 0f,
4f, -8f, 4f, 8f,
@ -317,7 +317,7 @@ fn test_Mat4() {
// let ident: Mat4<float> = NumericMatrixNxN::identity();
let ident: Mat4<float> = Mat4::identity();
assert option::unwrap(ident.invert()) == ident;
assert option::unwrap(ident.inverse()) == ident;
// exact_eq
// fuzzy_eq