当前位置: 首页>>代码示例>>C#>>正文


C# Vertex.IsInCircle方法代码示例

本文整理汇总了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);
        }
开发者ID:Walt-D-Cat,项目名称:NetTopologySuite,代码行数:55,代码来源:IncrementalDelaunayTriangulator.cs


注:本文中的Vertex.IsInCircle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。