Exemple #1
0
        public void AgregaVertice(Graphics g, int x, int y)
        {
            Vertice v = new Vertice(id);

            id++;
            vertices.Add(v);
            v.Dibujar(g, x, y);
        }
Exemple #2
0
        public void AgregaVertice(Graphics g, int x, int y)
        {
            bool    banColision = false;
            Vertice v           = new Vertice(id, x, y);

            for (int i = 0; i < vertices.Count; i++)
            {
                banColision = x <vertices[i].X + vertices[i].Radio && x> vertices[i].X && y <vertices[i].Y + vertices[i].Radio && y> vertices[i].Y;
            }

            if (!banColision)
            {
                id++;
                vertices.Add(v);
                v.Dibujar(g, x, y);
            }
        }
Exemple #3
0
        public void AgregaVertice(Graphics g, int x, int y, int width, int height)
        {
            bool    banColision = false;
            Vertice v           = new Vertice(idv, x, y);

            foreach (Vertice ver in vertices)
            {
                banColision = x - v.Radio <= ver.X + ver.Radio && x + v.Radio >= ver.X - ver.Radio && y - v.Radio <= ver.Y + ver.Radio && y + v.Radio >= ver.Y - ver.Radio;
                if (banColision)
                {
                    return;
                }
            }



            if (!banColision && v.ChecarLimites(x, y, width, height))
            {
                idv++;
                vertices.Add(v);
                v.Dibujar(g);
            }
        }