org.opensourcephysics.sip.ch05
Class ThreeBody

java.lang.Object
  extended by org.opensourcephysics.sip.ch05.ThreeBody
All Implemented Interfaces:
Drawable, ODE

public class ThreeBody
extends java.lang.Object
implements Drawable, ODE

ThreeBody models the gravitational three-body problem.


Constructor Summary
ThreeBody()
           
 
Method Summary
 void doStep()
          Steps the time using an ode solver.
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the three bodies.
 void getRate(double[] state, double[] rate)
          Gets the rate using the given state.
 double[] getState()
          Gets the state: x1, vx1, y1, vy1, x2, vx2, y2, vy2, x3, vx3, y3, vy3, t.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreeBody

public ThreeBody()
Method Detail

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draws the three bodies.

Specified by:
draw in interface Drawable
Parameters:
panel -
g -

doStep

public void doStep()
Steps the time using an ode solver.


getRate

public void getRate(double[] state,
                    double[] rate)
Gets the rate using the given state.

Specified by:
getRate in interface ODE
Parameters:
state - double[]
rate - double[]

getState

public double[] getState()
Gets the state: x1, vx1, y1, vy1, x2, vx2, y2, vy2, x3, vx3, y3, vy3, t.

Specified by:
getState in interface ODE
Returns:
the state