But, interseccion.IsOverlap is false, Cleary, as we can see, there are two segments that intersect. I try to put diferent values of tolerances but it not works.
Here is the way I think overlap tolerance for curve/curve intersection works.
First curves are broken up at kinks. So in the example of 2 rectangles we are intersecting a set of 4 lines segments against another set of 4 line segments.
When intersecting a pair of curves without kinks the first step is to find the distance from each curve endpoint to the opposite curve. If there are two endpoints within overlap tolerance we check to see if the intervening curve segment is entirely within overlap tolerance.
After any overlapping segments are removed in step 2 we look for intersections and then test for overlaps between consecutive intersections, using overlap tolerance.
So in conclusion. Just because two segments of curves are within overlap tolerance doesn’t mean they should result in an overlap event. Also, the endpoints of overlap events are always special, either they are curve endpoints, kink points or “true” intersection points.
One thing more. I think that the intersecction.CurveCurve has to return “IsOverlap=True” in this pair of curves: InterseccionOverlapNoFunciona.3dm (18.5 KB)
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
try
{
ObjRef[] crvRef;
Result res = RhinoGet.GetMultipleObjects("Select 2 curves", false, ObjectType.Curve, out crvRef);
if (res != Result.Success)
return res;
List<Curve> curvas = new List<Curve>();
foreach (ObjRef obj in crvRef)
{
curvas.Add((Curve)obj.Geometry());
}
if (curvas.Count != 2)
{
return Result.Failure;
}
var intersecciones = Intersection.CurveCurve(curvas[0], curvas[1], 0.01, 0.01);
foreach (IntersectionEvent interseccion in intersecciones)
{
if (interseccion.IsOverlap == false)
{
MessageBox.Show("No Overlap");
}
else
{
MessageBox.Show("Si Overlap");
}
}