Overlap domain


I have a Polyline that has two line segments that overlap each other:
Example.3dm (31.8 KB)

I need the domain between these two overlapping segments:

import rhinoscriptsyntax as rs
curve = rs.GetObject(“Get Curve”, rs.filter.curve)
point = rs.GetPointOnCurve(curve, “Pick a test point”)
domain = rs.CurveDomain(curve)
cutpoint = rs.CurveClosestPoint( curve, point,0 );
print domain
print cutpoint

In this case the returns domain is always from the top line, and I also need the bottom line domain, how can I choose which domain to return?

Top curve or bottom curve?
Domain closer to the start point, or closer to the end point??

Any idea?

You could maybe check for self intersection and evaluate the start and end intersect parameters…

import rhinoscriptsyntax as rs

curve = rs.GetObject("Get Curve", rs.filter.curve)
# if only one curve is supplied as an argument, it checks for self intersections...
if insec and len(insec)==2:
    print "Olap domain start={} | Olap domain end={}".format(dom_start,dom_end)
    print "Curve does not self-intersect"

Thanks @Helvetosaur,

I can’t see how it can help me, intersection give me the start/end intersection domains, this curve actually has 4 intersection domains.

I don’t understand your idea.


Perhaps it’s me that’s not understanding your idea… What are you trying to do once you have the overlap points?

I already solved it in another way, but it’s good to try a way to do this in overlapping curves.

i’m trying to fillet the first and last vertice:


I try get the domain for trim the curve, and EX: I get the CurveEndPoint and find the curve
domain for trim.

The problem is on overlapping curves, the domain is all the same.

Did I explain?

Is that like a 2D CAM toolpath with an approach path and a radius entry/exit?

I can see the problem using the typical fillet tools, which require getting the trim parameters. I wonder if this - which doesn’t depend on parameters - might work better:


As a radical solution could be to split the rectangle away from the overlap area - say at the upper right and lower right corners - then you will have two separate curves. Do your filleting on each and join all back together afterward.

Hello @Helvetosaur,

Yes is correct.

At this point I solved with a radical solution, exploded the curve, making fillet and then putting everything join together, a little more work but it works.