Skip to content

armgit / flix

Public Imported from GitHub
0

Making an ESP32-based quadcopter from scratch

Add missing equals and non-equals operators for quaternion lib

Oleg Kalachev9229b743ebd3
diff --git a/flix/quaternion.h b/flix/quaternion.h
index b61eeb8..252212e 100644
--- a/flix/quaternion.h
+++ b/flix/quaternion.h
@@ -148,6 +148,14 @@ public:
w * q.z + z * q.w + x * q.y - y * q.x);
}
+ bool operator == (const Quaternion& q) const {
+ return w == q.w && x == q.x && y == q.y && z == q.z;
+ }
+
+ bool operator != (const Quaternion& q) const {
+ return !(*this == q);
+ }
+
Quaternion inversed() const {
float normSqInv = 1 / (w * w + x * x + y * y + z * z);
return Quaternion(