Remove NumCast type parameters
The NumCast type parameter is no longer needed as it is a constraint of numeric::Number
This commit is contained in:
parent
d2885fea52
commit
c906578c69
4 changed files with 23 additions and 23 deletions
24
src/mat.rs
24
src/mat.rs
|
@ -313,7 +313,7 @@ pub trait Matrix4<T,V>: Matrix<T,V> {
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
pub struct Mat2<T> { x: Vec2<T>, y: Vec2<T> }
|
pub struct Mat2<T> { x: Vec2<T>, y: Vec2<T> }
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Matrix<T, Vec2<T>> for Mat2<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Matrix<T, Vec2<T>> for Mat2<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn col(&self, i: uint) -> Vec2<T> { self[i] }
|
fn col(&self, i: uint) -> Vec2<T> { self[i] }
|
||||||
|
|
||||||
|
@ -538,7 +538,7 @@ impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> +
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Matrix2<T, Vec2<T>> for Mat2<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Matrix2<T, Vec2<T>> for Mat2<T> {
|
||||||
/**
|
/**
|
||||||
* Construct a 2 x 2 matrix
|
* Construct a 2 x 2 matrix
|
||||||
*
|
*
|
||||||
|
@ -646,14 +646,14 @@ impl<T:Copy> Index<uint, Vec2<T>> for Mat2<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Neg<Mat2<T>> for Mat2<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Neg<Mat2<T>> for Mat2<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn neg(&self) -> Mat2<T> {
|
fn neg(&self) -> Mat2<T> {
|
||||||
Matrix2::from_cols(-self[0], -self[1])
|
Matrix2::from_cols(-self[0], -self[1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T>> FuzzyEq<T> for Mat2<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T>> FuzzyEq<T> for Mat2<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn fuzzy_eq(&self, other: &Mat2<T>) -> bool {
|
fn fuzzy_eq(&self, other: &Mat2<T>) -> bool {
|
||||||
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
||||||
|
@ -724,7 +724,7 @@ mat2_type!(Mat2f64<f64,Vec2f64>)
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
pub struct Mat3<T> { x: Vec3<T>, y: Vec3<T>, z: Vec3<T> }
|
pub struct Mat3<T> { x: Vec3<T>, y: Vec3<T>, z: Vec3<T> }
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Matrix<T, Vec3<T>> for Mat3<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Matrix<T, Vec3<T>> for Mat3<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn col(&self, i: uint) -> Vec3<T> { self[i] }
|
fn col(&self, i: uint) -> Vec3<T> { self[i] }
|
||||||
|
|
||||||
|
@ -998,7 +998,7 @@ impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> +
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Matrix3<T, Vec3<T>> for Mat3<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Matrix3<T, Vec3<T>> for Mat3<T> {
|
||||||
/**
|
/**
|
||||||
* Construct a 3 x 3 matrix
|
* Construct a 3 x 3 matrix
|
||||||
*
|
*
|
||||||
|
@ -1232,14 +1232,14 @@ impl<T:Copy> Index<uint, Vec3<T>> for Mat3<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Neg<Mat3<T>> for Mat3<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Neg<Mat3<T>> for Mat3<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn neg(&self) -> Mat3<T> {
|
fn neg(&self) -> Mat3<T> {
|
||||||
Matrix3::from_cols(-self[0], -self[1], -self[2])
|
Matrix3::from_cols(-self[0], -self[1], -self[2])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> FuzzyEq<T> for Mat3<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> FuzzyEq<T> for Mat3<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn fuzzy_eq(&self, other: &Mat3<T>) -> bool {
|
fn fuzzy_eq(&self, other: &Mat3<T>) -> bool {
|
||||||
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
||||||
|
@ -1315,7 +1315,7 @@ mat3_type!(Mat3f64<f64,Vec3f64>)
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
pub struct Mat4<T> { x: Vec4<T>, y: Vec4<T>, z: Vec4<T>, w: Vec4<T> }
|
pub struct Mat4<T> { x: Vec4<T>, y: Vec4<T>, z: Vec4<T>, w: Vec4<T> }
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Matrix<T, Vec4<T>> for Mat4<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Matrix<T, Vec4<T>> for Mat4<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn col(&self, i: uint) -> Vec4<T> { self[i] }
|
fn col(&self, i: uint) -> Vec4<T> { self[i] }
|
||||||
|
|
||||||
|
@ -1688,7 +1688,7 @@ impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> +
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Matrix4<T, Vec4<T>> for Mat4<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Matrix4<T, Vec4<T>> for Mat4<T> {
|
||||||
/**
|
/**
|
||||||
* Construct a 4 x 4 matrix
|
* Construct a 4 x 4 matrix
|
||||||
*
|
*
|
||||||
|
@ -1755,7 +1755,7 @@ impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> +
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Neg<Mat4<T>> for Mat4<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Neg<Mat4<T>> for Mat4<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn neg(&self) -> Mat4<T> {
|
fn neg(&self) -> Mat4<T> {
|
||||||
Matrix4::from_cols(-self[0], -self[1], -self[2], -self[3])
|
Matrix4::from_cols(-self[0], -self[1], -self[2], -self[3])
|
||||||
|
@ -1769,7 +1769,7 @@ impl<T:Copy> Index<uint, Vec4<T>> for Mat4<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T>> FuzzyEq<T> for Mat4<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T>> FuzzyEq<T> for Mat4<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn fuzzy_eq(&self, other: &Mat4<T>) -> bool {
|
fn fuzzy_eq(&self, other: &Mat4<T>) -> bool {
|
||||||
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
||||||
|
|
|
@ -12,7 +12,7 @@ use mat::{Mat4, Matrix4};
|
||||||
* can be found [here](http://www.opengl.org/wiki/GluPerspective_code).
|
* can be found [here](http://www.opengl.org/wiki/GluPerspective_code).
|
||||||
*/
|
*/
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn perspective<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>>(fovy: T, aspectRatio: T, near: T, far: T) -> Mat4<T> {
|
pub fn perspective<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>>(fovy: T, aspectRatio: T, near: T, far: T) -> Mat4<T> {
|
||||||
let ymax = near * tan(radians(fovy));
|
let ymax = near * tan(radians(fovy));
|
||||||
let xmax = ymax * aspectRatio;
|
let xmax = ymax * aspectRatio;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ pub fn perspective<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T>
|
||||||
* (http://www.opengl.org/sdk/docs/man2/xhtml/glFrustum.xml) function.
|
* (http://www.opengl.org/sdk/docs/man2/xhtml/glFrustum.xml) function.
|
||||||
*/
|
*/
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn frustum<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>>(left: T, right: T, bottom: T, top: T, near: T, far: T) -> Mat4<T> {
|
pub fn frustum<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>>(left: T, right: T, bottom: T, top: T, near: T, far: T) -> Mat4<T> {
|
||||||
let _0: T = num::cast(0);
|
let _0: T = num::cast(0);
|
||||||
let _1: T = num::cast(1);
|
let _1: T = num::cast(1);
|
||||||
let _2: T = num::cast(2);
|
let _2: T = num::cast(2);
|
||||||
|
|
|
@ -33,7 +33,7 @@ use vec::{vec3, dvec3, Vec3f, Vec3f32, Vec3f64};
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
pub struct Quat<T> { s: T, v: Vec3<T> }
|
pub struct Quat<T> { s: T, v: Vec3<T> }
|
||||||
|
|
||||||
pub impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Quat<T> {
|
pub impl<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Quat<T> {
|
||||||
/**
|
/**
|
||||||
* Construct the quaternion from one scalar component and three
|
* Construct the quaternion from one scalar component and three
|
||||||
* imaginary components
|
* imaginary components
|
||||||
|
@ -378,14 +378,14 @@ impl<T:Copy> Index<uint, T> for Quat<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Neg<Quat<T>> for Quat<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T> + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> Neg<Quat<T>> for Quat<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn neg(&self) -> Quat<T> {
|
fn neg(&self) -> Quat<T> {
|
||||||
Quat::new(-self[0], -self[1], -self[2], -self[3])
|
Quat::new(-self[0], -self[1], -self[2], -self[3])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T>> FuzzyEq<T> for Quat<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T>> FuzzyEq<T> for Quat<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn fuzzy_eq(&self, other: &Quat<T>) -> bool {
|
fn fuzzy_eq(&self, other: &Quat<T>) -> bool {
|
||||||
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
||||||
|
|
12
src/vec.rs
12
src/vec.rs
|
@ -683,7 +683,7 @@ impl<T:Copy + Number + Zero> ToHomogeneous<Vec3<T>> for Vec2<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> EuclideanVector<T> for Vec2<T> {
|
impl<T:Copy + Float + Zero + One + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> EuclideanVector<T> for Vec2<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn length2(&self) -> T {
|
fn length2(&self) -> T {
|
||||||
self.dot(self)
|
self.dot(self)
|
||||||
|
@ -742,7 +742,7 @@ impl<T:Copy + Float + NumCast + Zero + One + Add<T,T> + Sub<T,T> + Mul<T,T> + Di
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T>> FuzzyEq<T> for Vec2<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T>> FuzzyEq<T> for Vec2<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn fuzzy_eq(&self, other: &Vec2<T>) -> bool {
|
fn fuzzy_eq(&self, other: &Vec2<T>) -> bool {
|
||||||
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
||||||
|
@ -1077,7 +1077,7 @@ impl<T:Copy + Number + Zero + One + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> +
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> EuclideanVector<T> for Vec3<T> {
|
impl<T:Copy + Float + Zero + One + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> EuclideanVector<T> for Vec3<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn length2(&self) -> T {
|
fn length2(&self) -> T {
|
||||||
self.dot(self)
|
self.dot(self)
|
||||||
|
@ -1136,7 +1136,7 @@ impl<T:Copy + Float + NumCast + Zero + One + Add<T,T> + Sub<T,T> + Mul<T,T> + Di
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T>> FuzzyEq<T> for Vec3<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T>> FuzzyEq<T> for Vec3<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn fuzzy_eq(&self, other: &Vec3<T>) -> bool {
|
fn fuzzy_eq(&self, other: &Vec3<T>) -> bool {
|
||||||
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
||||||
|
@ -1464,7 +1464,7 @@ impl<T:Copy + Number + Zero + One> NumericVector4<T> for Vec4<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> EuclideanVector<T> for Vec4<T> {
|
impl<T:Copy + Float + Zero + One + Add<T,T> + Sub<T,T> + Mul<T,T> + Div<T,T> + Neg<T>> EuclideanVector<T> for Vec4<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn length2(&self) -> T {
|
fn length2(&self) -> T {
|
||||||
self.dot(self)
|
self.dot(self)
|
||||||
|
@ -1523,7 +1523,7 @@ impl<T:Copy + Float + NumCast + Zero + One + Add<T,T> + Sub<T,T> + Mul<T,T> + Di
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T:Copy + Float + NumCast + Zero + One + FuzzyEq<T>> FuzzyEq<T> for Vec4<T> {
|
impl<T:Copy + Float + Zero + One + FuzzyEq<T>> FuzzyEq<T> for Vec4<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn fuzzy_eq(&self, other: &Vec4<T>) -> bool {
|
fn fuzzy_eq(&self, other: &Vec4<T>) -> bool {
|
||||||
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
self.fuzzy_eq_eps(other, &num::cast(FUZZY_EPSILON))
|
||||||
|
|
Loading…
Reference in a new issue