# referencePathFrenet

Smooth reference path fit to waypoints

## Description

The `referencePathFrenet`

object fits a smooth, piecewise,
continuous curve to a set of waypoints given as `[x y]`

or ```
[x y
theta]
```

. After fitting, points along the curve, the path points are expressed as
`[x y theta kappa dkappa s]`

, where:

`x`

`y`

and`theta`

— SE(2) state expressed in global coordinates, with`x`

and`y`

in meters and`theta`

in radians`kappa`

— Curvature, or inverse of the radius, in meters`dkappa`

— Derivative of curvature with respect to arc length in meters per second`s`

— Arc length, or distance along path from path origin, in meters

Using this object, convert trajectories between global and Frenet coordinate systems, interpolate states along the path based on arc length, and query the closest point on a path from a global state.

The object expresses Frenet states as a vector of form ```
[S dS ddS L dL
ddL]
```

, where `S`

is the arc length and `L`

is the
perpendicular deviation from the direction of the reference path. Derivatives of
`S`

are relative to time. Derivatives of `L`

are relative
to the arc length, `S`

.

## Creation

### Syntax

### Description

`refPathObj = referencePathFrenet(`

fits a piecewise, continuous set of curves to the specified waypoints. The
`waypoints`

)`waypoints`

argument sets the `Waypoints`

property.

`refPathObj = referencePathFrenet(`

fits a piecewise, continuous set of curves to waypoints using the specified distance
between interpolated path points. The `waypoints`

,'DiscretizationDistance',discretionDist)`discretionDist`

argument sets
the `DiscretizationDistance`

property.

## Properties

## Object Functions

`closestPoint` | Find closest point on reference path to global point |

`closestPointsToSequence` | Projects sequence of points onto path |

`closestProjections` | Find orthogonal projections between path tangent vector and query point |

`curvature` | Return curvature at arclength |

`changeInCurvature` | Return change-in-curvature at arclength |

`frenet2global` | Convert Frenet states to global states |

`global2frenet` | Convert global states to Frenet states |

`interpolate` | Interpolate reference path at provided arc lengths |

`position` | Return xy-position at arclength |

`tangentAngle` | Return tangent angle at arclength |

`show` | Display reference path in figure |

## Examples

## Extended Capabilities

## Version History

**Introduced in R2020b**