Example #1
0
 public void SetOrientation(TPPLOrder orientation)
 {
     if (GetOrientation() != orientation)
     {
         Invert();
     }
 }
Example #2
0
        public TPPLOrder GetOrientation()
        {
            TPPLOrder ret = TPPLOrder.Unknown;

            if (Points != null)
            {
                int        i1, i2;
                tppl_float area = 0;

                for (i1 = 0; i1 < Points.Count; i1++)
                {
                    i2 = i1 + 1;

                    if (i2 == Points.Count)
                    {
                        i2 = 0;
                    }

                    area += Points[i1].X * Points[i2].Y - Points[i1].Y * Points[i2].X;
                }

                if (area > 0)
                {
                    return(TPPLOrder.CCW);
                }
                else if (area < 0)
                {
                    return(TPPLOrder.CW);
                }
            }

            return(ret);
        }