Type Alias splashsurf_lib::topology::Axis

source ·
pub type Axis = CartesianAxis3d;
Expand description

Abbreviated type alias for cartesian coordinate axes in 3D

Aliased Type§

enum Axis {
    X,
    Y,
    Z,
}

Variants§

§

X

The x-axis

§

Y

The y-axis

§

Z

The z-axis

Implementations§

source§

impl CartesianAxis3d

source

pub const fn all_possible() -> &'static [Axis; 3]

Returns a reference to an array containing all 3D cartesian axes

use crate::splashsurf_lib::topology::Axis;
assert_eq!(Axis::all_possible()[0], Axis::X);
assert_eq!(Axis::all_possible()[2], Axis::Z);
assert_eq!(Axis::all_possible().len(), 3);
source

pub const fn dim(self) -> usize

Converts the cartesian axis into the corresponding 3D dimension index (X=0, Y=1, Z=2)

use crate::splashsurf_lib::topology::Axis;
assert_eq!(Axis::X.dim(), 0);
assert_eq!(Axis::Y.dim(), 1);
assert_eq!(Axis::Z.dim(), 2);
source

pub const fn orthogonal_axes(&self) -> [Self; 2]

Returns the other two axes that are orthogonal to the current axis

use crate::splashsurf_lib::topology::Axis;
assert_eq!(Axis::X.orthogonal_axes(), [Axis::Y, Axis::Z]);
source

pub const fn with_direction(self, direction: Direction) -> DirectedAxis

Combines this coordinate axis with a direction into a DirectedAxis

use crate::splashsurf_lib::topology::{Axis, DirectedAxis, Direction};
assert_eq!(Axis::X.with_direction(Direction::Positive), DirectedAxis::new(Axis::X, Direction::Positive));

Trait Implementations§

source§

impl Clone for CartesianAxis3d

source§

fn clone(&self) -> CartesianAxis3d

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CartesianAxis3d

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for CartesianAxis3d

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for CartesianAxis3d

source§

fn cmp(&self, other: &CartesianAxis3d) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<CartesianAxis3d> for CartesianAxis3d

source§

fn eq(&self, other: &CartesianAxis3d) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<CartesianAxis3d> for CartesianAxis3d

source§

fn partial_cmp(&self, other: &CartesianAxis3d) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for CartesianAxis3d

source§

impl Eq for CartesianAxis3d

source§

impl StructuralEq for CartesianAxis3d

source§

impl StructuralPartialEq for CartesianAxis3d