Project Chrono: chrono::ChBezierCurveTracker Class Reference

Public Member Functions | List of all members
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)
| Create a tracker associated with the specified Bezier curve.
| ~ChBezierCurveTracker ()
| Destructor for ChBezierCurveTracker.
void | Reset (const ChVector3d &loc)
| Reset the tracker at the specified location.
int | CalcClosestPoint (const ChVector3d &loc, ChVector3d &point)
| Calculate the closest point on the underlying curve to the specified location.
int | CalcClosestPoint (const ChVector3d &loc, ChFrame<> &tnb, double &curvature)
| Calculate the closest point on the underlying curve to the specified location.

## Member Function Documentation

## ◆ CalcClosestPoint() [1/2]

int chrono::ChBezierCurveTracker::CalcClosestPoint | ( | const ChVector3d & | loc,
|  | ChFrame<> & | tnb,
|  | double & | curvature )

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

Return the TNB (tangent-normal-binormal) frame and the curvature at the closest point. The ChFrame 'tnb' has X axis along the tangent, Y axis along the normal, and Z axis along the binormal. The frame location is the closest point on the Bezier curve. Note that the normal and binormal are not defined at points with zero curvature. In such cases, we return an orthonormal frame with X axis along the tangent.

## ◆ CalcClosestPoint() [2/2]

int chrono::ChBezierCurveTracker::CalcClosestPoint | ( | const ChVector3d & | loc,
|  | ChVector3d & | 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.

## ◆ Reset()

void chrono::ChBezierCurveTracker::Reset | ( | const ChVector3d & | 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.

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

- D:/W/B/src/chrono-9.0.1/src/chrono/core/ChBezierCurve.h
- D:/W/B/src/chrono-9.0.1/src/chrono/core/ChBezierCurve.cpp