RhinoCommon Intersection question

If there is a case where two objects (say brep and a curve) are just touching how can I make it so the intersection fails? So I can distinguish between touching and crossing (actual intersecting).

Currently what I try is Brep.IsPointInside() and I test the start, the mid and the end points.

But this doesn’t really work because the curve might be crossing but still the end and mid points to be outside and the result is as if the curve is touching at the start point.

perhaps I can evaluate the point of intersection and check if the parameter is 0 or 1 and any other number would mean it is crossing

Oh damn, did I just answer my own question again :smiley:

Depends on what you mean by “just touching”. Most of the intersection methods can return overlaps (i.e. where two geometries are coincident), which will help in some cases. If you’re just concerned with whether the end-points of a curve touches say a Brep, I’d just check the closest distance from the point to the brep.

it means the product of a trim is 1 curve = the original curve

I don’t follow, as always: provide an example file/image :wink:

I was trying to avoid this but here you go:
check-in-out-brep_v2.gh (20.0 KB)

I can’t figure it out. Perhaps eval point on curve could be it but still I don’t know how to do it.

What method can I use to check the parameter of the closest point on curve to a random 3d point?

how do I implement this:

parm = Rhino.Geometry.Curve.ClosestPoint(S,<intersection_point_here>,tol)
norm_parm = Rhino.Geometry.Curve.NormalizedLengthParameter(S,parm,<domain here 0 To 1>)

How do I define a domain 0 To 1 with RhinoCommon?

I soved it:

# B is the brep
# start is the start point of the curve
# end is the end point of the curve
# tol is the tolerance
start_close_check = closest_point(B,start,tol)[0]
end_close_check = closest_point(B,end,tol)[0]
start_point_check = point_check(B,start,tol,True)
end_point_check = point_check(B,end,tol,True)
if start_close_check == True and end_point_check == False or end_close_check == True and start_point_check == False:
print "touching outside"
elif start_close_check == True and end_point_check == True or end_close_check == True and start_point_check == True:
print "touching inside"