本文整理汇总了C#中Vertex.RightOf方法的典型用法代码示例。如果您正苦于以下问题:C# Vertex.RightOf方法的具体用法?C# Vertex.RightOf怎么用?C# Vertex.RightOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vertex
的用法示例。
在下文中一共展示了Vertex.RightOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LocateFromEdge
/// <summary>
/// Locates an edge of a triangle which contains a location
/// specified by a Vertex v.
/// The edge returned has the
/// property that either v is on e, or e is an edge of a triangle containing v.
/// The search starts from startEdge amd proceeds on the general direction of v.
/// </summary>
/// <remarks>
/// This locate algorithm relies on the subdivision being Delaunay. For
/// non-Delaunay subdivisions, this may loop for ever.
/// </remarks>
/// <param name="v">the location to search for</param>
/// <param name="startEdge">an edge of the subdivision to start searching at</param>
/// <returns>a QuadEdge which contains v, or is on the edge of a triangle containing v</returns>
/// <exception cref="LocateFailureException">
/// if the location algorithm fails to converge in a reasonable
/// number of iterations
/// </exception>
public QuadEdge LocateFromEdge(Vertex v, QuadEdge startEdge)
{
int iter = 0;
int maxIter = _quadEdges.Count;
QuadEdge e = startEdge;
while (true)
{
iter++;
/*
* So far it has always been the case that failure to locate indicates an
* invalid subdivision. So just fail completely. (An alternative would be
* to perform an exhaustive search for the containing triangle, but this
* would mask errors in the subdivision topology)
*
* This can also happen if two vertices are located very close together,
* since the orientation predicates may experience precision failures.
*/
if (iter > maxIter)
{
throw new LocateFailureException(e.ToLineSegment());
// String msg = "Locate failed to converge (at edge: " + e + ").
// Possible causes include invalid Subdivision topology or very close
// sites";
// System.err.println(msg);
// dumpTriangles();
}
if ((v.Equals(e.Orig)) || (v.Equals(e.Dest)))
{
break;
}
if (v.RightOf(e))
{
e = e.Sym;
}
else if (!v.RightOf(e.ONext))
{
e = e.ONext;
}
else if (!v.RightOf(e.DPrev))
{
e = e.DPrev;
}
else
{
// on edge or in triangle containing edge
break;
}
}
// System.out.println("Locate count: " + iter);
return e;
}