[wpimath] Quaternion::Log(): Remove duplicate calls to norm() (#6358)

This commit is contained in:
Thad House
2024-02-10 10:41:19 -08:00
committed by GitHub
parent 300419c151
commit e9c744c456
2 changed files with 6 additions and 4 deletions

View File

@@ -136,11 +136,12 @@ Quaternion Quaternion::Log(const Quaternion& other) const {
}
Quaternion Quaternion::Log() const {
double scalar = std::log(Norm());
double norm = Norm();
double scalar = std::log(norm);
double v_norm = m_v.norm();
double s_norm = W() / Norm();
double s_norm = W() / norm;
if (std::abs(s_norm + 1) < 1e-9) {
return Quaternion{scalar, -std::numbers::pi, 0, 0};