Spirograph Problem Set Javadocs

spirograph
Class Coord

java.lang.Object
  extended byspirograph.Coord

public class Coord
extends java.lang.Object

This class holds information regarding one dimension of the ball. It has methods to update the position of the ball, as well as methods to get and set certain variables.

Copyright © 1996 Massachusetts Institute of Technology.
Copyright © 2003 Franklin W. Olin College of Engineering.

Version:
$Id: Coord.java,v 1.4 2004/02/09 20:55:03 gus Exp $
Author:
Luis Sarmenta, lfgs@cag.lcs.mit.edu, Henry Wong, henryw@mit.edu, Patrick G. Heck, gus.heck@olin.edu
See Also:
AccelHandler, Spirograph

Constructor Summary
Coord()
           
 
Method Summary
 double getAccel()
          The acceleration along this axis.
 double getMaxPos()
          The maximum position for this coordinate.
 int getMode()
          Determines the current mode of operation, either position, velocity, or accleration control.
 double getPos()
          The current position of this coordinate.
 double getVel()
          The current velocity along this coordinate axis.
 void nextStep(java.util.Vector v, double step)
          Calculates the acceleration of the ball by taking the current acceleration and adding it to the combined accelerations resulting from each of the different gravitational fields.
 void setAccel(double accel)
          Set the acceleration along this axis.
 void setMaxPos(double pos)
          Set the maximum position for this coordinate
 void setMode(int mode)
          Sets the current mode.
 void setPos(double pos)
          Modify the current position of this coordinate.
 void setValue(double val)
          Sets the position, velocity or acceleration depending on the current mode.
 void setVel(double vel)
          Set the velocity along this axis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Coord

public Coord()
Method Detail

getMode

public int getMode()
Determines the current mode of operation, either position, velocity, or accleration control.

Returns:
AccelHandler.POSMODE, AccelHandler.VELMODE or AccelHandler.ACCELMODE

setMode

public void setMode(int mode)
Sets the current mode. Legal parameter values are AccelHandler.POSMODE, AccelHandler.VELMODE, or AccelHandler.ACCELMODE.

Parameters:
mode - The desired mode

getMaxPos

public double getMaxPos()
The maximum position for this coordinate.

Returns:
a positive double indicating the maximum allowable position

setMaxPos

public void setMaxPos(double pos)
               throws java.lang.IllegalArgumentException
Set the maximum position for this coordinate

Parameters:
pos - A positive value indicating the maximum position.
Throws:
java.lang.IllegalArgumentException - when pos < 0

getPos

public double getPos()
The current position of this coordinate.

Returns:
a double between -(getMaxPos()) and getMaxPos()

setPos

public void setPos(double pos)
            throws java.lang.IllegalArgumentException
Modify the current position of this coordinate.

Parameters:
pos - the desired new position
Throws:
java.lang.IllegalArgumentException - If the absolute value of the argument is greater than getMaxPos()

getVel

public double getVel()
The current velocity along this coordinate axis.

Returns:
the magnitude of a velocity vector along this axis

setVel

public void setVel(double vel)
Set the velocity along this axis.

Parameters:
vel - The new value for the velocity along this axis

getAccel

public double getAccel()
The acceleration along this axis.

Returns:
the magintude of an acceleration vector along this axis

setAccel

public void setAccel(double accel)
Set the acceleration along this axis.

Parameters:
accel - The new value for the acceleration along this axis

setValue

public void setValue(double val)
Sets the position, velocity or acceleration depending on the current mode.

Parameters:
val - The new value for the current movement mode.

nextStep

public void nextStep(java.util.Vector v,
                     double step)
Calculates the acceleration of the ball by taking the current acceleration and adding it to the combined accelerations resulting from each of the different gravitational fields.

Parameters:
v - A vector denoting the distance on this axis and the total distance from every gravitational source.
step - The size of the step to calculate.

Spirograph Problem Set Javadocs