Code cleanup and formatting.
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sat, 14 Jul 2018 00:18:48 +0000 (03:18 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sat, 14 Jul 2018 00:18:48 +0000 (03:18 +0300)
src/main/java/eu/svjatoslav/sixth/e3d/examples/GraphDemo.java
src/main/java/eu/svjatoslav/sixth/e3d/examples/OctreeDemo.java
src/main/java/eu/svjatoslav/sixth/e3d/examples/PointCloudDemo.java
src/main/java/eu/svjatoslav/sixth/e3d/examples/RainingNumbersDemo.java
src/main/java/eu/svjatoslav/sixth/e3d/examples/RandomPolygonsDemo.java
src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java
src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/MenuPanel.java
src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Cell.java
src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Star.java

index 679e43f..c28dd14 100644 (file)
@@ -22,8 +22,7 @@ public class GraphDemo {
 
     private static final double scale = 50d;
 
-    private static Graph getCosineGraph(final Point3D location)
-            throws IOException {
+    private static Graph getCosineGraph(final Point3D location) {
         final List<Point2D> data = new ArrayList<>();
         for (double x = 0; x < 20; x += 0.25) {
             final double y = Math.cos(x);
@@ -35,8 +34,7 @@ public class GraphDemo {
         return new Graph(scale, data, "Cosine", location);
     }
 
-    private static Graph getFormula1Graph(final Point3D location)
-            throws IOException {
+    private static Graph getFormula1Graph(final Point3D location) {
         final List<Point2D> data = new ArrayList<>();
         for (double x = 0; x < 20; x += 0.25) {
             final double y = Math.sin(Math.tan(x));
@@ -60,8 +58,7 @@ public class GraphDemo {
         return new Graph(scale, data, "y = ( (10-x)^2 ) / 30", location);
     }
 
-    private static Graph getFormula3Graph(final Point3D location)
-            throws IOException {
+    private static Graph getFormula3Graph(final Point3D location) {
         final List<Point2D> data = new ArrayList<>();
         for (double x = 0; x < 20; x += 0.25) {
             final double y = Math.sin(x / 2) + Math.sin(x / 1.26);
@@ -73,8 +70,7 @@ public class GraphDemo {
         return new Graph(scale, data, "y = sin(x/2) + sin(x/1.26)", location);
     }
 
-    private static Graph getSineGraph(final Point3D location)
-            throws IOException {
+    private static Graph getSineGraph(final Point3D location) {
         final List<Point2D> data = new ArrayList<>();
         for (double x = 0; x < 20; x += 0.25) {
             final double y = Math.sin(x);
@@ -86,8 +82,7 @@ public class GraphDemo {
         return new Graph(scale, data, "Sine", location);
     }
 
-    private static Graph getTangentGraph(final Point3D location)
-            throws IOException {
+    private static Graph getTangentGraph(final Point3D location) {
         final List<Point2D> data = new ArrayList<>();
         for (double x = 0; x < 20; x += 0.25) {
             double y = Math.tan(x);
index 5e5e15f..3234445 100755 (executable)
@@ -9,10 +9,10 @@
 package eu.svjatoslav.sixth.e3d.examples;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.gui.ViewPanel;
-import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.gui.ViewFrame;
+import eu.svjatoslav.sixth.e3d.gui.ViewPanel;
 import eu.svjatoslav.sixth.e3d.gui.humaninput.WorldNavigationTracker;
+import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.renderer.octree.OctreeVolume;
 import eu.svjatoslav.sixth.e3d.renderer.octree.raytracer.Camera;
 import eu.svjatoslav.sixth.e3d.renderer.octree.raytracer.LightSource;
index 0729693..9185614 100644 (file)
@@ -9,8 +9,8 @@
 package eu.svjatoslav.sixth.e3d.examples;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.gui.ViewFrame;
+import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.renderer.raster.ShapeCollection;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.Galaxy;
 
index b88a105..c42f6f8 100644 (file)
@@ -9,16 +9,15 @@
 package eu.svjatoslav.sixth.e3d.examples;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.gui.ViewPanel;
-import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.gui.ViewFrame;
+import eu.svjatoslav.sixth.e3d.gui.ViewPanel;
 import eu.svjatoslav.sixth.e3d.gui.ViewRenderListener;
+import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
 import eu.svjatoslav.sixth.e3d.renderer.raster.ShapeCollection;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractShape;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.textcanvas.TextCanvas;
 
-import java.io.IOException;
 import java.util.Collection;
 import java.util.Random;
 
@@ -28,7 +27,7 @@ public class RainingNumbersDemo implements ViewRenderListener {
     private final static int AREA = 600;
     private final static int AREA_HALF = AREA / 2;
 
-    public static void main(final String[] args) throws IOException {
+    public static void main(final String[] args) {
         new RainingNumbersDemo().run();
     }
 
index 4f26470..82210b0 100755 (executable)
@@ -45,7 +45,7 @@ public class RandomPolygonsDemo {
     }
 
     /* I don't want very dark polygons, so ensure there is at least some
-      * brightness present. */
+     * brightness present. */
     private static double getColorChannelBrightness() {
         return Math.random() * 0.7 + 0.3f;
     }
index 4cc2a75..71395c8 100644 (file)
@@ -11,10 +11,10 @@ package eu.svjatoslav.sixth.e3d.examples;
 import eu.svjatoslav.sixth.e3d.geometry.Point2D;
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
 import eu.svjatoslav.sixth.e3d.geometry.Rectangle;
-import eu.svjatoslav.sixth.e3d.gui.ViewPanel;
-import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.gui.ViewFrame;
+import eu.svjatoslav.sixth.e3d.gui.ViewPanel;
 import eu.svjatoslav.sixth.e3d.gui.textEditorComponent.TextEditComponent;
+import eu.svjatoslav.sixth.e3d.math.Transform;
 import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
 import eu.svjatoslav.sixth.e3d.renderer.raster.ShapeCollection;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.line.LineAppearance;
index 30c7ee3..9a5dc58 100644 (file)
@@ -23,7 +23,7 @@ class MenuPanel extends JPanel {
         sequentialGroup.addComponent(new JLabel("Choose an example to launch:"));
         sequentialGroup.addComponent(new JButton(new ShowOctree()));
         sequentialGroup.addComponent(new JButton(new ShowMathGraphs()));
-        sequentialGroup.addComponent(new JButton(new ShowPointcloud()));
+        sequentialGroup.addComponent(new JButton(new ShowPointCloud()));
         sequentialGroup.addComponent(new JButton(new ShowRain()));
         sequentialGroup.addComponent(new JButton(new ShowSinusMap()));
         sequentialGroup.addComponent(new JButton(new ShowTextEditors()));
@@ -43,7 +43,7 @@ class MenuPanel extends JPanel {
     }
 
     private class ShowSinusMap extends AbstractAction {
-        public ShowSinusMap() {
+        ShowSinusMap() {
             putValue(NAME, "Wireframe sphere and ploygon landscape");
         }
 
@@ -54,22 +54,18 @@ class MenuPanel extends JPanel {
     }
 
     private class ShowRain extends AbstractAction {
-        public ShowRain() {
+        ShowRain() {
             putValue(NAME, "Raining numbers");
         }
 
         @Override
         public void actionPerformed(final ActionEvent e) {
-            try {
-                RainingNumbersDemo.main(null);
-            } catch (final IOException e1) {
-                e1.printStackTrace();
-            }
+            RainingNumbersDemo.main(null);
         }
     }
 
-    private class ShowPointcloud extends AbstractAction {
-        public ShowPointcloud() {
+    private class ShowPointCloud extends AbstractAction {
+        ShowPointCloud() {
             putValue(NAME, "Pointcloud galaxy");
         }
 
@@ -80,7 +76,7 @@ class MenuPanel extends JPanel {
     }
 
     private class ShowMathGraphs extends AbstractAction {
-        public ShowMathGraphs() {
+        ShowMathGraphs() {
             putValue(NAME, "Mathematical graphs");
         }
 
@@ -95,7 +91,7 @@ class MenuPanel extends JPanel {
     }
 
     private class ShowRandomPolygons extends AbstractAction {
-        public ShowRandomPolygons() {
+        ShowRandomPolygons() {
             putValue(NAME, "Random polygons");
         }
 
@@ -106,7 +102,7 @@ class MenuPanel extends JPanel {
     }
 
     private class ShowOctree extends AbstractAction {
-        public ShowOctree() {
+        ShowOctree() {
             putValue(NAME, "Volumetric Octree");
         }
 
@@ -117,7 +113,7 @@ class MenuPanel extends JPanel {
     }
 
     private class ShowGameOfLife extends AbstractAction {
-        public ShowGameOfLife() {
+        ShowGameOfLife() {
             putValue(NAME, "Game of Life");
         }
 
index 4d1cca0..5817148 100755 (executable)
@@ -9,7 +9,7 @@ import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.composite.base.AbstractCom
 /**
  * This class corresponds to a single cell within matrix.
  */
-public class Cell extends AbstractCompositeShape implements
+class Cell extends AbstractCompositeShape implements
         MouseInteractionController {
 
     /**
index 693c21d..ad242d0 100644 (file)
@@ -7,7 +7,7 @@ import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.GlowingPoint;
 import java.util.ArrayList;
 import java.util.List;
 
-public class Star extends GlowingPoint {
+class Star extends GlowingPoint {
     public static final int STAR_SIZE = 10;
 
     public static final int UNIQUE_STARS_COUNT = 30;