/// <summary> /// Calculate width of Rectangulo /// </summary> /// <returns>The width of rectangulo</returns> private float CalcularWidthRectangulo() { float widthRectangulo; widthRectangulo = Math.Abs(vertice1.GetX() - vertice3.GetX()); return(widthRectangulo); }
/// <summary> /// Method to build a Rectangulo with vertice1 and vertice3 /// </summary> /// <param name="vertice1">Class Punto</param> /// <param name="vertice3">Class Punto</param> public Rectangulo(Punto vertice1, Punto vertice3) { int puntosX; int puntosY; //With vertice1 and vertice3 calculate the other vertices //using method Abs from Math puntosX = Math.Abs(vertice1.GetX() - vertice3.GetX()); puntosY = Math.Abs(vertice1.GetY() - vertice3.GetY()); //All vertices for the Rectangulo this.vertice1 = vertice1; this.vertice2 = new Punto(vertice1.GetX() + puntosX, vertice1.GetY()); this.vertice3 = vertice3; this.vertice4 = new Punto(vertice1.GetX(), vertice1.GetY() + puntosY); }