Пример #1
0
        void ProcessSlice(int[] lbm, int[] lbmz, bool[] lbms, int xres, int yres, List <SupportLocation> sl)
        {
            int npix = xres * yres;

            int[] searchmap = new int[npix];
            int   x, y, p;

            for (p = 0; p < npix; p++)
            {
                searchmap[p] = 0;
            }

            int islandid               = 1;
            List <SliceIsland> islands = new List <SliceIsland>();

            // find islands in the slice
            for (x = 0; x < xres; x++)
            {
                for (y = 0; y < yres; y++)
                {
                    p = y * xres + x;
                    int sid = lbm[p];// &0xFFFFFF;
                    if ((searchmap[p] == 0) && (sid != 0))
                    {
                        SliceIsland si = new SliceIsland(islandid, sid, xres, yres);
                        si.supportGap = m_supportgap;
                        si.FloodIsland(searchmap, lbm, lbmz, x, y);
                        islands.Add(si);
                        islandid++;
                    }
                }
            }

            // locate potential supports locations
            foreach (SliceIsland si in islands)
            {
                // case 1: island is not supported at all.
                if (si.supportedCount == 0)
                {
                    SupportLooseIsland(searchmap, si, lbm, lbmz, lbms, sl);
                }
                // case 2: island is partially supported
                else
                {
                    SupportSupportedIsland(searchmap, si, lbm, lbmz, lbms, sl);
                }
            }
        }
        void ProcessSlice(int[] lbm, int[] lbmz, bool[] lbms, int xres, int yres, List<SupportLocation> sl)
        {
            int npix = xres * yres;
            int[] searchmap = new int[npix];
            int x, y, p;
            for (p = 0; p < npix; p++)
                searchmap[p] = 0;

            int islandid = 1;
            List<SliceIsland> islands = new List<SliceIsland>();

            // find islands in the slice
            for (x = 0; x < xres; x++)
                for (y = 0; y < yres; y++)
                {
                    p = y * xres + x;
                    int sid = lbm[p];// &0xFFFFFF;
                    if ((searchmap[p] == 0) && (sid != 0))
                    {
                        SliceIsland si = new SliceIsland(islandid, sid, xres, yres);
                        si.supportGap = m_supportgap;
                        si.FloodIsland(searchmap, lbm, lbmz, x, y);
                        islands.Add(si);
                        islandid++;
                    }
                }

            // locate potential supports locations
            foreach (SliceIsland si in islands)
            {
                // case 1: island is not supported at all.
                if (si.supportedCount == 0)
                {
                    SupportLooseIsland(searchmap, si, lbm, lbmz, lbms, sl);
                }
                // case 2: island is partially supported
                else
                {
                    SupportSupportedIsland(searchmap, si, lbm, lbmz, lbms, sl);
                }
            }
        }