offsetPointAt method

Vector2 offsetPointAt(
  1. double t,
  2. double distance, {
  3. List<Vector2>? cachedFirstOrderDerivativePoints,
})

Returns the point distance units away in the clockwise direction from the point along the curve at parameter value t.

See derivativeAt for information about the optional parameter cachedFirstOrderDerivativePoints.

Implementation

Vector2 offsetPointAt(double t, double distance,
    {List<Vector2>? cachedFirstOrderDerivativePoints}) {
  final offsetPoint = pointAt(t);
  final normalVector = normalAt(t,
      cachedFirstOrderDerivativePoints: cachedFirstOrderDerivativePoints);

  offsetPoint.addScaled(normalVector, distance);

  return offsetPoint;
}