Exemple #1
0
        private void AddShallowBump(Point2I point, fieldT currFld,
                                    LinkedList <bumpT> steepBumps, LinkedList <bumpT> shallowBumps)
        {
            // First, the far point of shallow is set to the new point.
            currFld.m_Shallow.m_Far = point;
            // Second, we need to add the new bump to the shallow bump list for
            // future steep bump handling.
            shallowBumps.AddLast(new bumpT());
            shallowBumps.Last.Value.m_Location = point;
            shallowBumps.Last.Value.m_Parent   = currFld.m_ShallowBump;
            currFld.m_ShallowBump = shallowBumps.Last.Value;
            // Now we have too look through the list of steep bumps and see if
            // any of them are below the line.
            // If there are, we need to replace near point too.
            bumpT currentBump = currFld.m_SteepBump;

            while (currentBump != null)
            {
                if (currFld.m_Shallow.IsAbove(currentBump.m_Location))
                {
                    currFld.m_Shallow.m_Near = currentBump.m_Location;
                }
                currentBump = currentBump.m_Parent;
            }
        }
Exemple #2
0
        private void AddSteepBump(Point2I point, fieldT currFld,
                                  LinkedList <bumpT> steepBumps, LinkedList <bumpT> shallowBumps)
        {
            currFld.m_Steep.m_Far = point;
            steepBumps.AddLast(new bumpT());
            steepBumps.Last.Value.m_Location = point;
            steepBumps.Last.Value.m_Parent   = currFld.m_SteepBump;
            currFld.m_SteepBump = steepBumps.Last.Value;
            // Now look through the list of shallow bumps and see if any of them
            // are below the line.
            bumpT currentBump = currFld.m_ShallowBump;

            while (currentBump != null)
            {
                if (currFld.m_Steep.IsBelow(currentBump.m_Location))
                {
                    currFld.m_Steep.m_Near = currentBump.m_Location;
                }
                currentBump = currentBump.m_Parent;
            }
        }