Example #1
0
        // alternative method of support detection
        void ProcessSlice2(List <SupportLocation> sl)
        {
            int npix = m_asp.xres * m_asp.yres;
            int x, y, p;

            for (p = 0; p < npix; p++)
            {
                m_asp.searchmap[p] = 0;
            }
            int ptid = 0;

            // find islands in the slice
            for (x = 0; x < m_asp.xres; x++)
            {
                for (y = 0; y < m_asp.yres; y++)
                {
                    p = y * m_asp.xres + x;
                    int sid = m_asp.lbm[p];
                    if ((sid != 0) && (m_asp.lbmz[p] != sid - 1) && (m_asp.searchmap[p] == 0))
                    {
                        if (m_asp.lbmz[p] != 0)
                        {
                            continue;   // right now intra-object supports not supported
                        }
                        ptid++;
                        if (UpdateSearchMap(x, y, ptid))
                        {
                            SupportLocation s = new SupportLocation(x, y, sid, m_asp.lbmz[p]);
                            sl.Add(s);
                            m_asp.lbms[p] = true;
                        }
                    }
                }
            }
        }
Example #2
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);
                }
            }
        }
Example #3
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);
                }
            }
        }
Example #4
0
    public override void instantiateSupports(MeshGenerator meshGenerator, TrackSegment4 trackSegment, GameObject putMeshOnGO)
    {
        SupportConfiguration supportConfiguration = trackSegment.track.TrackedRide.supportConfiguration;

        if ((Object)supportConfiguration != (Object)null)
        {
            for (int j = 0; j < sideOffsets.Length; j++)
            {
                SupportLocation supportLocation = Object.Instantiate(supportConfiguration.supportLocationGO);
                supportLocation.trackSegment = trackSegment;

                supportLocation.t          = 0f;
                supportLocation.sideOffset = sideOffsets[j];
                supportLocation.rebuild();
            }
        }
    }
        // alternative method of support detection
        void ProcessSlice2(List<SupportLocation> sl)
        {
            int npix = m_asp.xres * m_asp.yres;
            int x, y, p;
            for (p = 0; p < npix; p++)
                m_asp.searchmap[p] = 0;
            int ptid = 0;

            // find islands in the slice
            for (x = 0; x < m_asp.xres; x++)
            {
                for (y = 0; y < m_asp.yres; y++)
                {
                    p = y * m_asp.xres + x;
                    int sid = m_asp.lbm[p];
                    if ((sid != 0) && (m_asp.lbmz[p] != sid - 1) && (m_asp.searchmap[p] == 0))
                    {
                        if (m_asp.lbmz[p] != 0)
                            continue;   // right now intra-object supports not supported
                        ptid++;
                        if (UpdateSearchMap(x, y, ptid))
                        {
                            SupportLocation s = new SupportLocation(x, y, sid, m_asp.lbmz[p]);
                            sl.Add(s);
                            m_asp.lbms[p] = true;
                        }
                    }
                }
            }
        }
 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);
         }
     }
 }
        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);
                }
            }
        }
Example #8
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);
         }
     }
 }
Example #9
0
        // alternative method of support detection
        void ProcessSlice2(List<SupportLocation> sl)
        {
            int npix = m_asp.xres * m_asp.yres;
            int b, x, y, p;
            for (p = 0; p < npix; p++)
                m_asp.searchmap[p] = 0;
            int ptid = 0;

            // find islands in the slice
            for (x = 0; x < m_asp.xres; x++)
            {
                for (y = 0; y < m_asp.yres; y++)
                {
                    p = y * m_asp.xres + x;
                    int sid = m_asp.lbm[p];
                    if ((sid != 0) && (m_asp.lbmz[p] != sid - 1) && (m_asp.searchmap[p] == 0))
                    {
                        b = m_asp.lbmz[p];
                        if ((b != 0) && (sid - b < m_asp.minHeight))
                            continue; // disregard supports that are too low
                        ptid++;
                        if (UpdateSearchMap(x, y, ptid))
                        {
                            SupportLocation s = new SupportLocation(x, y, sid, b);
                            sl.Add(s);
                            m_asp.lbms[p] = m_asp.lbmz[p];
                        }
                    }
                }
            }
        }