Planar Curve

Hi,
planarCurve.3dm (228.1 KB)
Attached curve is planar, with rhinocommand i can make it planarsurface. But with the below code, I get planarity as “false”. I need plane of this curve.

            var go = new GetObject();
            go.SetCommandPrompt("Select objects");
            go.AcceptNothing(true);
            go.GeometryFilter = ObjectType.Curve;
            GetResult res = go.GetMultiple(1, 0);
            if (go.CommandResult() != Rhino.Commands.Result.Success)
            {
                return go.CommandResult();
            }
            MessageBox.Show(go.Objects()[0].Curve().IsPlanar().ToString());

What may be wrong?

Thanks,

I am dealing with the same issue, just planarizing quads.

This has something to do with tolerances.

If I use tolerance 0.01 I can create planar boundary surfaces, but when I use 0.0001 I cannot.

I reality they are both not planar, but on first case the deviation from planar is around 0.01 unit, so rhino assumes it is planar and creates surface. I am wondering if there is even such thing as planar if considering floating point errors, as points will often deviate at least 0.0000000x from each other in all cases.

So you have consider two things units you are working and tolerance.
So if you are using for instance units as meters, you can question if 0.001 unit tolerance which is 1 mm is good for you?

Also function IsPlanar() has overload for specifying the tolerance IsPlanar(0.0001), check under which tolerance it is planar and at which not. And if this tolerance is good for you.

Planarity has nothing to do with real life issue of being planar, it is how computer works, even rotation, move operaitons can make your curve not planar…

Hi Petras,

I didnt know it had overload, it worked for me now. 0.01 tolerance will be enough for me.

Thank you very much,

In lieu of making a new post about this…

I’ve noticed that, given a Planar Curve (according to GH), using Curve.TryGetPlane(out plane) seems to return false. When I pass it the ModelAbsoluteTolerance, it returns true (Curve.TryGetPlane(out plane, Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance)).

I would assume that, without the second tolerance parameter, RhinoCommon would use the document tolerance, but it seems that this is not the case…

Is this a bug? Or is the TryGetPlane() tolerance set to some very low constant?

Hi @tom_svilans,

Without a specified tolerance, the function uses the tolerance returned by RhinoMath.ZeroTolerance, or 1.0e-12.

– Dale

Gotcha. Thanks!