Struct splashsurf_lib::topology::DirectedAxis [−][src]
Expand description
Identifies a direction along a specific cartesian axis
Fields
axis: Axis
direction: Direction
Implementations
Returns a reference to an array of all possible directed axes in 3D
Constructs a new directed axis
use crate::splashsurf_lib::topology::{Axis, DirectedAxis, Direction};
assert_eq!(DirectedAxis::new(Axis::X, Direction::Positive),
Axis::X.with_direction(Direction::Positive));
Returns a directed axis with the opposite direction
use crate::splashsurf_lib::topology::{Axis, DirectedAxis, Direction};
assert_eq!(DirectedAxis::new(Axis::X, Direction::Positive)
.opposite(), DirectedAxis::new(Axis::X, Direction::Negative));
assert_eq!(DirectedAxis::new(Axis::Z, Direction::Negative)
.opposite(), DirectedAxis::new(Axis::Z, Direction::Positive));
Converts the directed axis into a unique index in the range (0..=5)
Converts an index in the range (0..=5)
to the corresponding directed axis, panics if the index is out of range
pub fn apply_single_step<N: Clone + CheckedAdd<Output = N> + CheckedSub<Output = N> + One>(
&self,
index: &[N; 3]
) -> Option<[N; 3]>
pub fn apply_single_step<N: Clone + CheckedAdd<Output = N> + CheckedSub<Output = N> + One>(
&self,
index: &[N; 3]
) -> Option<[N; 3]>
Applies an increment of 1
in the direction of this directed axis to the given index array, returns None
on overflow
use crate::splashsurf_lib::topology::{Axis, DirectedAxis, Direction};
assert_eq!(DirectedAxis::new(Axis::X, Direction::Positive)
.apply_single_step(&[1,2,3]), Some([2,2,3]));
pub fn checked_apply_step<N: Clone + CheckedAdd<Output = N> + CheckedSub<Output = N>>(
&self,
index: &[N; 3],
step: N
) -> Option<[N; 3]>
pub fn checked_apply_step<N: Clone + CheckedAdd<Output = N> + CheckedSub<Output = N>>(
&self,
index: &[N; 3],
step: N
) -> Option<[N; 3]>
Applies the given step in the direction of this directed axis to the given index array, returns None
on overflow
use crate::splashsurf_lib::topology::{Axis, DirectedAxis, Direction};
assert_eq!(DirectedAxis::new(Axis::X, Direction::Positive)
.checked_apply_step(&[1,2,3], 6), Some([7,2,3]));
assert_eq!(DirectedAxis::new(Axis::Z, Direction::Negative)
.checked_apply_step(&[1,2,3], 10), Some([1,2,-7]));
pub fn checked_apply_step_ijk<N: Clone + CheckedAdd<Output = N> + CheckedSub<Output = N>>(
&self,
index: &[N; 3],
step: &[N; 3]
) -> Option<[N; 3]>
pub fn checked_apply_step_ijk<N: Clone + CheckedAdd<Output = N> + CheckedSub<Output = N>>(
&self,
index: &[N; 3],
step: &[N; 3]
) -> Option<[N; 3]>
Applies the corresponding component of the step in the direction of this directed axis to the given index array, returns None
on overflow
use crate::splashsurf_lib::topology::{Axis, DirectedAxis, Direction};
assert_eq!(DirectedAxis::new(Axis::X, Direction::Positive)
.checked_apply_step_ijk(&[1,2,3], &[6,8,10]), Some([7,2,3]));
assert_eq!(DirectedAxis::new(Axis::Z, Direction::Negative)
.checked_apply_step_ijk(&[1,2,3], &[6,8,10]), Some([1,2,-7]));
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for DirectedAxis
impl Send for DirectedAxis
impl Sync for DirectedAxis
impl Unpin for DirectedAxis
impl UnwindSafe for DirectedAxis
Blanket Implementations
Mutably borrows from an owned value. Read more
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.