Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            GrahamScan   ch = new GrahamScan();
            IPositionSet ps = ch.ConvexHull(getPoints2((Bitmap)pictureBox1.Image));
            Graphics     g  = Graphics.FromImage(pictureBox1.Image);
            IPosition    p1 = ps.GetPosition();
            IPosition    p2 = ps.GetPosition();

            while (p2 != null)
            {
                g.DrawLine(new Pen(Color.Green), new PointF(p1.GetX(), p1.GetY()), new PointF(p2.GetX(), p2.GetY()));
                p1 = p2;
                p2 = ps.GetPosition();
            }
            ps.InitToTraverseSet();
            p2 = ps.GetPosition();
            g.DrawLine(new Pen(Color.Green), new PointF(p1.GetX(), p1.GetY()), new PointF(p2.GetX(), p2.GetY()));

            pictureBox1.Refresh();
        }
        void GSCH(double n, Object o)
        {
            GrahamScan GS = new GrahamScan();

            GS.ConvexHull((IPositionSet)o);
        }