Esempio n. 1
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 13JUN2009  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////
        private Crossings GetCrossings(int xlo, int ylo,
                                       int xhi, int yhi)
        {
            Crossings cross = new Crossings.EvenOdd(xlo, ylo, xhi, yhi);
            int       lastx = Xpoints[NumOfPoints - 1];
            int       lasty = Ypoints[NumOfPoints - 1];
            int       curx, cury;

            // Walk the edges of the polygon
            for (int i = 0; i < NumOfPoints; i++)
            {
                curx = Xpoints[i];
                cury = Ypoints[i];
                if (cross.AccumulateLine(lastx, lasty, curx, cury))
                {
                    return(null);
                }
                lastx = curx;
                lasty = cury;
            }

            return(cross);
        }
Esempio n. 2
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 13JUN2009  James Shen                 	          Initial Creation
        ////////////////////////////////////////////////////////////////////////////
        private Crossings GetCrossings(int xlo, int ylo,
                int xhi, int yhi)
        {
            Crossings cross = new Crossings.EvenOdd(xlo, ylo, xhi, yhi);
            int lastx = Xpoints[NumOfNpoints - 1];
            int lasty = Ypoints[NumOfNpoints - 1];
            int curx, cury;

            // Walk the edges of the polygon
            for (int i = 0; i < NumOfNpoints; i++)
            {
                curx = Xpoints[i];
                cury = Ypoints[i];
                if (cross.AccumulateLine(lastx, lasty, curx, cury))
                {
                    return null;
                }
                lastx = curx;
                lasty = cury;
            }

            return cross;
        }