mirror of
https://github.com/okalachev/flix.git
synced 2026-06-28 05:56:44 +00:00
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:
+10
-1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user