Skip to content
Snippets Groups Projects
Verified Commit de6ee5bc authored by Justin Carpentier's avatar Justin Carpentier
Browse files

geometry: fix operator==

parent 5bd8ef10
No related branches found
No related tags found
No related merge requests found
...@@ -98,7 +98,8 @@ namespace eigenpy ...@@ -98,7 +98,8 @@ namespace eigenpy
{ self.angle() = angle; } { self.angle() = angle; }
static bool __eq__(const AngleAxis & u, const AngleAxis & v) static bool __eq__(const AngleAxis & u, const AngleAxis & v)
{ return u.isApprox(v); } { return u.axis() == v.axis() && v.angle() == u.angle(); }
static bool __ne__(const AngleAxis & u, const AngleAxis & v) static bool __ne__(const AngleAxis & u, const AngleAxis & v)
{ return !__eq__(u,v); } { return !__eq__(u,v); }
......
...@@ -178,9 +178,9 @@ namespace eigenpy ...@@ -178,9 +178,9 @@ namespace eigenpy
return self.isApprox(other,prec); return self.isApprox(other,prec);
} }
static bool __eq__(const Quaternion& u, const Quaternion& v) static bool __eq__(const Quaternion & u, const Quaternion & v)
{ {
return u.isApprox(v,1e-9); return u.coeffs() == v.coeffs();
} }
static bool __ne__(const Quaternion& u, const Quaternion& v) static bool __ne__(const Quaternion& u, const Quaternion& v)
......
...@@ -20,7 +20,7 @@ assert(isapprox(np.linalg.norm(q.coeffs()),1)) ...@@ -20,7 +20,7 @@ assert(isapprox(np.linalg.norm(q.coeffs()),1))
r = AngleAxis(q) r = AngleAxis(q)
q2 = Quaternion(r) q2 = Quaternion(r)
assert(q==q2) assert(q==q)
assert(isapprox(q.coeffs(),q2.coeffs())) assert(isapprox(q.coeffs(),q2.coeffs()))
Rq = q.matrix() Rq = q.matrix()
...@@ -29,7 +29,7 @@ assert(isapprox(Rq*Rq.T,np.eye(3))) ...@@ -29,7 +29,7 @@ assert(isapprox(Rq*Rq.T,np.eye(3)))
assert(isapprox(Rr,Rq)) assert(isapprox(Rr,Rq))
qR = Quaternion(Rr) qR = Quaternion(Rr)
assert(q==qR) assert(q.isApprox(qR))
assert(isapprox(q.coeffs(),qR.coeffs())) assert(isapprox(q.coeffs(),qR.coeffs()))
assert(isapprox(qR[3],1./np.sqrt(30))) assert(isapprox(qR[3],1./np.sqrt(30)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment