Exemple #1
0
        public Rectangulo(Punto Vertice1, Punto Vertice3)
        {
            this.Vertice1 = new Punto(Math.Abs(Vertice1.GetX()), Math.Abs(Vertice1.GetY()));
            this.Vertice3 = new Punto(Math.Abs(Vertice3.GetX()), Math.Abs(Vertice3.GetY()));
            this.Vertice2 = new Punto(Math.Abs(Vertice1.GetX()), Math.Abs(Vertice3.GetY()));
            this.Vertice4 = new Punto(Math.Abs(Vertice3.GetX()), Math.Abs(Vertice1.GetY()));

            float Base   = Vertice4.GetX() - Vertice1.GetX();
            float Altura = Vertice1.GetY() - Vertice2.GetY();

            this.area      = (Base * Altura);
            this.perimetro = (this.Area() * 2);
        }
        public int Altura(Punto dos)
        {
            int vertice2Y = Math.Abs(dos.GetY());
            int vertice1Y = Math.Abs(this.vertice1.GetY());

            return(vertice2Y - vertice1Y);
        }
Exemple #3
0
        public Rectangulo(Punto vertice1, Punto vertice3)
        {
            this.vertice1 = vertice1;
            this.vertice3 = vertice3;
            Punto aux  = new Punto(vertice1.GetX(), vertice3.GetY());
            Punto aux2 = new Punto(vertice3.GetX(), vertice1.GetY());

            this.vertice2  = aux;
            this.vertice4  = aux;
            this.area      = 0;
            this.perimetro = 0;
        }