Gazebo Math

API Reference

8.0.0
RotationSpline Class Reference

Spline for rotations. More...

#include <gz/math/RotationSpline.hh>

Public Member Functions

 RotationSpline ()
 Constructor. Sets the autoCalc to true.
 
void AddPoint (const Quaterniond &_p)
 Adds a control point to the end of the spline.
 
void AutoCalculate (bool _autoCalc)
 Tells the spline whether it should automatically calculate tangents on demand as points are added.
 
void Clear ()
 Clears all the points in the spline.
 
Quaterniond Interpolate (const unsigned int _fromIndex, const double _t, const bool _useShortestPath=true)
 Interpolates a single segment of the spline given a parametric value.
 
Quaterniond Interpolate (double _t, const bool _useShortestPath=true)
 Returns an interpolated point based on a parametric value over the whole series.
 
const QuaterniondPoint (const unsigned int _index) const
 Gets the detail of one of the control points of the spline.
 
unsigned int PointCount () const
 Gets the number of control points in the spline.
 
void RecalcTangents ()
 Recalculates the tangents associated with this spline.
 
bool UpdatePoint (const unsigned int _index, const Quaterniond &_value)
 Updates a single point in the spline.
 

Detailed Description

Spline for rotations.

Constructor & Destructor Documentation

◆ RotationSpline()

Constructor. Sets the autoCalc to true.

Member Function Documentation

◆ AddPoint()

void AddPoint ( const Quaterniond _p)

Adds a control point to the end of the spline.

Parameters
[in]_pcontrol point

◆ 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]_autoCalcIf true, tangents are calculated for you whenever a point changes. If false, you must call reclacTangents to recalculate them when it best suits.

◆ Clear()

void Clear ( )

Clears all the points in the spline.

◆ Interpolate() [1/2]

Quaterniond Interpolate ( const unsigned int  _fromIndex,
const double  _t,
const bool  _useShortestPath = true 
)

Interpolates a single segment of the spline given a parametric value.

Parameters
[in]_fromIndexThe point index to treat as t = 0. _fromIndex + 1 is deemed to be t = 1
[in]_tParametric value
[in]_useShortestPathDefines if rotation should take the shortest possible path
Returns
the rotation, or [INF, INF, INF, INF] on error. Use Quateriond::IsFinite() to check for an error

◆ Interpolate() [2/2]

Quaterniond Interpolate ( double  _t,
const bool  _useShortestPath = true 
)

Returns an interpolated point based on a parametric value over the whole series.

Remarks
Given a t value between 0 and 1 representing the parametric distance along the whole length of the spline, this method returns an interpolated point.
Parameters
[in]_tParametric value.
[in]_useShortestPathDefines if rotation should take the shortest possible path
Returns
The rotation, or [INF, INF, INF, INF] on error. Use Quateriond::IsFinite() to check for an error

◆ Point()

const Quaterniond & Point ( const unsigned int  _index) const

Gets the detail of one of the control points of the spline.

Parameters
[in]_indexthe index of the control point. _index is clamped to [0, PointCount()-1].
Remarks
This point must already exist in the spline.
Returns
The quaternion at the specified point. If there are no points, then a Quaterniond with a value of [INF, INF, INF, INF] is returned.

◆ PointCount()

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

◆ UpdatePoint()

bool UpdatePoint ( const unsigned int  _index,
const Quaterniond _value 
)

Updates a single point in the spline.

Remarks
This point must already exist in the spline.
Parameters
[in]_indexindex
[in]_valuethe new control point value
Returns
True on success, false if _index is larger or equal than PointCount().

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