mirror of
https://github.com/Theaninova/Bampy.git
synced 2025-12-11 03:56:17 +00:00
31 lines
605 B
Rust
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(),
|
|
}
|
|
}
|
|
}
|