This commit is contained in:
Quaternions 2024-08-30 13:19:51 -07:00
parent 247987b51d
commit d65fe40354
2 changed files with 11 additions and 7 deletions

View File

@ -46,8 +46,8 @@ macro_rules! impl_matrix {
}
// Impl floating-point based methods
//#[cfg(feature="fixed_wide_traits")]
//$crate::impl_wide_matrix_operations!( ($struct_outer { $($field_outer), + }, $size_outer), ($struct_inner, $size_inner), $fields_inner );
#[cfg(feature="fixed_wide_traits")]
$crate::impl_wide_matrix_operations!( ($struct_outer { $($field_outer), + }, $size_outer), ($struct_inner, $size_inner), $fields_inner );
};
}

View File

@ -31,7 +31,10 @@ macro_rules! impl_wide_vector_operations {
};
}
/*
// Notes:
// Mat3<Vec2>.dot(Vec3) -> Vec2
// mat.mat can be implemented off the back of mat.vec
#[doc(hidden)]
#[macro_export(local_inner_macros)]
macro_rules! impl_wide_matrix_operations {
@ -44,11 +47,11 @@ macro_rules! impl_wide_matrix_operations {
#[inline]
fn wide_mul(self, rhs: Self) -> Self::Output {
$struct{
$( $field: self.$field.wide_mul(rhs.$field) ), +
$( $field_outer: self.$field_outer.wide_mul(rhs.$field_outer) ), +
}
}
}
impl<V:core::ops::Add<Output=V>,U,T:fixed_wide_traits::wide::WideMul<U,Output=V>> fixed_wide_traits::wide::WideDot<$struct<U>> for $struct<T> {
impl<U,T:fixed_wide_traits::wide::WideMul<U,Output=V>> fixed_wide_traits::wide::WideDot<$struct<U>> for $struct<T> {
type Output=V;
#[inline]
fn wide_dot(self, rhs: $struct<U>) -> Self::Output {
@ -57,17 +60,18 @@ macro_rules! impl_wide_matrix_operations {
)
}
}
/* TODO: nasty determinant macro
impl<U:std::ops::Add<Output=U>,T:Copy+fixed_wide_traits::wide::WideMul<Output=U>> $struct<T> {
#[inline]
pub fn wide_length_squared(&self) -> U {
pub fn wide_det(&self) -> U {
$crate::sum_repeating!(
$( + self.$field.wide_mul(self.$field) ) +
)
}
}
*/
};
}
*/
// HACK: Allows us to sum repeating tokens in macros.
// See: https://stackoverflow.com/a/60187870/17452730