Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
eigenpy
Commits
de6ee5bc
Verified
Commit
de6ee5bc
authored
Nov 08, 2019
by
Justin Carpentier
Browse files
geometry: fix operator==
parent
5bd8ef10
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/eigenpy/angle-axis.hpp
View file @
de6ee5bc
...
...
@@ -98,7 +98,8 @@ namespace eigenpy
{
self
.
angle
()
=
angle
;
}
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
)
{
return
!
__eq__
(
u
,
v
);
}
...
...
include/eigenpy/quaternion.hpp
View file @
de6ee5bc
...
...
@@ -178,9 +178,9 @@ namespace eigenpy
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
)
...
...
unittest/python/test_geometry.py
View file @
de6ee5bc
...
...
@@ -20,7 +20,7 @@ assert(isapprox(np.linalg.norm(q.coeffs()),1))
r
=
AngleAxis
(
q
)
q2
=
Quaternion
(
r
)
assert
(
q
==
q
2
)
assert
(
q
==
q
)
assert
(
isapprox
(
q
.
coeffs
(),
q2
.
coeffs
()))
Rq
=
q
.
matrix
()
...
...
@@ -29,7 +29,7 @@ assert(isapprox(Rq*Rq.T,np.eye(3)))
assert
(
isapprox
(
Rr
,
Rq
))
qR
=
Quaternion
(
Rr
)
assert
(
q
==
qR
)
assert
(
q
.
isApprox
(
qR
)
)
assert
(
isapprox
(
q
.
coeffs
(),
qR
.
coeffs
()))
assert
(
isapprox
(
qR
[
3
],
1.
/
np
.
sqrt
(
30
)))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment