1212#include < Eigen/Geometry>
1313
1414#include " eigenpy/exception.hpp"
15- #include " eigenpy/registration.hpp"
1615
1716namespace eigenpy
1817{
@@ -69,25 +68,25 @@ namespace eigenpy
6968 void visit (PyClass& cl) const
7069 {
7170 cl
72- .def (bp::init<>(" Default constructor" ))
73- .def (bp::init<Vector4>((bp::arg (" vec4" )),
71+ .def (bp::init<>(bp::arg ( " self " ), " Default constructor" ))
72+ .def (bp::init<Vector4>((bp::arg (" self " ), bp::arg ( " vec4" )),
7473 " Initialize from a vector 4D.\n "
7574 " \t vec4 : a 4D vector representing quaternion coefficients in the order xyzw." ))
76- .def (bp::init<Matrix3>((bp::arg (" R" )),
75+ .def (bp::init<Matrix3>((bp::arg (" self " ), bp::arg ( " R" )),
7776 " Initialize from rotation matrix.\n "
7877 " \t R : a rotation matrix 3x3." ))
79- .def (bp::init<AngleAxis>((bp::arg (" aa" )),
78+ .def (bp::init<AngleAxis>((bp::arg (" self " ), bp::arg ( " aa" )),
8079 " Initialize from an angle axis.\n "
8180 " \t aa: angle axis object." ))
82- .def (bp::init<Quaternion>((bp::arg (" quat" )),
81+ .def (bp::init<Quaternion>((bp::arg (" self " ), bp::arg ( " quat" )),
8382 " Copy constructor.\n "
8483 " \t quat: a quaternion." ))
8584 .def (" __init__" ,bp::make_constructor (&QuaternionVisitor::FromTwoVectors,
8685 bp::default_call_policies (),
8786 (bp::arg (" u: a 3D vector" ),bp::arg (" v: a 3D vector" ))),
8887 " Initialize from two vectors u and v" )
8988 .def (bp::init<Scalar,Scalar,Scalar,Scalar>
90- ((bp::arg (" w" ),bp::arg (" x" ),bp::arg (" y" ),bp::arg (" z" )),
89+ ((bp::arg (" self " ), bp::arg ( " w" ),bp::arg (" x" ),bp::arg (" y" ),bp::arg (" z" )),
9190 " Initialize from coefficients.\n\n "
9291 " ... note:: The order of coefficients is *w*, *x*, *y*, *z*. "
9392 " The [] operator numbers them differently, 0...4 for *x* *y* *z* *w*!" ))
@@ -107,30 +106,61 @@ namespace eigenpy
107106
108107 .def (" isApprox" ,
109108 &call<Quaternion>::isApprox,
110- isApproxQuaternion_overload (bp::args (" other" ," prec" ),
109+ isApproxQuaternion_overload (bp::args (" self " , " other" ," prec" ),
111110 " Returns true if *this is approximately equal to other, within the precision determined by prec." ))
112111
113112 /* --- Methods --- */
114113 .def (" coeffs" ,(const Vector4 & (Quaternion::*)()const )&Quaternion::coeffs,
114+ bp::arg (" self" ),
115+ " Returns a vector of the coefficients (x,y,z,w)" ,
115116 bp::return_value_policy<bp::copy_const_reference>())
116- .def (" matrix" ,&Quaternion::matrix," Returns an equivalent 3x3 rotation matrix. Similar to toRotationMatrix." )
117- .def (" toRotationMatrix" ,&Quaternion::toRotationMatrix," Returns an equivalent 3x3 rotation matrix." )
117+ .def (" matrix" ,&Quaternion::matrix,
118+ bp::arg (" self" ),
119+ " Returns an equivalent 3x3 rotation matrix. Similar to toRotationMatrix." )
120+ .def (" toRotationMatrix" ,&Quaternion::toRotationMatrix,
121+ // bp::arg("self"), // Bug in Boost.Python
122+ " Returns an equivalent 3x3 rotation matrix." )
118123
119- .def (" setFromTwoVectors" ,&setFromTwoVectors,((bp::arg (" a" ),bp::arg (" b" )))," Set *this to be the quaternion which transforms a into b through a rotation."
124+ .def (" setFromTwoVectors" ,&setFromTwoVectors,((bp::arg (" self" ),bp::arg (" a" ),bp::arg (" b" ))),
125+ " Set *this to be the quaternion which transforms a into b through a rotation."
120126 ,bp::return_self<>())
121- .def (" conjugate" ,&Quaternion::conjugate," Returns the conjugated quaternion. The conjugate of a quaternion represents the opposite rotation." )
122- .def (" inverse" ,&Quaternion::inverse," Returns the quaternion describing the inverse rotation." )
123- .def (" setIdentity" ,&Quaternion::setIdentity,bp::return_self<>()," Set *this to the idendity rotation." )
124- .def (" norm" ,&Quaternion::norm," Returns the norm of the quaternion's coefficients." )
125- .def (" normalize" ,&Quaternion::normalize," Normalizes the quaternion *this." )
126- .def (" normalized" ,&Quaternion::normalized," Returns a normalized copy of *this." )
127- .def (" squaredNorm" ,&Quaternion::squaredNorm," Returns the squared norm of the quaternion's coefficients." )
128- .def (" dot" ,&Quaternion::template dot<Quaternion>,bp::arg (" other" )," Returns the dot product of *this with other"
127+ .def (" conjugate" ,&Quaternion::conjugate,
128+ bp::arg (" self" ),
129+ " Returns the conjugated quaternion.\n "
130+ " The conjugate of a quaternion represents the opposite rotation." )
131+ .def (" inverse" ,&Quaternion::inverse,
132+ bp::arg (" self" ),
133+ " Returns the quaternion describing the inverse rotation." )
134+ .def (" setIdentity" ,&Quaternion::setIdentity,
135+ bp::arg (" self" ),
136+ " Set *this to the idendity rotation." ,bp::return_self<>())
137+ .def (" norm" ,&Quaternion::norm,
138+ bp::arg (" self" ),
139+ " Returns the norm of the quaternion's coefficients." )
140+ .def (" normalize" ,&Quaternion::normalize,
141+ bp::arg (" self" ),
142+ " Normalizes the quaternion *this." )
143+ .def (" normalized" ,&Quaternion::normalized,
144+ bp::arg (" self" ),
145+ " Returns a normalized copy of *this." )
146+ .def (" squaredNorm" ,&Quaternion::squaredNorm,
147+ bp::arg (" self" ),
148+ " Returns the squared norm of the quaternion's coefficients." )
149+ .def (" dot" ,&Quaternion::template dot<Quaternion>,
150+ (bp::arg (" self" ),bp::arg (" other" )),
151+ " Returns the dot product of *this with an other Quaternion.\n "
129152 " Geometrically speaking, the dot product of two unit quaternions corresponds to the cosine of half the angle between the two rotations." )
130- .def (" _transformVector" ,&Quaternion::_transformVector,bp::arg (" vector" )," Rotation of a vector by a quaternion." )
131- .def (" vec" ,&vec," Returns a vector expression of the imaginary part (x,y,z)." )
132- .def (" angularDistance" ,&Quaternion::template angularDistance<Quaternion>," Returns the angle (in radian) between two rotations." )
133- .def (" slerp" ,&slerp,bp::args (" t" ," other" ),
153+ .def (" _transformVector" ,&Quaternion::_transformVector,
154+ (bp::arg (" self" ),bp::arg (" vector" )),
155+ " Rotation of a vector by a quaternion." )
156+ .def (" vec" ,&vec,
157+ bp::arg (" self" ),
158+ " Returns a vector expression of the imaginary part (x,y,z)." )
159+ .def (" angularDistance" ,
160+ // (bp::arg("self"),bp::arg("other")), // Bug in Boost.Python
161+ &Quaternion::template angularDistance<Quaternion>,
162+ " Returns the angle (in radian) between two rotations." )
163+ .def (" slerp" ,&slerp,bp::args (" self" ," t" ," other" ),
134164 " Returns the spherical linear interpolation between the two quaternions *this and other at the parameter t in [0;1]." )
135165
136166 /* --- Operators --- */
@@ -144,9 +174,9 @@ namespace eigenpy
144174 .def (" __setitem__" ,&QuaternionVisitor::__setitem__)
145175 .def (" __getitem__" ,&QuaternionVisitor::__getitem__)
146176 .def (" assign" ,&assign<Quaternion>,
147- bp::arg ( " quat" )," Set *this from an quaternion quat and returns a reference to *this." ,bp::return_self<>())
177+ bp::args ( " self " , " quat" )," Set *this from an quaternion quat and returns a reference to *this." ,bp::return_self<>())
148178 .def (" assign" ,(Quaternion & (Quaternion::*)(const AngleAxis &))&Quaternion::operator =,
149- bp::arg ( " aa" )," Set *this from an angle-axis aa and returns a reference to *this." ,bp::return_self<>())
179+ bp::args ( " self " , " aa" )," Set *this from an angle-axis aa and returns a reference to *this." ,bp::return_self<>())
150180 .def (" __str__" ,&print)
151181 .def (" __repr__" ,&print)
152182
@@ -158,7 +188,8 @@ namespace eigenpy
158188 " Returns the quaternion which transforms a into b through a rotation." ,
159189 bp::return_value_policy<bp::manage_new_object>())
160190 .staticmethod (" FromTwoVectors" )
161- .def (" Identity" ,&Quaternion::Identity," Returns a quaternion representing an identity rotation." )
191+ .def (" Identity" ,&Quaternion::Identity,
192+ " Returns a quaternion representing an identity rotation." )
162193 .staticmethod (" Identity" )
163194 ;
164195 }
0 commit comments