Skip to content

Commit ed6518c

Browse files
authored
Merge pull request #221 from jcarpent/devel
Fix init call order
2 parents 6e74d28 + 424595c commit ed6518c

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

include/eigenpy/quaternion.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2020 CNRS INRIA
2+
* Copyright 2014-2021 CNRS INRIA
33
*/
44

55
#ifndef __eigenpy_quaternion_hpp__
@@ -111,12 +111,12 @@ namespace eigenpy
111111
{
112112
cl
113113
.def(bp::init<>(bp::arg("self"),"Default constructor"))
114-
.def(bp::init<Vector4>((bp::arg("self"),bp::arg("vec4")),
115-
"Initialize from a vector 4D.\n"
116-
"\tvec4 : a 4D vector representing quaternion coefficients in the order xyzw."))
117114
.def(bp::init<Matrix3>((bp::arg("self"),bp::arg("R")),
118115
"Initialize from rotation matrix.\n"
119116
"\tR : a rotation matrix 3x3."))
117+
.def(bp::init<Vector4>((bp::arg("self"),bp::arg("vec4")),
118+
"Initialize from a vector 4D.\n"
119+
"\tvec4 : a 4D vector representing quaternion coefficients in the order xyzw."))
120120
.def(bp::init<AngleAxis>((bp::arg("self"),bp::arg("aa")),
121121
"Initialize from an angle axis.\n"
122122
"\taa: angle axis object."))

unittest/python/test_geometry.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ def isapprox(a,b,epsilon=1e-6):
1818
assert(isapprox(np.linalg.norm(q.coeffs()),q.norm()))
1919
assert(isapprox(np.linalg.norm(q.coeffs()),1))
2020

21+
v = np.array([0.5,-0.5,0.5,0.5])
22+
qv = Quaternion(v)
23+
assert(isapprox(qv.coeffs(), v))
24+
2125
r = AngleAxis(q)
2226
q2 = Quaternion(r)
2327
assert(q==q)

0 commit comments

Comments
 (0)