org.highpoint.titus.apps.osp.canonicalspaceship
Class CanonicalSpaceShip

java.lang.Object
  extended byorg.highpoint.titus.apps.osp.canonicalspaceship.CanonicalSpaceShip
All Implemented Interfaces:
org.opensourcephysics.numerics.ODE

public class CanonicalSpaceShip
extends java.lang.Object
implements org.opensourcephysics.numerics.ODE

Author:
Aaron Titus

Constructor Summary
CanonicalSpaceShip()
          The constructor.
 
Method Summary
 void getRate(double[] state, double[] rate)
          Gets the rate of change using the argument's state variables.
 double[] getState()
          Get the state of the spaceship.
 void initialize(org.opensourcephysics.display.DrawingPanel drawingPanel, double x, double y, double z, double vx, double vy, double vz, double dt, boolean thrustN, boolean thrustS, boolean thrustE, boolean thrustW, double magThrust)
          Initialize the spaceship
 void stepState()
          Step the state forward in time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CanonicalSpaceShip

public CanonicalSpaceShip()
The constructor.

Method Detail

getState

public double[] getState()
Get the state of the spaceship. The state[] array contains: position, velocity, time, and thrust

Specified by:
getState in interface org.opensourcephysics.numerics.ODE
Returns:
the state

getRate

public void getRate(double[] state,
                    double[] rate)
Description copied from interface: org.opensourcephysics.numerics.ODE
Gets the rate of change using the argument's state variables. This method may be invoked many times with different intermediate states as an ODESolver is carrying out the solution.

Specified by:
getRate in interface org.opensourcephysics.numerics.ODE
Parameters:
state - the state array
rate - the rate array

initialize

public void initialize(org.opensourcephysics.display.DrawingPanel drawingPanel,
                       double x,
                       double y,
                       double z,
                       double vx,
                       double vy,
                       double vz,
                       double dt,
                       boolean thrustN,
                       boolean thrustS,
                       boolean thrustE,
                       boolean thrustW,
                       double magThrust)
Initialize the spaceship

Parameters:
drawingPanel - the drawing panel that will dispaly the particles
x - x position
y - y position
vx - x velocity
vy - y velocity
vz - z velocity
dt - time step for ODE solver
thrustN - on/off (1 or 0) for N engine
thrustS - on/off (1 or 0) for S engine
thrustE - on/off (1 or 0) for E engine
thrustW - on/off (1 or 0) for W engine
magThrust - magnitude of engine thrust
Returns:
the state variables

stepState

public void stepState()
Step the state forward in time.