From 2c501960f9fcaa7830da8417053f20df54244540 Mon Sep 17 00:00:00 2001 From: Justin Carpentier <justin.carpentier@inria.fr> Date: Fri, 21 May 2021 17:35:46 +0200 Subject: [PATCH] geometry: fix default constructor --- include/eigenpy/quaternion.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/eigenpy/quaternion.hpp b/include/eigenpy/quaternion.hpp index 9b89fe2f..5c2c2bfc 100644 --- a/include/eigenpy/quaternion.hpp +++ b/include/eigenpy/quaternion.hpp @@ -110,7 +110,6 @@ namespace eigenpy void visit(PyClass& cl) const { cl - .def(bp::init<>(bp::arg("self"),"Default constructor")[bp::return_value_policy<bp::return_by_value>()]) .def(bp::init<Matrix3>((bp::arg("self"),bp::arg("R")), "Initialize from rotation matrix.\n" "\tR : a rotation matrix 3x3.")[bp::return_value_policy<bp::return_by_value>()]) @@ -129,6 +128,8 @@ namespace eigenpy (bp::arg("vec4"))), "Initialize from a vector 4D.\n" "\tvec4 : a 4D vector representing quaternion coefficients in the order xyzw.") + .def("__init__",bp::make_constructor(&QuaternionVisitor::DefaultConstructor), + "Default constructor") .def(bp::init<Scalar,Scalar,Scalar,Scalar> ((bp::arg("self"),bp::arg("w"),bp::arg("x"),bp::arg("y"),bp::arg("z")), "Initialize from coefficients.\n\n" @@ -269,6 +270,11 @@ namespace eigenpy return q; } + static Quaternion* DefaultConstructor() + { + return new Quaternion; + } + static Quaternion* FromOneVector(const Vector4& v) { Quaternion* q(new Quaternion(v)); -- GitLab