use crate::{
algebra::Identity,
common,
quaternion::Quaternion,
scalar::{HasScalar, Scalar},
};
impl<T> Quaternion<T> {
#[inline]
pub const fn new(x: T, y: T, z: T, w: T) -> Self {
Self::from_array([x, y, z, w])
}
#[inline]
pub const fn len(&self) -> usize {
4
}
#[inline]
pub const fn is_empty(&self) -> bool {
false
}
}
impl<T> Default for Quaternion<T>
where
Self: Identity,
{
fn default() -> Self {
Self::IDENTITY
}
}
common::impl_tuple_wrapper_casts!([T], Quaternion<T> => Quaternion<U>, item: T, len: 4);
common::impl_bytemuck_basic!([T], Quaternion<T>, item: T);
impl<T> HasScalar for Quaternion<T>
where
T: Scalar,
{
type Scalar = T;
}