diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..f00af9b
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000..2a706a0
--- /dev/null
+++ b/.project
@@ -0,0 +1,17 @@
+
+
+ Mathe-Simulation-Gruppe4
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/Geodaten_Erdkugel.png b/Geodaten_Erdkugel.png
new file mode 100644
index 0000000..4867e93
Binary files /dev/null and b/Geodaten_Erdkugel.png differ
diff --git a/bin/.gitignore b/bin/.gitignore
new file mode 100644
index 0000000..33628ba
--- /dev/null
+++ b/bin/.gitignore
@@ -0,0 +1,2 @@
+/app/
+/utils/
diff --git a/src/app/_0_Constants.java b/src/app/_0_Constants.java
new file mode 100644
index 0000000..d993678
--- /dev/null
+++ b/src/app/_0_Constants.java
@@ -0,0 +1,42 @@
+package app;
+
+public class _0_Constants {
+ public static int WINDOW_WIDTH = 800;
+ public static int WINDOW_HEIGHT = 600;
+
+ public static int FPS = 200;
+ public static int TPF = 1000 / FPS;
+
+ public static double TIMESCALE = 1;
+
+ // Eigene Konstanten
+
+ // Startpunkte
+ public static double START_X = WINDOW_WIDTH / 2;
+ public static double START_Y= WINDOW_HEIGHT / 2;
+
+ // Skalierungsfaktor und Drehung der X-Achse
+ public static double S1 = (1 / Math.sqrt(2) / 3);
+ public static double ALPHA = Math.toRadians(135);
+
+ // Radius
+ public static int DIAMETER = 400;
+ public static int RADIUS = DIAMETER / 2;
+ public static int DIAMETER_KUGEL = 10;
+ public static int RADIUS_KUGEL = DIAMETER_KUGEL / 2;
+
+ // Axes
+ public static double[][] NULLVECTOR_X = new double[][] { {RADIUS}, {0}, {0}, {1} };
+ public static double[][] NULLVECTOR_Y = new double[][] { {0}, {RADIUS}, {0}, {1} };
+ public static double[][] NULLVECTOR_Z = new double[][] { {0}, {0}, {RADIUS}, {1} };
+ public static double[][] ZENTRUM = new double[][] { {0}, {0}, {0}, {1} };
+
+ // Axes Optional
+ public static double[][] NULLVECTOR_MINUS_X = new double[][] { {-RADIUS}, {0}, {0}, {1} };
+ public static double[][] NULLVECTOR_MINUS_Y = new double[][] { {0}, {-RADIUS}, {0}, {1} };
+ public static double[][] NULLVECTOR_MINUS_Z = new double[][] { {0}, {0}, {-RADIUS}, {1} };
+
+ // Simulation
+ public static double VELOCITY = 10;
+
+}
diff --git a/src/app/_0_Matrices.java b/src/app/_0_Matrices.java
new file mode 100644
index 0000000..804d6f7
--- /dev/null
+++ b/src/app/_0_Matrices.java
@@ -0,0 +1,47 @@
+package app;
+
+public class _0_Matrices {
+
+ public static double[][] M_JavaNormalized = new double[][] {
+ { -(_0_Constants.S1) * Math.sin(_0_Constants.ALPHA), 1, 0, _0_Constants.START_X},
+ { -(_0_Constants.S1) * Math.cos(_0_Constants.ALPHA), 0, -1, _0_Constants.START_Y},
+ };
+
+
+ public static double[][] M_JavaNormalized_Umriss = new double[][] {
+ { -(_0_Constants.S1) * Math.sin(_0_Constants.ALPHA), 1, 0},
+ { (_0_Constants.S1) * Math.cos(_0_Constants.ALPHA), 0, -1},
+ };
+
+ public static double[][] DrehungX(double winkel) {
+ return new double[][] {
+ { 1, 0, 0},
+ { 0, Math.cos(winkel), -Math.sin(winkel) },
+ { 0, Math.sin(winkel), Math.cos(winkel) } };
+ }
+ public static double[][] DrehungY(double theta) {
+ return new double[][] {
+ { Math.cos(theta), 0, -Math.sin(theta) },
+ { 0, 1, 0 },
+ { Math.sin(theta), 0, Math.cos(theta) }
+ };
+ }
+ public static double[][] DrehungZ(double phi) {
+ return new double[][] {
+ { Math.cos(phi), -Math.sin(phi), 0 },
+ { Math.sin(phi), Math.cos(phi), 0 },
+ { 0, 0, 1 }
+ };
+ }
+
+ public static double[][] START = new double[][] {
+ {_0_Constants.RADIUS * Math.cos( Math.toRadians(45) ) * Math.cos( Math.toRadians(230) )},
+ {_0_Constants.RADIUS * Math.cos( Math.toRadians(45) ) * Math.sin( Math.toRadians(230) )},
+ {_0_Constants.RADIUS * Math.sin( Math.toRadians(45) ) }
+ };
+ public static double[][] END = new double[][] {
+ {_0_Constants.RADIUS * Math.cos( Math.toRadians(-35) ) * Math.cos( Math.toRadians(30) )},
+ {_0_Constants.RADIUS * Math.cos( Math.toRadians(-35) ) * Math.sin( Math.toRadians(30) )},
+ {_0_Constants.RADIUS * Math.sin( Math.toRadians(-35) ) }
+ };
+}
diff --git a/src/app/_1_GeoAnimation_CreateAnimation.java b/src/app/_1_GeoAnimation_CreateAnimation.java
new file mode 100644
index 0000000..4d14075
--- /dev/null
+++ b/src/app/_1_GeoAnimation_CreateAnimation.java
@@ -0,0 +1,46 @@
+package app;
+
+import java.util.Timer;
+
+//import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+import utils.ApplicationTime;
+import utils.FrameUpdate;
+
+public class _1_GeoAnimation_CreateAnimation {
+
+ private static JFrame frame;
+
+ public static void main(String[] args) {
+
+ //open new thread for time measurement
+ ApplicationTime animThread = new ApplicationTime();
+ animThread.start();
+
+ CreateFrame(animThread);
+
+ Timer timer = new Timer();
+ timer.scheduleAtFixedRate(new FrameUpdate(frame), 100, _0_Constants.TPF);
+ }
+
+ //create a JFrame as my container for the simulation content
+ private static void CreateFrame(ApplicationTime thread) {
+
+ //Create a new frame
+ frame = new JFrame("Mathematik und Simulation");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ //Add a JPanel as the new drawing surface
+ JPanel panel = new _1_GeoAnimation_DrawingOperations(thread);
+ frame.add(panel);
+ frame.pack(); //adjusts size of the JFrame to fit the size of it's components
+ frame.setVisible(true);
+
+ // TODO Add other stuff
+// JButton button = new JButton("Click here!");
+// frame.add(button);
+ }
+
+}
diff --git a/src/app/_1_GeoAnimation_DrawingOperations.java b/src/app/_1_GeoAnimation_DrawingOperations.java
new file mode 100644
index 0000000..b9cb7ca
--- /dev/null
+++ b/src/app/_1_GeoAnimation_DrawingOperations.java
@@ -0,0 +1,162 @@
+package app;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import javax.swing.JPanel;
+//import javax.swing.colorchooser.*;
+
+import com.sun.org.apache.xalan.internal.templates.Constants;
+
+import utils.ApplicationTime;
+
+import java.util.Collections;
+
+@SuppressWarnings({ "serial", "unused" })
+public class _1_GeoAnimation_DrawingOperations extends JPanel{
+ // panel has a single time tracking thread associated with it
+ private ApplicationTime t;
+ private double time;
+
+ public _1_GeoAnimation_DrawingOperations(ApplicationTime thread) {
+ this.t = thread;
+ }
+
+ // set this panel's preferred size for auto-sizing the container JFrame
+ public Dimension getPreferredSize() {
+ return new Dimension(_0_Constants.WINDOW_WIDTH, _0_Constants.WINDOW_HEIGHT);
+ }
+
+ // Objekt-Attribute
+ _2_Methods Meth = new _2_Methods();
+// double[][] drehMatrix = Meth.drehBewegung();
+ ArrayList WegX = new ArrayList();
+ ArrayList WegY = new ArrayList();
+ double distance = Meth.startToEnd();
+ double differencePhi = Meth.getPhi(_0_Matrices.END) - Meth.getPhi(_0_Matrices.START);
+ double differenceTheta = Meth.getTheta(_0_Matrices.END) - Meth.getTheta(_0_Matrices.START);
+
+ // DRAWING OPERATIONS IN HERE
+ @Override protected void paintComponent(Graphics g) {
+
+ super.paintComponent(g);
+ time = t.GetTimeInSeconds();
+
+ Graphics2D g2d;
+ g2d = (Graphics2D) g;
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
+
+ // Drawing Background
+ g2d.setColor(Color.BLACK);
+ g2d.fillRect(0, 0, _0_Constants.WINDOW_WIDTH, _0_Constants.WINDOW_HEIGHT);
+
+ // Random Text
+ g2d.setColor(Color.WHITE);
+ g2d.setFont(new Font("Arial", Font.BOLD, 15));
+ g2d.drawString("FÜRCHTET DIESEN TEXT MUAHAHAHAHA", 10, 30);
+ for(int breitengrad = -90; breitengrad <= 90; breitengrad += 30) {
+ double[][] text = new double[][] {
+ {(_0_Constants.RADIUS + 40) * Math.cos( Math.toRadians(breitengrad) ) * Math.cos( Math.toRadians(270) ) },
+ {(_0_Constants.RADIUS + 40) * Math.cos( Math.toRadians(breitengrad) ) * Math.sin( Math.toRadians(270) ) },
+ {(_0_Constants.RADIUS + 40) * Math.sin( Math.toRadians(breitengrad) ) },
+ {1}
+ };
+ g2d.drawString(String.valueOf(breitengrad)+"°", Meth.getCoords(text, "x")-15, Meth.getCoords(text, "y"));
+ }
+
+ // Drawing Coordinate-System
+ g2d.setColor(Color.RED);
+ g2d.drawLine(Meth.getCoords(_0_Constants.ZENTRUM, "x"), Meth.getCoords(_0_Constants.ZENTRUM, "y"), Meth.getCoords(_0_Constants.NULLVECTOR_X, "x"), Meth.getCoords(_0_Constants.NULLVECTOR_X, "y") );
+ g2d.drawLine(Meth.getCoords(_0_Constants.ZENTRUM, "x"), Meth.getCoords(_0_Constants.ZENTRUM, "y"), Meth.getCoords(_0_Constants.NULLVECTOR_MINUS_X, "x"), Meth.getCoords(_0_Constants.NULLVECTOR_MINUS_X, "y") );
+ g2d.setColor(Color.GREEN);
+ g2d.drawLine(Meth.getCoords(_0_Constants.ZENTRUM, "x"), Meth.getCoords(_0_Constants.ZENTRUM, "y"), Meth.getCoords(_0_Constants.NULLVECTOR_Y, "x"), Meth.getCoords(_0_Constants.NULLVECTOR_Y, "y") );
+ g2d.drawLine(Meth.getCoords(_0_Constants.ZENTRUM, "x"), Meth.getCoords(_0_Constants.ZENTRUM, "y"), Meth.getCoords(_0_Constants.NULLVECTOR_MINUS_Y, "x"), Meth.getCoords(_0_Constants.NULLVECTOR_MINUS_Y, "y") );
+ g2d.setColor(Color.BLUE);
+ g2d.drawLine(Meth.getCoords(_0_Constants.ZENTRUM, "x"), Meth.getCoords(_0_Constants.ZENTRUM, "y"), Meth.getCoords(_0_Constants.NULLVECTOR_Z, "x"), Meth.getCoords(_0_Constants.NULLVECTOR_Z, "y") );
+ g2d.drawLine(Meth.getCoords(_0_Constants.ZENTRUM, "x"), Meth.getCoords(_0_Constants.ZENTRUM, "y"), Meth.getCoords(_0_Constants.NULLVECTOR_MINUS_Z, "x"), Meth.getCoords(_0_Constants.NULLVECTOR_MINUS_Z, "y") );
+
+ // Drawing The Globus
+ double[][] erdkreis = new double[4][1];
+ erdkreis[3][0] = 1;
+ for(int winkelEins = 0; winkelEins < 360 ; winkelEins += 15) {
+ for(double winkelZwei = 0; winkelZwei < 360 ; winkelZwei +=0.25) {
+ // Längengrad
+ erdkreis[0][0] = _0_Constants.RADIUS * Math.cos( Math.toRadians(winkelZwei) ) * Math.cos( Math.toRadians(winkelEins) );
+ erdkreis[1][0] = _0_Constants.RADIUS * Math.cos( Math.toRadians(winkelZwei) ) * Math.sin( Math.toRadians(winkelEins) );
+ erdkreis[2][0] = _0_Constants.RADIUS * Math.sin( Math.toRadians(winkelZwei) );
+ if( Meth.istHinten(erdkreis) )
+ g2d.setColor(Color.DARK_GRAY);
+ else
+ g2d.setColor(Color.WHITE);
+ g2d.drawLine(Meth.getCoords(erdkreis, "x"), Meth.getCoords(erdkreis, "y"), Meth.getCoords(erdkreis, "x"), Meth.getCoords(erdkreis, "y"));
+ // Breitengrad
+ erdkreis[0][0] = _0_Constants.RADIUS * Math.cos( Math.toRadians(winkelEins) ) * Math.cos( Math.toRadians(winkelZwei) );
+ erdkreis[1][0] = _0_Constants.RADIUS * Math.cos( Math.toRadians(winkelEins) ) * Math.sin( Math.toRadians(winkelZwei) );
+ erdkreis[2][0] = _0_Constants.RADIUS * Math.sin( Math.toRadians(winkelEins) ) ;
+ if( Meth.istHinten(erdkreis) )
+ g2d.setColor(Color.DARK_GRAY);
+ else
+ g2d.setColor(Color.WHITE);
+
+ g2d.drawLine(Meth.getCoords(erdkreis, "x"), Meth.getCoords(erdkreis, "y"), Meth.getCoords(erdkreis, "x"), Meth.getCoords(erdkreis, "y"));
+ }
+ }
+
+ // Zeichnen der Umrissellipse
+ g.setColor(Color.MAGENTA);
+ for(double parameter = 0; parameter < 360 ; parameter+=0.25) {
+// double winkelTheta = Math.toRadians(180);
+// double winkelPhi = Math.toRadians(-220);
+ double winkelTheta = Math.toRadians(90);
+ double winkelPhi = Math.toRadians(0);
+ double[][] kreis = Meth.umrissellipse(winkelPhi,winkelTheta,Math.toRadians(parameter));
+ g2d.drawLine((int)(kreis[0][0]*_0_Constants.RADIUS+_0_Constants.START_X), (int)(kreis[1][0]*_0_Constants.RADIUS+_0_Constants.START_Y), (int)(kreis[0][0]*_0_Constants.RADIUS+_0_Constants.START_X), (int)(kreis[1][0]*_0_Constants.RADIUS+_0_Constants.START_Y));
+ }
+
+ // Start- & Endpunkt Zeichnen
+ g2d.setColor(Color.YELLOW);
+ g2d.setFont(new Font("Arial", Font.BOLD, 20));
+ g2d.fillOval(Meth.getCoords(Meth.normVector(_0_Matrices.START), "x")-(_0_Constants.RADIUS_KUGEL), Meth.getCoords(Meth.normVector(_0_Matrices.START), "y")-(_0_Constants.RADIUS_KUGEL), _0_Constants.DIAMETER_KUGEL, _0_Constants.DIAMETER_KUGEL);
+ g2d.drawString("START", Meth.getCoords(Meth.normVector(_0_Matrices.START), "x"),Meth.getCoords(Meth.normVector(_0_Matrices.START), "y")-15);
+ g2d.fillOval(Meth.getCoords(Meth.normVector(_0_Matrices.END), "x")-(_0_Constants.RADIUS_KUGEL), Meth.getCoords(Meth.normVector(_0_Matrices.END), "y")-(_0_Constants.RADIUS_KUGEL), _0_Constants.DIAMETER_KUGEL, _0_Constants.DIAMETER_KUGEL);
+ g2d.drawString("END", Meth.getCoords(Meth.normVector(_0_Matrices.END), "x"),Meth.getCoords(Meth.normVector(_0_Matrices.END), "y")-15);
+
+ // TODO Wenn sich zwei Punkte gegenüberstehen, was dann?
+ // TODO Stopper verbessern
+ // Wegpunkt & Streckenverlauf Zeichnen
+ g2d.setColor(Color.CYAN);
+ double[][] bewegung = Meth.drehBewegung(Math.toRadians(time));
+
+ WegX.add(Meth.getCoords(Meth.normVector(bewegung), "x"));
+ WegY.add(Meth.getCoords(Meth.normVector(bewegung), "y"));
+ for(int i = 0; i < WegX.size(); i++)
+ g2d.drawLine(WegX.get(i), WegY.get(i), WegX.get(i), WegY.get(i));
+
+ g2d.setColor(Color.CYAN);
+ double differencePhi = Meth.getPhi(_0_Matrices.END) - Meth.getPhi(bewegung);
+ if (differencePhi < 0)
+ differencePhi *= (-1);
+ System.out.println("Phi: " + differencePhi);
+ double differenceTheta = Meth.getTheta(_0_Matrices.END) - Meth.getTheta(bewegung);
+ if (differenceTheta < 0)
+ differenceTheta *= (-1);
+ System.out.println("Theta: " + differenceTheta);
+ if(differencePhi >= 0.5 && differenceTheta >= 0.5)
+ g2d.setColor(Color.RED);
+ else
+ g2d.setColor(Color.CYAN);
+ g2d.fillOval(Meth.getCoords(Meth.normVector(bewegung), "x")-(_0_Constants.RADIUS_KUGEL), Meth.getCoords(Meth.normVector(bewegung), "y")-(_0_Constants.RADIUS_KUGEL), _0_Constants.DIAMETER_KUGEL, _0_Constants.DIAMETER_KUGEL);
+
+ // TODO Reihenfolge von Globus und Bewegung fixen
+ // TODO Reale Orte an wählbare Koordinaten knüpfen
+
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/app/_2_Methods.java b/src/app/_2_Methods.java
new file mode 100644
index 0000000..019e8dd
--- /dev/null
+++ b/src/app/_2_Methods.java
@@ -0,0 +1,152 @@
+package app;
+
+public class _2_Methods {
+
+ // Gibt X oder Y Koordinate aus einem normierten Vektor zurück, abhängig vom String Parameter
+ protected int getCoords(double[][] _vector, String _axe) {
+ double[][] coordinate = matrixMultiplikation(_0_Matrices.M_JavaNormalized, _vector);
+ if( _axe.contentEquals("x"))
+ return (int)coordinate[0][0];
+ else if( _axe.contentEquals("y"))
+ return (int)coordinate[1][0];
+ else
+ return -1000;
+ }
+
+ // Führt eine Matrixmultiplikation zweier 2D-Arrays aus
+ protected double[][] matrixMultiplikation(double[][] matrix_eins, double[][] matrix_zwei) {
+ double[][] ergebnismatrix = new double[matrix_eins.length][matrix_zwei[0].length];
+ if(matrix_eins[0].length == matrix_zwei.length)
+ for(int z=0; z