Example #1
0
        //constructor
        public Rectangulo(Punto vertice1, Punto vertice3)
        {
            //Math.sqrt = raiz cuadrada  // math.pow= potencia

            this.ladoVertical   = Math.Abs(vertice1.getX() - vertice3.getX());
            this.ladoHorizontal = Math.Abs(vertice1.getY() - vertice3.getY());
            this.perimetro      = (this.ladoVertical * 2) + (this.ladoHorizontal * 2);
            this.area           = ladoVertical * ladoHorizontal;
        }
Example #2
0
        //constructor
        public Rectangulo(Punto vertice1, Punto vertice3)
        {
            //Math.sqrt = raiz cuadrada  // math.pow= potencia

            this.ladoVertical = Math.Abs(vertice1.getX() - vertice3.getX());
            this.ladoHorizontal = Math.Abs(vertice1.getY() - vertice3.getY());
            this.perimetro = (this.ladoVertical * 2) + (this.ladoHorizontal * 2);
            this.area = ladoVertical * ladoHorizontal;
        }
Example #3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="vertice1"></param>
        /// <param name="vertice3"></param>
        public Rectangulo(Punto vertice1, Punto vertice3)
        {
            float h;

            this.vertice1 = vertice1;
            this.vertice2 = new Punto(vertice1.getX(), vertice3.getY());
            this.vertice3 = vertice3;
            this.vertice4 = new Punto(vertice3.getX(), vertice1.getY());

            this.lado = Math.Abs(this.vertice1.getX() - this.vertice3.getX());
            h         = Math.Abs(this.vertice1.getY() - this.vertice3.getY());

            this.perimetro = lado * 2 + h * 2;
            this.area      = lado * h;
        }