Unverified Commit 7f791ea8 authored by Guilhem Saurel's avatar Guilhem Saurel Committed by GitHub
Browse files

Merge pull request #58 from loco-3d/nd_curves

curves → ndcurves, fix #2
parents 991a37b3 8fe7090a
...@@ -2,7 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.1) ...@@ -2,7 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
# Project properties # Project properties
SET(PROJECT_ORG loco-3d) 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_DESCRIPTION "creatie and manipulate spline and bezier curves.")
SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}") SET(PROJECT_URL "https://github.com/${PROJECT_ORG}/${PROJECT_NAME}")
......
Curves ND-Curves
=================== ===================
[![Pipeline status](https://gepgitlab.laas.fr/loco-3d/curves/badges/master/pipeline.svg)](https://gepgitlab.laas.fr/loco-3d/curves/commits/master) [![Pipeline status](https://gepgitlab.laas.fr/loco-3d/curves/badges/master/pipeline.svg)](https://gepgitlab.laas.fr/loco-3d/curves/commits/master)
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <vector> #include <vector>
#include <utility> #include <utility>
namespace curves { namespace ndcurves {
/// \brief An inverse kinematics architecture enforcing an arbitrary number of strict priority levels (Reference : Boulic et Al. 2003) /// \brief An inverse kinematics architecture enforcing an arbitrary number of strict priority levels (Reference : Boulic et Al. 2003)
template <typename _Matrix_Type_> template <typename _Matrix_Type_>
void PseudoInverse(_Matrix_Type_& pinvmat) { void PseudoInverse(_Matrix_Type_& pinvmat) {
...@@ -50,5 +50,5 @@ Matrix3 skew(const Point& x) { ...@@ -50,5 +50,5 @@ Matrix3 skew(const Point& x) {
static const double MARGIN(0.001); static const double MARGIN(0.001);
} // namespace curves } // namespace ndcurves
#endif //_SPLINEMATH #endif //_SPLINEMATH
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <vector> #include <vector>
#include <stdexcept> #include <stdexcept>
namespace curves { namespace ndcurves {
/// \brief Computes a binomial coefficient . /// \brief Computes a binomial coefficient .
/// \param n : an unsigned integer. /// \param n : an unsigned integer.
/// \param k : an unsigned integer. /// \param k : an unsigned integer.
...@@ -54,8 +54,8 @@ struct Bern { ...@@ -54,8 +54,8 @@ struct Bern {
/// \param other : the other Bernstein polynomial to check. /// \param other : the other Bernstein polynomial to check.
/// \return true if the two Bernstein polynomials are approximately equals. /// \return true if the two Bernstein polynomials are approximately equals.
virtual bool operator==(const Bern& other) const { virtual bool operator==(const Bern& other) const {
return curves::isApprox<Numeric>(m_minus_i, other.m_minus_i) && curves::isApprox<Numeric>(i_, other.i_) && return ndcurves::isApprox<Numeric>(m_minus_i, other.m_minus_i) && ndcurves::isApprox<Numeric>(i_, other.i_) &&
curves::isApprox<Numeric>(bin_m_i_, other.bin_m_i_); ndcurves::isApprox<Numeric>(bin_m_i_, other.bin_m_i_);
} }
/// \brief Check if actual Bernstein polynomial and other are different. /// \brief Check if actual Bernstein polynomial and other are different.
...@@ -92,8 +92,8 @@ std::vector<Bern<Numeric> > makeBernstein(const unsigned int n) { ...@@ -92,8 +92,8 @@ std::vector<Bern<Numeric> > makeBernstein(const unsigned int n) {
} }
return res; return res;
} }
} // namespace curves } // namespace ndcurves
DEFINE_CLASS_TEMPLATE_VERSION(typename Numeric, curves::Bern<Numeric>) DEFINE_CLASS_TEMPLATE_VERSION(typename Numeric, ndcurves::Bern<Numeric>)
#endif //_CLASS_BERNSTEIN #endif //_CLASS_BERNSTEIN
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <iostream> #include <iostream>
namespace curves { namespace ndcurves {
/// \class BezierCurve. /// \class BezierCurve.
/// \brief Represents a Bezier curve of arbitrary dimension and order. /// \brief Represents a Bezier curve of arbitrary dimension and order.
/// For degree lesser than 4, the evaluation is analitycal. Otherwise /// For degree lesser than 4, the evaluation is analitycal. Otherwise
...@@ -68,7 +68,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> { ...@@ -68,7 +68,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> {
mult_T_(mult_T), mult_T_(mult_T),
size_(std::distance(PointsBegin, PointsEnd)), size_(std::distance(PointsBegin, PointsEnd)),
degree_(size_ - 1), degree_(size_ - 1),
bernstein_(curves::makeBernstein<num_t>((unsigned int)degree_)) bernstein_(ndcurves::makeBernstein<num_t>((unsigned int)degree_))
{ {
if (bernstein_.size() != size_) { if (bernstein_.size() != size_) {
throw std::invalid_argument("Invalid size of polynomial"); throw std::invalid_argument("Invalid size of polynomial");
...@@ -103,7 +103,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> { ...@@ -103,7 +103,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> {
mult_T_(mult_T), mult_T_(mult_T),
size_(std::distance(PointsBegin, PointsEnd) + 4), size_(std::distance(PointsBegin, PointsEnd) + 4),
degree_(size_ - 1), degree_(size_ - 1),
bernstein_(curves::makeBernstein<num_t>((unsigned int)degree_)) bernstein_(ndcurves::makeBernstein<num_t>((unsigned int)degree_))
{ {
if (Safe && (size_ < 1 || T_max_ <= T_min_)) { if (Safe && (size_ < 1 || T_max_ <= T_min_)) {
throw std::invalid_argument("can't create bezier min bound is higher than max bound"); 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<Time, Numeric, Safe, Point> { ...@@ -156,9 +156,9 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> {
* @return true if the two curves are approximately equals * @return true if the two curves are approximately equals
*/ */
bool isApprox(const bezier_curve_t& other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const { 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()) && bool equal = ndcurves::isApprox<num_t>(T_min_, other.min()) && ndcurves::isApprox<num_t>(T_max_, other.max()) &&
dim_ == other.dim() && degree_ == other.degree() && size_ == other.size_ && dim_ == other.dim() && degree_ == other.degree() && size_ == other.size_ &&
curves::isApprox<Numeric>(mult_T_, other.mult_T_) && bernstein_ == other.bernstein_; ndcurves::isApprox<Numeric>(mult_T_, other.mult_T_) && bernstein_ == other.bernstein_;
if (!equal) return false; if (!equal) return false;
for (size_t i = 0; i < size_; ++i) { for (size_t i = 0; i < size_; ++i) {
if (!control_points_.at(i).isApprox(other.control_points_.at(i), prec)) return false; if (!control_points_.at(i).isApprox(other.control_points_.at(i), prec)) return false;
...@@ -471,7 +471,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> { ...@@ -471,7 +471,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> {
n_ij = bin(n,i-j); n_ij = bin(n,i-j);
mn_i = bin(m+n,i); mn_i = bin(m+n,i);
num_t mul = num_t(mj*n_ij) / num_t(mn_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); new_waypoints.push_back(current_point);
} }
...@@ -492,7 +492,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> { ...@@ -492,7 +492,7 @@ struct bezier_curve : public curve_abc<Time, Numeric, Safe, Point> {
throw std::invalid_argument("Can't perform cross product on Bezier curves with dimensions != 3 "); throw std::invalid_argument("Can't perform cross product on Bezier curves with dimensions != 3 ");
t_point_t new_waypoints; t_point_t new_waypoints;
for(typename t_point_t::const_iterator cit = waypoints().begin(); cit != waypoints().end(); ++cit){ 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_); return bezier_curve_t(new_waypoints.begin(),new_waypoints.end(),min(),max(),mult_T_);
} }
...@@ -728,9 +728,9 @@ bezier_curve<T,N,S,P> operator*(const double k, const bezier_curve<T,N,S,P>& p1) ...@@ -728,9 +728,9 @@ bezier_curve<T,N,S,P> operator*(const double k, const bezier_curve<T,N,S,P>& p1)
return res*=k; return res*=k;
} }
} // namespace curves } // namespace ndcurves
DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Time, typename Numeric, bool Safe, typename Point), DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Time, typename Numeric, bool Safe, typename Point),
SINGLE_ARG(curves::bezier_curve<Time, Numeric, Safe, Point>)) SINGLE_ARG(ndcurves::bezier_curve<Time, Numeric, Safe, Point>))
#endif //_CLASS_BEZIERCURVE #endif //_CLASS_BEZIERCURVE
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "curve_abc.h" #include "curve_abc.h"
namespace curves { namespace ndcurves {
/// \class constant_curve. /// \class constant_curve.
/// \brief Represents a constant_curve curve, always returning the same value and a null derivative /// \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<Time, Numeric, Safe, Point, Point_deriv ...@@ -115,7 +115,7 @@ struct constant_curve : public curve_abc<Time, Numeric, Safe, Point, Point_deriv
*/ */
virtual bool isApprox(const constant_curve_t& other, virtual bool isApprox(const constant_curve_t& other,
const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const { 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()) && return ndcurves::isApprox<num_t>(T_min_, other.min()) && ndcurves::isApprox<num_t>(T_max_, other.max()) &&
dim_ == other.dim() && value_.isApprox(other.value_, prec); dim_ == other.dim() && value_.isApprox(other.value_, prec);
} }
...@@ -169,9 +169,9 @@ struct constant_curve : public curve_abc<Time, Numeric, Safe, Point, Point_deriv ...@@ -169,9 +169,9 @@ struct constant_curve : public curve_abc<Time, Numeric, Safe, Point, Point_deriv
} }
}; // struct constant_curve }; // struct constant_curve
} // namespace curves } // namespace ndcurves
DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Time, typename Numeric, bool Safe, typename Point, typename Point_derivate), DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Time, typename Numeric, bool Safe, typename Point, typename Point_derivate),
SINGLE_ARG(curves::constant_curve<Time, Numeric, Safe, Point, Point_derivate>)) SINGLE_ARG(ndcurves::constant_curve<Time, Numeric, Safe, Point, Point_derivate>))
#endif // _CLASS_CONSTANTCURVE #endif // _CLASS_CONSTANTCURVE
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
#ifndef _CLASS_CROSSIMP #ifndef _CLASS_CROSSIMP
#define _CLASS_CROSSIMP #define _CLASS_CROSSIMP
#include "curves/fwd.h" #include "ndcurves/fwd.h"
namespace curves { namespace ndcurves {
inline inline
Eigen::Vector3d cross(const Eigen::VectorXd& a, const Eigen::VectorXd& b){ Eigen::Vector3d cross(const Eigen::VectorXd& a, const Eigen::VectorXd& b){
Eigen::Vector3d c; Eigen::Vector3d c;
...@@ -32,5 +32,5 @@ template<typename N, bool S> ...@@ -32,5 +32,5 @@ template<typename N, bool S>
linear_variable<N,S> cross(const linear_variable<N,S>& a, const linear_variable<N,S>& b){ linear_variable<N,S> cross(const linear_variable<N,S>& a, const linear_variable<N,S>& b){
return a.cross(b); return a.cross(b);
} }
} // namespace curves } // namespace ndcurves
#endif //_CLASS_CROSSIMP #endif //_CLASS_CROSSIMP
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <boost/serialization/utility.hpp> // To serialize std::pair #include <boost/serialization/utility.hpp> // To serialize std::pair
namespace curves { namespace ndcurves {
/// \class CubicHermiteSpline. /// \class CubicHermiteSpline.
/// \brief Represents a set of cubic hermite splines defining a continuous function \f$p(t)\f$. /// \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 /// 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<Time, Numeric, Safe, Point> { ...@@ -118,7 +118,7 @@ struct cubic_hermite_spline : public curve_abc<Time, Numeric, Safe, Point> {
*/ */
bool isApprox(const cubic_hermite_spline_t& other, bool isApprox(const cubic_hermite_spline_t& other,
const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const { 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()) && bool equal = ndcurves::isApprox<num_t>(T_min_, other.min()) && ndcurves::isApprox<num_t>(T_max_, other.max()) &&
dim_ == other.dim() && degree_ == other.degree() && size_ == other.size() && dim_ == other.dim() && degree_ == other.degree() && size_ == other.size() &&
time_control_points_ == other.time_control_points_ && duration_splines_ == other.duration_splines_; time_control_points_ == other.time_control_points_ && duration_splines_ == other.duration_splines_;
if (!equal) return false; if (!equal) return false;
...@@ -366,8 +366,8 @@ struct cubic_hermite_spline : public curve_abc<Time, Numeric, Safe, Point> { ...@@ -366,8 +366,8 @@ struct cubic_hermite_spline : public curve_abc<Time, Numeric, Safe, Point> {
ar& boost::serialization::make_nvp("degree", degree_); ar& boost::serialization::make_nvp("degree", degree_);
} }
}; // End struct Cubic hermite spline }; // End struct Cubic hermite spline
} // namespace curves } // namespace ndcurves
DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Time, typename Numeric, bool Safe, typename Point), DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Time, typename Numeric, bool Safe, typename Point),
SINGLE_ARG(curves::cubic_hermite_spline<Time, Numeric, Safe, Point>)) SINGLE_ARG(ndcurves::cubic_hermite_spline<Time, Numeric, Safe, Point>))
#endif //_CLASS_CUBICHERMITESPLINE #endif //_CLASS_CUBICHERMITESPLINE
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <boost/smart_ptr/shared_ptr.hpp> #include <boost/smart_ptr/shared_ptr.hpp>
#include <functional> #include <functional>
namespace curves { namespace ndcurves {
template <typename T> template <typename T>
bool isApprox(const T a, const T b, const T eps = 1e-6) { bool isApprox(const T a, const T b, const T eps = 1e-6) {
...@@ -76,7 +76,7 @@ struct curve_abc : std::unary_function<Time, Point>, public serialization::Seria ...@@ -76,7 +76,7 @@ struct curve_abc : std::unary_function<Time, Point>, public serialization::Seria
*/ */
bool isEquivalent(const curve_t* other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision(), bool isEquivalent(const curve_t* other, const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision(),
const size_t order = 5) const { const size_t order = 5) const {
bool equal = curves::isApprox<num_t>(min(), other->min()) && curves::isApprox<num_t>(max(), other->max()) && bool equal = ndcurves::isApprox<num_t>(min(), other->min()) && ndcurves::isApprox<num_t>(max(), other->max()) &&
(dim() == other->dim()); (dim() == other->dim());
if (!equal) { if (!equal) {
return false; return false;
...@@ -144,8 +144,8 @@ struct curve_abc : std::unary_function<Time, Point>, public serialization::Seria ...@@ -144,8 +144,8 @@ struct curve_abc : std::unary_function<Time, Point>, public serialization::Seria
} }
}; };
BOOST_SERIALIZATION_ASSUME_ABSTRACT(curve_abc) 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), DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Time, typename Numeric, bool Safe, typename Point, typename Point_derivate),
SINGLE_ARG(curves::curve_abc<Time, Numeric, Safe, Point, Point_derivate>)) SINGLE_ARG(ndcurves::curve_abc<Time, Numeric, Safe, Point, Point_derivate>))
#endif //_STRUCT_CURVE_ABC #endif //_STRUCT_CURVE_ABC
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <functional> #include <functional>
#include <vector> #include <vector>
namespace curves { namespace ndcurves {
template <typename Point> template <typename Point>
struct curve_constraints : serialization::Serializable { struct curve_constraints : serialization::Serializable {
typedef Point point_t; typedef Point point_t;
...@@ -83,5 +83,5 @@ struct curve_constraints : serialization::Serializable { ...@@ -83,5 +83,5 @@ struct curve_constraints : serialization::Serializable {
ar& boost::serialization::make_nvp("dim", dim_); ar& boost::serialization::make_nvp("dim", dim_);
} }
}; };
} // namespace curves } // namespace ndcurves
#endif //_CLASS_CUBICZEROVELACC #endif //_CLASS_CUBICZEROVELACC
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <iostream> #include <iostream>
namespace curves { namespace ndcurves {
/// \brief Converts a cubic hermite spline or a bezier curve to a polynomial. /// \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. /// \param curve : the bezier curve/cubic hermite spline defined between [Tmin,Tmax] to convert.
/// \return the equivalent polynomial. /// \return the equivalent polynomial.
...@@ -94,5 +94,5 @@ Hermite hermite_from_curve(const typename Hermite::curve_abc_t& curve) { ...@@ -94,5 +94,5 @@ Hermite hermite_from_curve(const typename Hermite::curve_abc_t& curve) {
time_control_points.push_back(T_max); time_control_points.push_back(T_max);
return Hermite(control_points.begin(), control_points.end(), time_control_points); return Hermite(control_points.begin(), control_points.end(), time_control_points);
} }
} // namespace curves } // namespace ndcurves
#endif //_CLASS_CURVE_CONVERSION #endif //_CLASS_CURVE_CONVERSION
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <functional> #include <functional>
#include <vector> #include <vector>
namespace curves { namespace ndcurves {
/// \class ExactCubic. /// \class ExactCubic.
/// \brief Represents a set of cubic splines defining a continuous function /// \brief Represents a set of cubic splines defining a continuous function
/// crossing each of the waypoint given in its initialization. /// crossing each of the waypoint given in its initialization.
...@@ -308,9 +308,9 @@ struct exact_cubic : public piecewise_curve<Time, Numeric, Safe, Point> { ...@@ -308,9 +308,9 @@ struct exact_cubic : public piecewise_curve<Time, Numeric, Safe, Point> {
ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(piecewise_curve_t); 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, DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Time, typename Numeric, bool Safe, typename Point,
typename T_Point, typename SplineBase), typename T_Point, typename SplineBase),
SINGLE_ARG(curves::exact_cubic<Time, Numeric, Safe, Point, T_Point, SplineBase>)) SINGLE_ARG(ndcurves::exact_cubic<Time, Numeric, Safe, Point, T_Point, SplineBase>))
#endif //_CLASS_EXACTCUBIC #endif //_CLASS_EXACTCUBIC
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <vector> #include <vector>
#include <boost/smart_ptr/shared_ptr.hpp> #include <boost/smart_ptr/shared_ptr.hpp>
namespace curves { namespace ndcurves {
template <typename Time, typename Numeric, bool Safe, typename Point, typename Point_derivate> template <typename Time, typename Numeric, bool Safe, typename Point, typename Point_derivate>
struct curve_abc; struct curve_abc;
...@@ -107,6 +107,6 @@ typedef SO3Linear<double, double, true> SO3Linear_t; ...@@ -107,6 +107,6 @@ typedef SO3Linear<double, double, true> SO3Linear_t;
typedef SE3Curve<double, double, true> SE3Curve_t; typedef SE3Curve<double, double, true> SE3Curve_t;
typedef piecewise_curve<double, double, true, transform_t, point6_t, curve_SE3_t> piecewise_SE3_t; typedef piecewise_curve<double, double, true, transform_t, point6_t, curve_SE3_t> piecewise_SE3_t;
} // namespace curves } // namespace ndcurves
#endif // CURVES_FWD_H #endif // CURVES_FWD_H
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
#ifndef _CLASS_EFFECTORSPLINE #ifndef _CLASS_EFFECTORSPLINE
#define _CLASS_EFFECTORSPLINE #define _CLASS_EFFECTORSPLINE
#include "curves/exact_cubic.h" #include "ndcurves/exact_cubic.h"
namespace curves { namespace ndcurves {
namespace helpers { namespace helpers {
typedef double Numeric; typedef double Numeric;
typedef double Time; typedef double Time;
...@@ -111,5 +111,5 @@ exact_cubic_t* effector_spline(In wayPointsBegin, In wayPointsEnd, const Point& ...@@ -111,5 +111,5 @@ exact_cubic_t* effector_spline(In wayPointsBegin, In wayPointsEnd, const Point&
return new exact_cubic_t(splines); return new exact_cubic_t(splines);
} }
} // namespace helpers } // namespace helpers
} // namespace curves } // namespace ndcurves
#endif //_CLASS_EFFECTORSPLINE #endif //_CLASS_EFFECTORSPLINE
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
#ifndef _CLASS_EFFECTOR_SPLINE_ROTATION #ifndef _CLASS_EFFECTOR_SPLINE_ROTATION
#define _CLASS_EFFECTOR_SPLINE_ROTATION #define _CLASS_EFFECTOR_SPLINE_ROTATION
#include "curves/helpers/effector_spline.h" #include "ndcurves/helpers/effector_spline.h"
#include "curves/curve_abc.h" #include "ndcurves/curve_abc.h"
#include <Eigen/Geometry> #include <Eigen/Geometry>
namespace curves { namespace ndcurves {
namespace helpers { namespace helpers {
typedef Eigen::Matrix<Numeric, 4, 1> quat_t; typedef Eigen::Matrix<Numeric, 4, 1> quat_t;
typedef Eigen::Ref<quat_t> quat_ref_t; typedef Eigen::Ref<quat_t> quat_ref_t;
...@@ -82,7 +82,7 @@ class rotation_spline : public curve_abc_quat_t { ...@@ -82,7 +82,7 @@ class rotation_spline : public curve_abc_quat_t {
*/ */
bool isApprox(const rotation_spline& other, bool isApprox(const rotation_spline& other,
const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const { const Numeric prec = Eigen::NumTraits<Numeric>::dummy_precision()) const {
return curves::isApprox<Numeric>(min_, other.min_) && curves::isApprox<Numeric>(max_, other.max_) && return ndcurves::isApprox<Numeric>(min_, other.min_) && ndcurves::isApprox<Numeric>(max_, other.max_) &&
dim_ == other.dim_ && quat_from_.isApprox(other.quat_from_, prec) && dim_ == other.dim_ && quat_from_.isApprox(other.quat_from_, prec) &&
quat_to_.isApprox(other.quat_to_, prec) && time_reparam_.isApprox(other.time_reparam_, prec); quat_to_.isApprox(other.quat_to_, prec) && time_reparam_.isApprox(other.time_reparam_, prec);
} }
...@@ -288,5 +288,5 @@ class effector_spline_rotation { ...@@ -288,5 +288,5 @@ class effector_spline_rotation {
}; // End class effector_spline_rotation }; // End class effector_spline_rotation
} // namespace helpers } // namespace helpers
} // namespace curves } // namespace ndcurves
#endif //_CLASS_EFFECTOR_SPLINE_ROTATION #endif //_CLASS_EFFECTOR_SPLINE_ROTATION
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include <Eigen/Core> #include <Eigen/Core>
#include <stdexcept> #include <stdexcept>
namespace curves { namespace ndcurves {
template <typename Numeric = double, bool Safe = true> template <typename Numeric = double, bool Safe = true>
struct linear_variable : public serialization::Serializable { struct linear_variable : public serialization::Serializable {
typedef Eigen::Matrix<Numeric, Eigen::Dynamic, 1> vector_x_t; typedef Eigen::Matrix<Numeric, Eigen::Dynamic, 1> vector_x_t;
...@@ -116,7 +116,7 @@ struct linear_variable : public serialization::Serializable { ...@@ -116,7 +116,7 @@ struct linear_variable : public serialization::Serializable {
// (B1 x + c1) X (B2 x + c2) = (-c2X B1) x + (bX B2) x + b1Xb2 // (B1 x + c1) X (B2 x + c2) = (-c2X B1) x + (bX B2) x + b1Xb2
typename linear_variable_t::matrix_3_t newB = skew<typename linear_variable_t::matrix_3_t, typename linear_variable_t::vector_3_t>(-other.c()) * B() + typename linear_variable_t::matrix_3_t newB = skew<typename linear_variable_t::matrix_3_t, typename linear_variable_t::vector_3_t>(-other.c()) * B() +
skew<typename linear_variable_t::matrix_3_t, typename linear_variable_t::vector_3_t>(c()) * other.B(); skew<typename linear_variable_t::matrix_3_t, typename linear_variable_t::vector_3_t>(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); return linear_variable_t(newB,newC);
} }
...@@ -226,8 +226,8 @@ std::ostream &operator<<(std::ostream &os, const linear_variable<N, S>& l) { ...@@ -226,8 +226,8 @@ std::ostream &operator<<(std::ostream &os, const linear_variable<N, S>& l) {
return os << "linear_variable: \n \t B:\n"<< l.B() << "\t c: \n" << l.c().transpose(); 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), DEFINE_CLASS_TEMPLATE_VERSION(SINGLE_ARG(typename Numeric, bool Safe),
SINGLE_ARG(curves::linear_variable<Numeric, Safe>)) SINGLE_ARG(ndcurves::linear_variable<Numeric, Safe>))
#endif //_CLASS_LINEAR_VARIABLE #endif //_CLASS_LINEAR_VARIABLE
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
#ifndef _CLASS_DEFINITIONS_H #ifndef _CLASS_DEFINITIONS_H
#define _CLASS_DEFINITIONS_H #define _CLASS_DEFINITIONS_H
#include <curves/bezier_curve.h> #include <ndcurves/bezier_curve.h>
#include <curves/linear_variable.h> #include <ndcurves/linear_variable.h>
#include <curves/quadratic_variable.h> #include <ndcurves/quadratic_variable.h>
#include <curves/curve_constraint.h> #include <ndcurves/curve_constraint.h>
namespace curves { namespace ndcurves {
namespace optimization { namespace optimization {
enum constraint_flag { enum constraint_flag {
...@@ -81,5 +81,5 @@ struct problem_definition : public curve_constraints<Point> { ...@@ -81,5 +81,5 @@ struct problem_definition : public curve_constraints<Point> {
}; };