Refactored for AB5

This commit is contained in:
2022-05-06 22:42:28 +02:00
parent e84bf3bf4a
commit 6b1f1ecc2a
6 changed files with 176 additions and 199 deletions

View File

@ -19,7 +19,7 @@ Ziel der Aufgabe ist die Anwendung der Konzepte: Gleichheit und Hash-Werte, Hash
- [Massive](../src/Massive.java) ist ein Interface, das Himmelskörper (als kohärente Massen) - [Massive](../src/Massive.java) ist ein Interface, das Himmelskörper (als kohärente Massen)
beschreibt. `Massive` ist der gemeinsame Obertyp für verschiedene Klassen von Himmelkörpern. Die beschreibt. `Massive` ist der gemeinsame Obertyp für verschiedene Klassen von Himmelkörpern. Die
meisten spezifizierten Methoden sind mit einer `default`-Implementierung definiert. Dieser meisten spezifizierten Methoden sind mit einer `default`-Implementierung definiert. Dieser
Programcode wird ausgeführt, falls die entsprechende Klasse (`Body` oder `NamedBody`) über keine Programmcode wird ausgeführt, falls die entsprechende Klasse (`Body` oder `NamedBody`) über keine
eigene Definition der Methode verfügt. Verändern Sie diese Datei bitte nicht. eigene Definition der Methode verfügt. Verändern Sie diese Datei bitte nicht.
- [NamedBody](../src/NamedBody.java) ist das Gerüst einer Klassendefinition. Die Klasse - [NamedBody](../src/NamedBody.java) ist das Gerüst einer Klassendefinition. Die Klasse
repräsentiert Himmelskörper, die einen Namen haben. repräsentiert Himmelskörper, die einen Namen haben.
@ -100,8 +100,3 @@ Ihre Aufgaben sind folgende:
- Implementierung von `Simulation5`: 1 Punkte - Implementierung von `Simulation5`: 1 Punkte
- Gesamt: 5 Punkte - Gesamt: 5 Punkte

View File

@ -1,125 +1,78 @@
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class Aufgabe5Test { public class Aufgabe5Test {
public static void main(String[] args) { @Test
public void testEP2() {
/* //TODO: uncomment for testing /* //TODO: uncomment for testing
//test classes NamedBody and MassiveForceHashMap //test classes NamedBody and MassiveForceHashMap
// create 12 named bodies // create 12 named bodies
NamedBody sun1, mercury1, venus1, earth1, moon1, mars1, deimos1, phobos1, vesta1, NamedBody sun1, mercury1, venus1, earth1, moon1, mars1, deimos1, phobos1, vesta1, pallas1, hygiea1, ceres1;
pallas1, hygiea1, ceres1;
// create a nameless body // create a nameless body
Body earth2 = new Body(5.972E24, new Vector3(-6.13135922534815E10,-1.383789852227691E11, Body earth2 = new Body(5.972E24, new Vector3(-6.13135922534815E10, -1.383789852227691E11, 2.719682263474911E7), new Vector3(26832.720535473603, -11948.23168764519, 1.9948243075997851));
2.719682263474911E7), new Vector3(26832.720535473603,-11948.23168764519,1.9948243075997851));
// create the same 12 named body-force pairs // create the same 12 named body-force pairs
sun1 = new NamedBody("Sun",1.989E30, new Vector3(0.0,0.0,0.0) sun1 = new NamedBody("Sun", 1.989E30, new Vector3(0.0, 0.0, 0.0), new Vector3(0.0, 0.0, 0.0));
, new Vector3(0.0,0.0,0.0)); earth1 = new NamedBody("Earth", 5.972E24, new Vector3(-6.13135922534815E10, -1.383789852227691E11, 2.719682263474911E7), new Vector3(26832.720535473603, -11948.23168764519, 1.9948243075997851));
earth1 = new NamedBody("Earth",5.972E24, moon1 = new NamedBody("Moon", 7.349E22, new Vector3(-6.132484773775896E10, -1.387394951280871E11, 1.701046736294776E7), new Vector3(27916.62329282941, -12020.39526008238, -94.89703264508708));
new Vector3(-6.13135922534815E10,-1.383789852227691E11,2.719682263474911E7), new Vector3(26832.720535473603,-11948.23168764519,1.9948243075997851)); mars1 = new NamedBody("Mars", 6.41712E23, new Vector3(-1.7923193702925848E11, 1.726665823982123E11, 7.991673845249474E9), new Vector3(-15925.78496403673, -15381.16179928219, 68.67560910598857));
moon1 = new NamedBody("Moon",7.349E22, deimos1 = new NamedBody("Deimos", 1.8E20, new Vector3(-1.792255010450533E11, 1.726891122683271E11, 7.990659337380297E9), new Vector3(-17100.476719804457, -15020.348656808, 631.2927851249581));
new Vector3(-6.132484773775896E10,-1.387394951280871E11,1.701046736294776E7), new Vector3(27916.62329282941,-12020.39526008238,-94.89703264508708)); phobos1 = new NamedBody("Phobos", 1.08E20, new Vector3(-1.792253482539647E11, 1.72661109673625E11, 7.987848354800322E9), new Vector3(-14738.203714241401, -13671.17675223948, -411.0012490555253));
mars1 = new NamedBody("Mars",6.41712E23, mercury1 = new NamedBody("Mercury", 3.301E23, new Vector3(-5.167375560011926E10, -4.217574885682655E10, 1.14808913958168E9), new Vector3(21580.25398577148, -34951.03632847389, -4835.225596525241));
new Vector3(-1.7923193702925848E11,1.726665823982123E11,7.991673845249474E9), new Vector3(-15925.78496403673,-15381.16179928219,68.67560910598857)); venus1 = new NamedBody("Venus", 4.86747E24, new Vector3(-3.123150865740532E10, 1.0395568504115701E11, 3.173401325838074E9), new Vector3(-33748.180519629335, -10014.25141045021, 1809.94488874165));
deimos1 = new NamedBody("Deimos",1.8E20, vesta1 = new NamedBody("Vesta", 2.5908E20, new Vector3(-3.337493557929893E11, -4.7147908276077385E10, 4.1923010146878105E10), new Vector3(4440.54247538484, -19718.49074006637, 48.06573124543601));
new Vector3(-1.792255010450533E11,1.726891122683271E11,7.990659337380297E9), new Vector3(-17100.476719804457,-15020.348656808,631.2927851249581)); pallas1 = new NamedBody("Pallas", 2.14E20, new Vector3(4.3452066613895575E11, -2.057319365171432E11, 1.0549957423213101E11), new Vector3(5058.947582097117, 11184.45711782372, -8183.524138259704));
phobos1 = new NamedBody("Phobos",1.08E20, hygiea1 = new NamedBody("Hygiea", 8.32E19, new Vector3(-3.983943433707043E11, 2.325833000024021E11, -2.233667695713672E10), new Vector3(-6931.864585548552, -15686.8108598699, -690.5791992347208));
new Vector3(-1.792253482539647E11,1.72661109673625E11,7.987848354800322E9), new Vector3(-14738.203714241401,-13671.17675223948,-411.0012490555253)); ceres1 = new NamedBody("Ceres", 9.394E20, new Vector3(3.781372641419032E11, 1.96718960466285E11, -6.366459168068592E10), new Vector3(-8555.324226752316, 14718.33755980907, 2040.230135060142));
mercury1 = new NamedBody("Mercury",3.301E23,
new Vector3(-5.167375560011926E10,-4.217574885682655E10,1.14808913958168E9), new Vector3(21580.25398577148,-34951.03632847389,-4835.225596525241));
venus1 = new NamedBody("Venus",4.86747E24,
new Vector3(-3.123150865740532E10,1.0395568504115701E11,3.173401325838074E9), new Vector3(-33748.180519629335,-10014.25141045021,1809.94488874165));
vesta1 = new NamedBody("Vesta",2.5908E20,
new Vector3(-3.337493557929893E11,-4.7147908276077385E10,4.1923010146878105E10), new Vector3(4440.54247538484,-19718.49074006637,48.06573124543601));
pallas1 = new NamedBody("Pallas",2.14E20,
new Vector3(4.3452066613895575E11,-2.057319365171432E11,1.0549957423213101E11), new Vector3(5058.947582097117,11184.45711782372,-8183.524138259704));
hygiea1 = new NamedBody("Hygiea",8.32E19,
new Vector3(-3.983943433707043E11,2.325833000024021E11,-2.233667695713672E10), new Vector3(-6931.864585548552,-15686.8108598699,-690.5791992347208));
ceres1 = new NamedBody("Ceres",9.394E20,
new Vector3(3.781372641419032E11,1.96718960466285E11,-6.366459168068592E10), new Vector3(-8555.324226752316,14718.33755980907,2040.230135060142));
System.out.println("Test1:"); NamedBody sun2 = new NamedBody("Sun", 1.9895E30, new Vector3(0.1, 0.0, 0.0), new Vector3(0.0, 0.0, 0.0));
NamedBody sun2 = new NamedBody("Sun",1.9895E30, new Vector3(0.1,0.0,0.0) NamedBody earth3 = new NamedBody("Earth", 1, new Vector3(0, 0, 0), new Vector3(0, 0, 0));
, new Vector3(0.0,0.0,0.0)); assertEquals(sun1, sun2);
NamedBody earth3 = new NamedBody("Earth", 1, new Vector3(0,0,0), new Vector3(0,0,0)); assertEquals(sun2.hashCode(), sun1.hashCode());
testValue(sun1.equals(sun2), true); assertEquals(earth1, earth3);
testValue(sun1.hashCode(), sun2.hashCode()); assertEquals(earth3.hashCode(), earth1.hashCode());
testValue(earth1.equals(earth3), true);
testValue(earth1.hashCode(), earth3.hashCode());
// check basic functions of 'MassiveForceHashMap' // check basic functions of 'MassiveForceHashMap'
System.out.println("Test2:");
MassiveForceHashMap map = new MassiveForceHashMap(); MassiveForceHashMap map = new MassiveForceHashMap();
map.put(sun1, new Vector3(0,0,0)); map.put(sun1, new Vector3(0, 0, 0));
map.put(mercury1, new Vector3(0,0,0)); map.put(mercury1, new Vector3(0, 0, 0));
map.put(venus1, new Vector3(0,0,0)); map.put(venus1, new Vector3(0, 0, 0));
map.put(earth1, new Vector3(0,0,0)); map.put(earth1, new Vector3(0, 0, 0));
map.put(moon1, new Vector3(0,0,0)); map.put(moon1, new Vector3(0, 0, 0));
map.put(mars1, new Vector3(0,0,0)); map.put(mars1, new Vector3(0, 0, 0));
map.put(deimos1, new Vector3(0,0,0)); map.put(deimos1, new Vector3(0, 0, 0));
map.put(phobos1, new Vector3(0,0,0)); map.put(phobos1, new Vector3(0, 0, 0));
map.put(vesta1, new Vector3(0,0,0)); map.put(vesta1, new Vector3(0, 0, 0));
map.put(pallas1, new Vector3(0,0,0)); map.put(pallas1, new Vector3(0, 0, 0));
map.put(hygiea1, new Vector3(0,0,0)); map.put(hygiea1, new Vector3(0, 0, 0));
map.put(ceres1, new Vector3(0,0,0)); map.put(ceres1, new Vector3(0, 0, 0));
map.put(mars1, new Vector3(0,0,0)); // inserted twice map.put(mars1, new Vector3(0, 0, 0)); // inserted twice
testValue(map.keyList().size(), 12); assertEquals(12, map.keyList().size());
System.out.println("Test3:"); assertTrue(map.toString().contains("Mars"));
testValue(map.toString().contains("Mars"), true); assertTrue(map.toString().contains("Deimos"));
testValue(map.toString().contains("Deimos"), true); assertTrue(map.toString().contains("Moon"));
testValue(map.toString().contains("Moon"), true); assertTrue(map.toString().contains("Earth"));
testValue(map.toString().contains("Earth"), true);
System.out.println("Test4:");
MassiveLinkedList bl = map.keyList(); MassiveLinkedList bl = map.keyList();
boolean allThere = true; boolean allThere = true;
while (bl.size() > 0) { while (bl.size() > 0) {
allThere &= map.containsKey(bl.pollFirst()); allThere &= map.containsKey(bl.pollFirst());
} }
testValue(allThere, true); assertTrue(allThere);
testValue(map.containsKey(new Body(0,new Vector3(0,0,0), new Vector3(0,0,0))), assertFalse(map.containsKey(new Body(0, new Vector3(0, 0, 0), new Vector3(0, 0, 0))));
false); assertFalse(map.containsKey(new NamedBody("Omuamua", 0, new Vector3(0, 0, 0), new Vector3(0, 0, 0))));
testValue(map.containsKey(new NamedBody("Omuamua",0,new Vector3(0,0,0), new Vector3(0,0,
0))),
false);
System.out.println("Test5:"); Vector3 f = new Vector3(5, 5, 5);
Vector3 f = new Vector3(5,5,5);
map.put(earth3, f); map.put(earth3, f);
testValue(map.get(earth1), f); assertEquals(f, map.get(earth1));
testValue(map.get(earth2), null); assertNull(map.get(earth2));
*/ //TODO: uncomment */ //TODO: uncomment
} }
public static void testComparison(Object first, Object second, boolean expected) {
boolean real = first == second;
if (real == expected) {
System.out.println("Successful comparison");
} else {
System.out.println("Comparison NOT successful! Expected value: " + expected + " / Given value: " + real);
}
}
public static void testValue(Object given, Object expected) {
if (given == expected) {
System.out.println("Successful test");
} else {
System.out.println("Test NOT successful! Expected value: " + expected + " / Given value: " + given);
}
}
public static void testValue(double given, double expected) {
if (given < expected + (expected + 1) / 1e12 && given > expected - (expected + 1) / 1e12) {
System.out.println("Successful test");
} else {
System.out.println("Test NOT successful! Expected value: " + expected + " / Given value: " + given);
}
}
} }

View File

@ -1,64 +1,73 @@
// Represents a coherent mass with a mass center in 3D space. Has two naming schemes for its /**
// methods. Please, do not change this interface definition! * Represents a coherent mass with a mass center in 3D space. Has two naming schemes for its
// * methods. Please, do not change this interface definition!
*/
public interface Massive extends Drawable { public interface Massive extends Drawable {
// Returns the mass. /**
* Returns the mass.
*/
default double mass() { default double mass() {
return getMass(); return getMass();
} }
// Returns the mass center. /**
* Returns the mass center.
*/
default Vector3 massCenter() { default Vector3 massCenter() {
return getMassCenter(); return getMassCenter();
} }
// Returns the mass. /**
* Returns the mass.
*/
default double getMass() { default double getMass() {
return mass(); return mass();
} }
// Returns the mass center. /**
* Returns the mass center.
*/
default Vector3 getMassCenter() { default Vector3 getMassCenter() {
return massCenter(); return massCenter();
} }
// Returns the approximate radius of 'this', assuming it is a coherent round mass. /**
// (It is assumed that the radius r is related to the mass m by r = m ^ 0.5, * Returns the approximate radius of 'this', assuming it is a coherent round mass.
// where m and r measured in solar units.) * (It is assumed that the radius r is related to the mass m by r = m ^ 0.5,
* where m and r measured in solar units.)
*/
default double getRadius() { default double getRadius() {
return radius(); return radius();
} }
// Returns the approximate radius of 'this', assuming it is a coherent round mass. /**
// (It is assumed that the radius r is related to the mass m by r = m ^ 0.5, * Returns the approximate radius of 'this', assuming it is a coherent round mass.
// where m and r measured in solar units.) * (It is assumed that the radius r is related to the mass m by r = m ^ 0.5,
* where m and r measured in solar units.)
*/
default double radius() { default double radius() {
return SpaceDraw.massToRadius(mass()); return SpaceDraw.massToRadius(mass());
} }
// Returns a vector representing the gravitational force exerted by 'b' on this mass. /**
// The gravitational Force F is calculated by F = G*(m1*m2)/(r*r), with m1 and m2 being the * Returns a vector representing the gravitational force exerted by 'b' on this mass.
// masses of the objects interacting, r being the distance between the centers of the masses * The gravitational Force F is calculated by F = G*(m1*m2)/(r*r), with m1 and m2 being the
// and G being the gravitational constant. * masses of the objects interacting, r being the distance between the centers of the masses
* and G being the gravitational constant.
*/
default Vector3 gravitationalForce(Massive b) { default Vector3 gravitationalForce(Massive b) {
Vector3 direction = b.massCenter().minus(this.massCenter()); Vector3 direction = b.massCenter().minus(this.massCenter());
double distance = direction.length(); double distance = direction.length();
direction.normalize(); direction.normalize();
double force = Simulation.G*this.mass()*b.mass()/(distance * distance); double force = Simulation.G * this.mass() * b.mass() / (distance * distance);
return direction.times(force); return direction.times(force);
} }
// Centers this mass at a new position, according to the specified force vector 'force' exerted /**
// on it, and updates the current velocity vector accordingly. * Centers this mass at a new position, according to the specified force vector 'force' exerted
// (Velocity depends on the mass of 'this', its current velocity and the exerted force.) * on it, and updates the current velocity vector accordingly.
* (Velocity depends on the mass of 'this', its current velocity and the exerted force.)
*/
void move(Vector3 force); void move(Vector3 force);
} }

View File

@ -1,94 +1,108 @@
// A list of massive objects implemented as a linked list. /**
// The number of elements of the list is not limited. * A list of massive objects implemented as a linked list.
* The number of elements of the list is not limited.
*/
public class MassiveLinkedList { public class MassiveLinkedList {
//TODO: declare variables. //TODO: declare variables.
// Initializes 'this' as an empty list. /**
* Initializes 'this' as an empty list.
*/
public MassiveLinkedList() { public MassiveLinkedList() {
//TODO: define constructor. //TODO: define constructor.
} }
// Initializes 'this' as an independent copy of the specified list 'list'. /**
// Calling methods of this list will not affect the specified list 'list' * Initializes 'this' as an independent copy of the specified list 'list'.
// and vice versa. * Calling methods of this list will not affect the specified list 'list'
// Precondition: list != null. * and vice versa.
* Precondition: list != null.
*/
public MassiveLinkedList(BodyLinkedList list) { public MassiveLinkedList(BodyLinkedList list) {
//TODO: define constructor. //TODO: define constructor.
} }
// Inserts the specified element 'body' at the beginning of this list. /**
* Inserts the specified element 'body' at the beginning of this list.
*/
public void addFirst(Massive body) { public void addFirst(Massive body) {
//TODO: implement method. //TODO: implement method.
} }
// Appends the specified element 'body' to the end of this list. /**
* Appends the specified element 'body' to the end of this list.
*/
public void addLast(Massive body) { public void addLast(Massive body) {
//TODO: implement method. //TODO: implement method.
} }
// Returns the last element in this list. /**
// Returns 'null' if the list is empty. * Returns the last element in this list.
* Returns 'null' if the list is empty.
*/
public Massive getLast() { public Massive getLast() {
//TODO: implement method. //TODO: implement method.
return null; return null;
} }
// Returns the first element in this list. /**
// Returns 'null' if the list is empty. * Returns the first element in this list.
* Returns 'null' if the list is empty.
*/
public Massive getFirst() { public Massive getFirst() {
//TODO: implement method. //TODO: implement method.
return null; return null;
} }
// Retrieves and removes the first element in this list. /**
// Returns 'null' if the list is empty. * Retrieves and removes the first element in this list.
* Returns 'null' if the list is empty.
*/
public Massive pollFirst() { public Massive pollFirst() {
//TODO: implement method. //TODO: implement method.
return null; return null;
} }
// Retrieves and removes the last element in this list. /**
// Returns 'null' if the list is empty. * Retrieves and removes the last element in this list.
* Returns 'null' if the list is empty.
*/
public Massive pollLast() { public Massive pollLast() {
//TODO: implement method. //TODO: implement method.
return null; return null;
} }
// Inserts the specified element at the specified position in this list. /**
// Precondition: i >= 0 && i <= size(). * Inserts the specified element at the specified position in this list.
* Precondition: i >= 0 && i <= size().
*/
public void add(int i, Massive m) { public void add(int i, Massive m) {
//TODO: implement method. //TODO: implement method.
} }
// Returns the element at the specified position in this list. /**
// Precondition: i >= 0 && i < size(). * Returns the element at the specified position in this list.
* Precondition: i >= 0 && i < size().
*/
public Massive get(int i) { public Massive get(int i) {
//TODO: implement method. //TODO: implement method.
return null; return null;
} }
// Returns the index of the first occurrence of the specified element in this list, or -1 if /**
// this list does not contain the element. * Returns the index of the first occurrence of the specified element in this list, or -1 if
* this list does not contain the element.
*/
public int indexOf(Massive m) { public int indexOf(Massive m) {
//TODO: implement method. //TODO: implement method.
return -2; return -2;
} }
// Returns the number of elements in this list. /**
* Returns the number of elements in this list.
*/
public int size() { public int size() {
//TODO: implement method. //TODO: implement method.
return -1; return -1;
} }

View File

@ -1,42 +1,46 @@
public class NamedBody /* TODO: add clause(s) */ public class NamedBody /* TODO: add clause(s) */ {
{
// TODO: add missing parts of this class. // TODO: add missing parts of this class.
// Initializes this with name, mass, current position and movement. The associated force /**
// is initialized with a zero vector. * Initializes this with name, mass, current position and movement. The associated force
* is initialized with a zero vector.
*/
public NamedBody(String name, double mass, Vector3 massCenter, Vector3 currentMovement) { public NamedBody(String name, double mass, Vector3 massCenter, Vector3 currentMovement) {
// TODO: implement constructor. // TODO: implement constructor.
} }
// Returns the name of the body. /**
* Returns the name of the body.
*/
public String getName() { public String getName() {
// TODO: implement method. // TODO: implement method.
return ""; return "";
} }
// Compares `this` with the specified object. Returns `true` if the specified `o` is not /**
// `null` and is of type `NamedBody` and both `this` and `o` have equal names. * Compares `this` with the specified object. Returns `true` if the specified `o` is not
// Otherwise `false` is returned. * `null` and is of type `NamedBody` and both `this` and `o` have equal names.
* Otherwise `false` is returned.
*/
public boolean equals(Object o) { public boolean equals(Object o) {
//TODO: implement method. //TODO: implement method.
return false; return false;
} }
// Returns the hashCode of `this`. /**
* Returns the hashCode of `this`.
*/
public int hashCode() { public int hashCode() {
//TODO: implement method. //TODO: implement method.
return 0; return 0;
} }
// Returns a readable representation including the name of this body. /**
* Returns a readable representation including the name of this body.
*/
public String toString() { public String toString() {
//TODO: implement method. //TODO: implement method.
return ""; return "";
} }
} }

View File

@ -3,8 +3,9 @@ import codedraw.CodeDraw;
import java.awt.*; import java.awt.*;
import java.util.Random; import java.util.Random;
// Simulates the formation of a massive solar system. /**
// * Simulates the formation of a massive solar system.
*/
public class Simulation5 { public class Simulation5 {
// gravitational constant // gravitational constant
@ -30,25 +31,27 @@ public class Simulation5 {
// all quantities are based on units of kilogram respectively second and meter. // all quantities are based on units of kilogram respectively second and meter.
// The main simulation method using instances of other classes. /**
* The main simulation method using instances of other classes.
*/
public static void main(String[] args) { public static void main(String[] args) {
// simulation // simulation
CodeDraw cd = new CodeDraw(); CodeDraw cd = new CodeDraw();
// create solar system with 12 bodies // create solar system with 12 bodies
NamedBody sun = new NamedBody("Sun",1.989E30, new Vector3(0.0,0.0,0.0), new Vector3(0.0,0.0,0.0)); NamedBody sun = new NamedBody("Sun", 1.989E30, new Vector3(0.0, 0.0, 0.0), new Vector3(0.0, 0.0, 0.0));
NamedBody earth = new NamedBody("Earth",5.972E24, new Vector3(-6.13135922534815E10,-1.383789852227691E11,2.719682263474911E7), new Vector3(26832.720535473603,-11948.23168764519,1.9948243075997851)); NamedBody earth = new NamedBody("Earth", 5.972E24, new Vector3(-6.13135922534815E10, -1.383789852227691E11, 2.719682263474911E7), new Vector3(26832.720535473603, -11948.23168764519, 1.9948243075997851));
NamedBody moon = new NamedBody("Moon",7.349E22, new Vector3(-6.132484773775896E10,-1.387394951280871E11,1.701046736294776E7), new Vector3(27916.62329282941,-12020.39526008238,-94.89703264508708)); NamedBody moon = new NamedBody("Moon", 7.349E22, new Vector3(-6.132484773775896E10, -1.387394951280871E11, 1.701046736294776E7), new Vector3(27916.62329282941, -12020.39526008238, -94.89703264508708));
NamedBody mars = new NamedBody("Mars",6.41712E23, new Vector3(-1.7923193702925848E11,1.726665823982123E11,7.991673845249474E9), new Vector3(-15925.78496403673,-15381.16179928219,68.67560910598857)); NamedBody mars = new NamedBody("Mars", 6.41712E23, new Vector3(-1.7923193702925848E11, 1.726665823982123E11, 7.991673845249474E9), new Vector3(-15925.78496403673, -15381.16179928219, 68.67560910598857));
NamedBody deimos = new NamedBody("Deimos",1.8E20, new Vector3(-1.792255010450533E11,1.726891122683271E11,7.990659337380297E9), new Vector3(-17100.476719804457,-15020.348656808,631.2927851249581)); NamedBody deimos = new NamedBody("Deimos", 1.8E20, new Vector3(-1.792255010450533E11, 1.726891122683271E11, 7.990659337380297E9), new Vector3(-17100.476719804457, -15020.348656808, 631.2927851249581));
NamedBody phobos = new NamedBody("Phobos",1.08E20, new Vector3(-1.792253482539647E11,1.72661109673625E11,7.987848354800322E9), new Vector3(-14738.203714241401,-13671.17675223948,-411.0012490555253)); NamedBody phobos = new NamedBody("Phobos", 1.08E20, new Vector3(-1.792253482539647E11, 1.72661109673625E11, 7.987848354800322E9), new Vector3(-14738.203714241401, -13671.17675223948, -411.0012490555253));
NamedBody mercury = new NamedBody("Mercury",3.301E23, new Vector3(-5.167375560011926E10,-4.217574885682655E10,1.14808913958168E9), new Vector3(21580.25398577148,-34951.03632847389,-4835.225596525241)); NamedBody mercury = new NamedBody("Mercury", 3.301E23, new Vector3(-5.167375560011926E10, -4.217574885682655E10, 1.14808913958168E9), new Vector3(21580.25398577148, -34951.03632847389, -4835.225596525241));
NamedBody venus = new NamedBody("Venus",4.86747E24, new Vector3(-3.123150865740532E10,1.0395568504115701E11,3.173401325838074E9), new Vector3(-33748.180519629335,-10014.25141045021,1809.94488874165)); NamedBody venus = new NamedBody("Venus", 4.86747E24, new Vector3(-3.123150865740532E10, 1.0395568504115701E11, 3.173401325838074E9), new Vector3(-33748.180519629335, -10014.25141045021, 1809.94488874165));
NamedBody vesta = new NamedBody("Vesta",2.5908E20, new Vector3(-3.337493557929893E11,-4.7147908276077385E10,4.1923010146878105E10), new Vector3(4440.54247538484,-19718.49074006637,48.06573124543601)); NamedBody vesta = new NamedBody("Vesta", 2.5908E20, new Vector3(-3.337493557929893E11, -4.7147908276077385E10, 4.1923010146878105E10), new Vector3(4440.54247538484, -19718.49074006637, 48.06573124543601));
NamedBody pallas = new NamedBody("Pallas",2.14E20, new Vector3(4.3452066613895575E11,-2.057319365171432E11,1.0549957423213101E11), new Vector3(5058.947582097117,11184.45711782372,-8183.524138259704)); NamedBody pallas = new NamedBody("Pallas", 2.14E20, new Vector3(4.3452066613895575E11, -2.057319365171432E11, 1.0549957423213101E11), new Vector3(5058.947582097117, 11184.45711782372, -8183.524138259704));
NamedBody hygiea = new NamedBody("Hygiea",8.32E19, new Vector3(-3.983943433707043E11,2.325833000024021E11,-2.233667695713672E10), new Vector3(-6931.864585548552,-15686.8108598699,-690.5791992347208)); NamedBody hygiea = new NamedBody("Hygiea", 8.32E19, new Vector3(-3.983943433707043E11, 2.325833000024021E11, -2.233667695713672E10), new Vector3(-6931.864585548552, -15686.8108598699, -690.5791992347208));
NamedBody ceres = new NamedBody("Ceres",9.394E20, new Vector3(3.781372641419032E11,1.96718960466285E11,-6.366459168068592E10), new Vector3(-8555.324226752316,14718.33755980907,2040.230135060142)); NamedBody ceres = new NamedBody("Ceres", 9.394E20, new Vector3(3.781372641419032E11, 1.96718960466285E11, -6.366459168068592E10), new Vector3(-8555.324226752316, 14718.33755980907, 2040.230135060142));
// create some additional bodies // create some additional bodies
Body[] bodies = new Body[NUMBER_OF_BODIES]; Body[] bodies = new Body[NUMBER_OF_BODIES];
@ -63,6 +66,5 @@ public class Simulation5 {
//TODO: implementation of this method according to 'Aufgabenblatt5.md'. //TODO: implementation of this method according to 'Aufgabenblatt5.md'.
// Add both, NamedBody- and Body-objects, to your simulation. // Add both, NamedBody- and Body-objects, to your simulation.
} }
} }