Esempio n. 1
0
        private void GenerateAndDraw()
        {
            Canvas.Children.Clear();

            var        points = JCVGenerator.GeneratePoints(PointCount, DiagramWidth, DiagramHeight, (int)SeedNumber);
            JCVDiagram d      = Voronoi.JCVDiagramGenerate(points, DiagramWidth, DiagramHeight);

            DrawEdges(d.edges);

            DrawSiteCenters(d.sites);
        }
Esempio n. 2
0
        public void JCVDiagramGenerateTest()
        {
            JCVDiagram d = Voronoi.JCVDiagramGenerate();

            float[,] coords = new float[d.edges.Count, 4];
            for (int i = 0; i < d.edges.Count; i++)
            {
                coords[i, 0] = d.edges[i].Points[0].X;
                coords[i, 1] = d.edges[i].Points[0].Y;
                coords[i, 2] = d.edges[i].Points[1].X;
                coords[i, 3] = d.edges[i].Points[1].Y;
            }
            Assert.IsTrue(d.SiteCount == 4);
        }