Tolerance for Line2.Side

Hello, how can I set the tolerance for Grasshopper.Kernel.Geometry.Line2.Side ?

Hi,

What do you want to set the tolerance for?

I would like the Grasshopper.Kernel.Geometry.Line2.Side returned “Coincident” when the distance from the point to the line is less than the specified distance

Can you make your own small function to check this? You can use Line.ClosestPoint Method
And check if that distance is within your tolerance

1 Like

Or even without rhino common like shown here:

1 Like

You can for instance construct a perpendicular frame at the line center, and measure the signed distance from your point to this plane. If the point lies in the positive z-space of the plane a positive distance gets returned, and otherwise a negative one.

2021-02-28 08-28-50.2021-02-28 08_33_16

There really is no left and right without a relation to some other object, like this plane.
If you think about it, in reality you are this object “at the middle” that defines a left and right side in the first place.

import Rhino

t = Curve.Domain.Mid  # parameter at curve center
rv, plane = Curve.PerpendicularFrameAt(t)

signed_dist = plane.DistanceTo(Point)

if signed_dist < 0.0:
    print "Left:", signed_dist
elif signed_dist > 0.0:
    print "Right:", signed_dist
else:
    print "Centered:", signed_dist

# Outputs
a = plane

I’ve defined the positive distance as right and negative as left, but that’s totally up to you and customisable.

left_right.gh (6.7 KB)

1 Like

Thanks.
But unfortunately, this solution does not suit me.
The function “Grasshopper.Kernel.Geometry.Line2.Side” is very fast and it is well suited for multiple checks of the occurrence of a point in a polygon.