diff --git a/include/xpp/opt/impl/polynomial_xd-impl.h b/include/xpp/opt/impl/polynomial_xd-impl.h index ebfb237ac..8e47aa8bc 100644 --- a/include/xpp/opt/impl/polynomial_xd-impl.h +++ b/include/xpp/opt/impl/polynomial_xd-impl.h @@ -11,25 +11,15 @@ namespace xpp { namespace opt { template -PolynomialXd::PolynomialXd (int id, - double duration) +PolynomialXd::PolynomialXd (int id, double duration) { - SetDuration(duration); SetId(id); + SetBoundary(duration, Point(), Point()); } template PolynomialXd::~PolynomialXd () { - // TODO Auto-generated destructor stub -} - -template -void -PolynomialXd::SetDuration (double _duration) -{ - for (int dim=X; dim @@ -37,7 +27,7 @@ double PolynomialXd::GetDuration () const { // all polynomials have same duration, so just return duration of X - return polynomials_.at(X).duration; + return polynomials_.at(X).GetDuration(); } template @@ -54,22 +44,21 @@ template double PolynomialXd::GetCoefficient (int dim, PolyCoeff coeff) const { - return polynomials_.at(dim).c[coeff]; + return polynomials_.at(dim).GetCoefficient(coeff); } template void -PolynomialXd::SetCoefficients (int dim, - PolyCoeff coeff, - double value) +PolynomialXd::SetCoefficients (int dim, PolyCoeff coeff, + double value) { - polynomials_.at(dim).c[coeff] = value; + polynomials_.at(dim).SetCoefficient(coeff,value); } template void PolynomialXd::SetBoundary(double T, - const Point& start, - const Point& end) + const Point& start, + const Point& end) { for (int dim=X; dim c; //!< coefficients of spline - double duration; + private: + double duration; /** * @brief Calculates all spline coeff of current spline. * @@ -65,8 +72,6 @@ class Polynomial { * This is the only function that must be implemented by the child classes. */ virtual void SetPolynomialCoefficients(double T, const StateLin1d& start_p, const StateLin1d& end_p) = 0; - -protected: }; inline Polynomial::Polynomial() diff --git a/include/xpp/opt/polynomial_xd.h b/include/xpp/opt/polynomial_xd.h index 5d648c9cd..3fb1f0a5d 100644 --- a/include/xpp/opt/polynomial_xd.h +++ b/include/xpp/opt/polynomial_xd.h @@ -38,7 +38,6 @@ class PolynomialXd { static int GetNumCoeff() { return PolynomialType::GetNumCoeff(); }; - void SetDuration(double duration); double GetDuration() const; uint GetId() const { return id_; }; diff --git a/src/polynomial.cc b/src/polynomial.cc index 2f3a067ec..7bf1b5ebf 100644 --- a/src/polynomial.cc +++ b/src/polynomial.cc @@ -43,6 +43,21 @@ bool Polynomial::GetPoint(const double dt, StateLin1d& out) const return true; } +double Polynomial::GetCoefficient(PolynomialCoeff coeff) const +{ + return c[coeff]; +} + +void Polynomial::SetCoefficient(PolynomialCoeff coeff, double value) +{ + c[coeff] = value; +} + +double Polynomial::GetDuration() const +{ + return duration; +} + void LinearPolynomial::SetPolynomialCoefficients(double T, const StateLin1d& start, const StateLin1d& end) { c[F] = start.p;