Esempio n. 1
0
        private Poligon UpdateHull(Poligon hull, List <PointF> sortedPoints, int index)
        {
            int hullSize    = hull.GetNumberOfPoints();
            int orientation = OrientationTest(hull.GetPointAt(hullSize - 2), hull.GetPointAt(hullSize - 1), sortedPoints[index]);

            if (orientation == 2)
            {
                hull.AddPoint(sortedPoints[index]);
                Console.Write(sortedPoints[index].X + " " + sortedPoints[index].Y);
            }

            else if (orientation == 1)
            {
                hull.RemovePoint();
                hull.AddPoint(sortedPoints[index]);
                Console.Write(sortedPoints[index].X + " " + sortedPoints[index].Y);
            }

            else
            {
                PointF furthestPoint = HighestY(hull.GetPointAt(hullSize - 1), sortedPoints[index]);
                hull.RemovePoint();
                hull.AddPoint(furthestPoint);
                Console.Write(furthestPoint.X + " " + furthestPoint.Y);
            }

            return(hull);
        }
Esempio n. 2
0
        private void removeBtn_Click(object sender, EventArgs e)
        {
            poligon.RemovePoint();

            try
            {
                grafic.Series["Puncte poligon"].Points.RemoveAt(poligon.GetNumberOfPoints());

                if (grafic.Series["Puncte poligon"].Points.Count == 0)
                {
                    grafic.Series["Puncte poligon"].Points.AddXY(0, 0);
                    numberOfClicks = 0;
                }
            }
            catch (ArgumentOutOfRangeException ex)
            {
            }
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            grafic.Series["Puncte poligon"].Points.Clear();
            grafic.Series["Puncte acoperire convexa"].Points.Clear();
            grafic.Series["Acoperire convexa"].Points.Clear();

            grafic.Series["Puncte poligon"].Points.AddXY(0, 0);
            grafic.Series["Puncte poligon"].Points[0].Color = Color.Transparent;
            numberOfClicks = 0;

            int n = poligon.GetNumberOfPoints();

            for (int i = 0; i <= n; ++i)
            {
                poligon.RemovePoint();
            }

            n = acoperireConvexa.GetNumberOfPoints();
            for (int i = 0; i < n; ++i)
            {
                acoperireConvexa.RemovePoint();
            }
        }