Repository: bevyengine/bevy
File: crates/bevy_math/src/rotation2d.rs (Rust)

Code before:
    /// # use approx::{assert_relative_eq, assert_abs_diff_eq};
    ///
    /// let rot1 = Rot2::degrees(270.0);
    /// let rot2 = Rot2::degrees(-90.0);
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(rot1, rot2);
    ///
    /// let rot3 = Rot2::degrees(180.0);
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(rot1 * rot1, rot3);
    ///
    /// // A rotation by 365° and 5° are the same
    /// #[cfg(feature = "approx")]
    /// assert_abs_diff_eq!(Rot2::degrees(365.0), Rot2::degrees(5.0), epsilon = 2e-7);
    /// ```
    #[inline]
    pub fn degrees(degrees: f32) -> Self {
        Self::radians(degrees.to_radians())
    }

    /// Creates a [`Rot2`] from a counterclockwise fraction of a full turn of 360 degrees.
    /// Negative argument corresponds to a clockwise rotation.
    ///
    /// # Note
    ///
    /// Angles larger than or equal to 1 turn (in either direction) loop around to smaller rotations, since a full rotation returns an object into its starting orientation.
    ///
    /// # Example
    ///
    /// ```
    /// # use bevy_math::Rot2;
    /// # use approx::assert_relative_eq;
    ///
    /// let rot1 = Rot2::turn_fraction(0.75);
    /// let rot2 = Rot2::turn_fraction(-0.25);
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(rot1, rot2);
    ///
    /// let rot3 = Rot2::turn_fraction(0.5);
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(rot1 * rot1, rot3);
    ///
    /// // A rotation by 1.5 turns and 0.5 turns are the same
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(Rot2::turn_fraction(1.5), Rot2::turn_fraction(0.5));
    /// ```
    #[inline]
    pub fn turn_fraction(fraction: f32) -> Self {
        Self::radians(TAU * fraction)
    }


Review comment (suggestion):
```suggestion
    /// 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.
```

Code after:
    ///
    /// let rot1 = Rot2::degrees(270.0);
    /// let rot2 = Rot2::degrees(-90.0);
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(rot1, rot2);
    ///
    /// let rot3 = Rot2::degrees(180.0);
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(rot1 * rot1, rot3);
    ///
    /// // A rotation by 365° and 5° are the same
    /// #[cfg(feature = "approx")]
    /// assert_abs_diff_eq!(Rot2::degrees(365.0), Rot2::degrees(5.0), epsilon = 2e-7);
    /// ```
    #[inline]
    pub fn degrees(degrees: f32) -> Self {
        Self::radians(degrees.to_radians())
    }

    /// Creates a [`Rot2`] from a counterclockwise fraction of a full turn of 360 degrees.
    /// A negative argument corresponds to a clockwise rotation.
    ///
    /// # Note
    ///
    /// 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.
    ///
    /// # Example
    ///
    /// ```
    /// # use bevy_math::Rot2;
    /// # use approx::assert_relative_eq;
    ///
    /// let rot1 = Rot2::turn_fraction(0.75);
    /// let rot2 = Rot2::turn_fraction(-0.25);
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(rot1, rot2);
    ///
    /// let rot3 = Rot2::turn_fraction(0.5);
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(rot1 * rot1, rot3);
    ///
    /// // A rotation by 1.5 turns and 0.5 turns are the same
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(Rot2::turn_fraction(1.5), Rot2::turn_fraction(0.5));
    /// ```
    #[inline]
    pub fn turn_fraction(fraction: f32) -> Self {
        Self::radians(TAU * fraction)
    }

    /// Creates a [`Rot2`] from the sine and cosine of an angle.