5 #ifndef __eigenpy_angle_axis_hpp__ 6 #define __eigenpy_angle_axis_hpp__ 11 #include <Eigen/Geometry> 20 template<
typename Scalar>
30 static inline bool isApprox(
const AngleAxis &
self,
const AngleAxis & other,
31 const Scalar & prec = Eigen::NumTraits<Scalar>::dummy_precision())
33 return self.isApprox(other,prec);
37 template<
typename AngleAxis>
39 :
public bp::def_visitor< AngleAxisVisitor<AngleAxis> >
42 typedef typename AngleAxis::Scalar
Scalar;
43 typedef typename AngleAxis::Vector3
Vector3;
44 typedef typename AngleAxis::Matrix3
Matrix3;
53 template<class PyClass>
54 void visit(PyClass& cl)
const 57 .def(bp::init<>(bp::arg(
"self"),
"Default constructor"))
58 .def(bp::init<Scalar,Vector3>
59 ((bp::arg(
"self"),bp::arg(
"angle"),bp::arg(
"axis")),
60 "Initialize from angle and axis."))
61 .def(bp::init<Matrix3>
62 ((bp::arg(
"self"),bp::arg(
"rotation matrix")),
63 "Initialize from a rotation matrix"))
64 .def(bp::init<Quaternion>((bp::arg(
"self"),bp::arg(
"quaternion")),
65 "Initialize from a quaternion."))
66 .def(bp::init<AngleAxis>((bp::arg(
"self"),bp::arg(
"copy")),
72 bp::return_internal_reference<>()),
74 .add_property(
"angle",
75 (Scalar (AngleAxis::*)()
const)&AngleAxis::angle,
79 .def(
"inverse",&AngleAxis::inverse,
81 "Return the inverse rotation.")
82 .def(
"fromRotationMatrix",&AngleAxis::template fromRotationMatrix<Matrix3>,
83 (bp::arg(
"self"),bp::arg(
"rotation matrix")),
84 "Sets *this from a 3x3 rotation matrix",
86 .def(
"toRotationMatrix",
88 &AngleAxis::toRotationMatrix,
89 "Constructs and returns an equivalent 3x3 rotation matrix.")
92 "Returns an equivalent rotation matrix.")
96 isApproxAngleAxis_overload(bp::args(
"self",
"other",
"prec"),
97 "Returns true if *this is approximately equal to other, within the precision determined by prec."))
100 .def(bp::self * bp::other<Vector3>())
101 .def(bp::self * bp::other<Quaternion>())
102 .def(bp::self * bp::self)
106 .def(
"__str__",&print)
107 .def(
"__repr__",&print)
114 {
self.axis() =
axis; }
116 static void setAngle( AngleAxis &
self,
const Scalar & angle)
117 {
self.angle() = angle; }
119 static bool __eq__(
const AngleAxis & u,
const AngleAxis &
v)
120 {
return u.axis() == v.axis() && v.angle() == u.angle(); }
122 static bool __ne__(
const AngleAxis & u,
const AngleAxis &
v)
123 {
return !__eq__(u,v); }
125 static std::string
print(
const AngleAxis &
self)
127 std::stringstream ss;
128 ss <<
"angle: " <<
self.angle() << std::endl;
129 ss <<
"axis: " <<
self.axis().transpose() << std::endl;
138 bp::class_<AngleAxis>(
"AngleAxis",
139 "AngleAxis representation of a rotation.\n\n",
144 bp::implicitly_convertible<AngleAxis,RotationBase>();
151 #endif //ifndef __eigenpy_angle_axis_hpp__ Eigen::Quaternion< Scalar, 0 > Quaternion
static void setAngle(AngleAxis &self, const Scalar &angle)
boost::python::object matrix()
Eigen::AngleAxis< Scalar > AngleAxis
static std::string print(const AngleAxis &self)
Allows a template specialization.
static bool isApprox(const AngleAxis &self, const AngleAxis &other, const Scalar &prec=Eigen::NumTraits< Scalar >::dummy_precision())
static bool __ne__(const AngleAxis &u, const AngleAxis &v)
Eigen::RotationBase< AngleAxis, 3 > RotationBase
static bool __eq__(const AngleAxis &u, const AngleAxis &v)
AngleAxis::Matrix3 Matrix3
AngleAxis::Vector3 Vector3
static void setAxis(AngleAxis &self, const Vector3 &axis)