[wpimath] Expand Quaternion class with additional operators (#5600)

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
Jordan McMichael
2023-10-08 19:42:53 -04:00
committed by GitHub
parent 420f2f7c80
commit 33243f982b
9 changed files with 888 additions and 55 deletions

View File

@@ -174,6 +174,11 @@ Rotation3d Rotation3d::operator/(double scalar) const {
return *this * (1.0 / scalar);
}
bool Rotation3d::operator==(const Rotation3d& other) const {
return std::abs(std::abs(m_q.Dot(other.m_q)) -
m_q.Norm() * other.m_q.Norm()) < 1e-9;
}
Rotation3d Rotation3d::RotateBy(const Rotation3d& other) const {
return Rotation3d{other.m_q * m_q};
}