searchForClosestPoint Method

Search the range tree for closest point(s) to spacePoint.

searchForClosestPoint(spacePoint: Readonly<WritableXAndY> | Readonly<WritableXYAndZ>, maxDist?: number): undefined | CurveLocationDetail | CurveLocationDetail[]

@returns closest point detail(s) with following fields set:

  • detail.point = the closest point
  • detail.fraction = the index of the closest point in the points array
  • detail.a = distance from spacePoint to closest point
Parameter Type Description
spacePoint Readonly<WritableXAndY> | Readonly<WritableXYAndZ> point to test
maxDist number collect points at no more than this distance from spacePoint. If undefined, return only the closest point.

Returns - undefined | CurveLocationDetail | CurveLocationDetail[]

closest point detail(s) with following fields set:

  • detail.point = the closest point
  • detail.fraction = the index of the closest point in the points array
  • detail.a = distance from spacePoint to closest point

Defined in

Last Updated: 24 October, 2025