From 23a6ffb2434e7c89e0c1c30bfb02d8720f37ca99 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Wed, 28 Aug 2024 11:05:02 -0700 Subject: [PATCH] wip transpose --- fixed_wide_vectors/src/macros/mod.rs | 15 ++++++++--- fixed_wide_vectors/src/vector.rs | 40 ++++++++++++++-------------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/fixed_wide_vectors/src/macros/mod.rs b/fixed_wide_vectors/src/macros/mod.rs index 2d5a568..a5604e7 100644 --- a/fixed_wide_vectors/src/macros/mod.rs +++ b/fixed_wide_vectors/src/macros/mod.rs @@ -252,9 +252,18 @@ macro_rules! impl_vector { #[doc(hidden)] #[macro_export(local_inner_macros)] -macro_rules! impl_vector { - ( $struct: ident { $($field: ident), + }, ( $($generic: ident), + ), $size: expr, - $struct: ident { $($field: ident), + }, ( $($generic: ident), + ), $size: expr ) => { +macro_rules! impl_matrix { + ( $struct_outer: ident { $($field_outer: ident), + }, $size_outer: expr, + $struct_inner: ident { $($field_inner: ident), + }, $size_inner: expr ) => { + impl Transpose for $struct_outer<$struct_inner> { + fn transpose(self) -> $struct_inner<$struct_outer> { + $struct_inner{ + $( $field_inner: $struct_outer { + $( $field_outer: self.$field_outer.$field_inner), + + } ), + + } + } + } } } diff --git a/fixed_wide_vectors/src/vector.rs b/fixed_wide_vectors/src/vector.rs index 34d29f1..323bb9a 100644 --- a/fixed_wide_vectors/src/vector.rs +++ b/fixed_wide_vectors/src/vector.rs @@ -67,43 +67,43 @@ crate::impl_vector!(Vector2 { x, y }, (T, T), 2); crate::impl_vector!(Vector3 { x, y, z }, (T, T, T), 3); crate::impl_vector!(Vector4 { x, y, z, w }, (T, T, T, T), 4); -/* +//* crate::impl_matrix!( - Vector2 { x, y }, (T, T), 2, - Vector2 { x, y }, (T, T), 2, + Vector2 { x, y }, 2, + Vector2 { x, y }, 2 ); crate::impl_matrix!( - Vector2 { x, y }, (T, T), 2, - Vector3 { x, y, z }, (T, T, T), 3, + Vector2 { x, y }, 2, + Vector3 { x, y, z }, 3 ); crate::impl_matrix!( - Vector2 { x, y }, (T, T), 2, - Vector4 { x, y, z, w }, (T, T, T, T), 4, + Vector2 { x, y }, 2, + Vector4 { x, y, z, w }, 4 ); crate::impl_matrix!( - Vector3 { x, y, z }, (T, T, T), 3, - Vector2 { x, y }, (T, T), 2, + Vector3 { x, y, z }, 3, + Vector2 { x, y }, 2 ); crate::impl_matrix!( - Vector3 { x, y, z }, (T, T, T), 3, - Vector3 { x, y, z }, (T, T, T), 3, + Vector3 { x, y, z }, 3, + Vector3 { x, y, z }, 3 ); crate::impl_matrix!( - Vector3 { x, y, z }, (T, T, T), 3, - Vector4 { x, y, z, w }, (T, T, T, T), 4, + Vector3 { x, y, z }, 3, + Vector4 { x, y, z, w }, 4 ); crate::impl_matrix!( - Vector4 { x, y, z, w }, (T, T, T, T), 4, - Vector2 { x, y }, (T, T), 2, + Vector4 { x, y, z, w }, 4, + Vector2 { x, y }, 2 ); crate::impl_matrix!( - Vector4 { x, y, z, w }, (T, T, T, T), 4, - Vector3 { x, y, z }, (T, T, T), 3, + Vector4 { x, y, z, w }, 4, + Vector3 { x, y, z }, 3 ); crate::impl_matrix!( - Vector4 { x, y, z, w }, (T, T, T, T), 4, - Vector4 { x, y, z, w }, (T, T, T, T), 4, + Vector4 { x, y, z, w }, 4, + Vector4 { x, y, z, w }, 4 ); -*/ +//*/