Point in curve

What is the function in rhinocommon to test if point is in a curve?

I tried this one, but polyline function return always false, and only true when the point is on top of polyline point and false when inside closed polyline.
There is no way check this function for polylines?

private void RunScript(Point3d x, Polyline y, ref object A)
{
A = y.Contains(x);
B = y.ToPolylineCurve().Contains(x);
}

Is there also any function to find closest point on polyline or polyline first has to be converted to curve?

Thank you ,
Petras

There is this one
http://developer.rhino3d.com/wip/api/RhinoCommonWin/html/M_Rhino_Geometry_Polyline_ClosestPoint.htm

Nice, I thought it will return closest point of polyline corners, but id does what I need.

Do you now if there is a method for testing if point is inside closed polyline without converting polyline to curve or polylineCurve?

One solution I know is to make a half infinite line going from the point to test, you get the number of intersections
if uneven => inside,
if even => inside

Some work to treat particular case, but must be effective.
http://paulbourke.net/geometry/polygonmesh/InsidePolygon.txt
http://erich.realtimerendering.com/ptinpoly/

Hi @Petras_Vestartas,

You might consider using Curve.Contains.

– Dale

Hi @dale,

Is there a similar way to check whether a point is in a curve using rhino3dm py?

Hi @keshavanarayan82,

No, sorry. This is not a function found in openNURBS, which is what Rhino3dm is based off of.

– Dale