Ejemplo n.º 1
0
    public Bitmap Run()
    {
        var rando = new Random();
        var pts   = new Point <double> [c];

        var maxx = w - 1;
        var maxy = h - 1;

        for (int i = 0; i < c; i++)
        {
            pts[i] = new Point <double> {
                X = rando.Next(0, maxx), Y = rando.Next(0, maxy)
            };
        }

        var hull = new Quickhull <double>(pts);

        // TODO: improve inference here.
        hull.Run();

        Draw(hull.Points, Color.Green);
        Draw(hull.Lines, Color.Red);
        Draw(hull.Hull, Color.Blue);

        return(bmp);
    }
Ejemplo n.º 2
0
    public Bitmap Run()
    {
        var rando = new Random();
        var pts   = new Point <double> [c];

        var maxx = w - 1;
        var maxy = h - 1;

        for (var i = 0; i < c; i++)
        {
            pts[i] = new Point <double> {
                X = rando.Next(0, maxx), Y = rando.Next(0, maxy)
            };
        }

        var hull = new Quickhull <double>(pts);

        hull.Run();

        hull.Points.Draw(Color.Green, gfx);
        hull.Lines.Draw(Color.Red, gfx);
        hull.Hull.Draw(Color.Blue, gfx);

        return(bmp);
    }