mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
[wpimath] Constrain Rotation2d range to -pi to pi (#4611)
Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
This commit is contained in:
@@ -132,18 +132,18 @@ class WPILIB_DLLEXPORT Rotation2d {
|
||||
constexpr Rotation2d RotateBy(const Rotation2d& other) const;
|
||||
|
||||
/**
|
||||
* Returns the radian value of the rotation.
|
||||
* Returns the radian value of the rotation within (-pi, pi].
|
||||
*
|
||||
* @return The radian value of the rotation.
|
||||
*/
|
||||
constexpr units::radian_t Radians() const { return m_value; }
|
||||
constexpr units::radian_t Radians() const;
|
||||
|
||||
/**
|
||||
* Returns the degree value of the rotation.
|
||||
* Returns the degree value of the rotation within (-180, 180].
|
||||
*
|
||||
* @return The degree value of the rotation.
|
||||
*/
|
||||
constexpr units::degree_t Degrees() const { return m_value; }
|
||||
constexpr units::degree_t Degrees() const;
|
||||
|
||||
/**
|
||||
* Returns the cosine of the rotation.
|
||||
@@ -167,7 +167,6 @@ class WPILIB_DLLEXPORT Rotation2d {
|
||||
constexpr double Tan() const { return Sin() / Cos(); }
|
||||
|
||||
private:
|
||||
units::radian_t m_value = 0_rad;
|
||||
double m_cos = 1;
|
||||
double m_sin = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user