what if do like this - wait idk

This commit is contained in:
Quaternions 2024-08-28 14:09:44 -07:00
parent c9b999b8a6
commit 33b335f987
2 changed files with 6 additions and 43 deletions

View File

@ -267,14 +267,13 @@ macro_rules! impl_matrix_inner {
#[doc(hidden)]
#[macro_export(local_inner_macros)]
macro_rules! impl_matrix {
( $struct_outer: ident { $($field_outer: ident),+ }, $size_outer: expr,
$struct_inner: ident { $($field_inner: ident), + }, $size_inner: expr ) => {
( $struct_outer: ident { $($field_outer: ident),+ }, $size_outer: expr) => {
impl<T> Transpose for $struct_outer<$struct_inner<T>> {
fn transpose(self) -> $struct_inner<$struct_outer<T>> {
$struct_inner {
$(
$field_inner: impl_matrix_inner!(
$struct_outer { $($field_outer),+ }, $size_outer,
Vector2{x,y}, $size_outer,
$field_inner
)
),+

View File

@ -67,43 +67,7 @@ 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 }, 2,
Vector2 { x, y }, 2
);
crate::impl_matrix!(
Vector2 { x, y }, 2,
Vector3 { x, y, z }, 3
);
crate::impl_matrix!(
Vector2 { x, y }, 2,
Vector4 { x, y, z, w }, 4
);
crate::impl_matrix!(
Vector3 { x, y, z }, 3,
Vector2 { x, y }, 2
);
crate::impl_matrix!(
Vector3 { x, y, z }, 3,
Vector3 { x, y, z }, 3
);
crate::impl_matrix!(
Vector3 { x, y, z }, 3,
Vector4 { x, y, z, w }, 4
);
crate::impl_matrix!(
Vector4 { x, y, z, w }, 4,
Vector2 { x, y }, 2
);
crate::impl_matrix!(
Vector4 { x, y, z, w }, 4,
Vector3 { x, y, z }, 3
);
crate::impl_matrix!(
Vector4 { x, y, z, w }, 4,
Vector4 { x, y, z, w }, 4
);
//*/
//This internally implements non square matrices, idk how else to separate the repeated fields
crate::impl_matrix!(Vector2 { x, y }, 2);
crate::impl_matrix!(Vector3 { x, y, z }, 3);
crate::impl_matrix!(Vector4 { x, y, z, w }, 4);