# Overlap domain

Hello,

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...
insec=rs.CurveCurveIntersection(curve)
if insec and len(insec)==2:
dom_start=min(insec[0][5],insec[1][5])
dom_end=max(insec[0][5],insec[1][5])
print "Olap domain start={} | Olap domain end={}".format(dom_start,dom_end)
#check
else:
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.

Thanks

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.

Basically:
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:

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Curve_CreateFilletCurves.htm

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.

Thanks