Unverified Commit c8d0c091 authored by Rohan Budhiraja's avatar Rohan Budhiraja Committed by GitHub
Browse files

Merge pull request #6 from proyan/master

[python/spline] create spline by concatenating splines.
parents 3a7d0382 7c5dcf2a
......@@ -139,16 +139,21 @@ public:
const time_t& dt (t);
point_t h = coefficients_.col(order_);
std::size_t i=order_-1; bool ok=true;
while(ok)
if(order_!=0)
{
while(ok && order_!=0)
{
h = dt*h + coefficients_.col(i);
if (i==0)
ok=false;
else i--;
h = dt*h + coefficients_.col(i);
if (i==0)
ok=false;
else i--;
}
return h;
return h;
}
else
return h;
}
/// \brief Evaluation of the derivative spline at time t.
/// \param t : the time when to evaluate the spline
......
......@@ -260,6 +260,10 @@ public:
{
return subSplines_[0].size();
}
const t_spline_t& getSubsplines() const
{
return subSplines_;
}
virtual bool setInitialPoint(const point_t& /*x_init*/)
{
......
......@@ -160,6 +160,18 @@ void spline_from_waypoints(spline_t& self, const coeff_t& array,
return;
}
spline_t* spline_by_concatenation_constructor(const bp::list& list_splines)
{
t_spline_t subSplines;
subSplines.clear();
for(int i=0; i<len(list_splines); ++i) {
spline_t _sp = bp::extract<spline_t>(list_splines[i]);
const t_spline_t& _vec_subspline = _sp.getSubsplines();
subSplines.insert(subSplines.end(), _vec_subspline.begin(), _vec_subspline.end() );
}
return new spline_t(subSplines);
}
spline_t* wrapExactCubicConstructorvoid()
{
return new spline_t();
......@@ -318,6 +330,7 @@ BOOST_PYTHON_MODULE(libparametric_curves_pywrap)
("spline", no_init)
.def("__init__", make_constructor(&wrapExactCubicConstructorvoid))
.def("__init__", make_constructor(&wrapExactCubicConstructorPolySequence))
.def("__init__", make_constructor(&spline_by_concatenation_constructor))
.def("min", &spline_t::tmin, bp::return_value_policy<bp::return_by_value>())
.def("max", &spline_t::tmax, bp::return_value_policy<bp::return_by_value>())
.def("__call__", &spline_t::operator(), bp::return_value_policy<bp::return_by_value>())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment