diff --git a/src/test/test_vec.rs b/src/test/test_vec.rs index e13245b..da4e314 100644 --- a/src/test/test_vec.rs +++ b/src/test/test_vec.rs @@ -76,7 +76,7 @@ fn test_Vec2() { } #[test] -fn test_Vec2_geometric() { +fn test_Vec2_euclidean() { let a = Vec2::new(5f, 12f); // (5, 12, 13) Pythagorean triple let b0 = Vec2::new(3f, 4f); // (3, 4, 5) Pythagorean triple let b = a.add_v(&b0); @@ -190,7 +190,7 @@ fn test_Vec3() { } #[test] -fn test_Vec3_geometric() { +fn test_Vec3_euclidean() { let a = Vec3::new(2f, 3f, 6f); // (2, 3, 6, 7) Pythagorean quadruple let b0 = Vec3::new(1f, 4f, 8f); // (1, 4, 8, 9) Pythagorean quadruple let b = a.add_v(&b0); @@ -304,7 +304,7 @@ fn test_Vec4() { } #[test] -fn test_Vec4_geometric() { +fn test_Vec4_euclidean() { let a = Vec4::new(1f, 2f, 4f, 10f); // (1, 2, 4, 10, 11) Pythagorean quintuple let b0 = Vec4::new(1f, 2f, 8f, 10f); // (1, 2, 8, 10, 13) Pythagorean quintuple let b = a.add_v(&b0); diff --git a/src/vec.rs b/src/vec.rs index d070086..8d4976c 100644 --- a/src/vec.rs +++ b/src/vec.rs @@ -64,12 +64,20 @@ pub trait Vector4: Vector { */ pub trait NumericVector: Vector, Neg { /** - * Returns a vector with each component set to one + * The standard basis vector + * + * # Returns + * + * A vector with each component set to one */ static pure fn identity() -> self; /** - * Returns a vector with each component set to zero + * The null vector + * + * # Returns + * + * A vector with each component set to zero */ static pure fn zero() -> self; @@ -172,9 +180,13 @@ pub trait NumericVector4: NumericVector { } /** - * A vector with geometric properties + * A Euclidean (or Affine) vector + * + * # Type parameters + * + * * `T` - The type of the components. This should be a floating point type. */ -pub trait GeometricVector: NumericVector { +pub trait EuclideanVector: NumericVector { /** * Returns the squared length of the vector */ @@ -206,8 +218,15 @@ pub trait GeometricVector: NumericVector { pure fn lerp(&self, other: &self, amount: T) -> self; } -pub trait MutableGeometricVector: MutableNumericVector<&self/T>, - GeometricVector { +/** + * A mutable Euclidean (or Affine) vector + * + * # Type parameters + * + * * `T` - The type of the components. This should be a floating point type. + */ +pub trait MutableEuclideanVector: MutableNumericVector<&self/T>, + EuclideanVector { /** * Normalize the vector */ @@ -368,7 +387,7 @@ pub impl Vec2: MutableNumericVector<&self/T> { } } -pub impl Vec2: GeometricVector { +pub impl Vec2: EuclideanVector { #[inline(always)] pure fn length2(&self) -> T { self.dot(self) @@ -402,7 +421,7 @@ pub impl Vec2: GeometricVector { } } -pub impl Vec2: MutableGeometricVector<&self/T> { +pub impl Vec2: MutableEuclideanVector<&self/T> { #[inline(always)] fn normalize_self(&mut self) { let mut n: T = Number::from(1); @@ -622,7 +641,7 @@ pub impl Vec3: MutableNumericVector3<&self/T> { } } -pub impl Vec3: GeometricVector { +pub impl Vec3: EuclideanVector { #[inline(always)] pure fn length2(&self) -> T { self.dot(self) @@ -656,7 +675,7 @@ pub impl Vec3: GeometricVector { } } -pub impl Vec3: MutableGeometricVector<&self/T> { +pub impl Vec3: MutableEuclideanVector<&self/T> { #[inline(always)] fn normalize_self(&mut self) { let mut n: T = Number::from(1); @@ -875,7 +894,7 @@ pub impl Vec4: MutableNumericVector<&self/T> { } } -pub impl Vec4: GeometricVector { +pub impl Vec4: EuclideanVector { #[inline(always)] pure fn length2(&self) -> T { self.dot(self) @@ -909,7 +928,7 @@ pub impl Vec4: GeometricVector { } } -pub impl Vec4: MutableGeometricVector<&self/T> { +pub impl Vec4: MutableEuclideanVector<&self/T> { #[inline(always)] fn normalize_self(&mut self) { let mut n: T = Number::from(1);