From: Svjatoslav Agejenko Date: Sun, 28 Aug 2022 03:14:51 +0000 (+0300) Subject: Improved JavaDoc. X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=0f7068dde61bcdbee69782182607015132dc1060;p=sixth-3d.git Improved JavaDoc. --- diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point2D.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point2D.java index e22808c..a82382f 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point2D.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point2D.java @@ -18,14 +18,19 @@ public class Point2D implements Cloneable { this.y = y; } - public Point2D(final Point2D source) { - x = source.x; - y = source.y; + public Point2D(final Point2D parent) { + x = parent.x; + y = parent.y; } - public Point2D add(final Point2D direction) { - x += direction.x; - y += direction.y; + /** + * Add other point to current point. + * + * @return current point. + */ + public Point2D add(final Point2D otherPoint) { + x += otherPoint.x; + y += otherPoint.y; return this; } @@ -38,9 +43,9 @@ public class Point2D implements Cloneable { return new Point2D(this); } - public void clone(final Point2D source) { - x = source.x; - y = source.y; + public void clone(final Point2D parent) { + x = parent.x; + y = parent.y; } public Point2D getMiddle(final Point2D p1, final Point2D p2) { @@ -78,9 +83,14 @@ public class Point2D implements Cloneable { y = (int) y; } - public Point2D subtract(final Point2D point) { - x -= point.x; - y -= point.y; + /** + * Subtract other point from current point. + * + * @return current point. + */ + public Point2D subtract(final Point2D otherPoint) { + x -= otherPoint.x; + y -= otherPoint.y; return this; } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java index 54fbd35..e2c9868 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/geometry/Point3D.java @@ -35,16 +35,24 @@ public class Point3D implements Cloneable { this.z = z; } - public Point3D(final Point3D parentPoint) { - x = parentPoint.x; - y = parentPoint.y; - z = parentPoint.z; + /** + * Creates new current point by cloning coordinates from parent point. + */ + public Point3D(final Point3D parent) { + x = parent.x; + y = parent.y; + z = parent.z; } - public Point3D add(final Point3D direction) { - x += direction.x; - y += direction.y; - z += direction.z; + /** + * Add other point to current point. + * + * @return current point. + */ + public Point3D add(final Point3D otherPoint) { + x += otherPoint.x; + y += otherPoint.y; + z += otherPoint.z; return this; } @@ -52,10 +60,10 @@ public class Point3D implements Cloneable { return new Point3D(this); } - public Point3D clone(final Point3D source) { - x = source.x; - y = source.y; - z = source.z; + public Point3D clone(final Point3D parent) { + x = parent.x; + y = parent.y; + z = parent.z; return this; } @@ -153,10 +161,15 @@ public class Point3D implements Cloneable { this.z = z; } - public Point3D subtract(final Point3D direction) { - x -= direction.x; - y -= direction.y; - z -= direction.z; + /** + * Subtract other point from current point. + * + * @return current point. + */ + public Point3D subtract(final Point3D otherPoint) { + x -= otherPoint.x; + y -= otherPoint.y; + z -= otherPoint.z; return this; } @@ -165,33 +178,45 @@ public class Point3D implements Cloneable { return "x:" + x + " y:" + y + " z:" + z; } + /** + * @return current point. + */ public Point3D translateX(final double xIncrement) { x += xIncrement; return this; } + /** + * @return current point. + */ public Point3D translateY(final double yIncrement) { y += yIncrement; return this; } + /** + * @return current point. + */ public Point3D translateZ(final double zIncrement) { z += zIncrement; return this; } + /** + * Here we assume that Z coordinate is distance to the viewer. + * If Z is positive, then point is in front of the viewer, and therefore it is visible. + * + * @return point visibility status. + */ public boolean isVisible() { - - if (z > 0) - return true; - - // if ((z > 0) && (x > -1000) && (y > -1000) && (x < 2000) && (y < - // 2000)) - // return true; - - return false; + return z > 0; } + /** + * Resets point to 0 coordinate in X, Y and Z axis. + * + * @return current point. + */ public Point3D zero() { x = 0; y = 0; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewPanel.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewPanel.java index 7cf2b2f..7f9b7eb 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewPanel.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/ViewPanel.java @@ -34,11 +34,13 @@ public class ViewPanel extends JPanel implements ComponentListener { private Timer canvasUpdateTimer; private ViewUpdateTimerTask canvasUpdateTimerTask; private RenderingContext renderingContext = null; + /** - * Currently target FPS for this view. It can be changed at runtime. Also when nothing - * changes in the view, then frames are not really repainted. + * Currently target frames per second rate for this view. Target FPS can be changed at runtime. + * 3D engine tries to be smart and only repaints screen when there are visible changes. */ private int targetFPS = 60; + /** * Set to true if it is known than next frame reeds to be painted. Flag is cleared * immediately after frame got updated.