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

Code before:
    ///
    /// let rot1 = Rot2::radians(3.0 * FRAC_PI_2);
    /// let rot2 = Rot2::radians(-FRAC_PI_2);
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(rot1, rot2);
    ///
    /// let rot3 = Rot2::radians(PI);
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(rot1 * rot1, rot3);
    ///
    /// // A rotation by 3π and 1π are the same
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(Rot2::radians(3.0 * PI), Rot2::radians(PI));
    /// ```
    #[inline]
    pub fn radians(radians: f32) -> Self {
        let (sin, cos) = ops::sin_cos(radians);
        Self::from_sin_cos(sin, cos)
    }

    /// Creates a [`Rot2`] from a counterclockwise angle in degrees.
    /// Negative argument corresponds to a clockwise rotation.
    ///
    /// # Note
    ///
    /// Angles larger than or equal to 360° (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, 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())
    }


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

Code after:
    /// let rot1 = Rot2::radians(3.0 * FRAC_PI_2);
    /// let rot2 = Rot2::radians(-FRAC_PI_2);
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(rot1, rot2);
    ///
    /// let rot3 = Rot2::radians(PI);
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(rot1 * rot1, rot3);
    ///
    /// // A rotation by 3π and 1π are the same
    /// #[cfg(feature = "approx")]
    /// assert_relative_eq!(Rot2::radians(3.0 * PI), Rot2::radians(PI));
    /// ```
    #[inline]
    pub fn radians(radians: f32) -> Self {
        let (sin, cos) = ops::sin_cos(radians);
        Self::from_sin_cos(sin, cos)
    }

    /// Creates a [`Rot2`] from a counterclockwise angle in degrees.
    /// A negative argument corresponds to a clockwise rotation.
    ///
    /// # Note
    ///
    /// 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.
    ///
    /// # Example
    ///
    /// ```
    /// # use bevy_math::Rot2;
    /// # 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.