koala
Class KoalaVector

java.lang.Object
  extended by koala.KoalaVector

public class KoalaVector
extends java.lang.Object

Represents a 2D vector, which is a line with magnitude and direction. Class essentially exists to encapsulate the all-pervasive vector calculations. The geometric convention at work here is that +x is to the right, +y is to the top, and +direction is anti-clockwise (the usual convention). Angles are in degrees.


Field Summary
 double x
           
 double y
           
 
Constructor Summary
KoalaVector(double x, double y)
           
 
Method Summary
 KoalaVector add(KoalaVector v)
           
static KoalaVector createFromMagAndDir(double magnitude, double direction)
           
 int direction()
           
 boolean equals(java.lang.Object ob)
           
 int integerX()
           
 int integerY()
           
 double magnitude()
           
static void main(java.lang.String[] args)
           
 void normalise()
           
 void scale(double s)
           
 KoalaVector subtract(KoalaVector v)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x

y

public double y
Constructor Detail

KoalaVector

public KoalaVector(double x,
                   double y)
Method Detail

createFromMagAndDir

public static KoalaVector createFromMagAndDir(double magnitude,
                                              double direction)

direction

public int direction()

magnitude

public double magnitude()

add

public KoalaVector add(KoalaVector v)

subtract

public KoalaVector subtract(KoalaVector v)

normalise

public void normalise()

scale

public void scale(double s)

integerX

public int integerX()

integerY

public int integerY()

equals

public boolean equals(java.lang.Object ob)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)