base
|
#include <Spline.hpp>
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 ¶meters=std::vector< double >(), std::vector< CoordinateType > const &coord_types=std::vector< CoordinateType >()) |
void | interpolate (std::vector< double > const &coordinates, std::vector< double > ¶meterOut, std::vector< double > const ¶meterIn=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) |
SplineBase * | getSubSpline (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 ¶m, 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... | |
Representation and manipulation of a N-order, 3D NURBS curve
The availability of this class is dependent on the availability of the SISL library
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 |
base::geometry::SplineBase::SplineBase | ( | SplineBase const & | source | ) |
base::geometry::SplineBase::~SplineBase | ( | ) |
|
explicit |
|
explicit |
void base::geometry::SplineBase::append | ( | SplineBase const & | other | ) |
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
|
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.
void base::geometry::SplineBase::clear | ( | ) |
Reinitializes the curve
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
void base::geometry::SplineBase::derive | ( | unsigned int | order, |
SplineBase & | result | ||
) | const |
Returns the i-th derivative of this curve
|
protected |
available only in Spline<3>
|
protected |
|
protected |
|
protected |
Warning, do not use this method, it is broken and returns the wrong result
|
protected |
|
protected |
|
protected |
std::vector< double > base::geometry::SplineBase::getCoordinates | ( | ) | const |
|
inline |
double base::geometry::SplineBase::getCurvature | ( | double | _param | ) | const |
Returns the curvature at the given position
out_of_range | if _param is not in [start_param, end_param] and runtime_error if SISL returns an error |
double base::geometry::SplineBase::getCurvatureMax | ( | ) |
Returns the maximum curvature of the curve
double base::geometry::SplineBase::getCurveLength | ( | double | relative_resolution = 0.01 | ) | const |
Returns the length of the curve in geometric space
relative_error | the acceptable error on the final result w.r.t. the real curve length |
double base::geometry::SplineBase::getCurveLength | ( | double | startParam, |
double | relative_resolution | ||
) | const |
double base::geometry::SplineBase::getCurveLength | ( | double | startParam, |
double | endParam, | ||
double | relative_resolution | ||
) | const |
|
inline |
Returns the order of the curve
|
inline |
Returns the dimension of the space in which the curve lies
|
inline |
|
protected |
available only in Spline<3>
|
inline |
|
protected |
available only in Spline<3>
std::vector< double > base::geometry::SplineBase::getKnots | ( | ) | const |
|
protected |
|
protected |
|
protected |
int base::geometry::SplineBase::getPointCount | ( | ) | const |
Returns the number of points for this curve
|
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
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.
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.
int base::geometry::SplineBase::getSISLCurveType | ( | ) | const |
|
inline |
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
double base::geometry::SplineBase::getVariationOfCurvature | ( | double | _param | ) |
Returns the first order derivative of the curvature at the given position
out_of_range | if _param is not in [start_param, end_param] and runtime_error if SISL returns an error |
|
protected |
available only in Spline<3>
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.
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. |
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 >() |
||
) |
|
inline |
Returns true if the curve is not yet initialized
bool base::geometry::SplineBase::isNURBS | ( | ) | const |
|
inline |
Returns true if the curve is a point
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)
|
protected |
SplineBase const & base::geometry::SplineBase::operator= | ( | SplineBase const & | base | ) |
|
protected |
available only in Spline<3>
|
protected |
available only in Spline<3>
void base::geometry::SplineBase::printCurveProperties | ( | std::ostream & | io | ) |
Display the curve properties on the given IO object
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
|
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)
void base::geometry::SplineBase::reverse | ( | ) |
Reverses the direction of the curve
|
inline |
Change the curve order. This is only propagated after interpolate() is called
|
inline |
Changes the default geometric resolution
void base::geometry::SplineBase::setSingleton | ( | double const * | coordinates | ) |
vector< double > base::geometry::SplineBase::simplify | ( | ) |
vector< double > base::geometry::SplineBase::simplify | ( | double | tolerance | ) |
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
bool base::geometry::SplineBase::testIntersection | ( | SplineBase const & | other, |
double | resolution = 0.01 |
||
) | const |
Tests for intersection between two curves