/*
- * Sixth 3D engine. Copyright ©2012-2020, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 3 of the GNU Lesser General Public License
- * or later as published by the Free Software Foundation.
- *
+ * Sixth 3D engine. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
*/
-
-
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;
}
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);
}
}