X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fgeometry%2FRectangle.java;h=1d11e72f4805ea51f8db751d9856baf85d1aadfe;hb=a3ff3683bd0a025061667b26b6fcf56fe20f0afc;hp=9d426c59d355391fe82e85564cf5fed4264d24dd;hpb=6213716671ccab6b7256de41838e1f5401ce173c;p=sixth-3d.git diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java index 9d426c5..1d11e72 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java @@ -1,15 +1,15 @@ /* - * Sixth - System for data storage, computation, exploration and interaction. - * Copyright ©2012-2016, 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; @@ -25,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); } }