Exemplo n.º 1
0
        //------------------------------------------------------------------------------

        internal virtual void Reset()
        {
            m_CurrentLM = m_MinimaList;
            if (m_CurrentLM == null)
            {
                return;                      //ie nothing to process
            }
            //reset all edges ...
            m_Scanbeam = null;
            LocalMinima lm = m_MinimaList;

            while (lm != null)
            {
                InsertScanbeam(lm.Y);
                TEdge e = lm.LeftBound;
                if (e != null)
                {
                    e.Curr   = e.Bot;
                    e.OutIdx = Unassigned;
                }
                e = lm.RightBound;
                if (e != null)
                {
                    e.Curr   = e.Bot;
                    e.OutIdx = Unassigned;
                }
                lm = lm.Next;
            }
            m_ActiveEdges = null;
        }
Exemplo n.º 2
0
 internal void InsertScanbeam(long Y)
 {
     if (m_Scanbeam == null)
     {
         m_Scanbeam      = new Scanbeam();
         m_Scanbeam.Next = null;
         m_Scanbeam.Y    = Y;
     }
     else if (Y > m_Scanbeam.Y)
     {
         Scanbeam scanbeam = new Scanbeam();
         scanbeam.Y    = Y;
         scanbeam.Next = m_Scanbeam;
         m_Scanbeam    = scanbeam;
     }
     else
     {
         Scanbeam scanbeam2 = m_Scanbeam;
         while (scanbeam2.Next != null && Y <= scanbeam2.Next.Y)
         {
             scanbeam2 = scanbeam2.Next;
         }
         if (Y != scanbeam2.Y)
         {
             Scanbeam scanbeam3 = new Scanbeam();
             scanbeam3.Y    = Y;
             scanbeam3.Next = scanbeam2.Next;
             scanbeam2.Next = scanbeam3;
         }
     }
 }
Exemplo n.º 3
0
 internal virtual void Reset()
 {
     m_CurrentLM = m_MinimaList;
     if (m_CurrentLM != null)
     {
         m_Scanbeam = null;
         for (LocalMinima localMinima = m_MinimaList; localMinima != null; localMinima = localMinima.Next)
         {
             InsertScanbeam(localMinima.Y);
             TEdge leftBound = localMinima.LeftBound;
             if (leftBound != null)
             {
                 TEdge tEdge = leftBound;
                 tEdge.Curr       = tEdge.Bot;
                 leftBound.OutIdx = -1;
             }
             leftBound = localMinima.RightBound;
             if (leftBound != null)
             {
                 TEdge tEdge2 = leftBound;
                 tEdge2.Curr      = tEdge2.Bot;
                 leftBound.OutIdx = -1;
             }
         }
         m_ActiveEdges = null;
     }
 }
Exemplo n.º 4
0
        //------------------------------------------------------------------------------

        internal void InsertScanbeam(int Y)
        {
            //single-linked list: sorted descending, ignoring dups.
            if (m_Scanbeam == null)
            {
                m_Scanbeam      = new Scanbeam();
                m_Scanbeam.Next = null;
                m_Scanbeam.Y    = Y;
            }
            else if (Y > m_Scanbeam.Y)
            {
                Scanbeam newSb = new Scanbeam();
                newSb.Y    = Y;
                newSb.Next = m_Scanbeam;
                m_Scanbeam = newSb;
            }
            else
            {
                Scanbeam sb2 = m_Scanbeam;
                while (sb2.Next != null && (Y <= sb2.Next.Y))
                {
                    sb2 = sb2.Next;
                }
                if (Y == sb2.Y)
                {
                    return;             //ie ignores duplicates
                }
                Scanbeam newSb = new Scanbeam();
                newSb.Y    = Y;
                newSb.Next = sb2.Next;
                sb2.Next   = newSb;
            }
        }
Exemplo n.º 5
0
        //------------------------------------------------------------------------------

        internal Boolean PopScanbeam(out int Y)
        {
            if (m_Scanbeam == null)
            {
                Y = 0;
                return(false);
            }
            Y          = m_Scanbeam.Y;
            m_Scanbeam = m_Scanbeam.Next;
            return(true);
        }
Exemplo n.º 6
0
 internal bool PopScanbeam(out long Y)
 {
     if (m_Scanbeam == null)
     {
         Y = 0L;
         return(false);
     }
     Y          = m_Scanbeam.Y;
     m_Scanbeam = m_Scanbeam.Next;
     return(true);
 }
 //------------------------------------------------------------------------------
 private void InsertScanbeam(Int64 Y)
 {
     if( m_Scanbeam == null )
       {
     m_Scanbeam = new Scanbeam();
     m_Scanbeam.next = null;
     m_Scanbeam.Y = Y;
       }
       else if(  Y > m_Scanbeam.Y )
       {
     Scanbeam newSb = new Scanbeam();
     newSb.Y = Y;
     newSb.next = m_Scanbeam;
     m_Scanbeam = newSb;
       } else
       {
     Scanbeam sb2 = m_Scanbeam;
     while( sb2.next != null  && ( Y <= sb2.next.Y ) ) sb2 = sb2.next;
     if(  Y == sb2.Y ) return; //ie ignores duplicates
     Scanbeam newSb = new Scanbeam();
     newSb.Y = Y;
     newSb.next = sb2.next;
     sb2.next = newSb;
       }
 }
 public Clipper()
 {
     m_Scanbeam = null;
     m_ActiveEdges = null;
     m_SortedEdges = null;
     m_IntersectNodes = null;
     m_ExecuteLocked = false;
     m_PolyOuts = new List<OutRec>();
     m_Joins = new List<JoinRec>();
     m_HorizJoins = new List<HorzJoinRec>();
     m_ReverseOutput = false;
 }
 //------------------------------------------------------------------------------
 void DisposeScanbeamList()
 {
     while ( m_Scanbeam != null ) {
       Scanbeam sb2 = m_Scanbeam.next;
       m_Scanbeam = null;
       m_Scanbeam = sb2;
       }
 }
Exemplo n.º 10
0
      //------------------------------------------------------------------------------

      private cInt PopScanbeam()
      {
        cInt Y = m_Scanbeam.Y;
        Scanbeam sb2 = m_Scanbeam;
        m_Scanbeam = m_Scanbeam.Next;
        sb2 = null;
        return Y;
      }
Exemplo n.º 11
0
      public Clipper(int InitOptions = 0): base() //constructor
      {
          m_Scanbeam = null;
          m_ActiveEdges = null;
          m_SortedEdges = null;
          m_IntersectNodes = null;
          m_ExecuteLocked = false;
          m_UsingPolyTree = false;
          m_PolyOuts = new List<OutRec>();
          m_Joins = new List<Join>();
          m_GhostJoins = new List<Join>();
          ReverseSolution = (ioReverseSolution & InitOptions) != 0;
          StrictlySimple = (ioStrictlySimple & InitOptions) != 0;
          PreserveCollinear = (ioPreserveCollinear & InitOptions) != 0;
#if use_xyz
          ZFillFunction = null;
#endif
      }
Exemplo n.º 12
0
 //------------------------------------------------------------------------------
 internal void InsertScanbeam(int Y)
 {
     //single-linked list: sorted descending, ignoring dups.
     if (m_Scanbeam == null)
     {
         m_Scanbeam = new Scanbeam();
         m_Scanbeam.Next = null;
         m_Scanbeam.Y = Y;
     }
     else if (Y > m_Scanbeam.Y)
     {
         Scanbeam newSb = new Scanbeam();
         newSb.Y = Y;
         newSb.Next = m_Scanbeam;
         m_Scanbeam = newSb;
     }
     else
     {
         Scanbeam sb2 = m_Scanbeam;
         while (sb2.Next != null && (Y <= sb2.Next.Y)) sb2 = sb2.Next;
         if (Y == sb2.Y) return; //ie ignores duplicates
         Scanbeam newSb = new Scanbeam();
         newSb.Y = Y;
         newSb.Next = sb2.Next;
         sb2.Next = newSb;
     }
 }
Exemplo n.º 13
0
        //------------------------------------------------------------------------------
        internal virtual void Reset()
        {
            m_CurrentLM = m_MinimaList;
            if (m_CurrentLM == null) return; //ie nothing to process

            //reset all edges ...
            m_Scanbeam = null;
            LocalMinima lm = m_MinimaList;
            while (lm != null)
            {
                InsertScanbeam(lm.Y);
                TEdge e = lm.LeftBound;
                if (e != null)
                {
                    e.Curr = e.Bot;
                    e.OutIdx = Unassigned;
                }
                e = lm.RightBound;
                if (e != null)
                {
                    e.Curr = e.Bot;
                    e.OutIdx = Unassigned;
                }
                lm = lm.Next;
            }
            m_ActiveEdges = null;
        }
Exemplo n.º 14
0
 //------------------------------------------------------------------------------
 internal Boolean PopScanbeam(out int Y)
 {
     if (m_Scanbeam == null)
     {
         Y = 0;
         return false;
     }
     Y = m_Scanbeam.Y;
     m_Scanbeam = m_Scanbeam.Next;
     return true;
 }
 //------------------------------------------------------------------------------
 private Int64 PopScanbeam()
 {
     Int64 Y = m_Scanbeam.Y;
       Scanbeam sb2 = m_Scanbeam;
       m_Scanbeam = m_Scanbeam.next;
       sb2 = null;
       return Y;
 }
 //------------------------------------------------------------------------------
 protected override void Reset()
 {
     base.Reset();
       m_Scanbeam = null;
       m_ActiveEdges = null;
       m_SortedEdges = null;
       DisposeAllPolyPts();
       LocalMinima lm = m_MinimaList;
       while (lm != null)
       {
     InsertScanbeam(lm.Y);
     InsertScanbeam(lm.leftBound.ytop);
     lm = lm.next;
       }
 }
 /// <summary>
 /// Reset all fields to default values in preparation for object recycling
 /// </summary>
 public void PrepareForRecycle()
 {
     Y    = new cInt();
     Next = null;
 }