Exemplo n.º 1
0
        private void AddSite(Vector2f p, int index)
        {
            float weigth = (float)this.weightDistributor * 100;
            Site  site   = Site.Create(p, index, weigth);

            sites.Add(site);
            sitesIndexedByLocation[p] = site;
        }
Exemplo n.º 2
0
        private void AddSite(Vector2 p, int index)
        {
            float weigth = (float)weigthDistributor.NextDouble() * 100;
            Site  site   = Site.Create(p, index, weigth);

            sites.Add(site);
            SitesIndexedByLocation[p] = site;
        }
Exemplo n.º 3
0
        private void Init(List <Vector2f> points, Rectf plotBounds)
        {
            Profiler.BeginSample("Create sites and dict");

            if (sites == null)
            {
                sites = new List <Site>(points.Count);
            }

            if (SitesIndexedByLocation == null)
            {
                SitesIndexedByLocation = new Dictionary <Vector2f, Site>(points.Count);
            }

            Profiler.EndSample();

            Profiler.BeginSample("Add points to sites");
            for (int i = 0; i < points.Count; i++)
            {
                Vector2f p = points[i];

                float weight = (float)weightDistributor.NextDouble() * 100;
                Site  site   = Site.Create(p, i, weight);
                sites.Add(site);
                SitesIndexedByLocation[p] = site;
            }
            Profiler.EndSample();

            PlotBounds = plotBounds;

            Profiler.BeginSample("Create edges and triangles");
#if TRIANGLES
            if (triangles == null)
            {
                triangles = new List <Triangle>();
            }
#endif
            if (Edges == null)
            {
                Edges = new List <Edge>();
            }
            Profiler.EndSample();

            FortunesAlgorithm();
        }