Class velvec

java.lang.Object
  |
  +--velvec

public class velvec
extends java.lang.Object

This class was written to provide support for using 2-Dimensional vectors. The name "velvec" is short for Velocity Vector. The primary function of the class is to provide a convenient way of representing various vectors. The class allows a 2D vector to be set or read as: 0. Polar format (Magnitude, Direction) (Direction expressed in degrees) 1. Component format (x,y). 2. Polar format (Magnitude, Direction) (Direction expressed in radians) velvec stores the vector information as a length 5 array of doubles. The class defines the position of each piece of infomation using static integer tags and holds a static reference to the Useful_Functions class for the purpose of using both the mod and string split functions.


Constructor Summary
velvec()
          Purpose: Default Constructor
velvec(double x, double y, int option)
          Purpose: Initializing Constructor
 
Method Summary
 java.lang.String collapse()
          Purpose: Collapses the velvec into a string with a delimiter between the two values This is used when packing the vector into a string for network transmission Roughly the equivalent of toString() in Java standard classes Returns: String Concat of the minimal representation of the vector (2 values, xy components) delimited with a "#"
 void copy(velvec orig)
          Purpose: Set velvec object to exactly match the Original velvec object passed to it.
 void expand(java.lang.String data)
          Purpose: Expand a collapsed velvec into its rich internal format.
 double gddir()
          Purpose: Give public access to the Degree Direction value of this vector Returns: velvec vector Degree Direction
 double gmag()
          Purpose: Give public access to the Magnitude value of this vector Returns: velvec vector Magnitude
 double grdir()
          Purpose: Give public access to the Radian Direction value of this vector Returns: velvec vector Radian Direction
 double gxc()
          Purpose: Give public access to the X-Component value of this vector Returns: velvec vector X-Component
 double gyc()
          Purpose: Give public access to the Y-Component value of this vector Returns: velvec vector Y-Component
 void invx()
          Purpose: Inverts the X-Component of the vector (rotates 180 degrees)
 void invy()
          Purpose: Inverts the Y-Component of the vector (rotates 180 degrees)
 java.lang.String print()
          Purpose: Print out the entire contents of the velvec Returns: String Concat of the minimal representation of the vector (2 values, xy components)
 java.lang.String print2()
          Purpose: Return String representatoin of vector Returns: String Concat of the minimal representation of the vector (2 values, xy components)
 void setvec(double x, double y, int option)
          Purpose: Sets the vector to a new direction and magnitude.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

velvec

public velvec()
Purpose: Default Constructor


velvec

public velvec(double x,
              double y,
              int option)
Purpose: Initializing Constructor

Method Detail

setvec

public void setvec(double x,
                   double y,
                   int option)
Purpose: Sets the vector to a new direction and magnitude. No matter what option is used all fields are updated such that the information will be available for use in all formats.


print

public java.lang.String print()
Purpose: Print out the entire contents of the velvec Returns: String Concat of the minimal representation of the vector (2 values, xy components)


print2

public java.lang.String print2()
Purpose: Return String representatoin of vector Returns: String Concat of the minimal representation of the vector (2 values, xy components)


collapse

public java.lang.String collapse()
Purpose: Collapses the velvec into a string with a delimiter between the two values This is used when packing the vector into a string for network transmission Roughly the equivalent of toString() in Java standard classes Returns: String Concat of the minimal representation of the vector (2 values, xy components) delimited with a "#"


expand

public void expand(java.lang.String data)
Purpose: Expand a collapsed velvec into its rich internal format. Utilizes the setvec() function defined above Rough equivalen of parseType() in Java standard classes


gmag

public double gmag()
Purpose: Give public access to the Magnitude value of this vector Returns: velvec vector Magnitude


grdir

public double grdir()
Purpose: Give public access to the Radian Direction value of this vector Returns: velvec vector Radian Direction


gddir

public double gddir()
Purpose: Give public access to the Degree Direction value of this vector Returns: velvec vector Degree Direction


gxc

public double gxc()
Purpose: Give public access to the X-Component value of this vector Returns: velvec vector X-Component


gyc

public double gyc()
Purpose: Give public access to the Y-Component value of this vector Returns: velvec vector Y-Component


invy

public void invy()
Purpose: Inverts the Y-Component of the vector (rotates 180 degrees)


invx

public void invx()
Purpose: Inverts the X-Component of the vector (rotates 180 degrees)


copy

public void copy(velvec orig)
Purpose: Set velvec object to exactly match the Original velvec object passed to it.