pub struct Orientation {
pub permutation_index: u8,
pub plane: OrientationPlane,
}Expand description
Describes the parametric orientation between two matched faces using a permutation matrix index (0-7).
The permutation matrix transforms face2’s parametric (u, v) coordinates
to align with face1’s. The plane field indicates whether the faces share
the same constant axis (in-plane) or have different constant axes
(cross-plane).
Construct via Orientation::from_flags when you have individual boolean
flags, or set permutation_index directly when you already know the
encoded value.
§Bit layout
permutation_index = u_reversed | (v_reversed << 1) | (swapped << 2)§Examples
use plot3d::{Orientation, OrientationPlane, PERMUTATION_MATRICES};
// Build from boolean flags: u reversed, v not reversed, axes swapped
let orient = Orientation::from_flags(true, false, true, OrientationPlane::CrossPlane);
assert_eq!(orient.permutation_index, 5); // 1 + 0 + 4
assert!(orient.u_reversed());
assert!(!orient.v_reversed());
assert!(orient.swapped());
// Retrieve the 2x2 matrix
let m = orient.matrix();
assert_eq!(*m, PERMUTATION_MATRICES[5]);Fields§
§permutation_index: u8Index (0-7) into PERMUTATION_MATRICES.
plane: OrientationPlaneWhether this is an in-plane or cross-plane match.
Implementations§
Source§impl Orientation
impl Orientation
Sourcepub fn from_flags(
u_reversed: bool,
v_reversed: bool,
swapped: bool,
plane: OrientationPlane,
) -> Self
pub fn from_flags( u_reversed: bool, v_reversed: bool, swapped: bool, plane: OrientationPlane, ) -> Self
Construct from the legacy boolean flags.
Sourcepub fn u_reversed(&self) -> bool
pub fn u_reversed(&self) -> bool
Whether block2’s u-axis is reversed relative to block1’s.
Sourcepub fn v_reversed(&self) -> bool
pub fn v_reversed(&self) -> bool
Whether block2’s v-axis is reversed relative to block1’s.
Trait Implementations§
Source§impl Clone for Orientation
impl Clone for Orientation
Source§fn clone(&self) -> Orientation
fn clone(&self) -> Orientation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Orientation
impl Debug for 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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Orientation
impl PartialEq for Orientation
Source§impl Serialize for Orientation
impl Serialize for Orientation
impl Eq for Orientation
impl StructuralPartialEq for Orientation
Auto Trait Implementations§
impl Freeze for Orientation
impl RefUnwindSafe for Orientation
impl Send for Orientation
impl Sync for Orientation
impl Unpin for Orientation
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more