Commit 05880e99 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

Merge branch 'pFernbach-topic/operator_equal' into 'devel'

P fernbach topic/operator equal

See merge request loco-3d/curves!41
parents 94370fc8 96722777
Subproject commit e8019fc05ccee5bd527265458e91c8232d6621fe
Subproject commit 54ece258eed16da94c7f10979588fcb47b744eb8
......@@ -45,6 +45,17 @@ struct Bern {
return bin_m_i_ * (pow(u, i_)) * pow((1 - u), m_minus_i);
}
virtual bool operator== (const Bern& other) const{
return curves::isApprox<Numeric>(m_minus_i, other.m_minus_i)
&& curves::isApprox<Numeric>(i_, other.i_)
&& curves::isApprox<Numeric>(bin_m_i_, other.bin_m_i_);
}
virtual bool operator!=(const Bern& other) const {
return !(*this == other);
}
/* Attributes */
Numeric m_minus_i;
Numeric i_;
......
......@@ -140,6 +140,49 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> {
}
}
/**
* @brief isApprox check if other and *this are approximately equals.
* Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent
* @param other the other curve to check
* @param prec the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision()
* @return true is the two curves are approximately equals
*/
bool isApprox(const bezier_curve_t& other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
bool equal = curves::isApprox<num_t> (T_min_, other.min())
&& curves::isApprox<num_t> (T_max_, other.max())
&& dim_ == other.dim()
&& degree_ == other.degree()
&& size_ == other.size_
&& curves::isApprox<Numeric>(mult_T_, other.mult_T_)
&& bernstein_ == other.bernstein_;
if(!equal)
return false;
for (size_t i = 0 ;i < size_;++i)
{
if(!control_points_.at(i).isApprox(other.control_points_.at(i),prec))
return false;
}
return true;
}
virtual bool isApprox(const curve_abc_t* other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
const bezier_curve_t* other_cast = dynamic_cast<const bezier_curve_t*>(other);
if(other_cast)
return isApprox(*other_cast,prec);
else
return false;
}
virtual bool operator==(const bezier_curve_t& other) const {
return isApprox(other);
}
virtual bool operator!=(const bezier_curve_t& other) const {
return !(*this == other);
}
/// \brief Compute the derived curve at order N.
/// Computes the derivative order N, \f$\frac{d^Nx(t)}{dt^N}\f$ of bezier curve of parametric equation x(t).
/// \param order : order of derivative.
......
......@@ -103,6 +103,50 @@ struct cubic_hermite_spline : public curve_abc<Time, Numeric, Safe, Point> {
}
}
/**
* @brief isApprox check if other and *this are approximately equals.
* Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent
* @param other the other curve to check
* @param prec the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision()
* @return true is the two curves are approximately equals
*/
bool isApprox(const cubic_hermite_spline_t& other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
bool equal = curves::isApprox<num_t> (T_min_, other.min())
&& curves::isApprox<num_t> (T_max_, other.max())
&& dim_ == other.dim()
&& degree_ == other.degree()
&& size_ == other.size()
&& time_control_points_ == other.time_control_points_
&& duration_splines_ == other.duration_splines_;
if(!equal)
return false;
for (std::size_t i = 0 ; i < size_ ;++i)
{
if((!control_points_[i].first.isApprox(other.control_points_[i].first,prec)) ||
(!control_points_[i].second.isApprox(other.control_points_[i].second,prec)) )
return false;
}
return true;
}
virtual bool isApprox(const curve_abc_t* other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
const cubic_hermite_spline_t* other_cast = dynamic_cast<const cubic_hermite_spline_t*>(other);
if(other_cast)
return isApprox(*other_cast,prec);
else
return false;
}
virtual bool operator==(const cubic_hermite_spline_t& other) const {
return isApprox(other);
}
virtual bool operator!=(const cubic_hermite_spline_t& other) const {
return !(*this == other);
}
/// \brief Evaluate the derivative of order N of spline at time t.
/// \param t : time when to evaluate the spline.
/// \param order : order of derivative.
......
......@@ -20,6 +20,13 @@
#include <functional>
namespace curves {
template <typename T>
bool isApprox(const T a, const T b, const T eps = 1e-6)
{
return fabs(a - b) < eps;
}
/// \struct curve_abc.
/// \brief Represents a curve of dimension Dim.
/// If value of parameter Safe is false, no verification is made on the evaluation of the curve.
......@@ -29,6 +36,7 @@ struct curve_abc : std::unary_function<Time, Point>, public serialization::Seria
typedef Point point_t;
typedef Point_derivate point_derivate_t;
typedef Time time_t;
typedef Numeric num_t;
typedef curve_abc<Time, Numeric, Safe, point_t,point_derivate_t> curve_t; // parent class
typedef boost::shared_ptr<curve_t> curve_ptr_t;
......@@ -59,6 +67,52 @@ struct curve_abc : std::unary_function<Time, Point>, public serialization::Seria
/// \return \f$\frac{d^Nx(t)}{dt^N}\f$, point corresponding on derivative curve of order N at time t.
virtual point_derivate_t derivate(const time_t t, const std::size_t order) const = 0;
/**
* @brief isEquivalent check if other and *this are approximately equal by values, given a precision treshold.
* This test is done by discretizing both curves and evaluating them and their derivatives.
* @param other the other curve to check
* @param order the order up to which the derivatives of the curves are checked for equality
* @param prec the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision()
* @return true is the two curves are approximately equals
*/
bool isEquivalent(const curve_t* other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision(),const size_t order = 5) const{
bool equal = curves::isApprox<num_t> (min(), other->min())
&& curves::isApprox<num_t> (max(), other->max())
&& (dim() == other->dim());
if(!equal){
return false;
}
time_t inc = (max() - min()) / 10.; // FIXME : define this step somewhere ??
// check the value along the two curves
time_t t = min();
while(t<= max()){
if(!(*this)(t).isApprox(other->operator()(t),prec)){
return false;
}
t += inc;
}
// check if the derivatives are equals
for(size_t n = 1 ; n <= order ; ++n){
t = min();
while(t<= max()){
if(!derivate(t,n).isApprox(other->derivate(t,n),prec)){
return false;
}
t += inc;
}
}
return true;
}
/**
* @brief isApprox check if other and *this are approximately equals given a precision treshold
* Only two curves of the same class can be approximately equals,
* for comparison between different type of curves see isEquivalent.
* @param other the other curve to check
* @param prec the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision()
* @return true is the two curves are approximately equals
*/
virtual bool isApprox(const curve_t* other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const = 0;
/*Operations*/
......
......@@ -109,6 +109,17 @@ struct exact_cubic : public piecewise_curve<Time, Numeric, Safe, Point> {
/// \brief Destructor.
virtual ~exact_cubic() {}
/**
* @brief isApprox check if other and *this are approximately equals.
* Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent
* @param other the other curve to check
* @param prec the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision()
* @return true is the two curves are approximately equals
*/
bool isApprox(const exact_cubic_t& other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
return piecewise_curve_t::isApprox(other,prec);
}
std::size_t getNumberSplines() { return this->getNumberCurves(); }
spline_t getSplineAt(std::size_t index) {
......
......@@ -62,7 +62,7 @@ typedef Eigen::Matrix<double, 3, 3> matrix3_t;
typedef Eigen::Matrix<double, 4, 4> matrix4_t;
typedef Eigen::Quaternion<double> quaternion_t;
typedef Eigen::Transform<double, 3, Eigen::Affine> transform_t;
typedef std::vector<pointX_t, Eigen::aligned_allocator<point3_t> > t_point3_t;
typedef std::vector<point3_t, Eigen::aligned_allocator<point3_t> > t_point3_t;
typedef std::vector<pointX_t, Eigen::aligned_allocator<pointX_t> > t_pointX_t;
// abstract curves types:
......
......@@ -72,6 +72,39 @@ class rotation_spline : public curve_abc_quat_t {
return quat_from_.slerp(time_reparam_(u)[0], quat_to_).coeffs();
}
/**
* @brief isApprox check if other and *this are approximately equals.
* Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent
* @param other the other curve to check
* @param prec the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision()
* @return true is the two curves are approximately equals
*/
bool isApprox(const rotation_spline& other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
return curves::isApprox<Numeric> (min_, other.min_)
&& curves::isApprox<Numeric> (max_, other.max_)
&& dim_ == other.dim_
&& quat_from_.isApprox(other.quat_from_,prec)
&& quat_to_.isApprox(other.quat_to_,prec)
&& time_reparam_.isApprox(other.time_reparam_,prec);
}
virtual bool isApprox(const curve_abc_quat_t* other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
const rotation_spline* other_cast = dynamic_cast<const rotation_spline*>(other);
if(other_cast)
return isApprox(*other_cast,prec);
else
return false;
}
virtual bool operator==(const rotation_spline& other) const {
return isApprox(other);
}
virtual bool operator!=(const rotation_spline& other) const {
return !(*this == other);
}
virtual quat_t derivate(time_t /*t*/, std::size_t /*order*/) const {
throw std::runtime_error("TODO quaternion spline does not implement derivate");
}
......
......@@ -81,7 +81,7 @@ struct linear_variable : public serialization::Serializable {
Numeric norm() const { return isZero() ? 0 : (B_.norm() + c_.norm()); }
bool isApprox(const linear_variable_t& other,const double prec = Eigen::NumTraits<Numeric>::dummy_precision()){
bool isApprox(const linear_variable_t& other,const double prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
return (*this - other).norm() < prec;
}
......
......@@ -80,6 +80,39 @@ struct piecewise_curve : public curve_abc<Time, Numeric, Safe, Point,Point_deriv
return (*curves_.at(find_interval(t)))(t);
}
/**
* @brief isApprox check if other and *this are approximately equals.
* Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent
* @param other the other curve to check
* @param prec the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision()
* @return true is the two curves are approximately equals
*/
bool isApprox(const piecewise_curve_t& other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
if(num_curves() != other.num_curves())
return false;
for (size_t i = 0 ; i < num_curves() ; ++i) {
if(! curve_at_index(i)->isApprox(other.curve_at_index(i).get(),prec))
return false;
}
return true;
}
virtual bool isApprox(const curve_t* other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
const piecewise_curve_t* other_cast = dynamic_cast<const piecewise_curve_t*>(other);
if(other_cast)
return isApprox(*other_cast,prec);
else
return false;
}
virtual bool operator==(const piecewise_curve_t& other) const {
return isApprox(other);
}
virtual bool operator!=(const piecewise_curve_t& other) const {
return !(*this == other);
}
/// \brief Evaluate the derivative of order N of curve at time t.
/// \param t : time when to evaluate the spline.
/// \param order : order of derivative.
......
......@@ -254,6 +254,40 @@ struct polynomial : public curve_abc<Time, Numeric, Safe, Point> {
return h;
}
/**
* @brief isApprox check if other and *this are approximately equals.
* Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent
* @param other the other curve to check
* @param prec the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision()
* @return true is the two curves are approximately equals
*/
bool isApprox(const polynomial_t& other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
return curves::isApprox<num_t> (T_min_, other.min())
&& curves::isApprox<num_t> (T_max_, other.max())
&& dim_ == other.dim()
&& degree_ == other.degree()
&& coefficients_.isApprox(other.coefficients_,prec);
}
virtual bool isApprox(const curve_abc_t* other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
const polynomial_t* other_cast = dynamic_cast<const polynomial_t*>(other);
if(other_cast)
return isApprox(*other_cast,prec);
else
return false;
}
virtual bool operator==(const polynomial_t& other) const {
return isApprox(other);
}
virtual bool operator!=(const polynomial_t& other) const {
return !(*this == other);
}
/// \brief Evaluation of the derivative of order N of spline at time t.
/// \param t : the time when to evaluate the spline.
/// \param order : order of derivative.
......
......@@ -150,6 +150,38 @@ struct SE3Curve : public curve_abc<Time, Numeric, Safe, Eigen::Transform<Numeric
return res;
}
/**
* @brief isApprox check if other and *this are approximately equals.
* Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent
* @param other the other curve to check
* @param prec the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision()
* @return true is the two curves are approximately equals
*/
bool isApprox(const SE3Curve_t& other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
return curves::isApprox<Numeric> (T_min_, other.min())
&& curves::isApprox<Numeric> (T_max_, other.max())
&& (translation_curve_ == other.translation_curve_ || translation_curve_->isApprox(other.translation_curve_.get(),prec))
&& (rotation_curve_ == other.rotation_curve_ || rotation_curve_->isApprox(other.rotation_curve_.get(),prec));
}
virtual bool isApprox(const curve_abc_t* other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
const SE3Curve_t* other_cast = dynamic_cast<const SE3Curve_t*>(other);
if(other_cast)
return isApprox(*other_cast,prec);
else
return false;
}
virtual bool operator==(const SE3Curve_t& other) const {
return isApprox(other);
}
virtual bool operator!=(const SE3Curve_t& other) const {
return !(*this == other);
}
/// \brief Evaluation of the derivative of order N of spline at time t.
/// \param t : the time when to evaluate the spline.
/// \param order : order of derivative.
......
......@@ -107,6 +107,39 @@ struct SO3Linear : public curve_abc<Time, Numeric, Safe, Eigen::Matrix<Numeric,
/// \return \f$x(t)\f$ point corresponding on spline at time t.
virtual matrix3_t operator()(const time_t t) const { return computeAsQuaternion(t).toRotationMatrix(); }
/**
* @brief isApprox check if other and *this are approximately equals.
* Only two curves of the same class can be approximately equals, for comparison between different type of curves see isEquivalent
* @param other the other curve to check
* @param prec the precision treshold, default Eigen::NumTraits<Numeric>::dummy_precision()
* @return true is the two curves are approximately equals
*/
bool isApprox(const SO3Linear_t& other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
return curves::isApprox<Numeric> (T_min_, other.min())
&& curves::isApprox<Numeric> (T_max_, other.max())
&& dim_ == other.dim()
&& init_rot_.toRotationMatrix().isApprox(other.init_rot_.toRotationMatrix(),prec)
&& end_rot_.toRotationMatrix().isApprox(other.end_rot_.toRotationMatrix(),prec);
}
virtual bool isApprox(const curve_abc_t* other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const{
const SO3Linear_t* other_cast = dynamic_cast<const SO3Linear_t*>(other);
if(other_cast)
return isApprox(*other_cast,prec);
else
return false;
}
virtual bool operator==(const SO3Linear_t& other) const {
return isApprox(other);
}
virtual bool operator!=(const SO3Linear_t& other) const {
return !(*this == other);
}
/// \brief Evaluation of the derivative of order N of spline at time t.
/// \param t : the time when to evaluate the spline.
/// \param order : order of derivative.
......
......@@ -22,6 +22,8 @@ struct CurveWrapper : curve_abc_t, wrapper<curve_abc_t> {
real min() { return this->get_override("min")(); }
real max() { return this->get_override("max")(); }
};
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(curve_abc_t_isEquivalent_overloads, curve_abc_t::isEquivalent, 1, 3)
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")(); }
......@@ -30,6 +32,8 @@ struct Curve3Wrapper : curve_3_t, wrapper<curve_3_t> {
real min() { return this->get_override("min")(); }
real max() { return this->get_override("max")(); }
};
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(curve_3_t_isEquivalent_overloads, curve_3_t::isEquivalent, 1, 3)
struct CurveRotationWrapper : curve_rotation_t, wrapper<curve_rotation_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")(); }
......@@ -38,6 +42,8 @@ struct CurveRotationWrapper : curve_rotation_t, wrapper<curve_rotation_t> {
real min() { return this->get_override("min")(); }
real max() { return this->get_override("max")(); }
};
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(curve_rotation_t_isEquivalent_overloads, curve_rotation_t::isEquivalent, 1, 3)
struct CurveSE3Wrapper : curve_SE3_t, wrapper<curve_SE3_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")(); }
......@@ -46,6 +52,8 @@ struct CurveSE3Wrapper : curve_SE3_t, wrapper<curve_SE3_t> {
real min() { return this->get_override("min")(); }
real max() { return this->get_override("max")(); }
};
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(curve_SE3_t_isEquivalent_overloads, curve_SE3_t::isEquivalent, 1, 3)
/* end base wrap of curve_abc */
/* Template constructor bezier */
......@@ -405,6 +413,11 @@ BOOST_PYTHON_MODULE(curves) {
args("self", "t"))
.def("derivate", pure_virtual(&curve_abc_t::derivate), "Evaluate the derivative of order N of curve at time t.",
args("self", "t", "N"))
.def("isEquivalent",&curve_abc_t::isEquivalent,curve_abc_t_isEquivalent_overloads(
(bp::arg("other"),
bp::arg("prec") = Eigen::NumTraits<double>::dummy_precision(),
bp::arg("order") = 5),
"isEquivalent check if self and other are approximately equal by values, given a precision treshold."))
.def("compute_derivate", pure_virtual(&curve_abc_t::compute_derivate_ptr),return_value_policy<manage_new_object>(), "Return the derivative of *this at the order N.", args("self", "N"))
.def("min", pure_virtual(&curve_abc_t::min), "Get the LOWER bound on interval definition of the curve.")
.def("max", pure_virtual(&curve_abc_t::max), "Get the HIGHER bound on interval definition of the curve.")
......@@ -427,6 +440,11 @@ BOOST_PYTHON_MODULE(curves) {
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("isEquivalent",&curve_3_t::isEquivalent,curve_3_t_isEquivalent_overloads(
(bp::arg("other"),
bp::arg("prec") = Eigen::NumTraits<double>::dummy_precision(),
bp::arg("order") = 5),
"isEquivalent check if self and other are approximately equal by values, given a precision treshold."))
.def("compute_derivate", pure_virtual(&curve_3_t::compute_derivate_ptr),return_value_policy<manage_new_object>(), "Return the derivative of *this at the order N.", args("self", "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.")
......@@ -437,6 +455,11 @@ BOOST_PYTHON_MODULE(curves) {
args("self", "t"))
.def("derivate", pure_virtual(&curve_rotation_t::derivate),
"Evaluate the derivative of order N of curve at time t.", args("self", "t", "N"))
.def("isEquivalent",&curve_rotation_t::isEquivalent,curve_rotation_t_isEquivalent_overloads(
(bp::arg("other"),
bp::arg("prec") = Eigen::NumTraits<double>::dummy_precision(),
bp::arg("order") = 5),
"isEquivalent check if self and other are approximately equal by values, given a precision treshold."))
.def("compute_derivate", pure_virtual(&curve_rotation_t::compute_derivate_ptr),return_value_policy<manage_new_object>(), "Return the derivative of *this at the order N.", args("self", "N"))
.def("min", pure_virtual(&curve_rotation_t::min), "Get the LOWER bound on interval definition of the curve.")
.def("max", pure_virtual(&curve_rotation_t::max), "Get the HIGHER bound on interval definition of the curve.")
......@@ -447,7 +470,12 @@ BOOST_PYTHON_MODULE(curves) {
args("self", "t"))
.def("derivate", pure_virtual(&curve_SE3_t::derivate),
"Evaluate the derivative of order N of curve at time t. Return as a vector 6.", args("self", "t", "N"))
.def("compute_derivate", pure_virtual(&curve_rotation_t::compute_derivate_ptr),return_value_policy<manage_new_object>(), "Return the derivative of *this at the order N.", args("self", "N"))
.def("isEquivalent",&curve_SE3_t::isEquivalent,curve_SE3_t_isEquivalent_overloads(
(bp::arg("other"),
bp::arg("prec") = Eigen::NumTraits<double>::dummy_precision(),
bp::arg("order") = 5),
"isEquivalent check if self and other are approximately equal by values, given a precision treshold."))
.def("compute_derivate", pure_virtual(&curve_SE3_t::compute_derivate_ptr),return_value_policy<manage_new_object>(), "Return the derivative of *this at the order N.", args("self", "N"))
.def("min", pure_virtual(&curve_SE3_t::min), "Get the LOWER bound on interval definition of the curve.")
.def("max", pure_virtual(&curve_SE3_t::max), "Get the HIGHER bound on interval definition of the curve.")
.def("dim", pure_virtual(&curve_SE3_t::dim), "Get the dimension of the curve.")
......@@ -486,6 +514,8 @@ BOOST_PYTHON_MODULE(curves) {
.def("loadFromBinary", &bezier3_t::loadFromBinary<bezier3_t>, bp::args("filename"),
"Loads *this from a binary file.")
//.def(SerializableVisitor<bezier_t>())
.def(bp::self == bp::self)
.def(bp::self != bp::self)
;
/** END bezier3 curve**/
/** BEGIN bezier curve**/
......@@ -509,6 +539,8 @@ BOOST_PYTHON_MODULE(curves) {
"Saves *this inside a binary file.")
.def("loadFromBinary", &bezier_t::loadFromBinary<bezier_t>, bp::args("filename"),
"Loads *this from a binary file.")
.def(bp::self == bp::self)
.def(bp::self != bp::self)
//.def(SerializableVisitor<bezier_t>())
;
/** END bezier curve**/
......@@ -549,7 +581,10 @@ BOOST_PYTHON_MODULE(curves) {
.def("waypoints", &wayPointsToLists, return_value_policy<manage_new_object>())
.def("waypointAtIndex", &bezier_linear_variable_t::waypointAtIndex)
.def_readonly("degree", &bezier_linear_variable_t::degree_)
.def_readonly("nbWaypoints", &bezier_linear_variable_t::size_);
.def_readonly("nbWaypoints", &bezier_linear_variable_t::size_)
.def(bp::self == bp::self)
.def(bp::self != bp::self)
;
class_<quadratic_variable_t>("cost", no_init)
.add_property("A", &cost_t_quad)
......@@ -601,7 +636,10 @@ BOOST_PYTHON_MODULE(curves) {
.def("saveAsBinary", &polynomial_t::saveAsBinary<polynomial_t>, bp::args("filename"),
"Saves *this inside a binary file.")
.def("loadFromBinary", &polynomial_t::loadFromBinary<polynomial_t>, bp::args("filename"),
"Loads *this from a binary file.");
"Loads *this from a binary file.")
.def(bp::self == bp::self)
.def(bp::self != bp::self)
;
/** END polynomial function**/
/** BEGIN piecewise curve function **/
......@@ -665,7 +703,10 @@ BOOST_PYTHON_MODULE(curves) {
.def("saveAsBinary", &piecewise_t::saveAsBinary<piecewise_t>,
bp::args("filename"), "Saves *this inside a binary file.")
.def("loadFromBinary", &piecewise_t::loadFromBinary<piecewise_t>,
bp::args("filename"), "Loads *this from a binary file.");
bp::args("filename"), "Loads *this from a binary file.")
.def(bp::self == bp::self)
.def(bp::self != bp::self)
;
class_<piecewise_SE3_t, bases<curve_SE3_t> >("piecewise_SE3", init<>())
.def("__init__", make_constructor(&wrapPiecewiseSE3Constructor, default_call_policies(), arg("curve")),
......@@ -696,6 +737,8 @@ BOOST_PYTHON_MODULE(curves) {
"Saves *this inside a binary file.")
.def("loadFromBinary", &piecewise_SE3_t::loadFromBinary<piecewise_SE3_t>, bp::args("filename"),
"Loads *this from a binary file.")
.def(bp::self == bp::self)
.def(bp::self != bp::self)
#ifdef CURVES_WITH_PINOCCHIO_SUPPORT
.def("append", &addFinalSE3,
"Append a new linear SE3 curve at the end of the piecewise curve, defined between self.max() "
......@@ -722,7 +765,10 @@ BOOST_PYTHON_MODULE(curves) {
.def("saveAsBinary", &exact_cubic_t::saveAsBinary<exact_cubic_t>, bp::args("filename"),
"Saves *this inside a binary file.")
.def("loadFromBinary", &exact_cubic_t::loadFromBinary<exact_cubic_t>, bp::args("filename"),
"Loads *this from a binary file.");
"Loads *this from a binary file.")
.def