From: Svjatoslav Agejenko Date: Sat, 14 Jul 2018 00:18:48 +0000 (+0300) Subject: Code cleanup and formatting. X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;ds=inline;h=63b799f7add2ebb5cd30b50c2581bc246f6e7b82;p=sixth-3d-demos.git Code cleanup and formatting. --- diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/GraphDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/GraphDemo.java index 679e43f..c28dd14 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/GraphDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/GraphDemo.java @@ -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 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 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 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 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 data = new ArrayList<>(); for (double x = 0; x < 20; x += 0.25) { double y = Math.tan(x); diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/OctreeDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/OctreeDemo.java index 5e5e15f..3234445 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/OctreeDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/OctreeDemo.java @@ -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; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/PointCloudDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/PointCloudDemo.java index 0729693..9185614 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/PointCloudDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/PointCloudDemo.java @@ -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; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/RainingNumbersDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/RainingNumbersDemo.java index b88a105..c42f6f8 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/RainingNumbersDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/RainingNumbersDemo.java @@ -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(); } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/RandomPolygonsDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/RandomPolygonsDemo.java index 4f26470..82210b0 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/RandomPolygonsDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/RandomPolygonsDemo.java @@ -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; } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java index 4cc2a75..71395c8 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/TextEditorDemo.java @@ -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; diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/MenuPanel.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/MenuPanel.java index 30c7ee3..9a5dc58 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/MenuPanel.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/launcher/MenuPanel.java @@ -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"); } diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Cell.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Cell.java index 4d1cca0..5817148 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Cell.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Cell.java @@ -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 { /** diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Star.java b/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Star.java index 693c21d..ad242d0 100644 --- a/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Star.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/examples/life/Star.java @@ -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;