Commit 7cca5327 authored by stonneau's avatar stonneau
Browse files

more cleaning

parent fcd529d6
......@@ -63,7 +63,6 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
/* Constructors - destructors */
/*Operations*/
public:
public:
/// \brief Evaluation of the cubic spline at time t.
/// \param t : the time when to evaluate the spine
......@@ -100,8 +99,8 @@ struct bezier_curve : public curve_abc<Time, Numeric, Dim, Safe, Point>
/*Operations*/
/*Helpers*/
virtual time_t MinBound() const{return minBound_;}
virtual time_t MaxBound() const{return minBound_;}
virtual time_t min() const{return minBound_;}
virtual time_t max() const{return maxBound_;}
/*Helpers*/
public:
......
......@@ -22,15 +22,15 @@
namespace spline
{
/// \class CubicFunction
/// \brief Represents a cubic spline defined on the interval
/// [tBegin, tEnd]. It follows the equation
/// x(t) = a + b(t - t_min_) + c(t - t_min_)^2 + d(t - t_min_)^3
///
template<typename Time= double, typename Numeric=Time, int Dim=3, bool Safe=false
, typename Point= Eigen::Matrix<Numeric, Dim, 1> >
struct cubic_function : public curve_abc<Time, Numeric, Dim, Safe, Point>
{
/// \class CubicFunction
/// \brief Represents a cubic spline defined on the interval
/// [tBegin, tEnd]. It follows the equation
/// x(t) = a + b(t - t_min_) + c(t - t_min_)^2 + d(t - t_min_)^3
///
template<typename Time= double, typename Numeric=Time, int Dim=3, bool Safe=false
, typename Point= Eigen::Matrix<Numeric, Dim, 1> >
struct cubic_function : public curve_abc<Time, Numeric, Dim, Safe, Point>
{
typedef Point point_t;
typedef Time time_t;
typedef Numeric num_t;
......@@ -53,8 +53,8 @@ namespace spline
}
private:
//cubic_function(const cubic_function&);
//cubic_function& operator=(const cubic_function&);
cubic_function(const cubic_function&);
cubic_function& operator=(const cubic_function&);
/* Constructors - destructors */
/*Operations*/
......@@ -72,8 +72,10 @@ namespace spline
/*Helpers*/
public:
num_t virtual MinBound() const {return t_min_;}
num_t virtual MaxBound() const {return t_max_;}
/// \brief Returns the minimum time for wich curve is defined
num_t virtual min() const {return t_min_;}
/// \brief Returns the maximum time for wich curve is defined
num_t virtual max() const {return t_max_;}
/*Helpers*/
/*Attributes*/
......
......@@ -46,8 +46,11 @@ struct curve_abc : std::unary_function<Time, Point>
/*Operations*/
/*Helpers*/
virtual time_t MinBound() const = 0;
virtual time_t MaxBound() const = 0;
public:
/// \brief Returns the minimum time for wich curve is defined
virtual time_t min() const = 0;
/// \brief Returns the maximum time for wich curve is defined
virtual time_t max() const = 0;
/*Helpers*/
};
......
......@@ -27,9 +27,6 @@
#include <functional>
#include <vector>
#include <Eigen/StdVector>
#include <iostream>
namespace spline
{
......@@ -162,8 +159,8 @@ struct exact_cubic : public curve_abc<Time, Numeric, Dim, Safe, Point>
/*Helpers*/
public:
num_t virtual MinBound() const{return subSplines_.front()->t_min_;}
num_t virtual MaxBound() const{return subSplines_.back()->t_max_;}
num_t virtual min() const{return subSplines_.front()->t_min_;}
num_t virtual max() const{return subSplines_.back()->t_max_;}
/*Helpers*/
/*Attributes*/
......
......@@ -110,6 +110,16 @@ void CubicFunctionTest(bool& error)
{
std::cout << "Evaluation of cubic cf2 error, 1.1 should be an out of range value\n";
}
if(cf.max() != 1)
{
error = true;
std::cout << "Evaluation of exactCubic error, MaxBound should be equal to 1\n";
}
if(cf.min() != 0)
{
error = true;
std::cout << "Evaluation of exactCubic error, MinBound should be equal to 1\n";
}
}
/*bezier_curve Function tests*/
......@@ -180,6 +190,16 @@ void BezierCurveTest(bool& error)
{
std::cout << "Evaluation of bezier cf error, 1.1 should be an out of range value\n";
}
if(cf.max() != 1)
{
error = true;
std::cout << "Evaluation of exactCubic error, MaxBound should be equal to 1\n";
}
if(cf.min() != 0)
{
error = true;
std::cout << "Evaluation of exactCubic error, MinBound should be equal to 1\n";
}
}
/*Exact Cubic Function tests*/
......@@ -215,12 +235,12 @@ void ExactCubicNoErrorTest(bool& error)
{
std::cout << "Evaluation of exactCubic cf error, 1.2 should be an out of range value\n";
}
if(exactCubic.MaxBound() != 1)
if(exactCubic.max() != 1)
{
error = true;
std::cout << "Evaluation of exactCubic error, MaxBound should be equal to 1\n";
}
if(exactCubic.MinBound() != 0)
if(exactCubic.min() != 0)
{
error = true;
std::cout << "Evaluation of exactCubic error, MinBound should be equal to 1\n";
......
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