PlanarClosedCurveRelationship behave differently from V5 to V6

I have a plugin written for V5 and now converting to V6. One of the function that I find different is the PlanarClosedCurveRelationship is different.

I call the function with 0 tolerance with no issue in version 5, but in V6, it always return false.

Curve.PlanarClosedCurveRelationship(closedCurve, polyCurve, Plane.WorldXY, 0) Or is it because my curve that is being tested is a polycurve that causes the issue?

Hi @TobyLai,

Can you provide some code and geoemtry that repeats the problem?

Thanks,

– Dale

Hi Dale,

Here is a sample code that I extract from my plugins. Basically if this code execute in Rhino 5, the result will be true, but in Rhino 6, the tolerance has to be non zero in order to get it to return true. It is not a big deal, just want to confirm that the tolerance is important in this situation.

         point3dList.Add(new Point3d(0, 0, 0));
         point3dList.Add(new Point3d(400,0,0));
         point3dList.Add(new Point3d(400,400,0));
         point3dList.Add(new Point3d(0,400,0));
         point3dList.Add(new Point3d(0,0, 0));

         PolylineCurve polyLineCurve = new PolylineCurve(point3dList);
         RhinoDoc.ActiveDoc.Objects.Add(polyLineCurve);


         Point3d pointQ = new Point3d(100, 100, 0);
         

         double yMin = pointQ.Y - (Math.Sqrt(3) * X / 2) / 3 ;
         double yMax = pointQ.Y + (Math.Sqrt(3) * X) / 3;
         double xMin = pointQ.X - X / 2 ;
         double xMax = pointQ.X + X / 2 ;

         Line bottom = new Line(xMax, yMin, 0, xMin, yMin, 0);
         Line left = new Line(xMin, yMin, 0, pointQ.X, yMax, 0);
         Line right = new Line(pointQ.X, yMax, 0, xMax, yMin, 0);
         PolyCurve polyCurve = new PolyCurve();
         polyCurve.Append(bottom);
         polyCurve.Append(left);
         polyCurve.Append(right);

         RhinoDoc.ActiveDoc.Objects.Add(polyCurve);

         if (Curve.PlanarClosedCurveRelationship(polyLineCurve, polyCurve, Plane.WorldXY, 0) == RegionContainment.BInsideA)
         {
            return true;
         }

         else
         { 
            return false;
         }

Hi @TobyLai,

Can you provide complete code - code that runs?

Thanks,

– Dale

Thanks for helping, It is hard to share my code as that particular function is called from another code that has few thousands lines.

I have decided to put a non zero tolerance into the function, but the code in Rhino 5 works with 0. That is all.

Curve.PlanarClosedCurveRelationship(polyLineCurve, polyCurve, Plane.WorldXY, 0.0001)