Commit c61f7bc5 authored by JasonChmn's avatar JasonChmn Committed by Pierre Fernbach
Browse files

[curve_abc] Add virtual function to get dimension of curve

parent 40b5d9e5
......@@ -399,6 +399,9 @@ namespace curves
public:
/*Helpers*/
/// \brief Get dimension of curve.
/// \return dimension of curve.
std::size_t virtual dim() const{return dim_;};
/// \brief Get the minimum time for which the curve is defined
/// \return \f$t_{min}\f$, lower bound of time range.
virtual time_t min() const{return T_min_;}
......@@ -408,6 +411,8 @@ namespace curves
/*Helpers*/
/* Attributes */
/// Dim of curve
std::size_t dim_;
/// Starting time of cubic hermite spline : T_min_ is equal to first time of control points.
/*const*/ time_t T_min_;
/// Ending time of cubic hermite spline : T_max_ is equal to last time of control points.
......
......@@ -357,6 +357,9 @@ namespace curves
/*Helpers*/
public:
/// \brief Get dimension of curve.
/// \return dimension of curve.
std::size_t virtual dim() const{return dim_;};
/// \brief Get the minimum time for which the curve is defined
/// \return \f$t_{min}\f$, lower bound of time range.
Time virtual min() const{return time_control_points_.front();}
......@@ -366,12 +369,13 @@ namespace curves
/*Helpers*/
/*Attributes*/
/// Dim of curve
std::size_t dim_;
/// Vector of pair < Point, Tangent >.
t_pair_point_tangent_t control_points_;
/// Vector of Time corresponding to time of each N control points : time at \f$P_0, P_1, P_2, ..., P_N\f$.
/// Exemple : \f$( 0., 0.5, 0.9, ..., 4.5 )\f$ with values corresponding to times for \f$P_0, P_1, P_2, ..., P_N\f$ respectively.
vector_time_t time_control_points_;
/// Vector of Time corresponding to time duration of each subspline.<br>
/// For N control points with time \f$T_{P_0}, T_{P_1}, T_{P_2}, ..., T_{P_N}\f$ respectively,
/// duration of each subspline is : ( T_{P_1}-T_{P_0}, T_{P_2}-T_{P_1}, ..., T_{P_N}-T_{P_{N-1} )<br>
......
......@@ -54,6 +54,9 @@ namespace curves
/*Operations*/
/*Helpers*/
/// \brief Get dimension of curve.
/// \return dimension of curve.
virtual std::size_t dim() const = 0;
/// \brief Get the minimum time for which the curve is defined.
/// \return \f$t_{min}\f$, lower bound of time range.
virtual time_t min() const = 0;
......
......@@ -87,10 +87,12 @@ namespace curves
return exact_cubic_constraint_one_dim(waypoints.begin(), waypoints.end());
}
virtual std::size_t dim() const{return dim_;}
virtual time_t min() const{return min_;}
virtual time_t max() const{return max_;}
/*Attributes*/
std::size_t dim_; //const
Eigen::Quaterniond quat_from_; //const
Eigen::Quaterniond quat_to_; //const
double min_; //const
......
......@@ -305,6 +305,9 @@ namespace curves
/*Helpers*/
public:
/// \brief Get dimension of curve.
/// \return dimension of curve.
std::size_t virtual dim() const{return dim_;};
/// \brief Get the minimum time for which the curve is defined
/// \return \f$t_{min}\f$, lower bound of time range.
Time virtual min() const{return T_min_;}
......@@ -315,6 +318,7 @@ namespace curves
/*Helpers*/
/* Attributes */
std::size_t dim_; // Dim of curve
t_curve_t curves_; // for curves 0/1/2 : [ curve0, curve1, curve2 ]
t_time_t time_curves_; // for curves 0/1/2 : [ Tmin0, Tmax0,Tmax1,Tmax2 ]
std::size_t size_; // Number of segments in piecewise curve = size of curves_
......
......@@ -217,6 +217,9 @@ namespace curves
public:
/*Helpers*/
/// \brief Get dimension of curve.
/// \return dimension of curve.
std::size_t virtual dim() const{return dim_;};
/// \brief Get the minimum time for which the curve is defined
/// \return \f$t_{min}\f$ lower bound of time range.
num_t virtual min() const {return T_min_;}
......@@ -229,7 +232,7 @@ namespace curves
coeff_t coefficients_; //const
std::size_t dim_; //const
std::size_t degree_; //const
time_t T_min_, T_max_;
time_t T_min_, T_max_; //const
/*Attributes*/
private:
......
......@@ -284,6 +284,7 @@ namespace curves
.def("__init__", make_constructor(&wrapBezierConstructorBounds3Constraints))
.def("min", &bezier3_t::min)
.def("max", &bezier3_t::max)
.def("dim", &bezier3_t::dim)
.def("__call__", &bezier3_t::operator())
.def("derivate", &bezier3_t::derivate)
.def("compute_derivate", &bezier3_t::compute_derivate)
......@@ -316,6 +317,7 @@ namespace curves
.def("__init__", make_constructor(&wrapBezierLinearConstructorBounds))
.def("min", &bezier_linear_variable_t::min)
.def("max", &bezier_linear_variable_t::max)
.def("dim", &bezier_linear_variable_t::dim)
//.def("__call__", &bezier_linear_control_t::operator())
.def("derivate", &bezier_linear_variable_t::derivate)
.def("compute_derivate", &bezier_linear_variable_t::compute_derivate)
......@@ -338,6 +340,7 @@ namespace curves
" Spline order is given by the number of the columns -1.")
.def("min", &polynomial3_t::min, "Get the LOWER bound on interval definition of the curve.")
.def("max", &polynomial3_t::max,"Get the HIGHER bound on interval definition of the curve.")
.def("dim", &polynomial3_t::dim)
.def("__call__", &polynomial3_t::operator(),"Evaluate the spline at the given time.")
.def("derivate", &polynomial3_t::derivate,"Evaluate the derivative of order N of curve at time t.",args("self","t","N"))
.def("compute_derivate", &polynomial3_t::compute_derivate,"Compute derivative of order N of curve at time t.")
......@@ -358,6 +361,7 @@ namespace curves
"Create a peicewise-polynomial curve containing the given polynomial curve.")
.def("min", &piecewise_polynomial3_curve_t::min,"Set the LOWER bound on interval definition of the curve.")
.def("max", &piecewise_polynomial3_curve_t::max,"Set the HIGHER bound on interval definition of the curve.")
.def("dim", &piecewise_polynomial3_curve_t::dim)
.def("__call__", &piecewise_polynomial3_curve_t::operator(),"Evaluate the curve at the given time.")
.def("derivate", &piecewise_polynomial3_curve_t::derivate,"Evaluate the derivative of order N of curve at time t.",args("self","t","N"))
.def("add_curve", &piecewise_polynomial3_curve_t::add_curve,
......@@ -377,6 +381,7 @@ namespace curves
.def("__init__", make_constructor(&wrapPiecewiseBezier3CurveConstructor))
.def("min", &piecewise_bezier3_curve_t::min)
.def("max", &piecewise_bezier3_curve_t::max)
.def("dim", &piecewise_bezier3_curve_t::dim)
.def("__call__", &piecewise_bezier3_curve_t::operator())
.def("derivate", &piecewise_bezier3_curve_t::derivate)
.def("add_curve", &piecewise_bezier3_curve_t::add_curve)
......@@ -394,6 +399,7 @@ namespace curves
.def("__init__", make_constructor(&wrapPiecewiseCubicHermite3CurveConstructor))
.def("min", &piecewise_cubic_hermite_curve_t::min)
.def("max", &piecewise_cubic_hermite_curve_t::max)
.def("dim", &piecewise_cubic_hermite_curve_t::dim)
.def("__call__", &piecewise_cubic_hermite_curve_t::operator())
.def("derivate", &piecewise_cubic_hermite_curve_t::derivate)
.def("add_curve", &piecewise_cubic_hermite_curve_t::add_curve)
......@@ -414,6 +420,7 @@ namespace curves
.def("__init__", make_constructor(&wrapExactCubic3ConstructorConstraint))
.def("min", &exact_cubic3_t::min)
.def("max", &exact_cubic3_t::max)
.def("dim", &exact_cubic3_t::dim)
.def("__call__", &exact_cubic3_t::operator())
.def("derivate", &exact_cubic3_t::derivate)
.def("getNumberSplines", &exact_cubic3_t::getNumberSplines)
......@@ -433,6 +440,7 @@ namespace curves
.def("__init__", make_constructor(&wrapCubicHermiteSplineConstructor))
.def("min", &cubic_hermite_spline_t::min)
.def("max", &cubic_hermite_spline_t::max)
.def("dim", &cubic_hermite_spline_t::dim)
.def("__call__", &cubic_hermite_spline_t::operator())
.def("derivate", &cubic_hermite_spline_t::derivate)
.def("saveAsText", &cubic_hermite_spline_t::saveAsText<cubic_hermite_spline_t>,bp::args("filename"),"Saves *this inside a text file.")
......
Markdown is supported
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