mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
29c4c79342
# Objective - Another way of specifying rotations was requested in https://github.com/bevyengine/bevy/issues/11132#issuecomment-2344603178 ## Solution - Add methods on `Rot2` - `turn_fraction(fraction: f32) -> Self` - `as_turn_fraction(self) -> f32` - Also add some documentation on range of rotation ## Testing - extended existing tests - added new tests ## Showcase ```rust let rotation1 = Rot2::degrees(90.0); let rotation2 = Rot2::turn_fraction(0.25); // rotations should be equal assert_relative_eq!(rotation1, rotation2); // The rotation should be 90 degrees assert_relative_eq!(rotation2.as_radians(), FRAC_PI_2); assert_relative_eq!(rotation2.as_degrees(), 90.0); ``` --------- Co-authored-by: Joona Aalto <jondolf.dev@gmail.com> Co-authored-by: Jan Hohenheim <jan@hohenheim.ch> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
clippy.toml | ||
README.md |