projects
/
sixth-3d.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3e2b906
)
Updated readability of the code.
author
Svjatoslav Agejenko
<svjatoslav@svjatoslav.eu>
Tue, 28 Feb 2023 22:11:43 +0000
(
00:11
+0200)
committer
Svjatoslav Agejenko
<svjatoslav@svjatoslav.eu>
Tue, 28 Feb 2023 22:11:43 +0000
(
00:11
+0200)
src/main/java/eu/svjatoslav/sixth/e3d/geometry/Polygon.java
patch
|
blob
|
history
src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java
patch
|
blob
|
history
src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseInteractionController.java
patch
|
blob
|
history
src/main/java/eu/svjatoslav/sixth/e3d/math/Orientation.java
patch
|
blob
|
history
src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java
patch
|
blob
|
history
diff --git
a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Polygon.java
b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Polygon.java
index
9b96e5b
..
13996ee
100644
(file)
--- a/
src/main/java/eu/svjatoslav/sixth/e3d/geometry/Polygon.java
+++ b/
src/main/java/eu/svjatoslav/sixth/e3d/geometry/Polygon.java
@@
-4,6
+4,9
@@
*/
package eu.svjatoslav.sixth.e3d.geometry;
*/
package eu.svjatoslav.sixth.e3d.geometry;
+/**
+ * Utility class for polygon operations.
+ */
public class Polygon {
private static boolean intersectsLine(final Point2D point, Point2D p1,
public class Polygon {
private static boolean intersectsLine(final Point2D point, Point2D p1,
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
af40655
..
617978e
100644
(file)
--- a/
src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java
+++ b/
src/main/java/eu/svjatoslav/sixth/e3d/geometry/Rectangle.java
@@
-4,6
+4,12
@@
*/
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;
@@
-19,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);
}
}
}
}
diff --git
a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseInteractionController.java
b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseInteractionController.java
index
e29f978
..
d5f1f08
100644
(file)
--- a/
src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseInteractionController.java
+++ b/
src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/MouseInteractionController.java
@@
-4,6
+4,9
@@
*/
package eu.svjatoslav.sixth.e3d.gui.humaninput;
*/
package eu.svjatoslav.sixth.e3d.gui.humaninput;
+/**
+ * Interface that allows to handle mouse events.
+ */
public interface MouseInteractionController {
/**
public interface MouseInteractionController {
/**
diff --git
a/src/main/java/eu/svjatoslav/sixth/e3d/math/Orientation.java
b/src/main/java/eu/svjatoslav/sixth/e3d/math/Orientation.java
index
86db200
..
b889392
100644
(file)
--- a/
src/main/java/eu/svjatoslav/sixth/e3d/math/Orientation.java
+++ b/
src/main/java/eu/svjatoslav/sixth/e3d/math/Orientation.java
@@
-6,6
+6,9
@@
package eu.svjatoslav.sixth.e3d.math;
import eu.svjatoslav.sixth.e3d.geometry.Point3D;
import eu.svjatoslav.sixth.e3d.geometry.Point3D;
+/**
+ * Used to represent transformation in a 3D space.
+ */
public class Orientation implements Cloneable {
public class Orientation implements Cloneable {
diff --git
a/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java
b/src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java
index
94c359c
..
f7f64db
100755
(executable)
--- a/
src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java
+++ b/
src/main/java/eu/svjatoslav/sixth/e3d/math/Transform.java
@@
-6,6
+6,10
@@
package eu.svjatoslav.sixth.e3d.math;
import eu.svjatoslav.sixth.e3d.geometry.Point3D;
import eu.svjatoslav.sixth.e3d.geometry.Point3D;
+/**
+ * Used to represent transformation in a 3D space.
+ * Transformations are represented as a translation and an orientation.
+ */
public class Transform implements Cloneable {
private final Point3D translation;
public class Transform implements Cloneable {
private final Point3D translation;