You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Objective
- Certain pieces of documentation on `Rot2` are imprecise or misleading
- Try to make docs more comprehensive
## Solution
- Rewrite a bunch of doc comment, dropping `in radians` where there's no
values in radians,
- Clear up comments about "clamping" input angles by a hopefully more
accurate and clear explanation.
## Testing
- CI
---------
Co-authored-by: Matty Weatherley <[email protected]>
Co-authored-by: jf908 <[email protected]>
/// Corresponds to a counterclockwise quarter-turn.
80
89
pubconstFRAC_PI_2:Self = Self{cos:0.0,sin:1.0};
81
90
82
91
/// A counterclockwise rotation of π/3 radians.
92
+
/// Corresponds to a counterclockwise turn by 60°.
83
93
pubconstFRAC_PI_3:Self = Self{
84
94
cos:0.5,
85
95
sin:0.866_025_4,
86
96
};
87
97
88
98
/// A counterclockwise rotation of π/4 radians.
99
+
/// Corresponds to a counterclockwise turn by 45°.
89
100
pubconstFRAC_PI_4:Self = Self{
90
101
cos: core::f32::consts::FRAC_1_SQRT_2,
91
102
sin: core::f32::consts::FRAC_1_SQRT_2,
92
103
};
93
104
94
105
/// A counterclockwise rotation of π/6 radians.
106
+
/// Corresponds to a counterclockwise turn by 30°.
95
107
pubconstFRAC_PI_6:Self = Self{
96
108
cos:0.866_025_4,
97
109
sin:0.5,
98
110
};
99
111
100
112
/// A counterclockwise rotation of π/8 radians.
113
+
/// Corresponds to a counterclockwise turn by 22.5°.
101
114
pubconstFRAC_PI_8:Self = Self{
102
115
cos:0.923_879_5,
103
116
sin:0.382_683_43,
104
117
};
105
118
106
119
/// Creates a [`Rot2`] from a counterclockwise angle in radians.
120
+
/// A negative argument corresponds to a clockwise rotation.
107
121
///
108
122
/// # Note
109
123
///
110
-
/// The input rotation will always be clamped to the range `(-π, π]` by design.
124
+
/// Angles larger than or equal to 2π (in either direction) loop around to smaller rotations, since a full rotation returns an object to its starting orientation.
/// Creates a [`Rot2`] from a counterclockwise angle in degrees.
153
+
/// A negative argument corresponds to a clockwise rotation.
135
154
///
136
155
/// # Note
137
156
///
138
-
/// The input rotation will always be clamped to the range `(-180°, 180°]` by design.
157
+
/// Angles larger than or equal to 360° (in either direction) loop around to smaller rotations, since a full rotation returns an object to its starting orientation.
139
158
///
140
159
/// # Example
141
160
///
142
161
/// ```
143
162
/// # use bevy_math::Rot2;
144
-
/// # use approx::assert_relative_eq;
163
+
/// # use approx::{assert_relative_eq, assert_abs_diff_eq};
/// Creates a [`Rot2`] from a counterclockwise fraction of a full turn of 360 degrees.
184
+
/// A negative argument corresponds to a clockwise rotation.
161
185
///
162
186
/// # Note
163
187
///
164
-
/// The input rotation will always be clamped to the range `(-50%, 50%]` by design.
188
+
/// Angles larger than or equal to 1 turn (in either direction) loop around to smaller rotations, since a full rotation returns an object to its starting orientation.
165
189
///
166
190
/// # Example
167
191
///
@@ -177,13 +201,17 @@ impl Rot2 {
177
201
/// let rot3 = Rot2::turn_fraction(0.5);
178
202
/// #[cfg(feature = "approx")]
179
203
/// assert_relative_eq!(rot1 * rot1, rot3);
204
+
///
205
+
/// // A rotation by 1.5 turns and 0.5 turns are the same
0 commit comments