Skip to content

Commit ecd138d

Browse files
authored
Merge pull request #236 from jcarpent/devel
Additional fix
2 parents 3a7acfc + 750d69d commit ecd138d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

include/eigenpy/quaternion.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ namespace eigenpy
110110
void visit(PyClass& cl) const
111111
{
112112
cl
113-
.def(bp::init<>(bp::arg("self"),"Default constructor")[bp::return_value_policy<bp::return_by_value>()])
114113
.def(bp::init<Matrix3>((bp::arg("self"),bp::arg("R")),
115114
"Initialize from rotation matrix.\n"
116115
"\tR : a rotation matrix 3x3.")[bp::return_value_policy<bp::return_by_value>()])
@@ -129,6 +128,8 @@ namespace eigenpy
129128
(bp::arg("vec4"))),
130129
"Initialize from a vector 4D.\n"
131130
"\tvec4 : a 4D vector representing quaternion coefficients in the order xyzw.")
131+
.def("__init__",bp::make_constructor(&QuaternionVisitor::DefaultConstructor),
132+
"Default constructor")
132133
.def(bp::init<Scalar,Scalar,Scalar,Scalar>
133134
((bp::arg("self"),bp::arg("w"),bp::arg("x"),bp::arg("y"),bp::arg("z")),
134135
"Initialize from coefficients.\n\n"
@@ -269,9 +270,14 @@ namespace eigenpy
269270
return q;
270271
}
271272

273+
static Quaternion* DefaultConstructor()
274+
{
275+
return new Quaternion;
276+
}
277+
272278
static Quaternion* FromOneVector(const Vector4& v)
273279
{
274-
Quaternion* q(new Quaternion(v));
280+
Quaternion* q(new Quaternion(v[3],v[0],v[1],v[2]));
275281
return q;
276282
}
277283

0 commit comments

Comments
 (0)