Implement rotate method for quaternions as replace for multiplication

Vector rotating method is renamed from `rotate` to `rotateVector` to avoid inconsistent object and argument order in different `rotate` methods
This commit is contained in:
Oleg Kalachev
2025-01-09 09:56:49 +03:00
parent 5d10446aaf
commit ca032abc03
3 changed files with 15 additions and 8 deletions
+10 -1
View File
@@ -168,10 +168,19 @@ public:
}
// Rotate vector by quaternion
Vector rotate(const Vector& v) {
Vector rotateVector(const Vector& v) {
return conjugateInversed(v);
}
// Rotate quaternion by quaternion
Quaternion rotate(const Quaternion& q, const bool normalize = true) {
Quaternion rotated = (*this) * q;
if (normalize) {
rotated.normalize();
}
return rotated;
}
bool finite() const {
return isfinite(w) && isfinite(x) && isfinite(y) && isfinite(z);
}