Rename RealVec to FloatVec and use Float trait constraints
This commit is contained in:
parent
04c24a01fa
commit
3ce6578d56
4 changed files with 10 additions and 10 deletions
|
@ -20,7 +20,7 @@ pub use self::mat::{Mat2, ToMat2};
|
|||
pub use self::mat::{Mat3, ToMat3};
|
||||
pub use self::mat::{Mat4, ToMat4};
|
||||
pub use self::quat::{Quat, ToQuat};
|
||||
pub use self::vec::{NumVec, RealVec};
|
||||
pub use self::vec::{NumVec, FloatVec};
|
||||
pub use self::vec::{OrdVec, EqVec, BoolVec};
|
||||
pub use self::vec::{Vec2, ToVec2, AsVec2};
|
||||
pub use self::vec::{Vec3, ToVec3, AsVec3};
|
||||
|
|
|
@ -272,7 +272,7 @@ impl<T:Clone + Num> Neg<Mat2<T>> for Mat2<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Clone + Real> Mat2<T> {
|
||||
impl<T:Clone + Float> Mat2<T> {
|
||||
#[inline]
|
||||
pub fn from_angle(radians: T) -> Mat2<T> {
|
||||
let cos_theta = radians.cos();
|
||||
|
@ -754,7 +754,7 @@ impl<T:Clone + Num> Neg<Mat3<T>> for Mat3<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Clone + Real> Mat3<T> {
|
||||
impl<T:Clone + Float> Mat3<T> {
|
||||
/// Construct a matrix from an angular rotation around the `x` axis
|
||||
pub fn from_angle_x(radians: T) -> Mat3<T> {
|
||||
// http://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations
|
||||
|
@ -838,7 +838,7 @@ impl<T:Clone + Real> Mat3<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Clone + Real> ToQuat<T> for Mat3<T> {
|
||||
impl<T:Clone + Float> ToQuat<T> for Mat3<T> {
|
||||
/// Convert the matrix to a quaternion
|
||||
pub fn to_quat(&self) -> Quat<T> {
|
||||
// Implemented using a mix of ideas from jMonkeyEngine and Ken Shoemake's
|
||||
|
|
|
@ -67,7 +67,7 @@ impl<T> Quat<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Clone + Real> Quat<T> {
|
||||
impl<T:Clone + Float> Quat<T> {
|
||||
/// The multiplicative identity, ie: `q = 1 + 0i + 0j + 0i`
|
||||
#[inline]
|
||||
pub fn identity() -> Quat<T> {
|
||||
|
|
|
@ -43,8 +43,8 @@ pub trait NumVec<T,Slice>: Neg<T> {
|
|||
pub fn dot(&self, other: &Self) -> T;
|
||||
}
|
||||
|
||||
/// Vectors with real components
|
||||
pub trait RealVec<T,Slice>: NumVec<T,Slice> + ApproxEq<T> {
|
||||
/// Vectors with floating point components
|
||||
pub trait FloatVec<T,Slice>: NumVec<T,Slice> + ApproxEq<T> {
|
||||
pub fn magnitude2(&self) -> T;
|
||||
pub fn magnitude(&self) -> T;
|
||||
pub fn angle(&self, other: &Self) -> T;
|
||||
|
@ -332,7 +332,7 @@ impl<T:Num> Neg<Vec2<T>> for Vec2<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Real> RealVec<T,[T,..2]> for Vec2<T> {
|
||||
impl<T:Float> FloatVec<T,[T,..2]> for Vec2<T> {
|
||||
/// Returns the squared magnitude of the vector. This does not perform a
|
||||
/// square root operation like in the `magnitude` method and can therefore
|
||||
/// be more efficient for comparing the magnitudes of two vectors.
|
||||
|
@ -910,7 +910,7 @@ impl<T:Num> Neg<Vec3<T>> for Vec3<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Real> RealVec<T,[T,..3]> for Vec3<T> {
|
||||
impl<T:Float> FloatVec<T,[T,..3]> for Vec3<T> {
|
||||
/// Returns the squared magnitude of the vector. This does not perform a
|
||||
/// square root operation like in the `magnitude` method and can therefore
|
||||
/// be more efficient for comparing the magnitudes of two vectors.
|
||||
|
@ -1516,7 +1516,7 @@ impl<T:Num> Neg<Vec4<T>> for Vec4<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T:Real> RealVec<T,[T,..4]> for Vec4<T> {
|
||||
impl<T:Float> FloatVec<T,[T,..4]> for Vec4<T> {
|
||||
/// Returns the squared magnitude of the vector. This does not perform a
|
||||
/// square root operation like in the `magnitude` method and can therefore
|
||||
/// be more efficient for comparing the magnitudes of two vectors.
|
||||
|
|
Loading…
Reference in a new issue