Splines. More...
#include <gz/math/Spline.hh>
Public Member Functions | |
Spline () | |
constructor More... | |
void | AddPoint (const Vector3d &_p) |
Adds a single control point to the end of the spline. More... | |
void | AddPoint (const Vector3d &_p, const Vector3d &_t) |
Adds a single control point to the end of the spline with fixed tangent. More... | |
double | ArcLength () const |
Gets spline arc length. More... | |
double | ArcLength (const double _t) const |
Sets spline arc length up to a given parameter value _t . More... | |
double | ArcLength (const unsigned int _index, const double _t) const |
Sets a spline segment arc length. More... | |
void | AutoCalculate (bool _autoCalc) |
Tells the spline whether it should automatically calculate tangents on demand as points are added. More... | |
void | Clear () |
Clears all the points in the spline. More... | |
Vector3d | Interpolate (const double _t) const |
Interpolates a point on the spline at parameter value _t . More... | |
Vector3d | Interpolate (const unsigned int _fromIndex, const double _t) const |
Interpolates a point on a segment of the spline at parameter value _t . More... | |
Vector3d | InterpolateMthDerivative (const unsigned int _fromIndex, const unsigned int _mth, const double _s) const |
Interpolates the mth derivative of a segment of the spline at parameter value _t . More... | |
Vector3d | InterpolateMthDerivative (const unsigned int _mth, const double _1) const |
Interpolates the mth derivative of the spline at parameter value _t . More... | |
Vector3d | InterpolateTangent (const double _t) const |
Interpolates a tangent on the spline at parameter value _t . More... | |
Vector3d | InterpolateTangent (const unsigned int _fromIndex, const double _t) const |
Interpolates the tangent on a segment of the spline at parameter value _t . More... | |
Vector3d | MthDerivative (const unsigned int _index, const unsigned int _mth) const |
Gets the mth derivative for one of the control points of the spline. More... | |
Vector3d | Point (const unsigned int _index) const |
Gets the value for one of the control points of the spline. More... | |
size_t | PointCount () const |
Gets the number of control points in the spline. More... | |
void | RecalcTangents () |
Recalculates the tangents associated with this spline. More... | |
Vector3d | Tangent (const unsigned int _index) const |
Gets the tangent value for one of the control points of the spline. More... | |
double | Tension () const |
Gets the tension value. More... | |
void | Tension (double _t) |
Sets the tension parameter. More... | |
bool | UpdatePoint (const unsigned int _index, const Vector3d &_p) |
Updates a single control point value in the spline, keeping its tangent. More... | |
bool | UpdatePoint (const unsigned int _index, const Vector3d &_p, const Vector3d &_t) |
Updates a single control point in the spline, along with its tangent. More... | |
Detailed Description
Splines.
Constructor & Destructor Documentation
◆ Spline()
Spline | ( | ) |
constructor
Member Function Documentation
◆ AddPoint() [1/2]
void AddPoint | ( | const Vector3d & | _p | ) |
Adds a single control point to the end of the spline.
- Parameters
-
[in] _p control point value to add.
◆ AddPoint() [2/2]
Adds a single control point to the end of the spline with fixed tangent.
- Parameters
-
[in] _p control point value to add. [in] _t tangent at _p
.
◆ ArcLength() [1/3]
double ArcLength | ( | ) | const |
Gets spline arc length.
- Returns
- arc length or INF on error.
◆ ArcLength() [2/3]
double ArcLength | ( | const double | _t | ) | const |
Sets spline arc length up to a given parameter value _t
.
- Parameters
-
[in] _t parameter value (range 0 to 1).
- Returns
- arc length up to
_t
or INF on error.
◆ ArcLength() [3/3]
double ArcLength | ( | const unsigned int | _index, |
const double | _t | ||
) | const |
Sets a spline segment arc length.
- Parameters
-
[in] _index of the spline segment. [in] _t parameter value (range 0 to 1).
- Returns
- arc length of a given segment up to
_t
or INF on error.
◆ AutoCalculate()
void AutoCalculate | ( | bool | _autoCalc | ) |
Tells the spline whether it should automatically calculate tangents on demand as points are added.
- Remarks
- The spline calculates tangents at each point automatically based on the input points. Normally it does this every time a point changes. However, if you have a lot of points to add in one go, you probably don't want to incur this overhead and would prefer to defer the calculation until you are finished setting all the points. You can do this by calling this method with a parameter of 'false'. Just remember to manually call the recalcTangents method when you are done.
- Parameters
-
[in] _autoCalc If true, tangents are calculated for you whenever a point changes. If false, you must call RecalcTangents to recalculate them when it best suits.
◆ Clear()
void Clear | ( | ) |
Clears all the points in the spline.
◆ Interpolate() [1/2]
Vector3d Interpolate | ( | const double | _t | ) | const |
Interpolates a point on the spline at parameter value _t
.
- Remarks
- Parameter value is normalized over the whole spline arc length. Arc length is assumed to be linear with the parameter.
- Parameters
-
[in] _t parameter value (range 0 to 1).
- Returns
- the interpolated point, or [INF, INF, INF] on error. Use Vector3d::IsFinite() to check for an error.
◆ Interpolate() [2/2]
Vector3d Interpolate | ( | const unsigned int | _fromIndex, |
const double | _t | ||
) | const |
Interpolates a point on a segment of the spline at parameter value _t
.
- Remarks
- Parameter value is normalized over the segment arc length. Arc length is assumed to be linear with the parameter.
- Parameters
-
[in] _fromIndex The point index to treat as t = 0. fromIndex + 1 is deemed to be t = 1. [in] _t parameter value (range 0 to 1).
- Returns
- the interpolated point, or [INF, INF, INF] on error. Use Vector3d::IsFinite() to check for an error.
◆ InterpolateMthDerivative() [1/2]
Vector3d InterpolateMthDerivative | ( | const unsigned int | _fromIndex, |
const unsigned int | _mth, | ||
const double | _s | ||
) | const |
Interpolates the mth derivative of a segment of the spline at parameter value _t
.
- Remarks
- Parameter value is normalized over the segment arc length. Arc length is assumed to be linear with the parameter.
- Parameters
-
[in] _fromIndex point index to treat as t = 0, fromIndex + 1 is deemed to be t = 1. [in] _mth order of curve derivative to interpolate. [in] _s parameter value (range 0 to 1).
- Returns
- the interpolated mth derivative, or [INF, INF, INF] on error. Use Vector3d::IsFinite() to check for an error.
◆ InterpolateMthDerivative() [2/2]
Vector3d InterpolateMthDerivative | ( | const unsigned int | _mth, |
const double | _1 | ||
) | const |
Interpolates the mth derivative of the spline at parameter value _t
.
- Parameters
-
[in] _mth order of curve derivative to interpolate. [in] _1 parameter value (range 0 to 1).
- Returns
- the interpolated mth derivative, or [INF, INF, INF] on error. Use Vector3d::IsFinite() to check for an error.
◆ InterpolateTangent() [1/2]
Vector3d InterpolateTangent | ( | const double | _t | ) | const |
Interpolates a tangent on the spline at parameter value _t
.
- Remarks
- Parameter value is normalized over the whole spline arc length. Arc length is assumed to be linear with the parameter.
- Parameters
-
[in] _t parameter value (range 0 to 1).
- Returns
- the interpolated point, or [INF, INF, INF] on error. Use Vector3d::IsFinte() to check for an error.
◆ InterpolateTangent() [2/2]
Vector3d InterpolateTangent | ( | const unsigned int | _fromIndex, |
const double | _t | ||
) | const |
Interpolates the tangent on a segment of the spline at parameter value _t
.
- Remarks
- Parameter value is normalized over the segment arc length. Arc length is assumed to be linear with the parameter.
- Parameters
-
[in] _fromIndex the point index to treat as t = 0. fromIndex + 1 is deemed to be t = 1. [in] _t parameter value (range 0 to 1).
- Returns
- the interpolated point, or [INF, INF, INF] on error. Use Vector3d::IsFinte() to check for an error.
◆ MthDerivative()
Vector3d MthDerivative | ( | const unsigned int | _index, |
const unsigned int | _mth | ||
) | const |
Gets the mth derivative for one of the control points of the spline.
- Parameters
-
[in] _index the control point index. [in] _mth derivative order.
- Returns
- the control point mth derivative, or [INF, INF, INF] on error. Use Vector3d::IsFinite() to check for an error.
◆ Point()
Vector3d Point | ( | const unsigned int | _index | ) | const |
Gets the value for one of the control points of the spline.
- Parameters
-
[in] _index the control point index.
- Returns
- the control point value, or [INF, INF, INF] on error. Use Vector3d::IsFinite() to check for an error.
◆ PointCount()
size_t PointCount | ( | ) | const |
Gets the number of control points in the spline.
- Returns
- the count
◆ RecalcTangents()
void RecalcTangents | ( | ) |
Recalculates the tangents associated with this spline.
- Remarks
- If you tell the spline not to update on demand by calling setAutoCalculate(false) then you must call this after completing your updates to the spline points.
◆ Tangent()
Vector3d Tangent | ( | const unsigned int | _index | ) | const |
Gets the tangent value for one of the control points of the spline.
- Parameters
-
[in] _index the control point index.
- Returns
- the control point tangent, or [INF, INF, INF] on error. Use Vector3d::IsFinite() to check for an error.
◆ Tension() [1/2]
double Tension | ( | ) | const |
Gets the tension value.
- Returns
- the value of the tension, which is between 0.0 and 1.0.
◆ Tension() [2/2]
void Tension | ( | double | _t | ) |
Sets the tension parameter.
- Remarks
- A value of 0 results in a Catmull-Rom spline.
- Parameters
-
[in] _t Tension value between 0.0 and 1.0
◆ UpdatePoint() [1/2]
bool UpdatePoint | ( | const unsigned int | _index, |
const Vector3d & | _p | ||
) |
Updates a single control point value in the spline, keeping its tangent.
- Parameters
-
[in] _index the control point index. [in] _p the new control point value.
- Returns
- True on success.
◆ UpdatePoint() [2/2]
Updates a single control point in the spline, along with its tangent.
- Parameters
-
[in] _index the control point index. [in] _p the new control point value. [in] _t the new control point tangent.
- Returns
- True on success.
The documentation for this class was generated from the following file: