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; }
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); }