本文整理汇总了C#中FarseerPhysics.Common.Decomposition.CDT.Delaunay.Sweep.DTSweepContext.RemoveFromList方法的典型用法代码示例。如果您正苦于以下问题:C# DTSweepContext.RemoveFromList方法的具体用法?C# DTSweepContext.RemoveFromList怎么用?C# DTSweepContext.RemoveFromList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FarseerPhysics.Common.Decomposition.CDT.Delaunay.Sweep.DTSweepContext
的用法示例。
在下文中一共展示了DTSweepContext.RemoveFromList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FinalizationConvexHull
/// <summary>
/// If this is a Delaunay Triangulation of a pointset we need to fill so the triangle mesh gets a ConvexHull
/// </summary>
private static void FinalizationConvexHull(DTSweepContext tcx)
{
DelaunayTriangle t1, t2;
AdvancingFrontNode n1 = tcx.aFront.Head.Next;
AdvancingFrontNode n2 = n1.Next;
TurnAdvancingFrontConvex(tcx, n1, n2);
// TODO: implement ConvexHull for lower right and left boundary
// Lets remove triangles connected to the two "algorithm" points
// XXX: When the first the nodes are points in a triangle we need to do a flip before
// removing triangles or we will lose a valid triangle.
// Same for last three nodes!
// !!! If I implement ConvexHull for lower right and left boundary this fix should not be
// needed and the removed triangles will be added again by default
n1 = tcx.aFront.Tail.Prev;
if (n1.Triangle.Contains(n1.Next.Point) && n1.Triangle.Contains(n1.Prev.Point))
{
t1 = n1.Triangle.NeighborAcross(n1.Point);
RotateTrianglePair(n1.Triangle, n1.Point, t1, t1.OppositePoint(n1.Triangle, n1.Point));
tcx.MapTriangleToNodes(n1.Triangle);
tcx.MapTriangleToNodes(t1);
}
n1 = tcx.aFront.Head.Next;
if (n1.Triangle.Contains(n1.Prev.Point) && n1.Triangle.Contains(n1.Next.Point))
{
t1 = n1.Triangle.NeighborAcross(n1.Point);
RotateTrianglePair(n1.Triangle, n1.Point, t1, t1.OppositePoint(n1.Triangle, n1.Point));
tcx.MapTriangleToNodes(n1.Triangle);
tcx.MapTriangleToNodes(t1);
}
// Lower right boundary
TriangulationPoint first = tcx.aFront.Head.Point;
n2 = tcx.aFront.Tail.Prev;
t1 = n2.Triangle;
TriangulationPoint p1 = n2.Point;
n2.Triangle = null;
do
{
tcx.RemoveFromList(t1);
p1 = t1.PointCCW(p1);
if (p1 == first) break;
t2 = t1.NeighborCCW(p1);
t1.Clear();
t1 = t2;
} while (true);
// Lower left boundary
first = tcx.aFront.Head.Next.Point;
p1 = t1.PointCW(tcx.aFront.Head.Point);
t2 = t1.NeighborCW(tcx.aFront.Head.Point);
t1.Clear();
t1 = t2;
while (p1 != first) //TODO: Port note. This was do while before.
{
tcx.RemoveFromList(t1);
p1 = t1.PointCCW(p1);
t2 = t1.NeighborCCW(p1);
t1.Clear();
t1 = t2;
}
// Remove current head and tail node now that we have removed all triangles attached
// to them. Then set new head and tail node points
tcx.aFront.Head = tcx.aFront.Head.Next;
tcx.aFront.Head.Prev = null;
tcx.aFront.Tail = tcx.aFront.Tail.Prev;
tcx.aFront.Tail.Next = null;
tcx.FinalizeTriangulation();
}