本文整理汇总了C#中Vertex.IsInCircle方法的典型用法代码示例。如果您正苦于以下问题:C# Vertex.IsInCircle方法的具体用法?C# Vertex.IsInCircle怎么用?C# Vertex.IsInCircle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vertex
的用法示例。
在下文中一共展示了Vertex.IsInCircle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertSite
/// <summary>
/// Inserts a new point into a subdivision representing a Delaunay
/// triangulation, and fixes the affected edges so that the result is still a
/// Delaunay triangulation.
/// </summary>
/// <returns>a quadedge containing the inserted vertex</returns>
public NetTopologySuite.Triangulate.QuadEdge.QuadEdge InsertSite(Vertex v)
{
/*
* This code is based on Guibas and Stolfi (1985), with minor modifications
* and a bug fix from Dani Lischinski (Graphic Gems 1993). (The modification
* I believe is the test for the inserted site falling exactly on an
* existing edge. Without this test zero-width triangles have been observed
* to be created)
*/
var e = _subdiv.Locate(v);
if (_subdiv.IsVertexOfEdge(e, v)) {
// point is already in subdivision.
return e;
}
if (_subdiv.IsOnEdge(e, v.Coordinate))
{
// the point lies exactly on an edge, so delete the edge
// (it will be replaced by a pair of edges which have the point as a vertex)
e = e.OPrev;
_subdiv.Delete(e.ONext);
}
/*
* Connect the new point to the vertices of the containing triangle
* (or quadrilateral, if the new point fell on an existing edge.)
*/
var baseQuadEdge = _subdiv.MakeEdge(e.Orig, v);
NetTopologySuite.Triangulate.QuadEdge.QuadEdge.Splice(baseQuadEdge, e);
var startEdge = baseQuadEdge;
do {
baseQuadEdge = _subdiv.Connect(e, baseQuadEdge.Sym);
e = baseQuadEdge.OPrev;
} while (e.LNext != startEdge);
// Examine suspect edges to ensure that the Delaunay condition
// is satisfied.
do {
var t = e.OPrev;
if (t.Dest.RightOf(e) && v.IsInCircle(e.Orig, t.Dest, e.Dest)) {
NetTopologySuite.Triangulate.QuadEdge.QuadEdge.Swap(e);
e = e.OPrev;
} else if (e.ONext == startEdge) {
return baseQuadEdge; // no more suspect edges.
} else {
e = e.ONext.LPrev;
}
} while (true);
}