org.opensourcephysics.sip.ch03
Class Projectile

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

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

Projectile models the dynamics of a projectile and forms a template for other simulations.


Constructor Summary
Projectile()
           
 
Method Summary
 void draw(DrawingPanel drawingPanel, java.awt.Graphics g)
          Draws the projectile.
 void getRate(double[] state, double[] rate)
          Gets the rate.
 double[] getState()
          Gets the state.
 void setState(double x, double vx, double y, double vy)
          Sets the state.
 void setStepSize(double dt)
           
 void step()
          Steps (advances) the time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Projectile

public Projectile()
Method Detail

setStepSize

public void setStepSize(double dt)

step

public void step()
Steps (advances) the time.

Parameters:
dt - the time step.

setState

public void setState(double x,
                     double vx,
                     double y,
                     double vy)
Sets the state.

Parameters:
x -
vx -
y -
vy -

getState

public double[] getState()
Gets the state. Required for ODE interface.

Specified by:
getState in interface ODE
Returns:
double[] the state

getRate

public void getRate(double[] state,
                    double[] rate)
Gets the rate. Required for ODE inteface

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

draw

public void draw(DrawingPanel drawingPanel,
                 java.awt.Graphics g)
Draws the projectile. Required for Drawable interface.

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