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 |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
x
double x
y
double y
Position
public Position(double a,
double b)
- Initialize vector with initial value
- Parameters:
a
- the x valueb
- the y value
Position
public Position(Position p)
- Initialize vector with another vector
- Parameters:
p
- the another vector
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