use crate::{
common,
numeric::{NegOne, One, Zero},
vector::{Vector, Vector4Fields},
};
impl<T> Vector<T, 4> {
#[inline]
pub const fn new(x: T, y: T, z: T, w: T) -> Self {
Self::from_array([x, y, z, w])
}
}
impl<T> Vector<T, 4>
where
T: Zero + One,
{
pub const X: Self = Self::new(T::ONE, T::ZERO, T::ZERO, T::ZERO);
pub const Y: Self = Self::new(T::ZERO, T::ONE, T::ZERO, T::ZERO);
pub const Z: Self = Self::new(T::ZERO, T::ZERO, T::ONE, T::ZERO);
pub const W: Self = Self::new(T::ZERO, T::ZERO, T::ZERO, T::ONE);
pub const AXES: [Self; 4] = [Self::X, Self::Y, Self::Z, Self::W];
}
impl<T> Vector<T, 4>
where
T: Zero + NegOne,
{
pub const NEG_X: Self = Self::new(T::NEG_ONE, T::ZERO, T::ZERO, T::ZERO);
pub const NEG_Y: Self = Self::new(T::ZERO, T::NEG_ONE, T::ZERO, T::ZERO);
pub const NEG_Z: Self = Self::new(T::ZERO, T::ZERO, T::NEG_ONE, T::ZERO);
pub const NEG_W: Self = Self::new(T::ZERO, T::ZERO, T::ZERO, T::NEG_ONE);
}
common::_impl_layout_field_access!([T], Vector<T, 4> => Vector4Fields<T>);