Go::SplineInterpolator Class Reference
['geometry' - a spline library]

An Interpolator that generates a spline curve interpolating the given dataset. More...

#include <SplineInterpolator.h>

Inheritance diagram for Go::SplineInterpolator:

Go::Interpolator List of all members.

Public Types

enum  CondType
 CondType Enumerator specifying possible boundary conditions. More...

Public Member Functions

 SplineInterpolator ()
 Constructor takes no arguments.
virtual ~SplineInterpolator ()
 Virtual destructor ensures safe inheritance.
virtual const BsplineBasisbasis ()
 after the function interpolate() has been successfully run, this function can be called to get the BsplineBasis of the generated curve.
void interpolate (const std::vector< double > &params, const std::vector< double > &points, const std::vector< int > &tangent_index, const std::vector< double > &tangent_points, int order, std::vector< double > &coefs)
 This interpolating function also takes user-specified tangent information into account, but does not rely on the previously specified end conditions.
void interpolate (const std::vector< double > &params, const std::vector< double > &points, const std::vector< int > &tangent_index, const std::vector< double > &tangent_points, std::vector< double > &coefs)
 Does the same as the interpolate() function above, but expects the basis to have been specified in advance (by makeBasis() or setBasis()).
virtual void interpolate (int num_points, int dimension, const double *param_start, const double *data_start, std::vector< double > &coefs)
 The interpolating function, as inherited by Interpolator.
void setHermiteConditions (const Point &start_tangent, const Point &end_tangent)
 Set the endpoint conditions to 'Hermite'; impose tangents at start and end of curve.
void setNaturalConditions ()
 Set the endpoint conditions to 'Natural'; zero curvature at start and end of curve.
void setNaturalStartCondition ()
 Set the endpoint condition at start of curve to 'Natural'.
void setNaturalEndCondition ()
 Set the endpoint condition at end of curve to 'Natural'.
void setFreeConditions ()
 Set the endpoint conditions to 'Free' (meaning no conditions at all).
void setEndTangents (boost::shared_ptr< Point > &start_tangent, boost::shared_ptr< Point > &end_tangent)
 Specify tangents for endpoints of curve.
CondType getCondType ()
 Query the type of endpoint conditions currenltly specified.
void makeBasis (const std::vector< double > &params, const std::vector< int > &tangent_index, int order)
 Given a set of interpolation conditions (currently position and tangent information) and order, specify a fitting BsplineBasis (stored internally).
void setBasis (BsplineBasis &basis)
 Specify a user-defined BpslineBasis to be used for interpolation.

Detailed Description

An Interpolator that generates a spline curve interpolating the given dataset.

Definition at line 52 of file SplineInterpolator.h.


Member Enumeration Documentation

enum Go::SplineInterpolator::CondType

CondType Enumerator specifying possible boundary conditions.

    /// None           boundary conditions have not been specified yet. This will lead 
    ///                to an error if the virtual interpolate() function is called. (The
    ///                other two interpolate() functions do not care about end conditions.
    /// Hermite        The tangents are imposed at the start and end of the curve.
    /// Natural        No imposed tangents, but curvature is imposed to be zero at the
    ///                start and end of the curve.
    /// Free           No imposed conditions, neither at start nor end of curve.
    /// NaturalAtStart Curvature imposed to be zero at start of curve.  End of curve
    ///                will either have no conditions at all, or have an imposed
    ///                tangent (depending on whether the  latter has been specified or not.
    /// NaturalAtEnd   Curvature imposed to be zero at end of curve.  Start of curve
    ///                will either have no conditions, or have an imposed tangent
    ///                (depending on whether the latter has been specified or not).
    /// 

Definition at line 137 of file SplineInterpolator.h.


Member Function Documentation

virtual const BsplineBasis& Go::SplineInterpolator::basis (  )  [virtual]

after the function interpolate() has been successfully run, this function can be called to get the BsplineBasis of the generated curve.

Returns:
a constant reference to the BsplineBasis of the curve previously generated by interpolate().

Implements Go::Interpolator.

Referenced by setBasis().

void Go::SplineInterpolator::interpolate ( const std::vector< double > &  params,
const std::vector< double > &  points,
const std::vector< int > &  tangent_index,
const std::vector< double > &  tangent_points,
int  order,
std::vector< double > &  coefs 
)

This interpolating function also takes user-specified tangent information into account, but does not rely on the previously specified end conditions.

It constructs its own basis based on the given parametrization and order, so neither does it care about any basis previously set by the user. It carries out order-1 spline interpolation.

Parameters:
params vector containing the parameters for the data points. Its size is equal to the total number of datapoints.
points vector containing the coordinates of the data points. Its size is equal to the total number of datapoints multiplied with the spatial dimension. (NB: This is how the algorithm deduces the spatial dimension to use: divide the size of 'points' with the size of 'params').
tangent_index a vector containing the indexes of those data points that has tangents associated with them.
tangent_points a vector containing the tangents associated with those data points that are referred to in 'param_index'. Its size is equal to the total number of datapoints that has tangents, multiplied by the dimension of the space.
order the order of the spline basis to generate.
coefs Upon function completion, this vector will hold the coordinates of the control points of the generated spline curve. (Its basis can be obtained by calling the basis() function).

void Go::SplineInterpolator::interpolate ( const std::vector< double > &  params,
const std::vector< double > &  points,
const std::vector< int > &  tangent_index,
const std::vector< double > &  tangent_points,
std::vector< double > &  coefs 
)

Does the same as the interpolate() function above, but expects the basis to have been specified in advance (by makeBasis() or setBasis()).

If the basis is not consistent with the given data set, an exception will be thrown. (The number of point must at least be equal to the basis' order, and the number of basis functions must be equal to the number of points plus the number of tangents). For a description of the parameter list, see interpolate().

virtual void Go::SplineInterpolator::interpolate ( int  num_points,
int  dimension,
const double *  param_start,
const double *  data_start,
std::vector< double > &  coefs 
) [virtual]

The interpolating function, as inherited by Interpolator.

Does cubic spline interpolation of points (does not care about tangents). It constructs its own basis based on the given parametrization, so it does not care about any basis previously set by the user. Previously specified end conditions will be taken into account. For parameter list, see Interpolator.

Implements Go::Interpolator.

void Go::SplineInterpolator::setHermiteConditions ( const Point start_tangent,
const Point end_tangent 
) [inline]

Set the endpoint conditions to 'Hermite'; impose tangents at start and end of curve.

Note: endpoint conditions are considered by the virtual interpolate() function. The other interpolate functions disregard this setting.

Parameters:
start_tangent the imposed tangent at the start of the curve
end_tangent the imposed tangent at the end of the curve.

Definition at line 144 of file SplineInterpolator.h.

void Go::SplineInterpolator::setNaturalConditions (  )  [inline]

Set the endpoint conditions to 'Natural'; zero curvature at start and end of curve.

Note: endpoint conditions are considered by the virtual interpolate() function. The other interpolate functions disregard this setting.

Definition at line 154 of file SplineInterpolator.h.

void Go::SplineInterpolator::setNaturalStartCondition (  )  [inline]

Set the endpoint condition at start of curve to 'Natural'.

(Condition at end of curve will be 'Hermite' if a tangent has been previously specified, or 'Free' otherwise). Note: endpoint conditions are considered by the virtual interpolate() function. The other interpolate functions disregard this setting.

Definition at line 161 of file SplineInterpolator.h.

void Go::SplineInterpolator::setNaturalEndCondition (  )  [inline]

Set the endpoint condition at end of curve to 'Natural'.

(Condition at start of curve will be 'Hermite' if a tangent has been previously specified, or 'Free' otherwise). Note: endpoint conditions are considered by the virtual interpolate() function. The other interpolate functions disregard this setting.

Definition at line 168 of file SplineInterpolator.h.

void Go::SplineInterpolator::setFreeConditions (  )  [inline]

Set the endpoint conditions to 'Free' (meaning no conditions at all).

Note: endpoint conditions are considered by the virtual interpolate() function. The other interpolate functions disregard this setting.

Definition at line 173 of file SplineInterpolator.h.

void Go::SplineInterpolator::setEndTangents ( boost::shared_ptr< Point > &  start_tangent,
boost::shared_ptr< Point > &  end_tangent 
) [inline]

Specify tangents for endpoints of curve.

One or both of the shared pointers may be zero, which means that the corresponding endpoint condition will be set to 'Natural'; otherwise it will be set to 'Hermite'. Note: endpoint conditions are considered by the virtual interpolate() function. The other interpolate functions disregard this setting.

Definition at line 180 of file SplineInterpolator.h.

CondType Go::SplineInterpolator::getCondType (  )  [inline]

Query the type of endpoint conditions currenltly specified.

Returns:
the currently specified CondType.

Definition at line 197 of file SplineInterpolator.h.

void Go::SplineInterpolator::makeBasis ( const std::vector< double > &  params,
const std::vector< int > &  tangent_index,
int  order 
)

Given a set of interpolation conditions (currently position and tangent information) and order, specify a fitting BsplineBasis (stored internally).

Parameters:
params vector containing the parametrization of the expected datapoints (one parameter per point).
tangent_index vector containing indexes of those datapoints where tangent conditions will be imposed as well.
order Order of the requested BsplineBasis.

void Go::SplineInterpolator::setBasis ( BsplineBasis basis  )  [inline]

Specify a user-defined BpslineBasis to be used for interpolation.

Parameters:
basis the specified basis. NB: it must be suited to the interpolation conditions that are going to be used! If there is no need to end up with a specific basis, makeBasis() is safer.

Definition at line 217 of file SplineInterpolator.h.

References basis().


The documentation for this class was generated from the following file:
Generated on Mon Jun 11 14:48:19 2007 for GoTools Core Library by  doxygen 1.5.1