[wpimath] Add scalar multiply and divide operators to all geometry classes (#4438)

Closes #4435.
This commit is contained in:
Tyler Veness
2022-09-28 21:34:29 -07:00
committed by GitHub
parent 3937ff8221
commit 38bb23eb18
16 changed files with 180 additions and 4 deletions

View File

@@ -50,6 +50,10 @@ Rotation2d Rotation2d::operator*(double scalar) const {
return Rotation2d{m_value * scalar};
}
Rotation2d Rotation2d::operator/(double scalar) const {
return *this * (1.0 / scalar);
}
bool Rotation2d::operator==(const Rotation2d& other) const {
return std::hypot(m_cos - other.m_cos, m_sin - other.m_sin) < 1E-9;
}