Struct substrate::geometry::prelude::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) -> Orientation
pub fn from_reflect_and_angle(reflect_vert: bool, angle: f64) -> Orientation
Creates a new orientation with the given reflection and angle settings.
sourcepub fn identity() -> Orientation
pub fn identity() -> Orientation
Returns the identity orientation with reflect_vert = false
and angle = 0.
.
sourcepub fn apply(self, o: impl Into<Orientation>) -> Orientation
pub fn apply(self, o: impl Into<Orientation>) -> Orientation
Applies the reflection and rotation specified in
Orientation
o
to this orientation.
sourcepub fn reflected_vert(self) -> Orientation
pub fn reflected_vert(self) -> Orientation
Reflects the orientation vertically.
sourcepub fn reflected_horiz(self) -> Orientation
pub fn reflected_horiz(self) -> Orientation
Reflects the orientation horizontally.
sourcepub fn r90(self) -> Orientation
pub fn r90(self) -> Orientation
Rotates the orientation 90 degrees counter-clockwise.
sourcepub fn r180(self) -> Orientation
pub fn r180(self) -> Orientation
Rotates the orientation 180 degrees.
sourcepub fn r270(self) -> Orientation
pub fn r270(self) -> Orientation
Rotates the orientation 180 degrees counter-clockwise.
sourcepub fn r90cw(self) -> Orientation
pub fn r90cw(self) -> Orientation
Rotates the orientation 90 degrees clockwise.
sourcepub fn r180cw(self) -> Orientation
pub fn r180cw(self) -> Orientation
Rotates the orientation 180 degrees clockwise.
sourcepub fn r270cw(self) -> Orientation
pub fn r270cw(self) -> Orientation
Rotates the orientation 270 degrees clockwise.
sourcepub fn flip_yx(self) -> Orientation
pub fn flip_yx(self) -> Orientation
Flips the orientation around the line y = x
.
sourcepub fn flip_minus_yx(self) -> Orientation
pub fn flip_minus_yx(self) -> Orientation
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: &Orientation) -> bool
pub fn approx_eq(&self, other: &Orientation) -> bool
Compares the two orientations for approximate equality.
sourcepub fn from_transformation(value: Transformation) -> Orientation
pub fn from_transformation(value: Transformation) -> Orientation
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() -> [Orientation; 8]
pub fn all_rectangular() -> [Orientation; 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<Orientation, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Orientation, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl From<NamedOrientation> for Orientation
impl From<NamedOrientation> for Orientation
source§fn from(value: NamedOrientation) -> Orientation
fn from(value: NamedOrientation) -> Orientation
source§impl From<Orientation> for OrientationBytes
impl From<Orientation> for OrientationBytes
source§fn from(value: Orientation) -> OrientationBytes
fn from(value: Orientation) -> OrientationBytes
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 moresource§impl Serialize for Orientation
impl Serialize for Orientation
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Copy for Orientation
impl StructuralPartialEq for Orientation
Auto Trait Implementations§
impl RefUnwindSafe for Orientation
impl Send for Orientation
impl Sync for Orientation
impl Unpin for Orientation
impl UnwindSafe for Orientation
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, U> CustomHardwareType<Flipped<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
impl<T, U> CustomHardwareType<Flipped<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
source§fn from_layout_type(other: &Flipped<T>) -> U
fn from_layout_type(other: &Flipped<T>) -> U
source§impl<T, U> CustomHardwareType<InOut<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
impl<T, U> CustomHardwareType<InOut<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
source§fn from_layout_type(other: &InOut<T>) -> U
fn from_layout_type(other: &InOut<T>) -> U
source§impl<T, U> CustomHardwareType<Input<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
impl<T, U> CustomHardwareType<Input<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
source§fn from_layout_type(other: &Input<T>) -> U
fn from_layout_type(other: &Input<T>) -> U
source§impl<T, U> CustomHardwareType<Output<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
impl<T, U> CustomHardwareType<Output<T>> for Uwhere
U: CustomHardwareType<T>,
T: HardwareType,
source§fn from_layout_type(other: &Output<T>) -> U
fn from_layout_type(other: &Output<T>) -> U
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request