projects
/
sixth-3d.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated readability of the code.
[sixth-3d.git]
/
src
/
main
/
java
/
eu
/
svjatoslav
/
sixth
/
e3d
/
geometry
/
Rectangle.java
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
b589dd6
..
1d11e72
100644
(file)
--- a/
src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java
+++ b/
src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java
@@
-1,13
+1,15
@@
/*
/*
- * Sixth 3D engine. Author: Svjatoslav Agejenko.
+ * Sixth 3D engine. Author: Svjatoslav Agejenko.
* This project is released under Creative Commons Zero (CC0) license.
* This project is released under Creative Commons Zero (CC0) license.
- *
-*
*/
*/
-
-
package eu.svjatoslav.sixth.e3d.geometry;
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 class Rectangle {
public Point2D p1, p2;
@@
-23,23
+25,19
@@
public class Rectangle {
}
public double getHeight() {
}
public double getHeight() {
- return
Math.
abs(p1.y - p2.y);
+ return abs(p1.y - p2.y);
}
public double getLowerX() {
}
public double getLowerX() {
- if (p1.x < p2.x)
- return p1.x;
- return p2.x;
+ return min(p1.x, p2.x);
}
public double getLowerY() {
}
public double getLowerY() {
- if (p1.y < p2.y)
- return p1.y;
- return p2.y;
+ return min(p1.y, p2.y);
}
public double getWidth() {
}
public double getWidth() {
- return
Math.
abs(p1.x - p2.x);
+ return abs(p1.x - p2.x);
}
}
}
}