Пример #1
0
        /// <summary>
        /// Creates <see cref="QuadEdgeTriangle"/>s for all facets of a
        /// <see cref="QuadEdgeSubdivision"/> representing a triangulation.
        /// The <tt>data</tt> attributes of the <see cref="QuadEdge"/>s in the subdivision
        /// will be set to point to the triangle which contains that edge.
        /// This allows tracing the neighbour triangles of any given triangle.
        /// </summary>
        /// <param name="subdiv">The QuadEdgeSubdivision to create the triangles on.</param>
        /// <returns>A List of the created QuadEdgeTriangles</returns>
        public static IList <QuadEdgeTriangle> CreateOn(QuadEdgeSubdivision subdiv)
        {
            var visitor = new QuadEdgeTriangleBuilderVisitor();

            subdiv.VisitTriangles(visitor, false);
            return(visitor.GetTriangles());
        }
        private void Create()
        {
            if (_subdiv != null)
                return;

            Envelope siteEnv = DelaunayTriangulationBuilder.Envelope(_siteCoords);
            IList<Segment> segments = new List<Segment>();
            if (_constraintLines != null)
            {
                siteEnv.ExpandToInclude(_constraintLines.EnvelopeInternal);
                CreateVertices(_constraintLines);
                segments = CreateConstraintSegments(_constraintLines);
            }

            IEnumerable<Vertex> sites = CreateSiteVertices(_siteCoords);

            ConformingDelaunayTriangulator cdt = new ConformingDelaunayTriangulator(sites, _tolerance);
            cdt.SetConstraints(segments, new List<Vertex>(_constraintVertexMap.Values));
            cdt.FormInitialDelaunay();
            cdt.EnforceConstraints();
            _subdiv = cdt.Subdivision;
        }
 // ==================================================================
 /// <summary>
 /// Computes the Delaunay triangulation of the initial sites.
 /// </summary>
 public void FormInitialDelaunay()
 {
     ComputeBoundingBox();
     _subdiv = new QuadEdgeSubdivision(_computeAreaEnv, _tolerance);
     _subdiv.SetLocator(new LastFoundQuadEdgeLocator(_subdiv));
     _incDel = new IncrementalDelaunayTriangulator(_subdiv);
     InsertSites(_initialVertices);
 }
 /// <summary>
 /// Creates a new triangulator using the given <see cref="QuadEdgeSubdivision"/>.
 /// The triangulator uses the tolerance of the supplied subdivision.
 /// </summary>
 /// <param name="subdiv">a subdivision in which to build the TIN</param>
 public IncrementalDelaunayTriangulator(QuadEdgeSubdivision subdiv)
 {
     _subdiv = subdiv;
     _isUsingTolerance = subdiv.Tolerance > 0.0;
 }
Пример #5
0
 private static IList<QuadEdgeTriangle> ExtractTriangles(QuadEdgeSubdivision subdiv)
 {
     var qeTris = QuadEdgeTriangle.CreateOn(subdiv);
     return qeTris;
 }
        private void Create()
        {
            if (_subdiv != null) return;

            Envelope siteEnv = DelaunayTriangulationBuilder.Envelope(_siteCoords);
            _diagramEnv = siteEnv;
            // add a buffer around the final envelope
            double expandBy = Math.Max(_diagramEnv.Width, _diagramEnv.Height);
            _diagramEnv.ExpandBy(expandBy);
            if (_clipEnv != null)
                _diagramEnv.ExpandToInclude(_clipEnv);

            var vertices = DelaunayTriangulationBuilder.ToVertices(_siteCoords);
            _subdiv = new QuadEdgeSubdivision(siteEnv, _tolerance);
            IncrementalDelaunayTriangulator triangulator = new IncrementalDelaunayTriangulator(_subdiv);
            triangulator.InsertSites(vertices);
        }
Пример #7
0
 /// <summary>
 /// Creates <see cref="QuadEdgeTriangle"/>s for all facets of a
 /// <see cref="QuadEdgeSubdivision"/> representing a triangulation.
 /// The <tt>data</tt> attributes of the <see cref="QuadEdge"/>s in the subdivision
 /// will be set to point to the triangle which contains that edge.
 /// This allows tracing the neighbour triangles of any given triangle.
 /// </summary>
 /// <param name="subdiv">The QuadEdgeSubdivision to create the triangles on.</param>
 /// <returns>A List of the created QuadEdgeTriangles</returns>
 public static IList<QuadEdgeTriangle> CreateOn(QuadEdgeSubdivision subdiv)
 {
     var visitor = new QuadEdgeTriangleBuilderVisitor();
     subdiv.VisitTriangles(visitor, false);
     return visitor.GetTriangles();
 }
        private void Create()
        {
            if (_subdiv != null) return;

            var siteEnv = Envelope(_siteCoords);
            var vertices = ToVertices(_siteCoords);
            _subdiv = new QuadEdgeSubdivision(siteEnv, _tolerance);
            IncrementalDelaunayTriangulator triangulator = new IncrementalDelaunayTriangulator(_subdiv);
            triangulator.InsertSites(vertices);
        }