From 3ce6578d566e02b945c246641eb28a038ecd7725 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Sun, 14 Jul 2013 07:53:37 +1000 Subject: [PATCH] Rename RealVec to FloatVec and use Float trait constraints --- src/core/core.rs | 2 +- src/core/mat.rs | 6 +++--- src/core/quat.rs | 2 +- src/core/vec.rs | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/core.rs b/src/core/core.rs index a16c45f..b1d7274 100644 --- a/src/core/core.rs +++ b/src/core/core.rs @@ -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}; diff --git a/src/core/mat.rs b/src/core/mat.rs index ef3150d..7a4c5ec 100644 --- a/src/core/mat.rs +++ b/src/core/mat.rs @@ -272,7 +272,7 @@ impl Neg> for Mat2 { } } -impl Mat2 { +impl Mat2 { #[inline] pub fn from_angle(radians: T) -> Mat2 { let cos_theta = radians.cos(); @@ -754,7 +754,7 @@ impl Neg> for Mat3 { } } -impl Mat3 { +impl Mat3 { /// Construct a matrix from an angular rotation around the `x` axis pub fn from_angle_x(radians: T) -> Mat3 { // http://en.wikipedia.org/wiki/Rotation_matrix#Basic_rotations @@ -838,7 +838,7 @@ impl Mat3 { } } -impl ToQuat for Mat3 { +impl ToQuat for Mat3 { /// Convert the matrix to a quaternion pub fn to_quat(&self) -> Quat { // Implemented using a mix of ideas from jMonkeyEngine and Ken Shoemake's diff --git a/src/core/quat.rs b/src/core/quat.rs index c09a86c..df18a2f 100644 --- a/src/core/quat.rs +++ b/src/core/quat.rs @@ -67,7 +67,7 @@ impl Quat { } } -impl Quat { +impl Quat { /// The multiplicative identity, ie: `q = 1 + 0i + 0j + 0i` #[inline] pub fn identity() -> Quat { diff --git a/src/core/vec.rs b/src/core/vec.rs index 0988f88..cb82ba8 100644 --- a/src/core/vec.rs +++ b/src/core/vec.rs @@ -43,8 +43,8 @@ pub trait NumVec: Neg { pub fn dot(&self, other: &Self) -> T; } -/// Vectors with real components -pub trait RealVec: NumVec + ApproxEq { +/// Vectors with floating point components +pub trait FloatVec: NumVec + ApproxEq { pub fn magnitude2(&self) -> T; pub fn magnitude(&self) -> T; pub fn angle(&self, other: &Self) -> T; @@ -332,7 +332,7 @@ impl Neg> for Vec2 { } } -impl RealVec for Vec2 { +impl FloatVec for Vec2 { /// 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 Neg> for Vec3 { } } -impl RealVec for Vec3 { +impl FloatVec for Vec3 { /// 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 Neg> for Vec4 { } } -impl RealVec for Vec4 { +impl FloatVec for Vec4 { /// 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.