1use super::AdjustPrecision;
2use bevy_math::*;
3use glam_matrix_extras::*;
4
5pub type Scalar = f32;
7pub const FRAC_PI_2: Scalar = core::f32::consts::FRAC_PI_2;
9pub const PI: Scalar = core::f32::consts::PI;
11pub const TAU: Scalar = core::f32::consts::TAU;
13pub const FRAC_1_SQRT_2: Scalar = core::f32::consts::FRAC_1_SQRT_2;
15
16#[cfg(feature = "2d")]
18pub type Vector = Vec2;
19#[cfg(feature = "3d")]
21pub type Vector = Vec3;
22pub type Vector2 = Vec2;
24pub type Vector3 = Vec3;
26
27#[cfg(feature = "2d")]
29pub type Matrix = Mat2;
30#[cfg(feature = "3d")]
32pub type Matrix = Mat3;
33pub type Matrix2 = Mat2;
35pub type Matrix3 = Mat3;
37#[cfg(feature = "2d")]
39pub type SymmetricMatrix = SymmetricMat2;
40#[cfg(feature = "3d")]
42pub type SymmetricMatrix = SymmetricMat3;
43pub type SymmetricMatrix2 = SymmetricMat2;
45pub type SymmetricMatrix3 = SymmetricMat3;
47pub type Quaternion = Quat;
49
50impl AdjustPrecision for f32 {
51 type Adjusted = Scalar;
52 fn adjust_precision(&self) -> Self::Adjusted {
53 *self as Scalar
54 }
55}
56
57impl AdjustPrecision for f64 {
58 type Adjusted = Scalar;
59 fn adjust_precision(&self) -> Self::Adjusted {
60 *self as Scalar
61 }
62}
63
64impl AdjustPrecision for Vec3 {
65 type Adjusted = Vector3;
66 fn adjust_precision(&self) -> Self::Adjusted {
67 *self
68 }
69}
70
71impl AdjustPrecision for DVec3 {
72 type Adjusted = Vector3;
73 fn adjust_precision(&self) -> Self::Adjusted {
74 self.as_vec3()
75 }
76}
77
78impl AdjustPrecision for Vec2 {
79 type Adjusted = Vector2;
80 fn adjust_precision(&self) -> Self::Adjusted {
81 *self
82 }
83}
84
85impl AdjustPrecision for DVec2 {
86 type Adjusted = Vector2;
87 fn adjust_precision(&self) -> Self::Adjusted {
88 self.as_vec2()
89 }
90}
91
92impl AdjustPrecision for Quat {
93 type Adjusted = Quaternion;
94 fn adjust_precision(&self) -> Self::Adjusted {
95 *self
96 }
97}
98
99impl AdjustPrecision for DQuat {
100 type Adjusted = Quaternion;
101 fn adjust_precision(&self) -> Self::Adjusted {
102 self.as_quat()
103 }
104}
105
106impl AdjustPrecision for Mat3 {
107 type Adjusted = Matrix3;
108 fn adjust_precision(&self) -> Self::Adjusted {
109 *self
110 }
111}
112
113impl AdjustPrecision for DMat3 {
114 type Adjusted = Matrix3;
115 fn adjust_precision(&self) -> Self::Adjusted {
116 self.as_mat3()
117 }
118}
119
120impl AdjustPrecision for SymmetricMat2 {
121 type Adjusted = SymmetricMatrix2;
122 fn adjust_precision(&self) -> Self::Adjusted {
123 *self
124 }
125}
126
127impl AdjustPrecision for SymmetricDMat2 {
128 type Adjusted = SymmetricMatrix2;
129 fn adjust_precision(&self) -> Self::Adjusted {
130 self.as_symmetric_mat2()
131 }
132}
133
134impl AdjustPrecision for SymmetricMat3 {
135 type Adjusted = SymmetricMatrix3;
136 fn adjust_precision(&self) -> Self::Adjusted {
137 *self
138 }
139}
140
141impl AdjustPrecision for SymmetricDMat3 {
142 type Adjusted = SymmetricMatrix3;
143 fn adjust_precision(&self) -> Self::Adjusted {
144 self.as_symmetric_mat3()
145 }
146}