[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

@@ -183,7 +183,8 @@ public class Rotation2d {
@Override
public boolean equals(Object obj) {
if (obj instanceof Rotation2d) {
return Math.abs(((Rotation2d) obj).m_value - m_value) < 1E-9;
var other = (Rotation2d) obj;
return Math.hypot(m_cos - other.m_cos, m_sin - other.m_sin) < 1E-9;
}
return false;
}