Clockwise or counter clockwise orientation error

Hi guys
I have a problem with this curve.
I want to get a clockwise closed curve from this one

And I use the following code:

if (curvaCerrada.ClosedCurveOrientation(Plane.WorldXY) == CurveOrientation.CounterClockwise)
{
       curvaCerrada.Reverse();
}

But, curvaCerrada.ClosedCurveOrientation(Plane.WorldXY) returns the curve is clockwise.

cuadradoAntiHorario.3dm (13.9 KB)

Someone can help me?

Thanks in advance

PD: All code is below

`
            protected override Result RunCommand(RhinoDoc doc, RunMode mode)
            {

                ObjRef crvRef;
                Result res = RhinoGet.GetOneObject("Select closed curve", false, ObjectType.Curve, out crvRef);
                if (res != Result.Success)
                    return res;
                var curvaCerrada = crvRef.Curve();

                OrientarHoraria(ref curvaCerrada);
               
                return Result.Success;
            }

            public static void OrientarHoraria(ref Curve curvaCerrada)
            {
                if (curvaCerrada.IsClosed)
                {
                    //Ponemos la orientacion como toca
                    if (curvaCerrada.ClosedCurveOrientation(Plane.WorldXY) == CurveOrientation.CounterClockwise)
                    {
                        curvaCerrada.Reverse();
                    }
                }
                else
                {
                    throw new Exception("OrientarHoraria: La curva a orientar no esta cerrada");
                }
            }`

Hi Miguel,

There are some bugs in this function, which will be fixed in V6.

http://mcneel.myjetbrains.com/youtrack/issue/RH-32952

– D

Ok Dale,

Thanks

Hi @dale,

Can you please confirm that neither of Curve.ClosedCurveOrientation three overloads is safe to be used in Rhino 5? That is: regardless of which overload is chosen, it is not safe to use either of those three even in the latest Rhino 5 SR13?

Or is does the bug on Rhino5 only exist with the Curve.ClosedCurveOrientation(Plane) one?

Hi Djordje,

All overloads were modified in some way…

Have you tried calling this function in the Rhino WIP?

– Dale

Hi Dale, I haven’t tried calling them in Rhino WIP.

If I understood the upper track link, the issues with Curve.ClosedCurveOrientation functions have been fixed, but only in Rhino WIP (upper link states: “Release target: 6.0”)?

Does that mean that they are not safe to be used in Rhino 5 (including the latest Service Release 13) as the issue that the author of this topic reported is not/will not be fixed in Rhino 5?