4#ifndef __multicontact_api_python_geometry_linear_cone_hpp__
5#define __multicontact_api_python_geometry_linear_cone_hpp__
7#include <eigenpy/eigenpy.hpp>
8#include <pinocchio/fwd.hpp>
16namespace bp = boost::python;
20 :
public boost::python::def_visitor<LCPythonVisitor<LC> > {
27 typedef typename LC::Index
Index;
29 template <
class PyClass>
31 cl.def(bp::init<>(
"Default constructor."))
32 .def(bp::init<MatrixDx>((bp::arg(
"rays"),
"Init from a set of rays.")))
33 .def(bp::init<Index>(bp::args(
"size"),
"Init with a given size."))
34 .def(bp::init<LC>(bp::args(
"other"),
"Copy constructor."))
36 .add_property(
"size", &LC::size,
"Returns the size of the set of rays.")
37 .add_static_property(
"dim", &
dim,
"Dimension of the linear cone.")
40 "Matrix of rays of the linear cone.")
43 (
bool (LC::*)(
const LC &,
const Scalar &)
const) & LC::isApprox,
44 bp::args(
"other",
"prec"),
45 "Returns true if *this is approximately equal to other, within "
46 "the precision determined by prec.")
47 .def(
"stack", &LC::template stack<MatrixDx>, bp::args(
"rays"),
48 "Stack new rays to the set of rays.")
49 .def(
"stack", &LC::template stack<Scalar, LC::Options>,
50 bp::args(
"cone"),
"Stack the rays of one to the set of rays.")
52 .def(bp::self == bp::self)
53 .def(bp::self != bp::self);
56 static PyClass &
expose(
const std::string &class_name, std::string doc =
"") {
58 doc =
"Linear Cone of dimension " + LC::dim;
59 doc +=
" defined by its rays.";
62 static PyClass cl_ =
PyClass(class_name.c_str(), doc.c_str(), bp::no_init);
66 ENABLE_SPECIFIC_MATRIX_TYPE(
MatrixDx);
67 ENABLE_SPECIFIC_MATRIX_TYPE(
VectorD);
82 static int dim() {
return LC::dim; }
85template <
typename ForceCone>
87 :
public boost::python::def_visitor<ForceConePythonVisitor<ForceCone> > {
88 typedef typename ForceCone::Scalar
Scalar;
89 typedef typename ForceCone::Vector3
Vector3;
90 typedef typename ForceCone::VectorD
VectorD;
92 typedef typename ForceCone::Index
Index;
95 template <
class _PyClass>
96 void visit(_PyClass &cl)
const {
97 cl.def(bp::init<>(
"Default constructor."))
98 .def(bp::init<Matrix3x>(
99 (bp::arg(
"rays"),
"Init from a matrix of rays.")))
100 .def(bp::init<Index>(bp::args(
"size"),
"Init with a given size."))
101 .def(bp::init<ForceCone>(bp::args(
"other"),
"Copy constructor."))
103 .def(
"SE3ActOn", &ForceCone::SE3ActOn, bp::args(
"M"),
104 "Returns the action of SE3 on *this, i.e. a WrenchCone.")
105 .def(
"toWrenchCone", &
toWrenchCone,
"Returns *this as a WrenchCone.")
109 const int))&ForceCone::RegularCone,
110 bp::args(
"mu",
"direction",
"num rays"),
111 "Generates a regular linear cone from a given number of rays, a "
112 "main direction and a friction "
116 const Scalar))&ForceCone::RegularCone,
117 bp::args(
"mu",
"direction",
"num rays",
"angle offset"),
118 "Generates a regular linear cone from a given number of rays, a "
119 "main direction and a friction "
120 "coefficient, with an offset on the orientation.")
121 .staticmethod(
"RegularCone");
124 static void expose(
const std::string &class_name) {
125 std::string doc =
"Force Cone of dimension 3";
126 doc +=
" defined by its rays.";
130 bp::class_<ForceCone, bp::bases<typename ForceCone::Base> >(
131 class_name.c_str(), doc.c_str(), bp::no_init)
140template <
typename WrenchCone>
142 :
public boost::python::def_visitor<WrenchConePythonVisitor<WrenchCone> > {
145 typedef typename WrenchCone::Index
Index;
147 template <
class _PyClass>
149 cl.def(bp::init<>(
"Default constructor."))
150 .def(bp::init<Matrix6x>(
151 (bp::arg(
"rays"),
"Init from a matrix of rays.")))
152 .def(bp::init<Index>(bp::args(
"size"),
"Init with a given size."))
153 .def(bp::init<WrenchCone>(bp::args(
"other"),
"Copy constructor."))
155 .def(
"SE3ActOn", &WrenchCone::SE3ActOn, bp::args(
"M"),
156 "Returns the action of SE3 on *this, i.e. a WrenchCone.")
157 .def(
"linear", &
getLinear,
"Returns the linear block of *this.")
158 .def(
"angular", &
getAngular,
"Returns the angular block of *this.");
161 static void expose(
const std::string &class_name) {
162 std::string doc =
"Linear Wrench Cone";
166 bp::class_<WrenchCone, bp::bases<typename WrenchCone::Base> >(
167 class_name.c_str(), doc.c_str(), bp::no_init)