Exemplo n.º 1
0
        private int Orient(myPoint p1, myPoint p2, myPoint p3)
        {
            float val = (p2.Y - p1.Y) * (p3.X - p2.X) - (p2.X - p1.X) * (p3.Y - p2.Y);

            if (val == 0)
            {
                return(0);
            }
            return((val > 0) ? 1 : 2);
        }
Exemplo n.º 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            float min_y = Engine.points[0].Y;
            int   min   = 0;

            for (int i = 1; i < Engine.points.Count; i++)
            {
                float y = Engine.points[i].Y;

                if ((y < min_y) || (y == min_y && Engine.points[i].X < Engine.points[min].X))
                {
                    min_y = Engine.points[i].Y;

                    min = i;
                }
            }

            (Engine.points[0], Engine.points[min]) = (Engine.points[min], Engine.points[0]);

            myPoint p0 = Engine.points[0];
        }
Exemplo n.º 3
0
 private float Dist(myPoint p1, myPoint p2)
 {
     return((p1.X - p2.X) * (p1.X - p2.X) + (p1.Y - p2.Y) * (p1.Y - p2.Y));
 }