The candidates, for example the curves near the cursor. Required. In model.
pPoint2
The query point, for example the cursor in model units. Required. In model.
Returns
Ok with { index, point, t, distance }: the index into curves of the nearest one and its closest point, as Curve2.closestPoint gives it.
Errors
Returned when kernel2d is not registered, or is older than 0.18.0 (checked before the arguments).
The action is not available in the current context. Satisfy measured.requires first (e.g. create a node before editing one), or load the module measured.capability names (e.g. loadGeometryKernel() for kernel3d).
Returned when a curve has an unknown kind, a number that is not finite or outside kernel2d’s range (0, or 1e-100 ≤ |x| ≤ 1e150), or is degenerate (a zero-length segment; an arc with equal ends, its start at its centre, or its end off the circle through its start by more than the call’s tolerance (networkFaces) or 1e-9 of the radius; a radius that is not positive); paramPath names it as curves[i].
An argument is not valid geometry for this operation (non-finite, wrong shape or out of range). Check the argument named by paramPath against the operation’s documented parameters.
Returned when curves is empty, or p has a coordinate that is not finite or outside kernel2d’s range; paramPath is curves or p.
An argument is not valid geometry for this operation (non-finite, wrong shape or out of range). Check the argument named by paramPath against the operation’s documented parameters.
Returned when more than 65,536 curves; paramPath names the first one past the cap.
The call ran past its time budget and was stopped between nodes. Raise budgetMs, or simplify the graph.
Guarantees
distance is the smallest Curve2.closestPoint distance over curves, and ties go to the lowest index