4#ifndef __multicontact_api_python_geometry_second_order_cone_hpp__
5#define __multicontact_api_python_geometry_second_order_cone_hpp__
7#include <eigenpy/eigenpy.hpp>
15namespace bp = boost::python;
17template <
typename SOC>
19 :
public boost::python::def_visitor<SOCPythonVisitor<SOC> > {
24 template <
class PyClass>
26 cl.def(bp::init<>(
"Default constructor."))
27 .def(bp::init<MatrixD, VectorD>((bp::arg(
"Q"), bp::arg(
"direction"))))
29 .def(
"lhsValue", &SOC::lhsValue, bp::arg(
"vector"),
30 "Returns the lhs value of the conic inequality.")
31 .def(
"rhsValue", &SOC::rhsValue, bp::arg(
"vector"),
32 "Returns the rhs value of the conic inequality.")
33 .def(
"check", (
bool (SOC::*)(
const VectorD &)
const) & SOC::check,
35 "Checks if the vector given in argument belongs to the conic "
38 (
bool (SOC::*)(
const VectorD &,
const Scalar)
const) & SOC::check,
39 bp::args(
"vector",
"factor"),
40 "Checks if the vector given in argument belongs to the conic "
41 "constraint with a given reduction factor.")
42 .add_property(
"direction", &
get_direction, &SOC::setDirection,
43 "Accessor to the direction property.")
44 .add_property(
"Q", &
get_Q, &SOC::setQ,
"Accessor to the Q property.")
46 (
bool (SOC::*)(
const SOC &,
const Scalar &)
const) & SOC::isApprox,
47 bp::args(
"other",
"prec"),
48 "Returns true if *this is approximately equal to other, within "
49 "the precision determined by prec.")
50 .def(bp::self == bp::self)
51 .def(bp::self != bp::self)
53 .def(
"RegularCone", &SOC::RegularCone, bp::args(
"mu",
"direction"),
54 "Creates a regular cone from a given friction coefficient and a "
56 .staticmethod(
"RegularCone");
59 static void expose(
const std::string &class_name) {
60 std::string doc =
"SOC of dimension " + SOC::dim;
61 doc +=
" defined by its direction and its quadratic norm.";
62 bp::class_<SOC>(class_name.c_str(), doc.c_str(), bp::no_init)
67 ENABLE_SPECIFIC_MATRIX_TYPE(
MatrixD);
68 ENABLE_SPECIFIC_MATRIX_TYPE(
VectorD);