chrono::ChBezierCurveTracker Class Reference

## Description

Definition of a tracker on a ChBezierCurve path.

This utility class implements a tracker for a given path. It uses time coherence in order to provide an appropriate initial guess for the iterative (Newton) root finder.

#include <ChBezierCurve.h>

## Public Member Functions

ChBezierCurveTracker (std::shared_ptr< ChBezierCurve > path, bool isClosedPath=false)
Create a tracker associated with the specified Bezier curve.

~ChBezierCurveTracker ()
Destructor for ChBezierCurveTracker.

void reset (const ChVector<> &loc)
Reset the tracker at the specified location. More...

int calcClosestPoint (const ChVector<> &loc, ChVector<> &point)
Calculate the closest point on the underlying curve to the specified location. More...

void setIsClosedPath (bool isClosedPath)
Set if the path is treated as an open loop or a closed loop for tracking.

## Member Function Documentation

 int chrono::ChBezierCurveTracker::calcClosestPoint ( const ChVector<> & loc, ChVector<> & point )

Calculate the closest point on the underlying curve to the specified location.

This function returns the closest point on the underlying path to the specified location. The return value is -1 if this point coincides with the first point of the path, +1 if it coincides with the last point of the path, and 0 otherwise. Note that, in order to provide a reasonable initial guess for the Newton iteration, we use time coherence (by keeping track of the path interval and curve parameter within that interval from the last query). As such, this function should be called with a continuous sequence of locations.

 void chrono::ChBezierCurveTracker::reset ( const ChVector<> & loc )

Reset the tracker at the specified location.

This function reinitializes the pathTracker at the specified location. It calculates an appropriate initial guess for the curve segment and sets the curve parameter to 0.5.