本文整理汇总了C#中Vertices.RemoveRange方法的典型用法代码示例。如果您正苦于以下问题:C# Vertices.RemoveRange方法的具体用法?C# Vertices.RemoveRange怎么用?C# Vertices.RemoveRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vertices
的用法示例。
在下文中一共展示了Vertices.RemoveRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateSimplePolygon
/// <summary>
///
/// </summary>
/// <param name="entrance"></param>
/// <param name="last"></param>
/// <returns></returns>
private Vertices CreateSimplePolygon(Vector2 entrance, Vector2 last)
{
bool entranceFound = false;
bool endOfHull = false;
Vertices polygon = new Vertices(32);
Vertices hullArea = new Vertices(32);
Vertices endOfHullArea = new Vertices(32);
Vector2 current = Vector2.Zero;
#region Entrance check
// Get the entrance point. //todo: alle möglichkeiten testen
if (entrance == Vector2.Zero || !InBounds(ref entrance))
{
entranceFound = SearchHullEntrance(out entrance);
if (entranceFound)
{
current = new Vector2(entrance.X - 1f, entrance.Y);
}
}
else
{
if (IsSolid(ref entrance))
{
if (IsNearPixel(ref entrance, ref last))
{
current = last;
entranceFound = true;
}
else
{
Vector2 temp;
if (SearchNearPixels(false, ref entrance, out temp))
{
current = temp;
entranceFound = true;
}
else
{
entranceFound = false;
}
}
}
}
#endregion
if (entranceFound)
{
polygon.Add(entrance);
hullArea.Add(entrance);
Vector2 next = entrance;
do
{
// Search in the pre vision list for an outstanding point.
Vector2 outstanding;
if (SearchForOutstandingVertex(hullArea, out outstanding))
{
if (endOfHull)
{
// We have found the next pixel, but is it on the last bit of the hull?
if (endOfHullArea.Contains(outstanding))
{
// Indeed.
polygon.Add(outstanding);
}
// That's enough, quit.
break;
}
// Add it and remove all vertices that don't matter anymore
// (all the vertices before the outstanding).
polygon.Add(outstanding);
hullArea.RemoveRange(0, hullArea.IndexOf(outstanding));
}
// Last point gets current and current gets next. Our little spider is moving forward on the hull ;).
last = current;
current = next;
// Get the next point on hull.
if (GetNextHullPoint(ref last, ref current, out next))
{
// Add the vertex to a hull pre vision list.
hullArea.Add(next);
}
else
{
//.........这里部分代码省略.........