Example #1
0
        public bool SelfIntersects()
        {
            int     i;
            int     i1;
            int     j;
            int     j1;
            int     n;
            clsLine l1;
            clsLine l2;

            for (i = 0; i <= NumPoints - 2; i++)
            {
                i1 = i + 1;
                l1 = new clsLine(Point(i), Point(i1));

                n = NumPoints;
                if (i == 0)
                {
                    n = n - 1;
                }
                //Don't need to intersect the first line with the last, because they touch
                for (j = i + 2; j <= n; j++)
                {
                    j1 = j + 1;
                    if (j1 > NumPoints)
                    {
                        j1 = 0;
                    }
                    l2 = new clsLine(Point(j), Point(j1));

                    if (l1.IntersectShortLines(l2) != null)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }