Redefine identity and zero methods as wrappers for Matrix::identity and Matrix::zero

This commit is contained in:
Brendan Zabarauskas 2012-12-28 18:55:43 +10:00
parent aae354e3a6
commit cc465910de
3 changed files with 12 additions and 45 deletions

View file

@ -108,22 +108,13 @@ pub impl<T:Copy Float> Mat2<T> {
sin_theta, cos_theta)
}
// FIXME: An interim solution to the issues with static functions
/// Wrapper method for `Matrix::identity`
#[inline(always)]
static pure fn identity() -> Mat2<T> {
let _0 = Number::from(0);
let _1 = Number::from(1);
Mat2::new(_1, _0,
_0, _1)
}
static pure fn identity() -> Mat2<T> { Matrix::identity() }
// FIXME: An interim solution to the issues with static functions
/// Wrapper method for `Matrix::zero`
#[inline(always)]
static pure fn zero() -> Mat2<T> {
let _0 = Number::from(0);
Mat2::new(_0, _0,
_0, _0)
}
static pure fn zero() -> Mat2<T> { Matrix::zero() }
}
pub impl<T:Copy Float> Mat2<T>: Matrix<T, Vec2<T>> {

View file

@ -112,24 +112,13 @@ pub impl<T:Copy Float> Mat3<T> {
_0, _0, value)
}
// FIXME: An interim solution to the issues with static functions
/// Wrapper method for `Matrix::identity`
#[inline(always)]
static pure fn identity() -> Mat3<T> {
let _0 = Number::from(0);
let _1 = Number::from(1);
Mat3::new(_1, _0, _0,
_0, _1, _0,
_0, _0, _1)
}
static pure fn identity() -> Mat3<T> { Matrix::identity() }
// FIXME: An interim solution to the issues with static functions
/// Wrapper method for `Matrix::zero`
#[inline(always)]
static pure fn zero() -> Mat3<T> {
let _0 = Number::from(0);
Mat3::new(_0, _0, _0,
_0, _0, _0,
_0, _0, _0)
}
static pure fn zero() -> Mat3<T> { Matrix::zero() }
/**
* Construct a matrix from an angular rotation around the `x` axis

View file

@ -123,26 +123,13 @@ pub impl<T:Copy Float> Mat4<T> {
_0, _0, _0, value)
}
// FIXME: An interim solution to the issues with static functions
/// Wrapper method for `Matrix::identity`
#[inline(always)]
static pure fn identity() -> Mat4<T> {
let _0 = Number::from(0);
let _1 = Number::from(1);
Mat4::new(_1, _0, _0, _0,
_0, _1, _0, _0,
_0, _0, _1, _0,
_0, _0, _0, _1)
}
static pure fn identity() -> Mat4<T> { Matrix::identity() }
// FIXME: An interim solution to the issues with static functions
/// Wrapper method for `Matrix::zero`
#[inline(always)]
static pure fn zero() -> Mat4<T> {
let _0 = Number::from(0);
Mat4::new(_0, _0, _0, _0,
_0, _0, _0, _0,
_0, _0, _0, _0,
_0, _0, _0, _0)
}
static pure fn zero() -> Mat4<T> { Matrix::zero() }
}
pub impl<T:Copy Float> Mat4<T>: Matrix<T, Vec4<T>> {