コード例 #1
0
 //------------------------------------------------------------------------------
 private void DisposeIntersectNodes()
 {
     while ( m_IntersectNodes != null )
       {
     IntersectNode iNode = m_IntersectNodes.next;
     m_IntersectNodes = null;
     m_IntersectNodes = iNode;
       }
 }
コード例 #2
0
 //------------------------------------------------------------------------------
 private void SwapIntersectNodes(IntersectNode int1, IntersectNode int2)
 {
     TEdge e1 = int1.edge1;
       TEdge e2 = int1.edge2;
       IntPoint p = int1.pt;
       int1.edge1 = int2.edge1;
       int1.edge2 = int2.edge2;
       int1.pt = int2.pt;
       int2.edge1 = e1;
       int2.edge2 = e2;
       int2.pt = p;
 }
コード例 #3
0
 //------------------------------------------------------------------------------
 private void AddIntersectNode(TEdge e1, TEdge e2, IntPoint pt)
 {
     IntersectNode newNode = new IntersectNode();
       newNode.edge1 = e1;
       newNode.edge2 = e2;
       newNode.pt = pt;
       newNode.next = null;
       if (m_IntersectNodes == null) m_IntersectNodes = newNode;
       else if( Process1Before2(newNode, m_IntersectNodes) )
       {
     newNode.next = m_IntersectNodes;
     m_IntersectNodes = newNode;
       }
       else
       {
     IntersectNode iNode = m_IntersectNodes;
     while( iNode.next != null  && Process1Before2(iNode.next, newNode) )
         iNode = iNode.next;
     newNode.next = iNode.next;
     iNode.next = newNode;
       }
 }
コード例 #4
0
 //------------------------------------------------------------------------------
 private bool Process1Before2(IntersectNode node1, IntersectNode node2)
 {
     bool result;
       if (node1.pt.Y == node2.pt.Y)
       {
     if (node1.edge1 == node2.edge1 || node1.edge2 == node2.edge1)
     {
       result = node2.pt.X > node1.pt.X;
       if (node2.edge1.dx > 0) return !result; else return result;
     }
     else if (node1.edge1 == node2.edge2 || node1.edge2 == node2.edge2)
     {
       result = node2.pt.X > node1.pt.X;
       if (node2.edge2.dx > 0) return !result; else return result;
     }
     else return node2.pt.X > node1.pt.X;
       }
       else return node1.pt.Y > node2.pt.Y;
 }
コード例 #5
0
 //------------------------------------------------------------------------------
 private void ProcessIntersectList()
 {
     while( m_IntersectNodes != null )
       {
     IntersectNode iNode = m_IntersectNodes.next;
     {
       IntersectEdges( m_IntersectNodes.edge1 ,
         m_IntersectNodes.edge2 , m_IntersectNodes.pt, Protects.ipBoth );
       SwapPositionsInAEL( m_IntersectNodes.edge1 , m_IntersectNodes.edge2 );
     }
     m_IntersectNodes = null;
     m_IntersectNodes = iNode;
       }
 }
コード例 #6
0
ファイル: clipper.cs プロジェクト: caomw/elementdiscovery
        //------------------------------------------------------------------------------

        private bool ProcessParam1BeforeParam2(IntersectNode node1, IntersectNode node2)
        {
          bool result;
          if (node1.pt.Y == node2.pt.Y)
          {
            if (node1.edge1 == node2.edge1 || node1.edge2 == node2.edge1)
            {
              result = node2.pt.X > node1.pt.X;
                return node2.edge1.dx > 0 ? !result : result;
            }
            else if (node1.edge1 == node2.edge2 || node1.edge2 == node2.edge2)
            {
              result = node2.pt.X > node1.pt.X;
                return node2.edge2.dx > 0 ? !result : result;
            }
            else return node2.pt.X > node1.pt.X;
          }
          else return node1.pt.Y > node2.pt.Y;
        }
コード例 #7
0
 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;
 }
コード例 #8
0
ファイル: Clipper.cs プロジェクト: philazzi44/DnDCS
 //------------------------------------------------------------------------------
 private bool EdgesAdjacent(IntersectNode inode)
 {
     return (inode.edge1.nextInSEL == inode.edge2) ||
       (inode.edge1.prevInSEL == inode.edge2);
 }
コード例 #9
0
ファイル: Clipper.cs プロジェクト: philazzi44/DnDCS
 //------------------------------------------------------------------------------
 private void InsertIntersectNode(TEdge e1, TEdge e2, IntPoint pt)
 {
     IntersectNode newNode = new IntersectNode();
     newNode.edge1 = e1;
     newNode.edge2 = e2;
     newNode.pt = pt;
     newNode.next = null;
     if (m_IntersectNodes == null) m_IntersectNodes = newNode;
     else if (newNode.pt.Y > m_IntersectNodes.pt.Y)
     {
         newNode.next = m_IntersectNodes;
         m_IntersectNodes = newNode;
     }
     else
     {
         IntersectNode iNode = m_IntersectNodes;
         while (iNode.next != null && newNode.pt.Y < iNode.next.pt.Y)
             iNode = iNode.next;
         newNode.next = iNode.next;
         iNode.next = newNode;
     }
 }
コード例 #10
0
ファイル: clipper.cs プロジェクト: CharlesTaylor95/clipper
      //------------------------------------------------------------------------------

      private void SwapIntersectNodes(IntersectNode int1, IntersectNode int2)
      {
          TEdge e1 = int1.Edge1;
          TEdge e2 = int1.Edge2;
          IntPoint p = new IntPoint(int1.Pt);
          int1.Edge1 = int2.Edge1;
          int1.Edge2 = int2.Edge2;
          int1.Pt = int2.Pt;
          int2.Edge1 = e1;
          int2.Edge2 = e2;
          int2.Pt = p;
      }
コード例 #11
0
ファイル: clipper.cs プロジェクト: CharlesTaylor95/clipper
      //------------------------------------------------------------------------------

      private void ProcessIntersectList()
      {
          while (m_IntersectNodes != null)
          {
          IntersectNode iNode = m_IntersectNodes.Next;
          {
            IntersectEdges( m_IntersectNodes.Edge1 ,
              m_IntersectNodes.Edge2 , m_IntersectNodes.Pt, true);
            SwapPositionsInAEL( m_IntersectNodes.Edge1 , m_IntersectNodes.Edge2 );
          }
          m_IntersectNodes = null;
          m_IntersectNodes = iNode;
        }
      }
コード例 #12
0
ファイル: clipper.cs プロジェクト: CharlesTaylor95/clipper
      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
      }
コード例 #13
0
ファイル: Clipper.cs プロジェクト: JapaMala/armok-vision
        //------------------------------------------------------------------------------
        private void BuildIntersectList(int topY)
        {
            if (m_ActiveEdges == null) return;

            //prepare for sorting ...
            TEdge e = m_ActiveEdges;
            m_SortedEdges = e;
            while (e != null)
            {
                e.PrevInSEL = e.PrevInAEL;
                e.NextInSEL = e.NextInAEL;
                e.Curr.X = TopX(e, topY);
                e = e.NextInAEL;
            }

            //bubblesort ...
            bool isModified = true;
            while (isModified && m_SortedEdges != null)
            {
                isModified = false;
                e = m_SortedEdges;
                while (e.NextInSEL != null)
                {
                    TEdge eNext = e.NextInSEL;
                    IntPoint pt;
                    if (e.Curr.X > eNext.Curr.X)
                    {
                        IntersectPoint(e, eNext, out pt);
                        if (pt.Y < topY)
                            pt = new IntPoint(TopX(e, topY), topY);
                        IntersectNode newNode = new IntersectNode();
                        newNode.Edge1 = e;
                        newNode.Edge2 = eNext;
                        newNode.Pt = pt;
                        m_IntersectList.Add(newNode);

                        SwapPositionsInSEL(e, eNext);
                        isModified = true;
                    }
                    else
                        e = eNext;
                }
                if (e.PrevInSEL != null) e.PrevInSEL.NextInSEL = null;
                else break;
            }
            m_SortedEdges = null;
        }
コード例 #14
0
ファイル: Clipper.cs プロジェクト: JapaMala/armok-vision
 //------------------------------------------------------------------------------
 private static int IntersectNodeSort(IntersectNode node1, IntersectNode node2)
 {
     //the following typecast is safe because the differences in Pt.Y will
     //be limited to the height of the scanbeam.
     return (int)(node2.Pt.Y - node1.Pt.Y);
 }