Redefine identity and zero methods as wrappers for Matrix::identity and Matrix::zero
This commit is contained in:
parent
aae354e3a6
commit
cc465910de
3 changed files with 12 additions and 45 deletions
17
src/mat2.rs
17
src/mat2.rs
|
@ -108,22 +108,13 @@ pub impl<T:Copy Float> Mat2<T> {
|
||||||
sin_theta, cos_theta)
|
sin_theta, cos_theta)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: An interim solution to the issues with static functions
|
/// Wrapper method for `Matrix::identity`
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
static pure fn identity() -> Mat2<T> {
|
static pure fn identity() -> Mat2<T> { Matrix::identity() }
|
||||||
let _0 = Number::from(0);
|
|
||||||
let _1 = Number::from(1);
|
|
||||||
Mat2::new(_1, _0,
|
|
||||||
_0, _1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: An interim solution to the issues with static functions
|
/// Wrapper method for `Matrix::zero`
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
static pure fn zero() -> Mat2<T> {
|
static pure fn zero() -> Mat2<T> { Matrix::zero() }
|
||||||
let _0 = Number::from(0);
|
|
||||||
Mat2::new(_0, _0,
|
|
||||||
_0, _0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub impl<T:Copy Float> Mat2<T>: Matrix<T, Vec2<T>> {
|
pub impl<T:Copy Float> Mat2<T>: Matrix<T, Vec2<T>> {
|
||||||
|
|
19
src/mat3.rs
19
src/mat3.rs
|
@ -112,24 +112,13 @@ pub impl<T:Copy Float> Mat3<T> {
|
||||||
_0, _0, value)
|
_0, _0, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: An interim solution to the issues with static functions
|
/// Wrapper method for `Matrix::identity`
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
static pure fn identity() -> Mat3<T> {
|
static pure fn identity() -> Mat3<T> { Matrix::identity() }
|
||||||
let _0 = Number::from(0);
|
|
||||||
let _1 = Number::from(1);
|
|
||||||
Mat3::new(_1, _0, _0,
|
|
||||||
_0, _1, _0,
|
|
||||||
_0, _0, _1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: An interim solution to the issues with static functions
|
/// Wrapper method for `Matrix::zero`
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
static pure fn zero() -> Mat3<T> {
|
static pure fn zero() -> Mat3<T> { Matrix::zero() }
|
||||||
let _0 = Number::from(0);
|
|
||||||
Mat3::new(_0, _0, _0,
|
|
||||||
_0, _0, _0,
|
|
||||||
_0, _0, _0)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a matrix from an angular rotation around the `x` axis
|
* Construct a matrix from an angular rotation around the `x` axis
|
||||||
|
|
21
src/mat4.rs
21
src/mat4.rs
|
@ -123,26 +123,13 @@ pub impl<T:Copy Float> Mat4<T> {
|
||||||
_0, _0, _0, value)
|
_0, _0, _0, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: An interim solution to the issues with static functions
|
/// Wrapper method for `Matrix::identity`
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
static pure fn identity() -> Mat4<T> {
|
static pure fn identity() -> Mat4<T> { Matrix::identity() }
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: An interim solution to the issues with static functions
|
/// Wrapper method for `Matrix::zero`
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
static pure fn zero() -> Mat4<T> {
|
static pure fn zero() -> Mat4<T> { Matrix::zero() }
|
||||||
let _0 = Number::from(0);
|
|
||||||
Mat4::new(_0, _0, _0, _0,
|
|
||||||
_0, _0, _0, _0,
|
|
||||||
_0, _0, _0, _0,
|
|
||||||
_0, _0, _0, _0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub impl<T:Copy Float> Mat4<T>: Matrix<T, Vec4<T>> {
|
pub impl<T:Copy Float> Mat4<T>: Matrix<T, Vec4<T>> {
|
||||||
|
|
Loading…
Reference in a new issue