Skip to content
Snippets Groups Projects
Commit 42352410 authored by Pierre Fernbach's avatar Pierre Fernbach Committed by Pierre Fernbach
Browse files

[python] create parent class 'curve3' for all the curves of fixed dimension 3,...

[python] create parent class 'curve3' for all the curves of fixed dimension 3, bezier3 correctly inherit of this class
parent 2b7be216
No related branches found
No related tags found
No related merge requests found
......@@ -4,8 +4,6 @@
#include <vector>
namespace curves
{
using namespace boost::python;
......@@ -20,6 +18,17 @@ namespace curves
real max() { return this->get_override("max")();}
};
struct Curve3Wrapper : curve_3_t, wrapper<curve_3_t>
{
point_t operator()(const real) { return this->get_override("operator()")();}
point_t derivate(const real, const std::size_t) { return this->get_override("derivate")();}
std::size_t dim() { return this->get_override("dim")();}
real min() { return this->get_override("min")();}
real max() { return this->get_override("max")();}
};
/* end base wrap of curve_abc */
/* Template constructor bezier */
......@@ -339,8 +348,17 @@ namespace curves
.def("loadFromBinary",pure_virtual(&curve_abc_t::loadFromBinary<curve_abc_t>),bp::args("filename"),"Loads *this from a binary file.")
;
class_<Curve3Wrapper,boost::noncopyable, bases<curve_abc_t> >("curve3",no_init)
.def("__call__", pure_virtual(&curve_3_t::operator()),"Evaluate the curve at the given time.",args("self","t"))
.def("derivate", pure_virtual(&curve_3_t::derivate),"Evaluate the derivative of order N of curve at time t.",args("self","t","N"))
.def("min", pure_virtual(&curve_3_t::min), "Get the LOWER bound on interval definition of the curve.")
.def("max", pure_virtual(&curve_3_t::max),"Get the HIGHER bound on interval definition of the curve.")
.def("dim", pure_virtual(&curve_3_t::dim),"Get the dimension of the curve.")
;
/** BEGIN bezier3 curve**/
class_<bezier3_t, bases<curve_abc_t> >("bezier3", init<>())
class_<bezier3_t, bases<curve_3_t> >("bezier3", init<>())
.def("__init__", make_constructor(&wrapBezier3Constructor))
.def("__init__", make_constructor(&wrapBezier3ConstructorBounds))
.def("__init__", make_constructor(&wrapBezier3ConstructorConstraints))
......
......@@ -96,6 +96,7 @@ namespace curves
// Curves
typedef curve_abc<real, real, true, pointX_t> curve_abc_t; // generic class of curve
typedef curve_abc<real, real, true, point3_t> curve_3_t; // generic class of curve of size 3
typedef curves::cubic_hermite_spline <real, real, true, pointX_t> cubic_hermite_spline_t;
typedef curves::bezier_curve <real, real, true, pointX_t> bezier_t;
typedef curves::polynomial <real, real, true, pointX_t, t_pointX_t> polynomial_t;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment