|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.planeth.common.math.Vector2D
2D Vector implementation
| Field Summary | |
static Vector2D |
ZERO_VECTOR
|
| Constructor Summary | |
Vector2D(double size)
Constructor for Vector2D. |
|
Vector2D(double x,
double y)
Constructor for Vector2D. |
|
| Method Summary | |
Vector2D |
addWith(Vector2D vector)
Adds this Vector with the passed Vector. |
static Vector2D |
avg(Vector2D[] vertexes)
Returns the average Vector of the passed vertexes |
double |
avgDistance2VectorArray(Vector2D[] vertexes)
Returns the average distance between this Vector and the passed array of Vectors. |
java.lang.Object |
clone()
Returns a clone of this Vector |
static Vector2D |
createVectorByAngleAndMagnitude(double theta,
double length)
Erstellt einen Vektor anhand seines Richtungswinkels und seiner Distanz Creates a new Vector2D by angle and magnitude |
double |
crossProduct(Vector2D vector)
Returns the cross product of this Vector and the passed Vector. |
double |
distance2Vector(Vector2D vector)
Returns the distance between this Vector and the passed Vector. |
Vector2D |
divideWith(double value)
Divides this Vector with the value. |
double |
dotProduct(Vector2D vector)
Returns the dot product of this Vector and the passed Vector. |
boolean |
equals(java.lang.Object obj)
Returns true, if the coordinates of the Vector equals with the coordinates of the passed Vector (Object). |
double |
getAngle()
Returns the angle (in radians) of the Vector. |
int |
getIntX()
Returns the int value for x |
int |
getIntY()
Returns the int value for y |
double |
getMagnitude()
Returns the magnitude (length) of the Vector. |
double |
getX()
|
double |
getY()
|
boolean |
isZeroVector()
Returns true, if the Vector is (0,0) |
double |
maxDistance2VectorArray(Vector2D[] vectorArray)
Returns the max distance between this Vector and the passed array of Vectors. |
Vector2D |
multipyWith(double value)
Multiplies this Vector with the passed value. |
Vector2D |
normalize()
Normalizes the vector to maintain the same direction but with a absolute. |
void |
setLocation(double x,
double y)
Sets the coordinates of the Vector to a new position |
Vector2D |
subtractWith(Vector2D vector)
Subtracts this Vector with the passed Vector. |
static Vector2D |
sum(Vector2D[] vertexes)
Returns the Vector sum of the passed vertexes |
java.lang.String |
toString()
Returns the String interpretation of the Vector |
| Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final Vector2D ZERO_VECTOR
| Constructor Detail |
public Vector2D(double size)
size - value for x and y coordinate
public Vector2D(double x,
double y)
x - the x coordinatey - the y coordinate| Method Detail |
public static Vector2D sum(Vector2D[] vertexes)
vertexes - array of Vector2D
public static Vector2D avg(Vector2D[] vertexes)
vertexes - array of Vector2D
public static Vector2D createVectorByAngleAndMagnitude(double theta,
double length)
theta - angle in radianslength - magnitude of the Vector
public boolean isZeroVector()
public double getAngle()
public double getMagnitude()
public Vector2D addWith(Vector2D vector)
vector - Vector to add
public Vector2D subtractWith(Vector2D vector)
vector - Vector to subtract
public Vector2D divideWith(double value)
value - Divider
public Vector2D multipyWith(double value)
public double dotProduct(Vector2D vector)
vector -
public double crossProduct(Vector2D vector)
vector -
public Vector2D normalize()
public double distance2Vector(Vector2D vector)
vector - Vektor2
public double avgDistance2VectorArray(Vector2D[] vertexes)
vertexes -
public double maxDistance2VectorArray(Vector2D[] vectorArray)
vectorArray -
public void setLocation(double x,
double y)
x - x-coordinatey - y-coordinatepublic java.lang.Object clone()
Object.clone()public boolean equals(java.lang.Object obj)
obj - Vector to compare
Object.equals(java.lang.Object)public java.lang.String toString()
Object.toString()public double getX()
public double getY()
public int getIntX()
public int getIntY()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||