org.opensourcephysics.sip.ch05
Class Planet2

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

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

Planet2 models two interacting planets in the presence of a central inverse square law force.


Constructor Summary
Planet2()
           
 
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, t.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Planet2

public Planet2()
Method Detail

doStep

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


draw

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

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

getRate

public void getRate(double[] state,
                    double[] rate)
Gets the rate using the given state. Values in the rate array are overwritten.

Specified by:
getRate in interface ODE
Parameters:
state - the state
rate - the resulting rate

getState

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

Specified by:
getState in interface ODE
Returns:
the state