base
Public Types | Public Member Functions | Protected Member Functions | List of all members
base::geometry::SplineBase Class Reference

#include <Spline.hpp>

Inheritance diagram for base::geometry::SplineBase:
base::geometry::Spline< DIM > base::geometry::Spline3Base RubySpline base::geometry::Spline< 1 > base::geometry::Spline< 2 > base::geometry::Spline< 3 >

Public Types

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

 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
 

Protected Member Functions

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...
 

Detailed Description

Representation and manipulation of a N-order, 3D NURBS curve

The availability of this class is dependent on the availability of the SISL library

http://www.sintef.no/Informasjons&ndash;og-kommunikasjonsteknologi-IKT/Anvendt-matematikk/Fagomrader/Geometri/Prosjekter/The-SISL-Nurbs-Library/SISL-Homepage/

Member Enumeration Documentation

◆ CoordinateType

types to be used in the interpolate() method

Enumerator
ORDINARY_POINT 
KNUCKLE_POINT 
DERIVATIVE_TO_NEXT 
DERIVATIVE_TO_PRIOR 
SECOND_DERIVATIVE_TO_NEXT 
SECOND_DERIVATIVE_TO_PRIOR 
TANGENT_POINT_FOR_NEXT 
TANGENT_POINT_FOR_PRIOR 

Constructor & Destructor Documentation

◆ SplineBase() [1/3]

base::geometry::SplineBase::SplineBase ( SplineBase const &  source)

◆ ~SplineBase()

base::geometry::SplineBase::~SplineBase ( )

◆ SplineBase() [2/3]

base::geometry::SplineBase::SplineBase ( int  dimension,
double  geometric_resolution = 0.1,
int  order = 3 
)
explicit

◆ SplineBase() [3/3]

base::geometry::SplineBase::SplineBase ( double  geometric_resolution,
SISLCurve *  curve 
)
explicit

Member Function Documentation

◆ append() [1/2]

void base::geometry::SplineBase::append ( SplineBase const &  other)

◆ append() [2/2]

void base::geometry::SplineBase::append ( SplineBase const &  other,
double  tolerance 
)

Appends other at the end of this.

other is translated so that other's start point is equal to this's end point. The resulting curve is then appended to this

See also
join

◆ checkAndNormalizeParam()

bool base::geometry::SplineBase::checkAndNormalizeParam ( double &  param,
double  equalDistance = 0.001 
) const
protected

This function checks weather param is smaler or bigger than end and start param. It also sets param to start or end, if the difference between param and start/end is smaler than equalDistance.

returns true if param is inside start/end.

◆ clear()

void base::geometry::SplineBase::clear ( )

Reinitializes the curve

◆ crop()

void base::geometry::SplineBase::crop ( double  start_t,
double  end_t 
)

Crops this curve at the specified boundaries

After this operation, +this+ will represent the part of the curve that was in between the two given parameters

◆ derive()

void base::geometry::SplineBase::derive ( unsigned int  order,
SplineBase result 
) const

Returns the i-th derivative of this curve

◆ distanceError()

double base::geometry::SplineBase::distanceError ( base::Vector3d  _pt,
double  _param 
)
protected

available only in Spline<3>

◆ findClosestPoints()

void base::geometry::SplineBase::findClosestPoints ( double const *  ref_point,
std::vector< double > &  _result_points,
std::vector< std::pair< double, double > > &  _result_curves,
double  _geores 
) const
protected

◆ findLineIntersections()

void base::geometry::SplineBase::findLineIntersections ( double const *  _point,
double const *  _normal,
std::vector< double > &  _result_points,
std::vector< std::pair< double, double > > &  _result_curves,
double  _geores 
) const
protected

◆ findOneClosestPoint()

double base::geometry::SplineBase::findOneClosestPoint ( double const *  _pt,
double  _guess,
double  _geores 
) const
protected

Warning, do not use this method, it is broken and returns the wrong result

◆ findOneLineIntersection()

std::pair< double, bool > base::geometry::SplineBase::findOneLineIntersection ( double const *  _point,
double const *  _normal,
double  _guess,
double  _geores 
) const
protected

◆ findPointIntersections()

void base::geometry::SplineBase::findPointIntersections ( double const *  _point,
std::vector< double > &  _result_points,
std::vector< std::pair< double, double > > &  _result_curves,
double  _geores 
) const
protected

◆ findSphereIntersections()

void base::geometry::SplineBase::findSphereIntersections ( double const *  _center,
double  radius,
std::vector< double > &  points,
std::vector< std::pair< double, double > > &  segments,
double  _geores 
) const
protected

◆ getCoordinates()

std::vector< double > base::geometry::SplineBase::getCoordinates ( ) const

◆ getCoordinatesStride()

int base::geometry::SplineBase::getCoordinatesStride ( ) const
inline

◆ getCurvature()

double base::geometry::SplineBase::getCurvature ( double  _param) const

Returns the curvature at the given position

Exceptions
out_of_rangeif _param is not in [start_param, end_param] and runtime_error if SISL returns an error

◆ getCurvatureMax()

double base::geometry::SplineBase::getCurvatureMax ( )

Returns the maximum curvature of the curve

◆ getCurveLength() [1/3]

double base::geometry::SplineBase::getCurveLength ( double  relative_resolution = 0.01) const

Returns the length of the curve in geometric space

Parameters
relative_errorthe acceptable error on the final result w.r.t. the real curve length

◆ getCurveLength() [2/3]

double base::geometry::SplineBase::getCurveLength ( double  startParam,
double  relative_resolution 
) const

◆ getCurveLength() [3/3]

double base::geometry::SplineBase::getCurveLength ( double  startParam,
double  endParam,
double  relative_resolution 
) const

◆ getCurveOrder()

int base::geometry::SplineBase::getCurveOrder ( ) const
inline

Returns the order of the curve

◆ getDimension()

int base::geometry::SplineBase::getDimension ( ) const
inline

Returns the dimension of the space in which the curve lies

◆ getEndParam()

double base::geometry::SplineBase::getEndParam ( ) const
inline

◆ getFrenetFrame()

Matrix3d base::geometry::SplineBase::getFrenetFrame ( double  _param)
protected

available only in Spline<3>

◆ getGeometricResolution()

double base::geometry::SplineBase::getGeometricResolution ( ) const
inline

◆ getHeading()

double base::geometry::SplineBase::getHeading ( double  _param)
protected

available only in Spline<3>

◆ getKnots()

std::vector< double > base::geometry::SplineBase::getKnots ( ) const

◆ getPoint()

void base::geometry::SplineBase::getPoint ( double *  result,
double  _param 
) const
protected

◆ getPointAndTangent()

void base::geometry::SplineBase::getPointAndTangent ( double *  result,
double  _param 
) const
protected

◆ getPointAndTangentHelper()

void base::geometry::SplineBase::getPointAndTangentHelper ( double *  result,
double  _param,
bool  with_tangent 
) const
protected

◆ getPointCount()

int base::geometry::SplineBase::getPointCount ( ) const

Returns the number of points for this curve

◆ getResultClosestToGuess()

double base::geometry::SplineBase::getResultClosestToGuess ( double  _guess,
std::vector< double >  points,
std::vector< std::pair< double, double > >  curves 
) const
protected

Helper function for findOneClosestPoint and findOneLineIntersection. It returns the parameter in points and/or curves that is the closest to the given guess

The caller is in charge of making sure that at least one of points or curves is not empty

◆ getSISLCurve() [1/2]

SISLCurve const * base::geometry::SplineBase::getSISLCurve ( ) const

Return a pointer to the underlying SISL structure

This pointer will be non-NULL only after interpolate() has been called at least once.

◆ getSISLCurve() [2/2]

SISLCurve * base::geometry::SplineBase::getSISLCurve ( )

Return a pointer to the underlying SISL structure

This pointer will be non-NULL only after interpolate() has been called at least once.

◆ getSISLCurveType()

int base::geometry::SplineBase::getSISLCurveType ( ) const

◆ getStartParam()

double base::geometry::SplineBase::getStartParam ( ) const
inline

◆ getSubSpline()

SplineBase * base::geometry::SplineBase::getSubSpline ( double  start_t,
double  end_t 
) const

Returns a new curve, that represents the spline between start_t and end_t

◆ getVariationOfCurvature()

double base::geometry::SplineBase::getVariationOfCurvature ( double  _param)

Returns the first order derivative of the curvature at the given position

Exceptions
out_of_rangeif _param is not in [start_param, end_param] and runtime_error if SISL returns an error

◆ headingError()

double base::geometry::SplineBase::headingError ( double  _actHeading,
double  _param 
)
protected

available only in Spline<3>

◆ interpolate() [1/2]

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

Generates the curve

If the parameters array is given, it is the desired parameter for the provided points. Otherwise, an automatic parametrization is generated.

Parameters
coordinates- list of points/derivatives
parameters- list of parameters. Needs to be the same size as the number of actual points in the coordinates list, or zero.
coord_types- needs to be of the same size as coordinates, or zero. It marks the type of coordinate/derivative given by the coordinates param.

◆ interpolate() [2/2]

void base::geometry::SplineBase::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 >() 
)

◆ isEmpty()

bool base::geometry::SplineBase::isEmpty ( ) const
inline

Returns true if the curve is not yet initialized

◆ isNURBS()

bool base::geometry::SplineBase::isNURBS ( ) const

◆ isSingleton()

bool base::geometry::SplineBase::isSingleton ( ) const
inline

Returns true if the curve is a point

◆ join()

double base::geometry::SplineBase::join ( SplineBase const &  other,
double  tolerance,
bool  with_tangents 
)

Joins this and other

Unlike append, if the distance between this's end point and other's start point is greater than tolerance, the method computes an intermediate curve that smoothly joins this and other.

It retusn the parameter offset by which the parameters in other have been translated. I.e. if

offset = curve.join(other, tol, true);

Then other.get(t) == curve.get(t + offset)

◆ localClosestPointSearch()

double base::geometry::SplineBase::localClosestPointSearch ( double const *  ref_point,
double  _guess,
double  _start,
double  _end,
double  _geores 
) const
protected

◆ operator=()

SplineBase const & base::geometry::SplineBase::operator= ( SplineBase const &  base)

◆ poseError() [1/2]

Vector3d base::geometry::SplineBase::poseError ( base::Vector3d  _pt,
double  _actZRot,
double  _st_para 
)
protected

available only in Spline<3>

◆ poseError() [2/2]

Vector3d base::geometry::SplineBase::poseError ( base::Vector3d  _pt,
double  _actZRot,
double  _st_para,
double  minParam 
)
protected

available only in Spline<3>

◆ printCurveProperties()

void base::geometry::SplineBase::printCurveProperties ( std::ostream &  io)

Display the curve properties on the given IO object

◆ reset() [1/2]

void base::geometry::SplineBase::reset ( std::vector< double > const &  coordinates,
std::vector< double > const &  knots,
int  kind = -1 
)

Replaces the current internal SISLCurve by a new one that contains the given information

The semantic of the three parameters is internal to SISL

◆ reset() [2/2]

void base::geometry::SplineBase::reset ( SISLCurve *  curve)
protected

Replaces the current internal SISLCurve by the provided one. The SplineBase object takes ownership of the given curve.

Is is used in mutating methods that need to create a new curve: i.e. create a new curve, do SISL operation, replace current curve by new curve by calling reset(new_curve)

◆ reverse()

void base::geometry::SplineBase::reverse ( )

Reverses the direction of the curve

◆ setCurveOrder()

void base::geometry::SplineBase::setCurveOrder ( int  value)
inline

Change the curve order. This is only propagated after interpolate() is called

◆ setGeometricResolution()

void base::geometry::SplineBase::setGeometricResolution ( double  _geores)
inline

Changes the default geometric resolution

◆ setSingleton()

void base::geometry::SplineBase::setSingleton ( double const *  coordinates)

◆ simplify() [1/2]

vector< double > base::geometry::SplineBase::simplify ( )

◆ simplify() [2/2]

vector< double > base::geometry::SplineBase::simplify ( double  tolerance)

◆ split()

void base::geometry::SplineBase::split ( SplineBase second_part,
double  parameter 
)

Splits this curve in two parts, at the specified parameter

this is the first part of the new pair. second_part is filled with the second part

◆ testIntersection()

bool base::geometry::SplineBase::testIntersection ( SplineBase const &  other,
double  resolution = 0.01 
) const

Tests for intersection between two curves


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