roboplayer.geometry
Class Vector2d

java.lang.Object
  |
  +--roboplayer.geometry.Vector2d

public class Vector2d
extends java.lang.Object

Helper class for different vector functions.

Version:
1.0
Author:
Krzysztof Langner

Field Summary
 double x
           
 double y
           
 
Constructor Summary
Vector2d()
          Empty constructor
Vector2d(double posx, double posy)
          Constructor
Vector2d(Vector2d v)
          Copy constructor
 
Method Summary
 void add(Vector2d pos)
          Add vector
 double getDistance(Vector2d second)
          Get distance to second vector
 double getLength()
          Get length of this vector
 void multiply(double scalar)
          Multiply by scalar
 java.lang.String toString()
          Convert to string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public double x

y

public double y
Constructor Detail

Vector2d

public Vector2d()
Empty constructor


Vector2d

public Vector2d(double posx,
                double posy)
Constructor

Parameters:
posx - x coordinate
posy - y coordinate

Vector2d

public Vector2d(Vector2d v)
Copy constructor

Parameters:
v - source vector
Method Detail

add

public void add(Vector2d pos)
Add vector

Parameters:
pos - vector to add

multiply

public void multiply(double scalar)
Multiply by scalar

Parameters:
scalar - scalar

getLength

public double getLength()
Get length of this vector

Returns:
length of the vector

getDistance

public double getDistance(Vector2d second)
Get distance to second vector

Returns:
distance between vectors

toString

public java.lang.String toString()
Convert to string

Overrides:
toString in class java.lang.Object
Returns:
object converted to string