2024-08-30 20:02:48 +00:00
|
|
|
use crate::{Vector2,Vector3,Vector4};
|
|
|
|
|
|
|
|
pub struct Matrix2<T> {
|
|
|
|
pub x_axis: T,
|
|
|
|
pub y_axis: T,
|
|
|
|
}
|
|
|
|
pub struct Matrix3<T> {
|
|
|
|
pub x_axis: T,
|
|
|
|
pub y_axis: T,
|
|
|
|
pub z_axis: T,
|
|
|
|
}
|
|
|
|
pub struct Matrix4<T> {
|
|
|
|
pub x_axis: T,
|
|
|
|
pub y_axis: T,
|
|
|
|
pub z_axis: T,
|
|
|
|
pub w_axis: T,
|
|
|
|
}
|
|
|
|
|
2024-09-05 19:49:20 +00:00
|
|
|
crate::impl_matrix_named_fields!(
|
|
|
|
//outer struct
|
2024-09-03 16:23:28 +00:00
|
|
|
(
|
2024-09-05 19:49:20 +00:00
|
|
|
(Matrix2 { x_axis, y_axis }, 2),
|
|
|
|
(Matrix3 { x_axis, y_axis, z_axis }, 3),
|
|
|
|
(Matrix4 { x_axis, y_axis, z_axis, w_axis }, 4)
|
2024-09-03 16:23:28 +00:00
|
|
|
),
|
2024-09-05 19:49:20 +00:00
|
|
|
//inner struct
|
2024-09-03 16:23:28 +00:00
|
|
|
(
|
2024-09-05 19:49:20 +00:00
|
|
|
(Vector2 { x, y }, 2),
|
|
|
|
(Vector3 { x, y, z }, 3),
|
|
|
|
(Vector4 { x, y, z, w }, 4)
|
2024-09-03 16:23:28 +00:00
|
|
|
)
|
|
|
|
);
|
2024-09-04 20:38:29 +00:00
|
|
|
|
|
|
|
//Special case 3x3 matrix operations because I cba to write macros for the arbitrary cases
|
|
|
|
crate::impl_matrix_3x3!();
|