Struct geometry::orientation::Orientation
source · 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: f64) -> Self
pub fn from_reflect_and_angle(reflect_vert: bool, angle: f64) -> 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 approx_eq(&self, other: &Self) -> bool
pub fn approx_eq(&self, other: &Self) -> bool
Compares the two orientations for approximate equality.
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 moresource§impl Debug for Orientation
impl Debug for Orientation
source§impl Default for Orientation
impl Default for Orientation
source§fn default() -> Orientation
fn default() -> Orientation
source§impl<'de> Deserialize<'de> for Orientation
impl<'de> Deserialize<'de> for Orientation
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<NamedOrientation> for Orientation
impl From<NamedOrientation> for Orientation
source§fn from(value: NamedOrientation) -> Self
fn from(value: NamedOrientation) -> Self
source§impl From<Orientation> for OrientationBytes
impl From<Orientation> for OrientationBytes
source§fn from(value: Orientation) -> Self
fn from(value: Orientation) -> Self
source§impl PartialEq for Orientation
impl PartialEq for Orientation
source§fn eq(&self, other: &Orientation) -> bool
fn eq(&self, other: &Orientation) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for Orientation
impl PartialOrd for Orientation
source§fn partial_cmp(&self, other: &Orientation) -> Option<Ordering>
fn partial_cmp(&self, other: &Orientation) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more