public class Vector extends Position
NO_POSITION, x, y
Constructor and Description |
---|
Vector(double x,
double y)
Creates a vector.
|
Vector(float x,
float y)
Creates a vector.
|
Modifier and Type | Method and Description |
---|---|
Vector |
addVector(Vector other)
Add another vector.
|
Vector |
clone() |
Vector |
elementWiseMultiply(Vector other)
Element wise multiplication of this vector and another.
|
boolean |
isAproximateRotation(float degrees,
Vector other)
Checks if this vector is an approximate counterclockwise rotation of
another vector.
|
float |
length()
The length of the vector.
|
float |
multiply(Vector other)
Multiplies (dot product) this vector with another.
|
Vector |
normalize()
Normalizes this vector.
|
Vector |
reverse()
Reverse the vector.
|
Vector |
scalarMultiply(double scalar)
Scalar multiplies this vector.
|
Vector |
scalarMultiply(float scalar)
Scalar multiplies this vector.
|
Vector |
subtractVector(Vector other)
Subtracts another vector from this vector.
|
java.lang.String |
toString() |
distanceTo, equals, hashCode
public Vector(double x, double y)
x
- The x direction.y
- The y direction.public Vector(float x, float y)
x
- The x direction.y
- The y direction.public Vector addVector(Vector other)
other
- The other vector.public Vector elementWiseMultiply(Vector other)
other
- The other vector.public boolean isAproximateRotation(float degrees, Vector other)
degrees
- The degrees rotation.other
- The other vector.public float length()
public float multiply(Vector other)
other
- The other vector.public Vector normalize()
public Vector reverse()
public Vector scalarMultiply(double scalar)
scalar
- The scalar.public Vector scalarMultiply(float scalar)
scalar
- The scalar.public Vector subtractVector(Vector other)
other
- The other vector.