math
Class Vector2D

java.lang.Object
  extended by math.Vector2D

public class Vector2D
extends java.lang.Object

a 2 dimensional vector


Field Summary
 double x
           
 double y
           
 
Constructor Summary
Vector2D(double x, double y)
          constructor
Vector2D(Point2D start, Point2D end)
          constructor, creates a vector as the difference between a start and end point
Vector2D(Vector2D v)
           
 
Method Summary
 double magnitude()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

x

public double x

y

public double y
Constructor Detail

Vector2D

public Vector2D(double x,
                double y)
constructor

Parameters:
x -
y -

Vector2D

public Vector2D(Vector2D v)

Vector2D

public Vector2D(Point2D start,
                Point2D end)
constructor, creates a vector as the difference between a start and end point

Parameters:
start - [in] start point
end - [in] end point
Method Detail

magnitude

public double magnitude()
Returns:
the magnitude (length) of the vector