Esempio n. 1
0
        // triangulate button
        private void cmd_cut_Click(object sender, EventArgs e)
        {
            // if there's not a complete polygon yet
            if (polygon == null | status != prosess_status.POLYGON_READY)
            {
                return; // cancel prosessing
            }
            if (polygon.Length < 3)
            {
                return;
            }

            m = new mPolygonShape(polygon);             // initialize a new polygon-shape
            m.triangulate();                            // triangualete
            m.lb = listBox1;                            // assign reference of listbox
            listBox1.Items.Clear();                     // clear listbox

            Graphics g = panel_screen.CreateGraphics(); // Graphics handle

            g.Clear(Color.CornflowerBlue);              // cls screen

            // draw the result
            draw_ears(false); // wire_frame_only=false, allows filling of polygons
            draw_polygon();   // top of it, draw polygon, vertex markers
            status             = prosess_status.TRIANGULATION_COMPLETED;
            cmd_3color.Enabled = true;
        }
Esempio n. 2
0
        private void cmd_clear_Click(object sender, EventArgs e)
        {
            points.Clear(); // clear input points
            polygon = null;
            m       = null; // clear shape
            listBox1.Items.Clear();
            cmb_minumum.Items.Clear();
            cmb_other.Items.Clear();
            Graphics g = panel_screen.CreateGraphics();

            g.Clear(Color.CornflowerBlue);
            cmd_3color.Enabled  = false;
            cmd_animate.Enabled = false;
            cmd_cut.Enabled     = false;
            cmd_scan1.Enabled   = false;
            cmd_scan2.Enabled   = false;
            status = prosess_status.WAITING_USER_INPUT;
        }