Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8553

Clockwise or counter clockwise orientation error

$
0
0

@mprades wrote:

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");
                }
            }`

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 8553

Trending Articles