diff --git a/src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java b/src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java index 28104e0..f3265db 100644 --- a/src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java +++ b/src/jat/examples/ThreeBodyExample/ThreeBodyAPL.java @@ -1,14 +1,22 @@ package jat.examples.ThreeBodyExample; +import java.util.ArrayList; + import org.apache.commons.math3.ode.FirstOrderDifferentialEquations; import jat.coreNOSA.cm.ThreeBody; import jat.coreNOSA.math.MatrixVector.data.VectorN; public class ThreeBodyAPL extends ThreeBody implements FirstOrderDifferentialEquations{ + double initial_ta; + public ArrayList time = new ArrayList(); + public ArrayList xsol = new ArrayList(); + public ArrayList ysol = new ArrayList(); + public ArrayList zsol = new ArrayList(); - public ThreeBodyAPL(double G, double m1, double m2, double m3) { - super(G, m1, m2, m3); + public ThreeBodyAPL(double mu, VectorN r, VectorN v) { + super(mu, r, v); + initial_ta = ta; } @Override diff --git a/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java b/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java index 485a326..339acb3 100644 --- a/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java +++ b/src/jat/examples/ThreeBodyExample/ThreeBodyExample.java @@ -5,8 +5,6 @@ import jat.core.plot.plot.Plot2DPanel; import jat.core.plot.plot.PlotPanel; import jat.core.plot.plot.plots.ScatterPlot; -import jat.coreNOSA.math.MatrixVector.data.VectorN; -import jat.examples.TwoBodyExample.TwoBodyExample; import java.awt.Color; import java.text.DecimalFormat; @@ -20,29 +18,30 @@ import org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator; public class ThreeBodyExample { + public ThreeBodyExample() { } - + public static void main(String[] args) { - // TODO Auto-generated method stub + ThreeBodyExample x = new ThreeBodyExample(); - // create a ThreeBody orbit using three masses and gravitational con - ThreeBodyAPL sat = new ThreeBodyAPL(10, 0.3, 1.0, 2.0); - //initialize VectorN elements + // create a TwoBody orbit using orbit elements + ThreeBodyAPL sat = new ThreeBodyAPL(7000.0, 0.3, 0.0, 0.0, 0.0, 0.0); + double[] y = sat.randv(); - + ArrayRealVector v = new ArrayRealVector(y); DecimalFormat df2 = new DecimalFormat("#,###,###,##0.00"); RealVectorFormat format = new RealVectorFormat(df2); System.out.println(format.format(v)); - // find out the derivs of the problem - double[] derivs = sat.derivs(2.0, y); + // find out the period of the orbit + double period = sat.period(); // set the final time = one orbit period - double tf = 2.0; + double tf = period; // set the initial time to zero double t0 = 0.0; @@ -92,5 +91,4 @@ public static void main(String[] args) { System.out.println("end"); } - }