org.opensourcephysics.sip.ch05
Class Planet

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

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

Planet models and displays the motion of a planet using an inverse square force law. Students should test other ODESolvers in the Numerics package.


Constructor Summary
Planet()
           
 
Method Summary
 void doStep()
          Steps the differential equation and appends data to curve.
 void draw(DrawingPanel panel, java.awt.Graphics g)
          Draws the planet and its path.
 void getRate(double[] state, double[] rate)
          Gets the rate using the given state.
 double[] getState()
          Gets the state
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Planet

public Planet()
Method Detail

doStep

public void doStep()
Steps the differential equation and appends data to curve.


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

Specified by:
getState in interface ODE
Returns:
the state

draw

public void draw(DrawingPanel panel,
                 java.awt.Graphics g)
Draws the planet and its path.

Specified by:
draw in interface Drawable
Parameters:
panel - the drawing panel
g - the graphics context