simulator
Class Position

java.lang.Object
  |
  +--simulator.Position

class Position
extends java.lang.Object

This class rappresent a 2D vector with some operation


Field Summary
(package private)  double x
           
(package private)  double y
           
 
Constructor Summary
Position(double a, double b)
          Initialize vector with initial value
Position(Position p)
          Initialize vector with another vector
 
Method Summary
 double crossProduct(Position p)
          Performs a cross product of vector
 Position diff(Position P)
          Calculate the difference between this vector and the passed vector
 double dist(Position P)
          Calculate the distance beetween this vector and the passed vector
 double findAngle(Position P)
          Find the angle between this vector and the passed vector
 Position multiply(double a)
          Multiply the vector for a costant value
 Position sum(Position P)
          Calculate the sum vector of this vector and the passed vector
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

x

double x

y

double y
Constructor Detail

Position

public Position(double a,
                double b)
Initialize vector with initial value
Parameters:
a - the x value
b - the y value

Position

public Position(Position p)
Initialize vector with another vector
Parameters:
p - the another vector
Method Detail

findAngle

public double findAngle(Position P)
Find the angle between this vector and the passed vector
Parameters:
P - the passed vector

dist

public double dist(Position P)
Calculate the distance beetween this vector and the passed vector
Parameters:
P - the passed vector

sum

public Position sum(Position P)
Calculate the sum vector of this vector and the passed vector
Parameters:
P - the passed vector

diff

public Position diff(Position P)
Calculate the difference between this vector and the passed vector
Parameters:
P - the passed vector

multiply

public Position multiply(double a)
Multiply the vector for a costant value
Parameters:
a - the costant value

crossProduct

public double crossProduct(Position p)
Performs a cross product of vector
Parameters:
p - the 2° vector to use in the calcule
Returns:
the result us a number