Example #1
0
        private void btnCut_Click(object sender, EventArgs e)
        {
            Cutter.SetAB(ManagerDraw.Cutter.A, ManagerDraw.Cutter.B);
            ManagerDraw.DrawCutter();

            foreach (var line in ManagerDraw.Lines)
            {
                var points = Cutter.Cut(line.A, line.B);
                if (points != null)
                {
                    ManagerDraw.DrawCuttedLine(points[0], points[1]);
                }
            }
            pbCanvas.Refresh();
        }
Example #2
0
        private void Cut()
        {
            try
            {
                Cutter.Points = new List <Point>(ManagerDraw.Cutter);

                foreach (var line in ManagerDraw.Lines)
                {
                    var points = Cutter.Cut(line.A, line.B);
                    if (points != null)
                    {
                        ManagerDraw.DrawCuttedLine(points[0], points[1]);
                    }
                }
            }
            catch (NoConvexCutterException e)
            {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
        private void Cut()
        {
            try
            {
                Cutter.Points = new List <Point>(ManagerDraw.Cutter);

                var points = Cutter.Cut(ManagerDraw.Polygon.Points);
                if (points != null)
                {
                    for (int i = 1; i < points.Count(); i++)
                    {
                        ManagerDraw.DrawCuttedLine(points[i - 1], points[i]);
                    }

                    ManagerDraw.DrawCuttedLine(points.Last(), points.First());
                }
            }
            catch (NoConvexCutterException e)
            {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }