Пример #1
0
        void SupportSupportedIsland(int[] searchmap, SliceIsland si, int[] lbm, int[] lbmz, bool[] lbms, List <SupportLocation> sl)
        {
            int             l = si.maxx - si.minx;
            int             w = si.maxy - si.miny;
            int             x, y, b, p;
            SupportLocation s = null;

            for (x = si.minx; x <= si.maxx; x++)
            {
                for (y = si.miny; y < si.maxy; y++)
                {
                    p = y * si.xres + x;
                    if (lbms[p] || (searchmap[p] != si.islandid)) // skip if area is already supported
                    {
                        continue;
                    }
                    b = lbmz[p];
                    if (b != 0)
                    {
                        continue; // right now we support only base supports, so b must be 0;
                    }
                    // add support to current location, and mark this area as supported
                    s = new SupportLocation(x, y, si.sliceid, b);
                    sl.Add(s);
                    UpdateSupportMap(lbms, x, y, si.xres, si.yres);
                    si.FloodSupport(searchmap, x, y, x, y);
                }
            }
        }
Пример #2
0
        void SupportLooseIsland(int[] searchmap, SliceIsland si, int[] lbm, int[] lbmz, bool[] lbms, List <SupportLocation> sl)
        {
            int             l = si.maxx - si.minx;
            int             w = si.maxy - si.miny;
            int             x, y, t, b, p;
            SupportLocation s = null;

            // /*P*/ = need to use parameters here
            if ((l < m_supportgap) && (w < m_supportgap))
            {
                // Island is small, in this case just put as Single support in the center
                x = (si.minx + si.maxx) / 2;
                y = (si.miny + si.maxy) / 2;
                p = y * si.xres + x;
                t = lbm[p];
                b = lbmz[p];
                if ((t != 0) && (b == 0)) // right now we support only base supports, so b must be 0;
                {
                    s = new SupportLocation(x, y, t, b);
                    sl.Add(s);
                    UpdateSupportMap(lbms, x, y, si.xres, si.yres);
                }
            }
            if (s != null)
            {
                return;
            }

            // island is big or irregular shape, iterate over the island surface and add supports.
            for (x = si.minx; x <= si.maxx; x++)
            {
                for (y = si.miny; y < si.maxy; y++)
                {
                    p = y * si.xres + x;
                    if (searchmap[p] != si.islandid)
                    {
                        continue;
                    }
                    b = lbmz[p]; // &0xFFFFFF;
                    if (b != 0)
                    {
                        continue; // right now we support only base supports, so b must be 0;
                    }
                    // add support to current location, and mark this area as supported
                    s = new SupportLocation(x, y, si.sliceid, b);
                    sl.Add(s);
                    UpdateSupportMap(lbms, x, y, si.xres, si.yres);
                    si.FloodSupport(searchmap, x, y, x, y);
                }
            }
        }
        void SupportLooseIsland(int[] searchmap, SliceIsland si, int[] lbm, int[] lbmz, bool[] lbms, List<SupportLocation> sl)
        {
            int l = si.maxx - si.minx;
            int w = si.maxy - si.miny;
            int x, y, t, b, p;
            SupportLocation s = null;
            // /*P*/ = need to use parameters here
            if ((l < m_supportgap) && (w < m_supportgap))
            {
                // Island is small, in this case just put as Single support in the center
                x = (si.minx + si.maxx) / 2;
                y = (si.miny + si.maxy) / 2;
                p = y * si.xres + x;
                t = lbm[p];
                b = lbmz[p];
                if ((t != 0) && (b == 0)) // right now we support only base supports, so b must be 0;
                {
                    s = new SupportLocation(x, y, t, b);
                    sl.Add(s);
                    UpdateSupportMap(lbms, x, y, si.xres, si.yres);
                }
            }
            if (s != null)
                return;

            // island is big or irregular shape, iterate over the island surface and add supports.
            for (x = si.minx; x <= si.maxx; x++)
            {
                for (y = si.miny; y < si.maxy; y++)
                {
                    p = y * si.xres + x;
                    if (searchmap[p] != si.islandid)
                        continue;
                    b = lbmz[p]; // &0xFFFFFF;
                    if (b != 0)
                        continue; // right now we support only base supports, so b must be 0;
                    // add support to current location, and mark this area as supported
                    s = new SupportLocation(x, y, si.sliceid, b);
                    sl.Add(s);
                    UpdateSupportMap(lbms, x, y, si.xres, si.yres);
                    si.FloodSupport(searchmap, x, y, x, y);
                }
            }
        }
 void SupportSupportedIsland(int[] searchmap, SliceIsland si, int[] lbm, int[] lbmz, bool[] lbms, List<SupportLocation> sl)
 {
     int l = si.maxx - si.minx;
     int w = si.maxy - si.miny;
     int x, y, b, p;
     SupportLocation s = null;
     for (x = si.minx; x <= si.maxx; x++)
     {
         for (y = si.miny; y < si.maxy; y++)
         {
             p = y * si.xres + x;
             if (lbms[p] || (searchmap[p] != si.islandid)) // skip if area is already supported
                 continue;
             b = lbmz[p];
             if (b != 0)
                 continue; // right now we support only base supports, so b must be 0;
             // add support to current location, and mark this area as supported
             s = new SupportLocation(x, y, si.sliceid, b);
             sl.Add(s);
             UpdateSupportMap(lbms, x, y, si.xres, si.yres);
             si.FloodSupport(searchmap, x, y, x, y);
         }
     }
 }
Пример #5
0
 // calculate supports for islands that are at least partially unsupported by underneath layers.
 void SupportSupportedIsland(int[] searchmap, SliceIsland si, int[] lbm, int[] lbmz, int[] lbms, List<SupportLocation> sl)
 {
     int l = si.maxx - si.minx;
     int w = si.maxy - si.miny;
     int x, y, b, p, t;
     SupportLocation s = null;
     for (x = si.minx; x <= si.maxx; x++)
     {
         for (y = si.miny; y < si.maxy; y++)
         {
             p = y * si.xres + x;
             b = lbmz[p];
             t = lbm[p];
             if ((lbms[p] >= b) || (searchmap[p] != si.islandid)) // skip if area is already supported
                 continue;
             if ((b != 0) && (si.sliceid - b < m_asp.minHeight))
                 continue; // disregard supports that are too low
             // add support to current location, and mark this area as supported
             s = new SupportLocation(x, y, si.sliceid, b);
             sl.Add(s);
             UpdateSupportMap(lbms, x, y, si.xres, si.yres, t);
             si.FloodSupport(searchmap, x, y, x, y);
         }
     }
 }