Updated readability of the code.
[sixth-3d.git] / src / main / java / eu / svjatoslav / sixth / e3d / geometry / Rectangle.java
index af40655..617978e 100644 (file)
@@ -4,6 +4,12 @@
  */
 package eu.svjatoslav.sixth.e3d.geometry;
 
+import static java.lang.Math.abs;
+import static java.lang.Math.min;
+
+/**
+ * Rectangle class.
+ */
 public class Rectangle {
 
     public Point2D p1, p2;
@@ -19,23 +25,19 @@ public class Rectangle {
     }
 
     public double getHeight() {
-        return Math.abs(p1.y - p2.y);
+        return abs(p1.y - p2.y);
     }
 
     public double getLowerX() {
-        if (p1.x < p2.x)
-            return p1.x;
-        return p2.x;
+        return min(p1.x, p2.x);
     }
 
     public double getLowerY() {
-        if (p1.y < p2.y)
-            return p1.y;
-        return p2.y;
+        return min(p1.y, p2.y);
     }
 
     public double getWidth() {
-        return Math.abs(p1.x - p2.x);
+        return abs(p1.x - p2.x);
     }
 
 }