Commit 143b7d00 by Steve T

### renamed into curves ND

parent 991a37b3
 ... ... @@ -2,7 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.1) # Project properties SET(PROJECT_ORG loco-3d) SET(PROJECT_NAME curves) SET(PROJECT_NAME NDcurves) SET(PROJECT_DESCRIPTION "creatie and manipulate spline and bezier curves.") SET(PROJECT_URL "https://github.com/\${PROJECT_ORG}/\${PROJECT_NAME}") ... ...
 ... ... @@ -20,7 +20,7 @@ #include #include namespace curves { namespace NDcurves { /// \brief An inverse kinematics architecture enforcing an arbitrary number of strict priority levels (Reference : Boulic et Al. 2003) template void PseudoInverse(_Matrix_Type_& pinvmat) { ... ... @@ -50,5 +50,5 @@ Matrix3 skew(const Point& x) { static const double MARGIN(0.001); } // namespace curves } // namespace NDcurves #endif //_SPLINEMATH
 ... ... @@ -17,7 +17,7 @@ #include #include namespace curves { namespace NDcurves { /// \brief Computes a binomial coefficient . /// \param n : an unsigned integer. /// \param k : an unsigned integer. ... ... @@ -54,8 +54,8 @@ struct Bern { /// \param other : the other Bernstein polynomial to check. /// \return true if the two Bernstein polynomials are approximately equals. virtual bool operator==(const Bern& other) const { return curves::isApprox(m_minus_i, other.m_minus_i) && curves::isApprox(i_, other.i_) && curves::isApprox(bin_m_i_, other.bin_m_i_); return NDcurves::isApprox(m_minus_i, other.m_minus_i) && NDcurves::isApprox(i_, other.i_) && NDcurves::isApprox(bin_m_i_, other.bin_m_i_); } /// \brief Check if actual Bernstein polynomial and other are different. ... ... @@ -92,8 +92,8 @@ std::vector > makeBernstein(const unsigned int n) { } return res; } } // namespace curves } // namespace NDcurves DEFINE_CLASS_TEMPLATE_VERSION(typename Numeric, curves::Bern) DEFINE_CLASS_TEMPLATE_VERSION(typename Numeric, NDcurves::Bern) #endif //_CLASS_BERNSTEIN
 ... ... @@ -22,7 +22,7 @@ #include namespace curves { namespace NDcurves { /// \class BezierCurve. /// \brief Represents a Bezier curve of arbitrary dimension and order. /// For degree lesser than 4, the evaluation is analitycal. Otherwise ... ... @@ -68,7 +68,7 @@ struct bezier_curve : public curve_abc { mult_T_(mult_T), size_(std::distance(PointsBegin, PointsEnd)), degree_(size_ - 1), bernstein_(curves::makeBernstein((unsigned int)degree_)) bernstein_(NDcurves::makeBernstein((unsigned int)degree_)) { if (bernstein_.size() != size_) { throw std::invalid_argument("Invalid size of polynomial"); ... ... @@ -103,7 +103,7 @@ struct bezier_curve : public curve_abc { mult_T_(mult_T), size_(std::distance(PointsBegin, PointsEnd) + 4), degree_(size_ - 1), bernstein_(curves::makeBernstein((unsigned int)degree_)) bernstein_(NDcurves::makeBernstein((unsigned int)degree_)) { if (Safe && (size_ < 1 || T_max_ <= T_min_)) { throw std::invalid_argument("can't create bezier min bound is higher than max bound"); ... ... @@ -156,9 +156,9 @@ struct bezier_curve : public curve_abc { * @return true if the two curves are approximately equals */ bool isApprox(const bezier_curve_t& other, const Numeric prec = Eigen::NumTraits::dummy_precision()) const { bool equal = curves::isApprox(T_min_, other.min()) && curves::isApprox(T_max_, other.max()) && bool equal = NDcurves::isApprox(T_min_, other.min()) && NDcurves::isApprox(T_max_, other.max()) && dim_ == other.dim() && degree_ == other.degree() && size_ == other.size_ && curves::isApprox(mult_T_, other.mult_T_) && bernstein_ == other.bernstein_; NDcurves::isApprox(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; ... ... @@ -471,7 +471,7 @@ struct bezier_curve : public curve_abc { n_ij = bin(n,i-j); mn_i = bin(m+n,i); num_t mul = num_t(mj*n_ij) / num_t(mn_i); current_point += mul*curves::cross(waypointAtIndex(j), g.waypointAtIndex(i-j)); current_point += mul*NDcurves::cross(waypointAtIndex(j), g.waypointAtIndex(i-j)); } new_waypoints.push_back(current_point); } ... ... @@ -492,7 +492,7 @@ struct bezier_curve : public curve_abc { throw std::invalid_argument("Can't perform cross product on Bezier curves with dimensions != 3 "); t_point_t new_waypoints; for(typename t_point_t::const_iterator cit = waypoints().begin(); cit != waypoints().end(); ++cit){ new_waypoints.push_back(curves::cross(*cit, point)); new_waypoints.push_back(NDcurves::cross(*cit, point)); } return bezier_curve_t(new_waypoints.begin(),new_waypoints.end(),min(),max(),mult_T_); } ... ... @@ -728,9 +728,9 @@ bezier_curve operator*(const double k, const bezier_curve& p1) return res*=k; } } // namespace curves } // namespace NDcurves DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Time, typename Numeric, bool Safe, typename Point), SINGLE_ARG(curves::bezier_curve)) SINGLE_ARG(NDcurves::bezier_curve)) #endif //_CLASS_BEZIERCURVE
 ... ... @@ -11,7 +11,7 @@ #include "curve_abc.h" namespace curves { namespace NDcurves { /// \class constant_curve. /// \brief Represents a constant_curve curve, always returning the same value and a null derivative /// ... ... @@ -115,7 +115,7 @@ struct constant_curve : public curve_abc::dummy_precision()) const { return curves::isApprox(T_min_, other.min()) && curves::isApprox(T_max_, other.max()) && return NDcurves::isApprox(T_min_, other.min()) && NDcurves::isApprox(T_max_, other.max()) && dim_ == other.dim() && value_.isApprox(other.value_, prec); } ... ... @@ -169,9 +169,9 @@ struct constant_curve : public curve_abc)) SINGLE_ARG(NDcurves::constant_curve)) #endif // _CLASS_CONSTANTCURVE
 ... ... @@ -8,9 +8,9 @@ #ifndef _CLASS_CROSSIMP #define _CLASS_CROSSIMP #include "curves/fwd.h" #include "NDcurves/fwd.h" namespace curves { namespace NDcurves { inline Eigen::Vector3d cross(const Eigen::VectorXd& a, const Eigen::VectorXd& b){ Eigen::Vector3d c; ... ... @@ -32,5 +32,5 @@ template linear_variable cross(const linear_variable& a, const linear_variable& b){ return a.cross(b); } } // namespace curves } // namespace NDcurves #endif //_CLASS_CROSSIMP
 ... ... @@ -21,7 +21,7 @@ #include // To serialize std::pair namespace curves { namespace NDcurves { /// \class CubicHermiteSpline. /// \brief Represents a set of cubic hermite splines defining a continuous function \f\$p(t)\f\$. /// A hermite cubic spline is a minimal degree polynom interpolating a function in two ... ... @@ -118,7 +118,7 @@ struct cubic_hermite_spline : public curve_abc { */ bool isApprox(const cubic_hermite_spline_t& other, const Numeric prec = Eigen::NumTraits::dummy_precision()) const { bool equal = curves::isApprox(T_min_, other.min()) && curves::isApprox(T_max_, other.max()) && bool equal = NDcurves::isApprox(T_min_, other.min()) && NDcurves::isApprox(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; ... ... @@ -366,8 +366,8 @@ struct cubic_hermite_spline : public curve_abc { ar& boost::serialization::make_nvp("degree", degree_); } }; // End struct Cubic hermite spline } // namespace curves } // namespace NDcurves DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Time, typename Numeric, bool Safe, typename Point), SINGLE_ARG(curves::cubic_hermite_spline)) SINGLE_ARG(NDcurves::cubic_hermite_spline)) #endif //_CLASS_CUBICHERMITESPLINE
 ... ... @@ -19,7 +19,7 @@ #include #include namespace curves { namespace NDcurves { template bool isApprox(const T a, const T b, const T eps = 1e-6) { ... ... @@ -76,7 +76,7 @@ struct curve_abc : std::unary_function, public serialization::Seria */ bool isEquivalent(const curve_t* other, const Numeric prec = Eigen::NumTraits::dummy_precision(), const size_t order = 5) const { bool equal = curves::isApprox(min(), other->min()) && curves::isApprox(max(), other->max()) && bool equal = NDcurves::isApprox(min(), other->min()) && NDcurves::isApprox(max(), other->max()) && (dim() == other->dim()); if (!equal) { return false; ... ... @@ -144,8 +144,8 @@ struct curve_abc : std::unary_function, public serialization::Seria } }; BOOST_SERIALIZATION_ASSUME_ABSTRACT(curve_abc) } // namespace curves } // namespace NDcurves DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Time, typename Numeric, bool Safe, typename Point, typename Point_derivate), SINGLE_ARG(curves::curve_abc)) SINGLE_ARG(NDcurves::curve_abc)) #endif //_STRUCT_CURVE_ABC
 ... ... @@ -17,7 +17,7 @@ #include #include namespace curves { namespace NDcurves { template struct curve_constraints : serialization::Serializable { typedef Point point_t; ... ... @@ -83,5 +83,5 @@ struct curve_constraints : serialization::Serializable { ar& boost::serialization::make_nvp("dim", dim_); } }; } // namespace curves } // namespace NDcurves #endif //_CLASS_CUBICZEROVELACC
 ... ... @@ -12,7 +12,7 @@ #include namespace curves { namespace NDcurves { /// \brief Converts a cubic hermite spline or a bezier curve to a polynomial. /// \param curve : the bezier curve/cubic hermite spline defined between [Tmin,Tmax] to convert. /// \return the equivalent polynomial. ... ... @@ -94,5 +94,5 @@ Hermite hermite_from_curve(const typename Hermite::curve_abc_t& curve) { time_control_points.push_back(T_max); return Hermite(control_points.begin(), control_points.end(), time_control_points); } } // namespace curves } // namespace NDcurves #endif //_CLASS_CURVE_CONVERSION
 ... ... @@ -29,7 +29,7 @@ #include #include namespace curves { namespace NDcurves { /// \class ExactCubic. /// \brief Represents a set of cubic splines defining a continuous function /// crossing each of the waypoint given in its initialization. ... ... @@ -308,9 +308,9 @@ struct exact_cubic : public piecewise_curve { ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(piecewise_curve_t); } }; } // namespace curves } // namespace NDcurves DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Time, typename Numeric, bool Safe, typename Point, typename T_Point, typename SplineBase), SINGLE_ARG(curves::exact_cubic)) SINGLE_ARG(NDcurves::exact_cubic)) #endif //_CLASS_EXACTCUBIC
 ... ... @@ -13,7 +13,7 @@ #include #include namespace curves { namespace NDcurves { template struct curve_abc; ... ... @@ -107,6 +107,6 @@ typedef SO3Linear SO3Linear_t; typedef SE3Curve SE3Curve_t; typedef piecewise_curve piecewise_SE3_t; } // namespace curves } // namespace NDcurves #endif // CURVES_FWD_H
 ... ... @@ -19,9 +19,9 @@ #ifndef _CLASS_EFFECTORSPLINE #define _CLASS_EFFECTORSPLINE #include "curves/exact_cubic.h" #include "NDcurves/exact_cubic.h" namespace curves { namespace NDcurves { namespace helpers { typedef double Numeric; typedef double Time; ... ... @@ -111,5 +111,5 @@ exact_cubic_t* effector_spline(In wayPointsBegin, In wayPointsEnd, const Point& return new exact_cubic_t(splines); } } // namespace helpers } // namespace curves } // namespace NDcurves #endif //_CLASS_EFFECTORSPLINE
 ... ... @@ -19,11 +19,11 @@ #ifndef _CLASS_EFFECTOR_SPLINE_ROTATION #define _CLASS_EFFECTOR_SPLINE_ROTATION #include "curves/helpers/effector_spline.h" #include "curves/curve_abc.h" #include "NDcurves/helpers/effector_spline.h" #include "NDcurves/curve_abc.h" #include namespace curves { namespace NDcurves { namespace helpers { typedef Eigen::Matrix quat_t; typedef Eigen::Ref quat_ref_t; ... ... @@ -82,7 +82,7 @@ class rotation_spline : public curve_abc_quat_t { */ bool isApprox(const rotation_spline& other, const Numeric prec = Eigen::NumTraits::dummy_precision()) const { return curves::isApprox(min_, other.min_) && curves::isApprox(max_, other.max_) && return NDcurves::isApprox(min_, other.min_) && NDcurves::isApprox(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); } ... ... @@ -288,5 +288,5 @@ class effector_spline_rotation { }; // End class effector_spline_rotation } // namespace helpers } // namespace curves } // namespace NDcurves #endif //_CLASS_EFFECTOR_SPLINE_ROTATION
 ... ... @@ -21,7 +21,7 @@ #include #include namespace curves { namespace NDcurves { template struct linear_variable : public serialization::Serializable { typedef Eigen::Matrix vector_x_t; ... ... @@ -116,7 +116,7 @@ struct linear_variable : public serialization::Serializable { // (B1 x + c1) X (B2 x + c2) = (-c2X B1) x + (bX B2) x + b1Xb2 typename linear_variable_t::matrix_3_t newB = skew(-other.c()) * B() + skew(c()) * other.B(); typename linear_variable_t::vector_3_t newC = curves::cross(c(),other.c()); typename linear_variable_t::vector_3_t newC = NDcurves::cross(c(),other.c()); return linear_variable_t(newB,newC); } ... ... @@ -226,8 +226,8 @@ std::ostream &operator<<(std::ostream &os, const linear_variable& l) { return os << "linear_variable: \n \t B:\n"<< l.B() << "\t c: \n" << l.c().transpose(); } } // namespace curves } // namespace NDcurves DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Numeric, bool Safe), SINGLE_ARG(curves::linear_variable)) SINGLE_ARG(NDcurves::linear_variable)) #endif //_CLASS_LINEAR_VARIABLE
 ... ... @@ -9,12 +9,12 @@ #ifndef _CLASS_DEFINITIONS_H #define _CLASS_DEFINITIONS_H #include #include #include #include #include #include #include #include namespace curves { namespace NDcurves { namespace optimization { enum constraint_flag { ... ... @@ -81,5 +81,5 @@ struct problem_definition : public curve_constraints { }; } // namespace optimization } // namespace curves } // namespace NDcurves #endif //_CLASS_DEFINITIONS_H
 ... ... @@ -9,13 +9,13 @@ #ifndef _CLASS_LINEAR_PROBLEM_DETAILS #define _CLASS_LINEAR_PROBLEM_DETAILS #include #include #include #include #include #include #include #include #include #include namespace curves { namespace NDcurves { namespace optimization { template struct problem_data { ... ... @@ -338,5 +338,5 @@ inline constraint_flag& operator^=(constraint_flag& a, constraint_flag b) { } } // namespace optimization } // namespace curves } // namespace NDcurves #endif //_CLASS_LINEAR_PROBLEM_DETAILS
 ... ... @@ -9,12 +9,12 @@ #ifndef _CLASS_QUADRATIC_COST #define _CLASS_QUADRATIC_COST #include "curves/optimization/definitions.h" #include "curves/optimization/details.h" #include "NDcurves/optimization/definitions.h" #include "NDcurves/optimization/details.h" #include namespace curves { namespace NDcurves { namespace optimization { enum integral_cost_flag { ... ... @@ -47,5 +47,5 @@ quadratic_variable compute_integral_cost(const problem_data
 ... ... @@ -9,13 +9,13 @@ #ifndef _CLASS_LINEAR_PROBLEM #define _CLASS_LINEAR_PROBLEM #include "curves/optimization/definitions.h" #include "curves/optimization/details.h" #include "curves/optimization/integral_cost.h" #include "NDcurves/optimization/definitions.h" #include "NDcurves/optimization/details.h" #include "NDcurves/optimization/integral_cost.h" #include namespace curves { namespace NDcurves { namespace optimization { template ... ... @@ -38,5 +38,5 @@ quadratic_problem generate_problem(const problem_definition
 ... ... @@ -15,7 +15,7 @@ #include #include namespace curves { namespace NDcurves { /// \class PiecewiseCurve. /// \brief Represent a piecewise curve. We can add some new curve, /// but the starting time of the curve to add should be equal to the ending time of the actual ... ... @@ -601,10 +601,10 @@ struct piecewise_curve : public curve_abc)) SINGLE_ARG(NDcurves::piecewise_curve)) #endif // _CLASS_PIECEWISE_CURVE
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!