wip
This commit is contained in:
parent
eefbdafc16
commit
014b8333ff
@ -84,6 +84,60 @@ macro_rules! impl_wide_vector_operations {
|
||||
}
|
||||
|
||||
|
||||
// Notes:
|
||||
// Mat3<Vec2>.dot(Vec2) -> Vec3
|
||||
// Mat3<Vec4>.dot(Mat4<Vec2>) -> Mat3<Vec2>
|
||||
// mat.mat can be implemented off the back of mat.vec
|
||||
|
||||
#[doc(hidden)]
|
||||
#[macro_export(local_inner_macros)]
|
||||
macro_rules! impl_wide_matrix_mul {
|
||||
(
|
||||
//TODO: Fixed point impls
|
||||
$lhs: expr, $rhs: expr,
|
||||
($struct_outer: ident { $($field_outer: ident), + }, $vector_outer: ident { $($vector_field_outer: ident), + }, $size_outer: expr),
|
||||
($struct_inner: ident { $($field_inner: ident), + }, $matrix_inner: ident { $($matrix_field_inner: ident), + }, $size_inner: expr),
|
||||
($rhs_struct_inner: ident { $($rhs_field_inner: ident), + }, $rhs_matrix_inner: ident { $($rhs_matrix_field_inner: ident), + }, $rhs_size_inner: expr)
|
||||
) => {
|
||||
impl<T,U> fixed_wide_traits::wide::WideDot<$matrix_inner<$rhs_struct_inner<U>>> for $struct_outer<$struct_inner<T>>
|
||||
where
|
||||
$struct_inner<T>:fixed_wide_traits::wide::WideDot<$rhs_struct_inner<U>>,
|
||||
{
|
||||
type Output=$struct_outer<<$struct_inner<T> as fixed_wide_traits::wide::WideDot<$rhs_struct_inner<U>>::Output>;
|
||||
#[inline]
|
||||
fn wide_dot(self,rhs:$matrix_inner<$rhs_struct_inner<U>>)->Self::Output{
|
||||
//just made this up, don't trust it
|
||||
let tr=rhs.transpose();
|
||||
//TODO: use a macro expansion instead of transpose and map
|
||||
self.map(|axis|
|
||||
tr.map(|trax|
|
||||
axis.wide_dot(trax)
|
||||
).to_vector()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#[doc(hidden)]
|
||||
#[macro_export(local_inner_macros)]
|
||||
macro_rules! impl_wide_matrix_operations {
|
||||
(
|
||||
($struct_outer: ident { $($field_outer: ident), + }, $vector_outer: ident { $($vector_field_outer: ident), + }, $size_outer: expr),
|
||||
($struct_inner: ident { $($field_inner: ident), + }, $matrix_inner: ident { $($matrix_field_inner: ident), + }, $size_inner: expr)
|
||||
) => {
|
||||
/* 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_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
|
||||
#[doc(hidden)]
|
||||
|
Loading…
Reference in New Issue
Block a user