diff --git a/CMakeLists.txt b/CMakeLists.txt index 799935d1ece8ccc340b7e0583cd7e5874e7fd786..b6002b0741e3faee97926e78809d0961454b813a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.6) -project(spline) +project(curve) INCLUDE(cmake/base.cmake) INCLUDE(cmake/test.cmake) INCLUDE(cmake/python.cmake) diff --git a/python/spline_python.cpp b/python/spline_python.cpp index 764b5cc78e360fd6bbc0e216569e0da3edfa8574..9f9e1079be3124857c5520090b6b01e62a9ab211 100644 --- a/python/spline_python.cpp +++ b/python/spline_python.cpp @@ -1,10 +1,10 @@ -#include "hpp/spline/bezier_curve.h" -#include "hpp/spline/polynom.h" -#include "hpp/spline/exact_cubic.h" -#include "hpp/spline/spline_deriv_constraint.h" -#include "hpp/spline/curve_constraint.h" -#include "hpp/spline/bezier_polynom_conversion.h" -#include "hpp/spline/bernstein.h" +#include "hpp/curve/bezier_curve.h" +#include "hpp/curve/polynom.h" +#include "hpp/curve/exact_cubic.h" +#include "hpp/curve/spline_deriv_constraint.h" +#include "hpp/curve/curve_constraint.h" +#include "hpp/curve/bezier_polynom_conversion.h" +#include "hpp/curve/bernstein.h" #include <vector> @@ -30,20 +30,20 @@ typedef std::vector<Waypoint> T_Waypoint; typedef std::pair<real, point6_t> Waypoint6; typedef std::vector<Waypoint6> T_Waypoint6; -typedef spline::bezier_curve <real, real, 3, true, point_t> bezier_t; -typedef spline::bezier_curve <real, real, 6, true, point6_t> bezier6_t; -typedef spline::polynom <real, real, 3, true, point_t, t_point_t> polynom_t; -typedef spline::exact_cubic <real, real, 3, true, point_t, t_point_t> exact_cubic_t; +typedef curve::bezier_curve <real, real, 3, true, point_t> bezier_t; +typedef curve::bezier_curve <real, real, 6, true, point6_t> bezier6_t; +typedef curve::polynom <real, real, 3, true, point_t, t_point_t> polynom_t; +typedef curve::exact_cubic <real, real, 3, true, point_t, t_point_t> exact_cubic_t; typedef polynom_t::coeff_t coeff_t; typedef std::pair<real, point_t> waypoint_t; typedef std::vector<waypoint_t, Eigen::aligned_allocator<point_t> > t_waypoint_t; -typedef spline::Bern<double> bernstein_t; +typedef curve::Bern<double> bernstein_t; -typedef spline::spline_deriv_constraint <real, real, 3, true, point_t, t_point_t> spline_deriv_constraint_t; -typedef spline::curve_constraints<point_t> curve_constraints_t; -typedef spline::curve_constraints<point6_t> curve_constraints6_t; +typedef curve::spline_deriv_constraint <real, real, 3, true, point_t, t_point_t> spline_deriv_constraint_t; +typedef curve::curve_constraints<point_t> curve_constraints_t; +typedef curve::curve_constraints<point6_t> curve_constraints6_t; /*** TEMPLATE SPECIALIZATION FOR PYTHON ****/ EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(bernstein_t) @@ -54,7 +54,7 @@ EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(exact_cubic_t) EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(curve_constraints_t) EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(spline_deriv_constraint_t) -namespace spline +namespace curve { using namespace boost::python; template <typename PointList, typename T_Point> diff --git a/tests/Main.cpp b/tests/Main.cpp index 5046ad1c85f21378c10893be9f0dbc49b06ebb97..02862c7c07d17822c823ce4ae0c33a67b4e9b3e0 100644 --- a/tests/Main.cpp +++ b/tests/Main.cpp @@ -1,11 +1,11 @@ -#include "hpp/spline/exact_cubic.h" -#include "hpp/spline/bezier_curve.h" -#include "hpp/spline/polynom.h" -#include "hpp/spline/spline_deriv_constraint.h" -#include "hpp/spline/helpers/effector_spline.h" -#include "hpp/spline/helpers/effector_spline_rotation.h" -#include "hpp/spline/bezier_polynom_conversion.h" +#include "hpp/curve/exact_cubic.h" +#include "hpp/curve/bezier_curve.h" +#include "hpp/curve/polynom.h" +#include "hpp/curve/spline_deriv_constraint.h" +#include "hpp/curve/helpers/effector_spline.h" +#include "hpp/curve/helpers/effector_spline_rotation.h" +#include "hpp/curve/bezier_polynom_conversion.h" #include <string> #include <iostream> @@ -13,7 +13,7 @@ using namespace std; -namespace spline +namespace curve { typedef Eigen::Vector3d point_t; typedef std::vector<point_t,Eigen::aligned_allocator<point_t> > t_point_t; @@ -46,9 +46,9 @@ bool QuasiEqual(const double a, const double b, const float margin) const double margin = 0.001; -} // namespace spline +} // namespace curve -using namespace spline; +using namespace curve; ostream& operator<<(ostream& os, const point_t& pt) { @@ -456,7 +456,7 @@ void BezierToPolynomConversionTest(bool& error) /*Exact Cubic Function tests*/ void ExactCubicNoErrorTest(bool& error) { - spline::T_Waypoint waypoints; + curve::T_Waypoint waypoints; for(double i = 0; i <= 1; i = i + 0.2) { waypoints.push_back(std::make_pair(i,point_t(i,i,i))); @@ -502,7 +502,7 @@ void ExactCubicNoErrorTest(bool& error) /*Exact Cubic Function tests*/ void ExactCubicTwoPointsTest(bool& error) { - spline::T_Waypoint waypoints; + curve::T_Waypoint waypoints; for(double i = 0; i < 2; ++i) { waypoints.push_back(std::make_pair(i,point_t(i,i,i))); @@ -519,7 +519,7 @@ void ExactCubicTwoPointsTest(bool& error) void ExactCubicOneDimTest(bool& error) { - spline::T_WaypointOne waypoints; + curve::T_WaypointOne waypoints; point_one zero; zero(0,0) = 9; point_one one; one(0,0) = 14; point_one two; two(0,0) = 25; @@ -536,7 +536,7 @@ void ExactCubicOneDimTest(bool& error) ComparePoints(one, res1, errmsg, error); } -void CheckWayPointConstraint(const std::string& errmsg, const double step, const spline::T_Waypoint& /*wayPoints*/, const exact_cubic_t* curve, bool& error ) +void CheckWayPointConstraint(const std::string& errmsg, const double step, const curve::T_Waypoint& /*wayPoints*/, const exact_cubic_t* curve, bool& error ) { point_t res1; for(double i = 0; i <= 1; i = i + step) @@ -555,7 +555,7 @@ void CheckDerivative(const std::string& errmsg, const double eval_point, const s void ExactCubicPointsCrossedTest(bool& error) { - spline::T_Waypoint waypoints; + curve::T_Waypoint waypoints; for(double i = 0; i <= 1; i = i + 0.2) { waypoints.push_back(std::make_pair(i,point_t(i,i,i))); @@ -568,7 +568,7 @@ void ExactCubicPointsCrossedTest(bool& error) void ExactCubicVelocityConstraintsTest(bool& error) { - spline::T_Waypoint waypoints; + curve::T_Waypoint waypoints; for(double i = 0; i <= 1; i = i + 0.2) { waypoints.push_back(std::make_pair(i,point_t(i,i,i))); @@ -617,7 +617,7 @@ void CheckPointOnline(const std::string& errmsg, const point_t& A, const point_t void EffectorTrajectoryTest(bool& error) { // create arbitrary trajectory - spline::T_Waypoint waypoints; + curve::T_Waypoint waypoints; for(double i = 0; i <= 10; i = i + 2) { waypoints.push_back(std::make_pair(i,point_t(i,i,i))); @@ -674,7 +674,7 @@ double GetXRotFromQuat(helpers::quat_ref_const_t q) void EffectorSplineRotationNoRotationTest(bool& error) { // create arbitrary trajectory - spline::T_Waypoint waypoints; + curve::T_Waypoint waypoints; for(double i = 0; i <= 10; i = i + 2) { waypoints.push_back(std::make_pair(i,point_t(i,i,i))); @@ -696,7 +696,7 @@ void EffectorSplineRotationNoRotationTest(bool& error) void EffectorSplineRotationRotationTest(bool& error) { // create arbitrary trajectory - spline::T_Waypoint waypoints; + curve::T_Waypoint waypoints; for(double i = 0; i <= 10; i = i + 2) { waypoints.push_back(std::make_pair(i,point_t(i,i,i))); @@ -719,7 +719,7 @@ void EffectorSplineRotationRotationTest(bool& error) void EffectorSplineRotationWayPointRotationTest(bool& error) { // create arbitrary trajectory - spline::T_Waypoint waypoints; + curve::T_Waypoint waypoints; for(double i = 0; i <= 10; i = i + 2) { waypoints.push_back(std::make_pair(i,point_t(i,i,i)));