forked from M-Labs/nalgebra
Merge pull request #955 from qu1x/reflection
Add bias getter and alias for reflection.
This commit is contained in:
commit
441bfcb3ff
@ -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;
|
||||
|
@ -22,7 +22,7 @@ impl<T: ComplexField, S: Storage<T, Const<D>>, const D: usize> Reflection<T, Con
|
||||
}
|
||||
|
||||
impl<T: ComplexField, D: Dim, S: Storage<T, D>> Reflection<T, D, S> {
|
||||
/// 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<T: ComplexField, D: Dim, S: Storage<T, D>> Reflection<T, D, S> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The reflexion axis.
|
||||
/// The reflection axis.
|
||||
#[must_use]
|
||||
pub fn axis(&self) -> &Vector<T, D, S> {
|
||||
&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<R2: Dim, C2: Dim, S2>(&self, rhs: &mut Matrix<T, R2, C2, S2>)
|
||||
|
21
src/geometry/reflection_alias.rs
Normal file
21
src/geometry/reflection_alias.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use crate::base::ArrayStorage;
|
||||
use crate::geometry::Reflection;
|
||||
use crate::Const;
|
||||
|
||||
/// A 1-dimensional reflection.
|
||||
pub type Reflection1<T> = Reflection<T, Const<1>, ArrayStorage<T, 1, 1>>;
|
||||
|
||||
/// A 2-dimensional reflection.
|
||||
pub type Reflection2<T> = Reflection<T, Const<2>, ArrayStorage<T, 2, 1>>;
|
||||
|
||||
/// A 3-dimensional reflection.
|
||||
pub type Reflection3<T> = Reflection<T, Const<3>, ArrayStorage<T, 3, 1>>;
|
||||
|
||||
/// A 4-dimensional reflection.
|
||||
pub type Reflection4<T> = Reflection<T, Const<4>, ArrayStorage<T, 4, 1>>;
|
||||
|
||||
/// A 5-dimensional reflection.
|
||||
pub type Reflection5<T> = Reflection<T, Const<5>, ArrayStorage<T, 5, 1>>;
|
||||
|
||||
/// A 6-dimensional reflection.
|
||||
pub type Reflection6<T> = Reflection<T, Const<6>, ArrayStorage<T, 6, 1>>;
|
Loading…
Reference in New Issue
Block a user