public int NeighborPredicate(int ix, int iy, int circleSize, NeighborPredicateDelegate param1)
        {
            int count  = 0;
            int startx = ix - circleSize;
            int starty = iy - circleSize;
            int endx   = ix + circleSize;
            int endy   = iy + circleSize;

            if (startx < 0)
            {
                startx = 0;
            }
            else if (startx > MaxXPt)
            {
                startx = MaxXPt;
            }
            if (starty < 0)
            {
                starty = 0;
            }
            else if (starty > MaxYPt)
            {
                starty = MaxYPt;
            }
            if (endx < 0)
            {
                endx = 0;
            }
            else if (endx > MaxXPt)
            {
                endx = MaxXPt;
            }
            if (endy < 0)
            {
                endy = 0;
            }
            else if (endy > MaxYPt)
            {
                endy = MaxYPt;
            }
            for (int x = startx; x <= endx; x++)
            {
                for (int y = starty; y <= endy; y++)
                {
                    if (y != iy && x != ix)
                    {
                        if (true)
                        {
                            count += param1(x, y);
                        }
                    }
                }
            }
            return(count);
        }
Beispiel #2
0
 public int NeighborPredicate(int ix, int iy, int circleSize, NeighborPredicateDelegate param1)
 {
     int count = 0;
     int startx = ix - circleSize;
     int starty = iy - circleSize;
     int endx = ix + circleSize;
     int endy = iy + circleSize;
     if (startx < 0) startx = 0; else if (startx > MaxXPt) startx = MaxXPt;
     if (starty < 0) starty = 0; else if (starty > MaxYPt) starty = MaxYPt;
     if (endx < 0) endx = 0; else if (endx > MaxXPt) endx = MaxXPt;
     if (endy < 0) endy = 0; else if (endy > MaxYPt) endy = MaxYPt;
     for (int x = startx; x <= endx; x++)
         for (int y = starty; y <= endy; y++)
         {
             if (y != iy && x != ix)
             {
                 if(true)
                 {
                     count += param1(x, y);
                 }
             }
         }
     return count;
 }