本文整理汇总了C#中ClipperLib.TEdge类的典型用法代码示例。如果您正苦于以下问题:C# TEdge类的具体用法?C# TEdge怎么用?C# TEdge使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TEdge类属于ClipperLib命名空间,在下文中一共展示了TEdge类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: SlopesEqual
//------------------------------------------------------------------------------
internal bool SlopesEqual(TEdge e1, TEdge e2, bool UseFulllongRange)
{
if (e1.ybot == e1.ytop) return (e2.ybot == e2.ytop);
else if (e1.xbot == e1.xtop) return (e2.xbot == e2.xtop);
else if (UseFulllongRange)
return Int128.Int128Mul(e1.ytop - e1.ybot, e2.xtop - e2.xbot) ==
Int128.Int128Mul(e1.xtop - e1.xbot, e2.ytop - e2.ybot);
else return (Int64)(e1.ytop - e1.ybot) * (e2.xtop - e2.xbot) -
(Int64)(e1.xtop - e1.xbot)*(e2.ytop - e2.ybot) == 0;
}
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:11,代码来源:clipper.cs
示例17: AddHorzJoin
//------------------------------------------------------------------------------
private void AddHorzJoin(TEdge e, int idx)
{
HorzJoinRec hj = new HorzJoinRec();
hj.edge = e;
hj.savedIdx = idx;
m_HorizJoins.Add(hj);
}
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:8,代码来源:clipper.cs
示例18: AddBoundsToLML
//---------------------------------------------------------------------------
TEdge AddBoundsToLML(TEdge e)
{
//Starting at the top of one bound we progress to the bottom where there's
//a local minima. We then go to the top of the next bound. These two bounds
//form the left and right (or right and left) bounds of the local minima.
e.nextInLML = null;
e = e.next;
for (;;)
{
if ( e.dx == horizontal )
{
//nb: proceed through horizontals when approaching from their right,
// but break on horizontal minima if approaching from their left.
// This ensures 'local minima' are always on the left of horizontals.
if (e.next.ytop < e.ytop && e.next.xbot > e.prev.xbot) break;
if (e.xtop != e.prev.xbot) SwapX(e);
e.nextInLML = e.prev;
}
else if (e.ycurr == e.prev.ycurr) break;
else e.nextInLML = e.prev;
e = e.next;
}
//e and e.prev are now at a local minima ...
LocalMinima newLm = new LocalMinima();
newLm.next = null;
newLm.Y = e.prev.ybot;
if ( e.dx == horizontal ) //horizontal edges never start a left bound
{
if (e.xbot != e.prev.xbot) SwapX(e);
newLm.leftBound = e.prev;
newLm.rightBound = e;
} else if (e.dx < e.prev.dx)
{
newLm.leftBound = e.prev;
newLm.rightBound = e;
} else
{
newLm.leftBound = e;
newLm.rightBound = e.prev;
}
newLm.leftBound.side = EdgeSide.esLeft;
newLm.rightBound.side = EdgeSide.esRight;
InsertLocalMinima( newLm );
for (;;)
{
if ( e.next.ytop == e.ytop && e.next.dx != horizontal ) break;
e.nextInLML = e.next;
e = e.next;
if ( e.dx == horizontal && e.xbot != e.prev.xtop) SwapX(e);
}
return e.next;
}
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:56,代码来源:clipper.cs
示例19: AddJoin
//------------------------------------------------------------------------------
private void AddJoin(TEdge e1, TEdge e2, int e1OutIdx, int e2OutIdx)
{
JoinRec jr = new JoinRec();
if (e1OutIdx >= 0)
jr.poly1Idx = e1OutIdx; else
jr.poly1Idx = e1.outIdx;
jr.pt1a = new IntPoint(e1.xcurr, e1.ycurr);
jr.pt1b = new IntPoint(e1.xtop, e1.ytop);
if (e2OutIdx >= 0)
jr.poly2Idx = e2OutIdx; else
jr.poly2Idx = e2.outIdx;
jr.pt2a = new IntPoint(e2.xcurr, e2.ycurr);
jr.pt2b = new IntPoint(e2.xtop, e2.ytop);
m_Joins.Add(jr);
}
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:16,代码来源:clipper.cs
示例20: InitEdge
//------------------------------------------------------------------------------
private void InitEdge(TEdge e, TEdge eNext,
TEdge ePrev, IntPoint pt, PolyType polyType)
{
e.next = eNext;
e.prev = ePrev;
e.xcurr = pt.X;
e.ycurr = pt.Y;
if (e.ycurr >= e.next.ycurr)
{
e.xbot = e.xcurr;
e.ybot = e.ycurr;
e.xtop = e.next.xcurr;
e.ytop = e.next.ycurr;
e.windDelta = 1;
} else
{
e.xtop = e.xcurr;
e.ytop = e.ycurr;
e.xbot = e.next.xcurr;
e.ybot = e.next.ycurr;
e.windDelta = -1;
}
SetDx(e);
e.polyType = polyType;
e.outIdx = -1;
}
开发者ID:colin-dumitru,项目名称:Collaborative-Whiteboard,代码行数:27,代码来源:clipper.cs
注:本文中的ClipperLib.TEdge类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论