Exemplo n.º 1
0
        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);
            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;
        }