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-08-30 20:49:23 +00:00
|
|
|
crate::impl_extend!(Matrix2 { x_axis, y_axis }, Matrix3, z_axis);
|
|
|
|
crate::impl_extend!(Matrix3 { x_axis, y_axis, z_axis }, Matrix4, w_axis);
|
|
|
|
|
2024-08-30 20:02:48 +00:00
|
|
|
crate::impl_matrix!((Matrix2 { x_axis, y_axis }, ((T, T), (T, T)), 2), (Vector2, 2), (Vector2 { x, y }) );
|
|
|
|
crate::impl_matrix!((Matrix2 { x_axis, y_axis }, ((T, T, T), (T, T, T)), 2), (Vector3, 3), (Vector3 { x, y, z }) );
|
|
|
|
crate::impl_matrix!((Matrix2 { x_axis, y_axis }, ((T, T, T, T), (T, T, T, T)), 2), (Vector4, 4), (Vector4 { x, y, z, w }) );
|
|
|
|
crate::impl_matrix!((Matrix3 { x_axis, y_axis, z_axis }, ((T, T), (T, T), (T, T)), 3), (Vector2, 2), (Vector2 { x, y }) );
|
|
|
|
crate::impl_matrix!((Matrix3 { x_axis, y_axis, z_axis }, ((T, T, T), (T, T, T), (T, T, T)), 3), (Vector3, 3), (Vector3 { x, y, z }) );
|
|
|
|
crate::impl_matrix!((Matrix3 { x_axis, y_axis, z_axis }, ((T, T, T, T), (T, T, T, T), (T, T, T, T)), 3), (Vector4, 4), (Vector4 { x, y, z, w }) );
|
|
|
|
crate::impl_matrix!((Matrix4 { x_axis, y_axis, z_axis, w_axis }, ((T, T), (T, T), (T, T), (T, T)), 4), (Vector2, 2), (Vector2 { x, y }) );
|
|
|
|
crate::impl_matrix!((Matrix4 { x_axis, y_axis, z_axis, w_axis }, ((T, T, T), (T, T, T), (T, T, T), (T, T, T)), 4), (Vector3, 3), (Vector3 { x, y, z }) );
|
|
|
|
crate::impl_matrix!((Matrix4 { x_axis, y_axis, z_axis, w_axis }, ((T, T, T, T), (T, T, T, T), (T, T, T, T), (T, T, T, T)), 4), (Vector4, 4), (Vector4 { x, y, z, w }) );
|