base
Public Types | Public Member Functions | List of all members
base::geometry::Spline< DIM > Class Template Reference

#include <Spline.hpp>

Inheritance diagram for base::geometry::Spline< DIM >:
base::geometry::SplineBase

Public Types

typedef SplineBaseClass< DIM >::type base_t
 
typedef Eigen::Matrix< double, DIM, 1, Eigen::DontAlign > vector_t
 
typedef Eigen::Matrix< double, DIM, 1, Eigen::AutoAlign > vector_ta
 
typedef Eigen::Transform< double, DIM, Eigen::Affine > transform_t
 
- Public Types inherited from base::geometry::SplineBase
enum  CoordinateType {
  ORDINARY_POINT = 1, KNUCKLE_POINT = 2, DERIVATIVE_TO_NEXT = 3, DERIVATIVE_TO_PRIOR = 4,
  SECOND_DERIVATIVE_TO_NEXT = 5, SECOND_DERIVATIVE_TO_PRIOR = 6, TANGENT_POINT_FOR_NEXT = 13, TANGENT_POINT_FOR_PRIOR = 14
}
 

Public Member Functions

 Spline (double geometric_resolution=0.1, int order=3)
 
 Spline (double geometric_resolution, SISLCurve *curve)
 
 Spline (SplineBase const &base)
 
vector_t getStartPoint () const
 
vector_t getEndPoint () const
 
void setSingleton (vector_t const &v)
 
vector_t getPoint (double _param) const
 
std::vector< vector_tgetPoints (std::vector< double > const &parameters) const
 
Spline derive (int order) const
 
bool doAdvance (double &result, double &cur_length, double target, double start, vector_t const &start_p, double end, vector_t const &end_p, double _geores) const
 
std::pair< double, double > advance (double t, double length, double _geores) const
 
double length (double start, double end, double _geores) const
 
std::pair< vector_t, vector_tgetPointAndTangent (double _param) const
 
std::vector< vector_tsample (double _geores, std::vector< double > *parameters=0, int max_recursion=20) const
 
void sample (std::vector< vector_t > &result, double _geores, std::vector< double > *parameters=0, int max_recursion=20) const
 
void sample (std::vector< vector_t > &result, double start, vector_t const &start_p, double end, vector_t const &end_p, double _geores, std::vector< double > *parameters, int max_recursion=20) const
 
void interpolate (std::vector< vector_t > const &points, std::vector< double > const &parameters=std::vector< double >(), std::vector< SplineBase::CoordinateType > const &coord_types=std::vector< SplineBase::CoordinateType >())
 
void interpolate (std::vector< vector_t > const &points, std::vector< double > &parametersOut, std::vector< double > const &parametersIn=std::vector< double >(), std::vector< SplineBase::CoordinateType > const &coord_types=std::vector< SplineBase::CoordinateType >())
 
void interpolate (std::vector< vector_ta > const &points, std::vector< double > &parametersOut, std::vector< double > const &parametersIn=std::vector< double >(), std::vector< SplineBase::CoordinateType > const &coord_types=std::vector< SplineBase::CoordinateType >())
 
void interpolate (std::vector< vector_ta > const &points, std::vector< double > const &parameters=std::vector< double >(), std::vector< SplineBase::CoordinateType > const &coord_types=std::vector< SplineBase::CoordinateType >())
 
void interpolate (std::vector< double > const &coordinates, std::vector< double > const &parameters=std::vector< double >(), std::vector< SplineBase::CoordinateType > const &coord_types=std::vector< SplineBase::CoordinateType >())
 
void interpolate (std::vector< double > const &coordinates, std::vector< double > &parameterOut, std::vector< double > const &parameterIn=std::vector< double >(), std::vector< SplineBase::CoordinateType > const &coord_types=std::vector< SplineBase::CoordinateType >())
 
double distanceTo (vector_t const &_pt) const
 
template<typename Test >
std::pair< double, double > dichotomic_search (double start_t, double end_t, Test test, double resolution, double parameter_threshold) const
 
template<typename Test >
std::pair< double, double > dichotomic_search (double start_t, vector_t const &start_p, double end_t, vector_t const &end_p, Test test, double resolution, double parameter_threshold) const
 
void findSphereIntersections (vector_t const &_center, double _radius, std::vector< double > &points, std::vector< std::pair< double, double > > &segments) const
 
void findSphereIntersections (vector_t const &_center, double _radius, std::vector< double > &points, std::vector< std::pair< double, double > > &segments, double _geores) const
 
void findPointIntersections (vector_t const &_point, std::vector< double > &_result_points, std::vector< std::pair< double, double > > &_result_curves, double _geores) const
 
std::pair< double, bool > findOneLineIntersection (vector_t const &_pt, vector_t const &_normal) const
 
std::pair< double, bool > findOneLineIntersection (vector_t const &_pt, vector_t const &_normal, double geometric_resolution) const
 
std::pair< double, bool > findOneLineIntersection (vector_t const &_pt, vector_t const &_normal, double _guess, double _geometric_resolution) const
 
std::pair< double, bool > findOneLineIntersection (vector_t const &_pt, vector_t const &_normal, vector_t const &_guess, double _geometric_resolution) const
 
void findLineIntersections (vector_t const &_point, vector_t const &_normal, std::vector< double > &_result_points, std::vector< std::pair< double, double > > &_result_curves, double _geores) const
 
void findSegmentIntersections (vector_t const &_p0, vector_t const &_p1, std::vector< double > &_result_points, std::vector< std::pair< double, double > > &_result_curves, double _geores) const
 
bool isIntersectingSegment (vector_t const &_p0, vector_t const &_p1, double _geores)
 
double findOneClosestPoint (vector_t const &_pt) const
 
bool isCloser (const vector_t &p, const double &squaredDist, const double param, vector_t &pOfParam, double &squaredDistOfParam) const
 
double findOneClosestPoint (vector_t const &_pt, double _geometric_resolution) const
 
double findOneClosestPoint (vector_t const &_pt, double _guess, double _geometric_resolution) const
 
void findClosestPoints (vector_t const &_pt, std::vector< double > &_points, std::vector< std::pair< double, double > > &_curves) const
 
void findClosestPoints (vector_t const &_pt, std::vector< double > &_points, std::vector< std::pair< double, double > > &_curves, double _geores) const
 
double localClosestPointSearch (vector_t const &_pt, double _guess, double _start, double _end)
 
double localClosestPointSearch (vector_t const &_pt, double _guess, double _start, double _end, double _geores)
 
template<typename Transform >
void transform (Transform const &t)
 
- Public Member Functions inherited from base::geometry::SplineBase
 SplineBase (SplineBase const &source)
 
 ~SplineBase ()
 
 SplineBase (int dimension, double geometric_resolution=0.1, int order=3)
 
 SplineBase (double geometric_resolution, SISLCurve *curve)
 
void setGeometricResolution (double _geores)
 
double getGeometricResolution () const
 
bool isEmpty () const
 
bool isSingleton () const
 
int getDimension () const
 
int getPointCount () const
 
void setCurveOrder (int value)
 
int getCurveOrder () const
 
double getCurveLength (double relative_resolution=0.01) const
 
double getCurveLength (double startParam, double relative_resolution) const
 
double getCurveLength (double startParam, double endParam, double relative_resolution) const
 
double getCurvatureMax ()
 
double getStartParam () const
 
double getEndParam () const
 
SISLCurve const * getSISLCurve () const
 
SISLCurve * getSISLCurve ()
 
double getCurvature (double _param) const
 
double getVariationOfCurvature (double _param)
 
std::vector< double > getCoordinates () const
 
std::vector< double > getKnots () const
 
int getSISLCurveType () const
 
void printCurveProperties (std::ostream &io)
 
void interpolate (std::vector< double > const &coordinates, std::vector< double > const &parameters=std::vector< double >(), std::vector< CoordinateType > const &coord_types=std::vector< CoordinateType >())
 
void interpolate (std::vector< double > const &coordinates, std::vector< double > &parameterOut, std::vector< double > const &parameterIn=std::vector< double >(), std::vector< CoordinateType > const &coord_types=std::vector< CoordinateType >())
 
bool testIntersection (SplineBase const &other, double resolution=0.01) const
 
void clear ()
 
std::vector< double > simplify ()
 
std::vector< double > simplify (double tolerance)
 
SplineBase const & operator= (SplineBase const &base)
 
bool isNURBS () const
 
void reset (std::vector< double > const &coordinates, std::vector< double > const &knots, int kind=-1)
 
void reverse ()
 
void append (SplineBase const &other)
 
void append (SplineBase const &other, double tolerance)
 
double join (SplineBase const &other, double tolerance, bool with_tangents)
 
void split (SplineBase &second_part, double parameter)
 
void crop (double start_t, double end_t)
 
SplineBasegetSubSpline (double start_t, double end_t) const
 
int getCoordinatesStride () const
 
void setSingleton (double const *coordinates)
 
void derive (unsigned int order, SplineBase &result) const
 

Additional Inherited Members

- Protected Member Functions inherited from base::geometry::SplineBase
bool checkAndNormalizeParam (double &param, double equalDistance=0.001) const
 
void reset (SISLCurve *curve)
 
void getPoint (double *result, double _param) const
 
void getPointAndTangent (double *result, double _param) const
 
void findPointIntersections (double const *_point, std::vector< double > &_result_points, std::vector< std::pair< double, double > > &_result_curves, double _geores) const
 
std::pair< double, bool > findOneLineIntersection (double const *_point, double const *_normal, double _guess, double _geores) const
 
void findLineIntersections (double const *_point, double const *_normal, std::vector< double > &_result_points, std::vector< std::pair< double, double > > &_result_curves, double _geores) const
 
void findSphereIntersections (double const *_center, double radius, std::vector< double > &points, std::vector< std::pair< double, double > > &segments, double _geores) const
 
double findOneClosestPoint (double const *_pt, double _guess, double _geores) const
 
void findClosestPoints (double const *ref_point, std::vector< double > &_result_points, std::vector< std::pair< double, double > > &_result_curves, double _geores) const
 
double localClosestPointSearch (double const *ref_point, double _guess, double _start, double _end, double _geores) const
 
void getPointAndTangentHelper (double *result, double _param, bool with_tangent) const
 
double getResultClosestToGuess (double _guess, std::vector< double > points, std::vector< std::pair< double, double > > curves) const
 
base::Matrix3d getFrenetFrame (double _param)
 available only in Spline<3> More...
 
double getHeading (double _param)
 available only in Spline<3> More...
 
double headingError (double _actHeading, double _param)
 available only in Spline<3> More...
 
double distanceError (base::Vector3d _pt, double _param)
 available only in Spline<3> More...
 
base::Vector3d poseError (base::Vector3d _pt, double _actZRot, double _st_para)
 available only in Spline<3> More...
 
base::Vector3d poseError (base::Vector3d _pt, double _actZRot, double _st_para, double minParam)
 available only in Spline<3> More...
 

Member Typedef Documentation

◆ base_t

template<int DIM>
typedef SplineBaseClass<DIM>::type base::geometry::Spline< DIM >::base_t

◆ transform_t

template<int DIM>
typedef Eigen::Transform<double, DIM, Eigen::Affine> base::geometry::Spline< DIM >::transform_t

◆ vector_t

template<int DIM>
typedef Eigen::Matrix<double, DIM, 1, Eigen::DontAlign> base::geometry::Spline< DIM >::vector_t

◆ vector_ta

template<int DIM>
typedef Eigen::Matrix<double, DIM, 1, Eigen::AutoAlign> base::geometry::Spline< DIM >::vector_ta

Constructor & Destructor Documentation

◆ Spline() [1/3]

template<int DIM>
base::geometry::Spline< DIM >::Spline ( double  geometric_resolution = 0.1,
int  order = 3 
)
inlineexplicit

◆ Spline() [2/3]

template<int DIM>
base::geometry::Spline< DIM >::Spline ( double  geometric_resolution,
SISLCurve *  curve 
)
inlineexplicit

◆ Spline() [3/3]

template<int DIM>
base::geometry::Spline< DIM >::Spline ( SplineBase const &  base)
inline

Member Function Documentation

◆ advance()

template<int DIM>
std::pair<double, double> base::geometry::Spline< DIM >::advance ( double  t,
double  length,
double  _geores 
) const
inline

Find a parameter separated from another by a given curve length

Specifically, this method finds the parameter t1 so that the curve length between t and t1 is in [length, length + _geores]

If the end of the curve is reached first, then the parameter of the end of the curve is returned.

◆ derive()

template<int DIM>
Spline base::geometry::Spline< DIM >::derive ( int  order) const
inline

◆ dichotomic_search() [1/2]

template<int DIM>
template<typename Test >
std::pair<double, double> base::geometry::Spline< DIM >::dichotomic_search ( double  start_t,
double  end_t,
Test  test,
double  resolution,
double  parameter_threshold 
) const
inline

◆ dichotomic_search() [2/2]

template<int DIM>
template<typename Test >
std::pair<double, double> base::geometry::Spline< DIM >::dichotomic_search ( double  start_t,
vector_t const &  start_p,
double  end_t,
vector_t const &  end_p,
Test  test,
double  resolution,
double  parameter_threshold 
) const
inline

Does a dichotomic search to find the first point in [start_t, end_t] for which func returns true

end_t might be lower than start_t, in which case the point returned will be the last point in the curve

◆ distanceTo()

template<int DIM>
double base::geometry::Spline< DIM >::distanceTo ( vector_t const &  _pt) const
inline

Returns the distance between the given point and the curve

◆ doAdvance()

template<int DIM>
bool base::geometry::Spline< DIM >::doAdvance ( double &  result,
double &  cur_length,
double  target,
double  start,
vector_t const &  start_p,
double  end,
vector_t const &  end_p,
double  _geores 
) const
inline

Private helper method for advance and length

Iteratively computes a discretization of the curve from +start+ to +end+, with two points in the discretization not being further apart than _geores.

It accumulates the distance while doing so. If, at some point in the search, the accumulated distance cur_length gets bigger than target, then the parameter at that point gets stored in result and the method returns true.

If it never happens, the method returns false. In this case, result is set to end and cur_length is the approximate length of the whole segment.

◆ findClosestPoints() [1/2]

template<int DIM>
void base::geometry::Spline< DIM >::findClosestPoints ( vector_t const &  _pt,
std::vector< double > &  _points,
std::vector< std::pair< double, double > > &  _curves 
) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ findClosestPoints() [2/2]

template<int DIM>
void base::geometry::Spline< DIM >::findClosestPoints ( vector_t const &  _pt,
std::vector< double > &  _points,
std::vector< std::pair< double, double > > &  _curves,
double  _geores 
) const
inline

Returns the single points and curve segments that are closest to the given point.

◆ findLineIntersections()

template<int DIM>
void base::geometry::Spline< DIM >::findLineIntersections ( vector_t const &  _point,
vector_t const &  _normal,
std::vector< double > &  _result_points,
std::vector< std::pair< double, double > > &  _result_curves,
double  _geores 
) const
inline

◆ findOneClosestPoint() [1/3]

template<int DIM>
double base::geometry::Spline< DIM >::findOneClosestPoint ( vector_t const &  _pt) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ findOneClosestPoint() [2/3]

template<int DIM>
double base::geometry::Spline< DIM >::findOneClosestPoint ( vector_t const &  _pt,
double  _geometric_resolution 
) const
inline

This method return the closest point in the curve to the given point _pt.

◆ findOneClosestPoint() [3/3]

template<int DIM>
double base::geometry::Spline< DIM >::findOneClosestPoint ( vector_t const &  _pt,
double  _guess,
double  _geometric_resolution 
) const
inline

Returns a single closest point to _pt

This is a convenience method that calls findClosestPoints and returns one single parameter in the values returned.

Returns
the parameter of the found closes point
Parameters
_guessthis paramter is ignored. It is only there for backward compability
Exceptions
std::logic_errorif no points have been found (should not happen)
See also
localClosestPointSearch findClosestPoints

◆ findOneLineIntersection() [1/4]

template<int DIM>
std::pair<double, bool> base::geometry::Spline< DIM >::findOneLineIntersection ( vector_t const &  _pt,
vector_t const &  _normal 
) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ findOneLineIntersection() [2/4]

template<int DIM>
std::pair<double, bool> base::geometry::Spline< DIM >::findOneLineIntersection ( vector_t const &  _pt,
vector_t const &  _normal,
double  geometric_resolution 
) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Calls findOneClosestPoint using the start parameter as the guess parameter. I.e. it will always return the point closest to the start of the curve.

◆ findOneLineIntersection() [3/4]

template<int DIM>
std::pair<double, bool> base::geometry::Spline< DIM >::findOneLineIntersection ( vector_t const &  _pt,
vector_t const &  _normal,
double  _guess,
double  _geometric_resolution 
) const
inline

Returns a single intersection point between this curve and the line or plan defined by _pt and _normal

This is a convenience method that calls findLineIntersections and returns one single parameter in the values returned. The returned parameter is the closes point closest to _guess.

Returns
a (t, true) pair, with t being the parameter of the found intersection, if there is one. If there is none, the (0, false) pair is returned

◆ findOneLineIntersection() [4/4]

template<int DIM>
std::pair<double, bool> base::geometry::Spline< DIM >::findOneLineIntersection ( vector_t const &  _pt,
vector_t const &  _normal,
vector_t const &  _guess,
double  _geometric_resolution 
) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ findPointIntersections()

template<int DIM>
void base::geometry::Spline< DIM >::findPointIntersections ( vector_t const &  _point,
std::vector< double > &  _result_points,
std::vector< std::pair< double, double > > &  _result_curves,
double  _geores 
) const
inline

◆ findSegmentIntersections()

template<int DIM>
void base::geometry::Spline< DIM >::findSegmentIntersections ( vector_t const &  _p0,
vector_t const &  _p1,
std::vector< double > &  _result_points,
std::vector< std::pair< double, double > > &  _result_curves,
double  _geores 
) const
inline

◆ findSphereIntersections() [1/2]

template<int DIM>
void base::geometry::Spline< DIM >::findSphereIntersections ( vector_t const &  _center,
double  _radius,
std::vector< double > &  points,
std::vector< std::pair< double, double > > &  segments 
) const
inline

◆ findSphereIntersections() [2/2]

template<int DIM>
void base::geometry::Spline< DIM >::findSphereIntersections ( vector_t const &  _center,
double  _radius,
std::vector< double > &  points,
std::vector< std::pair< double, double > > &  segments,
double  _geores 
) const
inline

◆ getEndPoint()

template<int DIM>
vector_t base::geometry::Spline< DIM >::getEndPoint ( ) const
inline

Returns the geometric end point of the curve

◆ getPoint()

template<int DIM>
vector_t base::geometry::Spline< DIM >::getPoint ( double  _param) const
inline

Returns the geometric point that lies on the curve at the given parameter

◆ getPointAndTangent()

template<int DIM>
std::pair<vector_t, vector_t> base::geometry::Spline< DIM >::getPointAndTangent ( double  _param) const
inline

Returns the geometric point that lies on the curve at the given parameter

◆ getPoints()

template<int DIM>
std::vector<vector_t> base::geometry::Spline< DIM >::getPoints ( std::vector< double > const &  parameters) const
inline

◆ getStartPoint()

template<int DIM>
vector_t base::geometry::Spline< DIM >::getStartPoint ( ) const
inline

Returns the geometric start point of the curve

◆ interpolate() [1/6]

template<int DIM>
void base::geometry::Spline< DIM >::interpolate ( std::vector< vector_t > const &  points,
std::vector< double > const &  parameters = std::vector<double>(),
std::vector< SplineBase::CoordinateType > const &  coord_types = std::vector<SplineBase::CoordinateType>() 
)
inline

Compute the curve from the given set of points

◆ interpolate() [2/6]

template<int DIM>
void base::geometry::Spline< DIM >::interpolate ( std::vector< vector_t > const &  points,
std::vector< double > &  parametersOut,
std::vector< double > const &  parametersIn = std::vector<double>(),
std::vector< SplineBase::CoordinateType > const &  coord_types = std::vector<SplineBase::CoordinateType>() 
)
inline

◆ interpolate() [3/6]

template<int DIM>
void base::geometry::Spline< DIM >::interpolate ( std::vector< vector_ta > const &  points,
std::vector< double > &  parametersOut,
std::vector< double > const &  parametersIn = std::vector<double>(),
std::vector< SplineBase::CoordinateType > const &  coord_types = std::vector<SplineBase::CoordinateType>() 
)
inline

◆ interpolate() [4/6]

template<int DIM>
void base::geometry::Spline< DIM >::interpolate ( std::vector< vector_ta > const &  points,
std::vector< double > const &  parameters = std::vector<double>(),
std::vector< SplineBase::CoordinateType > const &  coord_types = std::vector<SplineBase::CoordinateType>() 
)
inline

Compute the curve from the given set of points

◆ interpolate() [5/6]

template<int DIM>
void base::geometry::Spline< DIM >::interpolate ( std::vector< double > const &  coordinates,
std::vector< double > const &  parameters = std::vector<double>(),
std::vector< SplineBase::CoordinateType > const &  coord_types = std::vector<SplineBase::CoordinateType>() 
)
inline

◆ interpolate() [6/6]

template<int DIM>
void base::geometry::Spline< DIM >::interpolate ( std::vector< double > const &  coordinates,
std::vector< double > &  parameterOut,
std::vector< double > const &  parameterIn = std::vector<double>(),
std::vector< SplineBase::CoordinateType > const &  coord_types = std::vector<SplineBase::CoordinateType>() 
)
inline

◆ isCloser()

template<int DIM>
bool base::geometry::Spline< DIM >::isCloser ( const vector_t p,
const double &  squaredDist,
const double  param,
vector_t pOfParam,
double &  squaredDistOfParam 
) const
inline

◆ isIntersectingSegment()

template<int DIM>
bool base::geometry::Spline< DIM >::isIntersectingSegment ( vector_t const &  _p0,
vector_t const &  _p1,
double  _geores 
)
inline

Returns true if this curve intersects the given segment

◆ length()

template<int DIM>
double base::geometry::Spline< DIM >::length ( double  start,
double  end,
double  _geores 
) const
inline

Computes the length of a curve segment

Specifically, this method finds the length of the curve by discretizing it with a step length of _geores

◆ localClosestPointSearch() [1/2]

template<int DIM>
double base::geometry::Spline< DIM >::localClosestPointSearch ( vector_t const &  _pt,
double  _guess,
double  _start,
double  _end 
)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ localClosestPointSearch() [2/2]

template<int DIM>
double base::geometry::Spline< DIM >::localClosestPointSearch ( vector_t const &  _pt,
double  _guess,
double  _start,
double  _end,
double  _geores 
)
inline

Performs a Newton search in the provided parametric interval, starting with the given guess. The order between _start and _end can be arbitrary.

This method is subject to local minima problems

◆ sample() [1/3]

template<int DIM>
std::vector<vector_t> base::geometry::Spline< DIM >::sample ( double  _geores,
std::vector< double > *  parameters = 0,
int  max_recursion = 20 
) const
inline

Returns a discretization of this curve so that two consecutive points are separated by a curve length lower than _geores

◆ sample() [2/3]

template<int DIM>
void base::geometry::Spline< DIM >::sample ( std::vector< vector_t > &  result,
double  _geores,
std::vector< double > *  parameters = 0,
int  max_recursion = 20 
) const
inline

Samples the curve so that the distance between two consecutive points is always below _geores

◆ sample() [3/3]

template<int DIM>
void base::geometry::Spline< DIM >::sample ( std::vector< vector_t > &  result,
double  start,
vector_t const &  start_p,
double  end,
vector_t const &  end_p,
double  _geores,
std::vector< double > *  parameters,
int  max_recursion = 20 
) const
inline

Helper method for the other sample methods

◆ setSingleton()

template<int DIM>
void base::geometry::Spline< DIM >::setSingleton ( vector_t const &  v)
inline

Resets this curve to a singleton

◆ transform()

template<int DIM>
template<typename Transform >
void base::geometry::Spline< DIM >::transform ( Transform const &  t)
inline

The documentation for this class was generated from the following file: