Files
Bampy/bampy/src/slicer/axis.rs
2024-07-22 13:33:06 +02:00

31 lines
605 B
Rust

use nalgebra::Vector3;
use super::FloatValue;
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
#[repr(usize)]
pub enum Axis {
#[default]
X = 0,
Y = 1,
Z = 2,
}
impl Axis {
pub fn other(&self) -> (Self, Self) {
match self {
Axis::X => (Axis::Y, Axis::Z),
Axis::Y => (Axis::X, Axis::Z),
Axis::Z => (Axis::X, Axis::Y),
}
}
pub fn normal(&self) -> Vector3<FloatValue> {
match self {
Axis::X => Vector3::x(),
Axis::Y => Vector3::y(),
Axis::Z => Vector3::z(),
}
}
}