From 06e20b4b95e42c47a7d80782ee734c8f0e2c1a98 Mon Sep 17 00:00:00 2001 From: Rouven Spreckels Date: Tue, 27 Jul 2021 15:17:30 +0200 Subject: [PATCH 1/2] Add getter for reflection bias. Fix typos. --- src/geometry/reflection.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/geometry/reflection.rs b/src/geometry/reflection.rs index 87166b81..a48b8024 100644 --- a/src/geometry/reflection.rs +++ b/src/geometry/reflection.rs @@ -22,7 +22,7 @@ impl>, const D: usize> Reflection> Reflection { - /// Creates a new reflection wrt the plane orthogonal to the given axis and bias. + /// Creates a new reflection wrt. the plane orthogonal to the given axis and bias. /// /// The bias is the position of the plane on the axis. In particular, a bias equal to zero /// represents a plane that passes through the origin. @@ -33,12 +33,21 @@ impl> Reflection { } } - /// The reflexion axis. + /// The reflection axis. #[must_use] pub fn axis(&self) -> &Vector { &self.axis } + /// The reflection bias. + /// + /// The bias is the position of the plane on the axis. In particular, a bias equal to zero + /// represents a plane that passes through the origin. + #[must_use] + pub fn bias(&self) -> T { + self.bias + } + // TODO: naming convention: reflect_to, reflect_assign ? /// Applies the reflection to the columns of `rhs`. pub fn reflect(&self, rhs: &mut Matrix) From 9824fbc67b8416d6abc519ff264bc9c6ead4d0c0 Mon Sep 17 00:00:00 2001 From: Rouven Spreckels Date: Tue, 27 Jul 2021 15:18:07 +0200 Subject: [PATCH 2/2] Add reflection alias. --- src/geometry/mod.rs | 2 ++ src/geometry/reflection_alias.rs | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/geometry/reflection_alias.rs diff --git a/src/geometry/mod.rs b/src/geometry/mod.rs index 2675817e..37ca57f9 100644 --- a/src/geometry/mod.rs +++ b/src/geometry/mod.rs @@ -73,6 +73,7 @@ mod transform_ops; mod transform_simba; mod reflection; +mod reflection_alias; mod orthographic; mod perspective; @@ -104,6 +105,7 @@ pub use self::transform::*; pub use self::transform_alias::*; pub use self::reflection::*; +pub use self::reflection_alias::*; pub use self::orthographic::Orthographic3; pub use self::perspective::Perspective3; diff --git a/src/geometry/reflection_alias.rs b/src/geometry/reflection_alias.rs new file mode 100644 index 00000000..14f55a3a --- /dev/null +++ b/src/geometry/reflection_alias.rs @@ -0,0 +1,21 @@ +use crate::base::ArrayStorage; +use crate::geometry::Reflection; +use crate::Const; + +/// A 1-dimensional reflection. +pub type Reflection1 = Reflection, ArrayStorage>; + +/// A 2-dimensional reflection. +pub type Reflection2 = Reflection, ArrayStorage>; + +/// A 3-dimensional reflection. +pub type Reflection3 = Reflection, ArrayStorage>; + +/// A 4-dimensional reflection. +pub type Reflection4 = Reflection, ArrayStorage>; + +/// A 5-dimensional reflection. +pub type Reflection5 = Reflection, ArrayStorage>; + +/// A 6-dimensional reflection. +pub type Reflection6 = Reflection, ArrayStorage>;