game.motion
Class ConstantAcceleration

java.lang.Object
  extended by game.motion.Stationary
      extended by game.motion.ConstantVelocity
          extended by game.motion.ConstantAcceleration
All Implemented Interfaces:
Trajectory

public class ConstantAcceleration
extends ConstantVelocity
implements Trajectory

Extends ConstantVelocity by contributing a constant (but not necessarily zero) acceleration.

Author:
Ron Cytron

Constructor Summary
ConstantAcceleration(lab4.Point origin, lab4.Vector v, lab4.Vector a)
          A new Trajectory based on the point of origin, a velocity, and an acceleration
ConstantAcceleration(Trajectory old, lab4.Vector v, lab4.Vector a)
          Constructs a new Trajectory based on the current location of the supplied one.
 
Method Summary
 lab4.Vector getCurrentAcceleration()
          Current acceleration
 lab4.Vector getCurrentVelocity()
          Current velocity computed as v + at
 lab4.Point getLocation(Time t)
          Current location computed as origin + vt + 1/2at^2
 
Methods inherited from class game.motion.Stationary
getCurrentLocation, getT0
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface game.motion.Trajectory
getCurrentLocation, getT0
 

Constructor Detail

ConstantAcceleration

public ConstantAcceleration(Trajectory old,
                            lab4.Vector v,
                            lab4.Vector a)
Constructs a new Trajectory based on the current location of the supplied one.

Parameters:
old - Trajectory for computing the current location.
v - Velocity of the new Trajectory
a - Acceleration of the new Trajectory

ConstantAcceleration

public ConstantAcceleration(lab4.Point origin,
                            lab4.Vector v,
                            lab4.Vector a)
A new Trajectory based on the point of origin, a velocity, and an acceleration

Parameters:
origin - Point of origin
v - original velocity
a - constant acceleration
Method Detail

getLocation

public lab4.Point getLocation(Time t)
Current location computed as origin + vt + 1/2at^2

Specified by:
getLocation in interface Trajectory
Overrides:
getLocation in class ConstantVelocity
Parameters:
t - time at which location should be computed, relative to time origin.
Returns:
current location at time t

getCurrentVelocity

public lab4.Vector getCurrentVelocity()
Current velocity computed as v + at

Specified by:
getCurrentVelocity in interface Trajectory
Overrides:
getCurrentVelocity in class ConstantVelocity
Returns:
current velocity

getCurrentAcceleration

public lab4.Vector getCurrentAcceleration()
Current acceleration

Specified by:
getCurrentAcceleration in interface Trajectory
Overrides:
getCurrentAcceleration in class Stationary
Returns:
current acceleration