[wpimath] Fix Rotation2d equality operator (#3128)

This commit is contained in:
Tyler Veness
2021-01-25 21:41:34 -08:00
committed by GitHub
parent fb5c8c39ae
commit 2c2ccb3618
4 changed files with 45 additions and 36 deletions

View File

@@ -65,7 +65,7 @@ Rotation2d Rotation2d::operator*(double scalar) const {
}
bool Rotation2d::operator==(const Rotation2d& other) const {
return units::math::abs(m_value - other.m_value) < 1E-9_rad;
return std::hypot(m_cos - other.m_cos, m_sin - other.m_sin) < 1E-9;
}
bool Rotation2d::operator!=(const Rotation2d& other) const {