1use super::AdjustPrecision;
2use bevy_math::*;
3
4pub type Scalar = f32;
6pub const FRAC_PI_2: Scalar = core::f32::consts::FRAC_PI_2;
8pub const PI: Scalar = core::f32::consts::PI;
10pub const TAU: Scalar = core::f32::consts::TAU;
12pub const FRAC_1_SQRT_2: Scalar = core::f32::consts::FRAC_1_SQRT_2;
14
15#[cfg(feature = "2d")]
17pub type Vector = Vec2;
18#[cfg(feature = "3d")]
20pub type Vector = Vec3;
21pub type Vector2 = Vec2;
23pub type Vector3 = Vec3;
25
26#[cfg(feature = "2d")]
28pub type Matrix = Mat2;
29#[cfg(feature = "3d")]
31pub type Matrix = Mat3;
32pub type Matrix2 = Mat2;
34pub type Matrix3 = Mat3;
36pub type Quaternion = Quat;
38
39impl AdjustPrecision for f32 {
40 type Adjusted = Scalar;
41 fn adjust_precision(&self) -> Self::Adjusted {
42 *self as Scalar
43 }
44}
45
46impl AdjustPrecision for f64 {
47 type Adjusted = Scalar;
48 fn adjust_precision(&self) -> Self::Adjusted {
49 *self as Scalar
50 }
51}
52
53impl AdjustPrecision for Vec3 {
54 type Adjusted = Vector3;
55 fn adjust_precision(&self) -> Self::Adjusted {
56 *self
57 }
58}
59
60impl AdjustPrecision for DVec3 {
61 type Adjusted = Vector3;
62 fn adjust_precision(&self) -> Self::Adjusted {
63 self.as_vec3()
64 }
65}
66
67impl AdjustPrecision for Vec2 {
68 type Adjusted = Vector2;
69 fn adjust_precision(&self) -> Self::Adjusted {
70 *self
71 }
72}
73
74impl AdjustPrecision for DVec2 {
75 type Adjusted = Vector2;
76 fn adjust_precision(&self) -> Self::Adjusted {
77 self.as_vec2()
78 }
79}
80
81impl AdjustPrecision for Quat {
82 type Adjusted = Quaternion;
83 fn adjust_precision(&self) -> Self::Adjusted {
84 *self
85 }
86}
87
88impl AdjustPrecision for DQuat {
89 type Adjusted = Quaternion;
90 fn adjust_precision(&self) -> Self::Adjusted {
91 self.as_quat()
92 }
93}
94
95impl AdjustPrecision for Mat3 {
96 type Adjusted = Matrix3;
97 fn adjust_precision(&self) -> Self::Adjusted {
98 *self
99 }
100}
101
102impl AdjustPrecision for DMat3 {
103 type Adjusted = Matrix3;
104 fn adjust_precision(&self) -> Self::Adjusted {
105 self.as_mat3()
106 }
107}