Returns the parameter of the point on a curve that is closest to a test point.
rhinoscriptsyntax.CurveClosestPoint (curve_id, test_point, segment_index=-1)
rhinoscript.curve.CurveClosestPoint (curve_id, test_point, segment_index=-1)
curve_id |
Required. String of Guid. The object's identifier. |
test_point |
Required. Array. The test, or sampling, point. |
segment_index |
Optional. Number. If curve_id identifies a polycurve object, then segment_index identifies the curve segment of the polycurve to query. |
Number |
The parameter of the closest point on the curve if successful. |
None |
If not successful, or on error. |
import rhinoscriptsyntax as rs
id = rs.GetObject("Select a curve")
if id:
point = rs.GetPointOnCurve(id, "Pick a test point")
if point:
param = rs.CurveClosestPoint(id, point)
print "Curve parameter:", param