SurgSim::Math::CardinalSplines Namespace Reference

## Functions

void | extendControlPoints (const SurgSim::DataStructures::VerticesPlain &points, std::vector< SurgSim::Math::Vector3d > *result)
| Function to add two 'ghost' points to 'points' at the beginning and the end, prepare 'points' for Cardinal Splines interpolation. More...
void | interpolate (size_t subdivisions, const std::vector< Math::Vector3d > &controlPoints, std::vector< Math::Vector3d > *points, double tau=0.4)
| Run Cardinal Splines interpolation on 'controlPoints'. More...

## Function Documentation

## extendControlPoints()

void SurgSim::Math::CardinalSplines::extendControlPoints | ( | const SurgSim::DataStructures::VerticesPlain & | points,
|  | std::vector< SurgSim::Math::Vector3d > * | result
| ) |  |

Function to add two 'ghost' points to 'points' at the beginning and the end, prepare 'points' for Cardinal Splines interpolation.

Parameters

  | points | List of points to be interpolated.
  [out] | result | List of points with two ghost points added, one at the beginning and another at the end of 'points'.

## interpolate()

void SurgSim::Math::CardinalSplines::interpolate | ( | size_t | subdivisions,
|  | const std::vector< Math::Vector3d > & | controlPoints,
|  | std::vector< Math::Vector3d > * | points,
|  | double | tau = `0.4`
| ) |  |

Run Cardinal Splines interpolation on 'controlPoints'.

See https://en.wikipedia.org/wiki/Centripetal_Catmull-Rom_spline https://en.wikipedia.org/wiki/Cubic_Hermite_spline https://people.cs.clemson.edu/~dhouse/courses/405/notes/splines.pdf https://www.cs.utexas.edu/~fussell/courses/cs384g/lectures/lecture16-Interpolating_curves.pdf for more details.

Parameters

  | subdivisions | Number of interpolated points between each pair of control points.
  | controlPoints | List of points to be interpolated.
  [out] | points | List of interpolated points, not including the control points.
  | tau | Defines the tension, affects how sharply the curve bends at the control points.