Changed license to Creative Commons Zero (CC0).
[sixth-3d-demos.git] / src / main / java / eu / svjatoslav / sixth / e3d / examples / GraphDemo.java
index 79027b0..ce5f1c6 100644 (file)
@@ -1,11 +1,8 @@
 /*
- * Sixth - System for data storage, computation, exploration and interaction.
- * Copyright ©2012-2016, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- * 
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 3 of the GNU Lesser General Public License
- * or later as published by the Free Software Foundation.
- */
+ * Sixth 3D engine demos. Author: Svjatoslav Agejenko. 
+ * This project is released under Creative Commons Zero (CC0) license.
+ *
+*/
 
 package eu.svjatoslav.sixth.e3d.examples;
 
@@ -23,8 +20,7 @@ public class GraphDemo {
 
     private static final double scale = 50d;
 
-    private static Graph getCosinusGraph(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);
@@ -33,11 +29,10 @@ public class GraphDemo {
             data.add(p);
         }
 
-        return new Graph(scale, data, "Cosinus", location);
+        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));
@@ -49,8 +44,7 @@ public class GraphDemo {
         return new Graph(scale, data, "y = sin(tan(x))", location);
     }
 
-    private static Graph getFormula2Graph(final Point3D location)
-            throws IOException {
+    private static Graph getFormula2Graph(final Point3D location) {
         final List<Point2D> data = new ArrayList<>();
         for (double x = 0; x < 20; x += 0.25) {
             final double y = (Math.pow((10 - x), 2) / 30) - 2;
@@ -62,8 +56,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);
@@ -75,8 +68,7 @@ public class GraphDemo {
         return new Graph(scale, data, "y = sin(x/2) + sin(x/1.26)", location);
     }
 
-    private static Graph getSinusGraph(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);
@@ -85,11 +77,10 @@ public class GraphDemo {
             data.add(p);
         }
 
-        return new Graph(scale, data, "Sinus", location);
+        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);
@@ -110,17 +101,17 @@ public class GraphDemo {
 
         final ViewFrame viewFrame = new ViewFrame();
 
-        final ShapeCollection geometryCollection = viewFrame.getView()
-                .getContext().getRootShapeCollection();
+        final ShapeCollection geometryCollection = viewFrame.getViewPanel()
+                .getRootShapeCollection();
 
         Point3D location = new Point3D(-600, -300, 0);
-        geometryCollection.addShape(getSinusGraph(location));
+        geometryCollection.addShape(getSineGraph(location));
 
         location = new Point3D(600, -300, 0);
         geometryCollection.addShape(getFormula1Graph(location));
 
         location = new Point3D(-600, 0, 0);
-        geometryCollection.addShape(getCosinusGraph(location));
+        geometryCollection.addShape(getCosineGraph(location));
 
         location = new Point3D(600, 0, 0);
         geometryCollection.addShape(getFormula2Graph(location));
@@ -131,7 +122,7 @@ public class GraphDemo {
         location = new Point3D(600, 300, 0);
         geometryCollection.addShape(getFormula3Graph(location));
 
-        viewFrame.getView().getContext().getAvatar()
+        viewFrame.getViewPanel().getAvatar()
                 .setLocation(new Point3D(0, 0, -500));
 
     }