当前位置: 首页>>代码示例>>C#>>正文


C# ClipperLib.TEdge类代码示例

本文整理汇总了C#中ClipperLib.TEdge的典型用法代码示例。如果您正苦于以下问题:C# TEdge类的具体用法?C# TEdge怎么用?C# TEdge使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TEdge类属于ClipperLib命名空间,在下文中一共展示了TEdge类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsMinima

 //------------------------------------------------------------------------------
 private bool IsMinima(TEdge e)
 {
     return e != null && (e.prev.nextInLML != e) && (e.next.nextInLML != e);
 }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:5,代码来源:clipper.cs

示例2: DeleteFromAEL

 //------------------------------------------------------------------------------
 private void DeleteFromAEL(TEdge e)
 {
     TEdge AelPrev = e.prevInAEL;
     TEdge AelNext = e.nextInAEL;
     if (AelPrev == null && AelNext == null && (e != m_ActiveEdges))
         return; //already deleted
     if (AelPrev != null)
         AelPrev.nextInAEL = AelNext;
     else m_ActiveEdges = AelNext;
     if (AelNext != null)
         AelNext.prevInAEL = AelPrev;
     e.nextInAEL = null;
     e.prevInAEL = null;
 }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:15,代码来源:clipper.cs

示例3: BuildIntersectList

        //------------------------------------------------------------------------------
        private void BuildIntersectList(Int64 botY, Int64 topY)
        {
            if ( m_ActiveEdges == null ) return;

              //prepare for sorting ...
              TEdge e = m_ActiveEdges;
              e.tmpX = TopX( e, topY );
              m_SortedEdges = e;
              m_SortedEdges.prevInSEL = null;
              e = e.nextInAEL;
              while( e != null )
              {
            e.prevInSEL = e.prevInAEL;
            e.prevInSEL.nextInSEL = e;
            e.nextInSEL = null;
            e.tmpX = 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 = new IntPoint();
              if(e.tmpX > eNext.tmpX && IntersectPoint(e, eNext, ref pt))
              {
                  if (pt.Y > botY)
                  {
                      pt.Y = botY;
                      pt.X = TopX(e, pt.Y);
                  }
                  AddIntersectNode(e, eNext, pt);
                  SwapPositionsInSEL(e, eNext);
                  isModified = true;
              }
              else
                e = eNext;
            }
            if( e.prevInSEL != null ) e.prevInSEL.nextInSEL = null;
            else break;
              }
              m_SortedEdges = null;
        }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:49,代码来源:clipper.cs

示例4: AddOutPt

 //------------------------------------------------------------------------------
 private void AddOutPt(TEdge e, TEdge altE, IntPoint pt)
 {
     bool ToFront = (e.side == EdgeSide.esLeft);
       if(  e.outIdx < 0 )
       {
       OutRec outRec = CreateOutRec();
       m_PolyOuts.Add(outRec);
       outRec.idx = m_PolyOuts.Count -1;
       e.outIdx = outRec.idx;
       OutPt op = new OutPt();
       outRec.pts = op;
       outRec.bottomPt = op;
       outRec.bottomE1 = e;
       outRec.bottomE2 = altE;
       op.pt = pt;
       op.idx = outRec.idx;
       op.next = op;
       op.prev = op;
       SetHoleState(e, outRec);
       } else
       {
       OutRec outRec = m_PolyOuts[e.outIdx];
       OutPt op = outRec.pts;
       if (ToFront && PointsEqual(pt, op.pt) ||
           (!ToFront && PointsEqual(pt, op.prev.pt))) return;
       OutPt op2 = new OutPt();
       op2.pt = pt;
       op2.idx = outRec.idx;
       if (op2.pt.Y == outRec.bottomPt.pt.Y &&
         op2.pt.X < outRec.bottomPt.pt.X)
       {
           outRec.bottomPt = op2;
           outRec.bottomE1 = e;
           outRec.bottomE2 = altE;
       }
       op2.next = op;
       op2.prev = op.prev;
       op2.prev.next = op2;
       op.prev = op2;
       if (ToFront) outRec.pts = op2;
       }
 }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:43,代码来源:clipper.cs

示例5: AddLocalMaxPoly

 //------------------------------------------------------------------------------
 private void AddLocalMaxPoly(TEdge e1, TEdge e2, IntPoint pt)
 {
     AddOutPt(e1, null, pt);
     if (e1.outIdx == e2.outIdx)
     {
         e1.outIdx = -1;
         e2.outIdx = -1;
     }
     else AppendPolygon(e1, e2);
 }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:11,代码来源:clipper.cs

示例6: AddIntersectNode

 //------------------------------------------------------------------------------
 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;
       }
 }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:23,代码来源:clipper.cs

示例7: AddEdgeToSEL

 //------------------------------------------------------------------------------
 private void AddEdgeToSEL(TEdge edge)
 {
     //SEL pointers in PEdge are reused to build a list of horizontal edges.
     //However, we don't need to worry about order with horizontal edge processing.
     if (m_SortedEdges == null)
     {
         m_SortedEdges = edge;
         edge.prevInSEL = null;
         edge.nextInSEL = null;
     }
     else
     {
         edge.nextInSEL = m_SortedEdges;
         edge.prevInSEL = null;
         m_SortedEdges.prevInSEL = edge;
         m_SortedEdges = edge;
     }
 }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:19,代码来源:clipper.cs

示例8: UpdateEdgeIntoAEL

 //------------------------------------------------------------------------------
 private void UpdateEdgeIntoAEL(ref TEdge e)
 {
     if (e.nextInLML == null)
         throw new ClipperException("UpdateEdgeIntoAEL: invalid call");
     TEdge AelPrev = e.prevInAEL;
     TEdge AelNext = e.nextInAEL;
     e.nextInLML.outIdx = e.outIdx;
     if (AelPrev != null)
         AelPrev.nextInAEL = e.nextInLML;
     else m_ActiveEdges = e.nextInLML;
     if (AelNext != null)
         AelNext.prevInAEL = e.nextInLML;
     e.nextInLML.side = e.side;
     e.nextInLML.windDelta = e.windDelta;
     e.nextInLML.windCnt = e.windCnt;
     e.nextInLML.windCnt2 = e.windCnt2;
     e = e.nextInLML;
     e.prevInAEL = AelPrev;
     e.nextInAEL = AelNext;
     if (e.dx != horizontal) InsertScanbeam(e.ytop);
 }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:22,代码来源:clipper.cs

示例9: SwapPositionsInSEL

        //------------------------------------------------------------------------------
        private void SwapPositionsInSEL(TEdge edge1, TEdge edge2)
        {
            if (edge1.nextInSEL == null && edge1.prevInSEL == null)
                return;
            if (edge2.nextInSEL == null && edge2.prevInSEL == null)
                return;

            if (edge1.nextInSEL == edge2)
            {
                TEdge next = edge2.nextInSEL;
                if (next != null)
                    next.prevInSEL = edge1;
                TEdge prev = edge1.prevInSEL;
                if (prev != null)
                    prev.nextInSEL = edge2;
                edge2.prevInSEL = prev;
                edge2.nextInSEL = edge1;
                edge1.prevInSEL = edge2;
                edge1.nextInSEL = next;
            }
            else if (edge2.nextInSEL == edge1)
            {
                TEdge next = edge1.nextInSEL;
                if (next != null)
                    next.prevInSEL = edge2;
                TEdge prev = edge2.prevInSEL;
                if (prev != null)
                    prev.nextInSEL = edge1;
                edge1.prevInSEL = prev;
                edge1.nextInSEL = edge2;
                edge2.prevInSEL = edge1;
                edge2.nextInSEL = next;
            }
            else
            {
                TEdge next = edge1.nextInSEL;
                TEdge prev = edge1.prevInSEL;
                edge1.nextInSEL = edge2.nextInSEL;
                if (edge1.nextInSEL != null)
                    edge1.nextInSEL.prevInSEL = edge1;
                edge1.prevInSEL = edge2.prevInSEL;
                if (edge1.prevInSEL != null)
                    edge1.prevInSEL.nextInSEL = edge1;
                edge2.nextInSEL = next;
                if (edge2.nextInSEL != null)
                    edge2.nextInSEL.prevInSEL = edge2;
                edge2.prevInSEL = prev;
                if (edge2.prevInSEL != null)
                    edge2.prevInSEL.nextInSEL = edge2;
            }

            if (edge1.prevInSEL == null)
                m_SortedEdges = edge1;
            else if (edge2.prevInSEL == null)
                m_SortedEdges = edge2;
        }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:57,代码来源:clipper.cs

示例10: SetWindingCount

        //------------------------------------------------------------------------------
        private void SetWindingCount(TEdge edge)
        {
            TEdge e = edge.prevInAEL;
            //find the edge of the same polytype that immediately preceeds 'edge' in AEL
            while (e != null && e.polyType != edge.polyType)
                e = e.prevInAEL;
            if (e == null)
            {
                edge.windCnt = edge.windDelta;
                edge.windCnt2 = 0;
                e = m_ActiveEdges; //ie get ready to calc windCnt2
            }
            else if (IsEvenOddFillType(edge))
            {
                //even-odd filling ...
                edge.windCnt = 1;
                edge.windCnt2 = e.windCnt2;
                e = e.nextInAEL; //ie get ready to calc windCnt2
            }
            else
            {
                //nonZero filling ...
                if (e.windCnt * e.windDelta < 0)
                {
                    if (Math.Abs(e.windCnt) > 1)
                    {
                        if (e.windDelta * edge.windDelta < 0)
                            edge.windCnt = e.windCnt;
                        else
                            edge.windCnt = e.windCnt + edge.windDelta;
                    }
                    else
                        edge.windCnt = e.windCnt + e.windDelta + edge.windDelta;
                }
                else
                {
                    if (Math.Abs(e.windCnt) > 1 && e.windDelta * edge.windDelta < 0)
                        edge.windCnt = e.windCnt;
                    else if (e.windCnt + edge.windDelta == 0)
                        edge.windCnt = e.windCnt;
                    else
                        edge.windCnt = e.windCnt + edge.windDelta;
                }
                edge.windCnt2 = e.windCnt2;
                e = e.nextInAEL; //ie get ready to calc windCnt2
            }

            //update windCnt2 ...
            if (IsEvenOddAltFillType(edge))
            {
                //even-odd filling ...
                while (e != edge)
                {
                    edge.windCnt2 = (edge.windCnt2 == 0) ? 1 : 0;
                    e = e.nextInAEL;
                }
            }
            else
            {
                //nonZero filling ...
                while (e != edge)
                {
                    edge.windCnt2 += e.windDelta;
                    e = e.nextInAEL;
                }
            }
        }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:68,代码来源:clipper.cs

示例11: SetHoleState

 //------------------------------------------------------------------------------
 private void SetHoleState(TEdge e, OutRec outRec)
 {
     bool isHole = false;
     TEdge e2 = e.prevInAEL;
     while (e2 != null)
     {
         if (e2.outIdx >= 0)
         {
             isHole = !isHole;
             if (outRec.FirstLeft == null)
                 outRec.FirstLeft = m_PolyOuts[e2.outIdx];
         }
         e2 = e2.prevInAEL;
     }
     if (isHole) outRec.isHole = true;
 }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:17,代码来源:clipper.cs

示例12: ProcessHorizontal

        //------------------------------------------------------------------------------
        private void ProcessHorizontal(TEdge horzEdge)
        {
            Direction Direction;
            Int64 horzLeft, horzRight;

            if (horzEdge.xcurr < horzEdge.xtop)
            {
                horzLeft = horzEdge.xcurr;
                horzRight = horzEdge.xtop;
                Direction = Direction.dLeftToRight;
            }
            else
            {
                horzLeft = horzEdge.xtop;
                horzRight = horzEdge.xcurr;
                Direction = Direction.dRightToLeft;
            }

            TEdge eMaxPair;
            if (horzEdge.nextInLML != null)
                eMaxPair = null;
            else
                eMaxPair = GetMaximaPair(horzEdge);

            TEdge e = GetNextInAEL(horzEdge, Direction);
            while (e != null)
            {
                TEdge eNext = GetNextInAEL(e, Direction);
                if (eMaxPair != null ||
                  ((Direction == Direction.dLeftToRight) && (e.xcurr <= horzRight)) ||
                  ((Direction == Direction.dRightToLeft) && (e.xcurr >= horzLeft)))
                {
                    //ok, so far it looks like we're still in range of the horizontal edge
                    if (e.xcurr == horzEdge.xtop && eMaxPair == null)
                    {
                        if (SlopesEqual(e, horzEdge.nextInLML, m_UseFullRange))
                        {
                            //if output polygons share an edge, they'll need joining later ...
                            if (horzEdge.outIdx >= 0 && e.outIdx >= 0)
                                AddJoin(horzEdge.nextInLML, e, horzEdge.outIdx, -1);
                            break; //we've reached the end of the horizontal line
                        }
                        else if (e.dx < horzEdge.nextInLML.dx)
                            //we really have got to the end of the intermediate horz edge so quit.
                            //nb: More -ve slopes follow more +ve slopes ABOVE the horizontal.
                            break;
                    }

                    if (e == eMaxPair)
                    {
                        //horzEdge is evidently a maxima horizontal and we've arrived at its end.
                        if (Direction == Direction.dLeftToRight)
                            IntersectEdges(horzEdge, e, new IntPoint(e.xcurr, horzEdge.ycurr), 0);
                        else
                            IntersectEdges(e, horzEdge, new IntPoint(e.xcurr, horzEdge.ycurr), 0);
                        if (eMaxPair.outIdx >= 0) throw new ClipperException("ProcessHorizontal error");
                        return;
                    }
                    else if (e.dx == horizontal && !IsMinima(e) && !(e.xcurr > e.xtop))
                    {
                        if (Direction == Direction.dLeftToRight)
                            IntersectEdges(horzEdge, e, new IntPoint(e.xcurr, horzEdge.ycurr),
                              (IsTopHorz(horzEdge, e.xcurr)) ? Protects.ipLeft : Protects.ipBoth);
                        else
                            IntersectEdges(e, horzEdge, new IntPoint(e.xcurr, horzEdge.ycurr),
                              (IsTopHorz(horzEdge, e.xcurr)) ? Protects.ipRight : Protects.ipBoth);
                    }
                    else if (Direction == Direction.dLeftToRight)
                    {
                        IntersectEdges(horzEdge, e, new IntPoint(e.xcurr, horzEdge.ycurr),
                          (IsTopHorz(horzEdge, e.xcurr)) ? Protects.ipLeft : Protects.ipBoth);
                    }
                    else
                    {
                        IntersectEdges(e, horzEdge, new IntPoint(e.xcurr, horzEdge.ycurr),
                          (IsTopHorz(horzEdge, e.xcurr)) ? Protects.ipRight : Protects.ipBoth);
                    }
                    SwapPositionsInAEL(horzEdge, e);
                }
                else if ( (Direction == Direction.dLeftToRight &&
                    e.xcurr > horzRight && horzEdge.nextInSEL == null) ||
                    (Direction == Direction.dRightToLeft &&
                    e.xcurr < horzLeft && horzEdge.nextInSEL == null) ) break;
                e = eNext;
            } //end while ( e )

            if (horzEdge.nextInLML != null)
            {
                if (horzEdge.outIdx >= 0)
                    AddOutPt(horzEdge, null, new IntPoint(horzEdge.xtop, horzEdge.ytop));
                UpdateEdgeIntoAEL(ref horzEdge);
            }
            else
            {
                if (horzEdge.outIdx >= 0)
                    IntersectEdges(horzEdge, eMaxPair,
                        new IntPoint(horzEdge.xtop, horzEdge.ycurr), Protects.ipBoth);
                DeleteFromAEL(eMaxPair);
                DeleteFromAEL(horzEdge);
//.........这里部分代码省略.........
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:101,代码来源:clipper.cs

示例13: IsTopHorz

 //------------------------------------------------------------------------------
 private bool IsTopHorz(TEdge horzEdge, double XPos)
 {
     TEdge e = m_SortedEdges;
     while (e != null)
     {
         if ((XPos >= Math.Min(e.xcurr, e.xtop)) && (XPos <= Math.Max(e.xcurr, e.xtop)))
             return false;
         e = e.nextInSEL;
     }
     return true;
 }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:12,代码来源:clipper.cs

示例14: SwapSides

 //------------------------------------------------------------------------------
 private static void SwapSides(TEdge edge1, TEdge edge2)
 {
     EdgeSide side = edge1.side;
     edge1.side = edge2.side;
     edge2.side = side;
 }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:7,代码来源:clipper.cs

示例15: TopX

 //------------------------------------------------------------------------------
 private static Int64 TopX(TEdge edge, Int64 currentY)
 {
     if (currentY == edge.ytop)
         return edge.xtop;
     return edge.xbot + Round(edge.dx *(currentY - edge.ybot));
 }
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:7,代码来源:clipper.cs


注:本文中的ClipperLib.TEdge类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。