pub struct Orientation { /* private fields */ }
Expand description
An orientation of a geometric object.
Captures reflection and rotation, but not position or scaling.
Implementations§
Source§impl Orientation
impl Orientation
Sourcepub fn from_reflect_and_angle(reflect_vert: bool, angle: Rotation) -> Self
pub fn from_reflect_and_angle(reflect_vert: bool, angle: Rotation) -> Self
Creates a new orientation with the given reflection and angle settings.
Sourcepub fn identity() -> Self
pub fn identity() -> Self
Returns the identity orientation with reflect_vert = false
and angle = 0.
.
Sourcepub fn apply(self, o: impl Into<Orientation>) -> Self
pub fn apply(self, o: impl Into<Orientation>) -> Self
Applies the reflection and rotation specified in
Orientation
o
to this orientation.
Sourcepub fn reflected_vert(self) -> Self
pub fn reflected_vert(self) -> Self
Reflects the orientation vertically.
Sourcepub fn reflected_horiz(self) -> Self
pub fn reflected_horiz(self) -> Self
Reflects the orientation horizontally.
Sourcepub fn flip_minus_yx(self) -> Self
pub fn flip_minus_yx(self) -> Self
Flips the orientation around the line y = -x
.
Sourcepub fn reflect_vert(&self) -> bool
pub fn reflect_vert(&self) -> bool
Returns whether the orientation is reflected vertically.
Sourcepub fn from_transformation(value: Transformation) -> Self
pub fn from_transformation(value: Transformation) -> Self
Returns the orientation represented by the given transformation.
Captures the rotation and reflection encoded by the Transformation
,
discarding the transformation’s translation.
§Example
let tf = Transformation::identity();
assert_eq!(Orientation::from_transformation(tf), NamedOrientation::R0.into());
Sourcepub fn all_rectangular() -> [Self; 8]
pub fn all_rectangular() -> [Self; 8]
Returns a slice of all 8 possible rectangular orientations.
Users should not rely upon the order of the orientations returned.
Trait Implementations§
Source§impl Clone for Orientation
impl Clone for Orientation
Source§fn clone(&self) -> Orientation
fn clone(&self) -> Orientation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more