Class Vector2D
java.lang.Object
Vector2D
Class that implements 2D Vector with methods to do basic calculations.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add(int vx, int vy)
void
static Vector2D
clone()
int
cross(int vx, int vy)
int
static int
int
distanceSq(int vx, int vy)
int
distanceSq(Vector2D v)
void
divide(int scalar)
int
dot(int vx, int vy)
int
static int
boolean
boolean
equalValue(Vector2D vector2d)
int[]
getDivided(int scalar)
double
int
getMultiplied(int scalar)
getPerp()
void
multiply(int scalar)
void
void
reverse()
void
set(int x, int y)
void
void
setZero()
void
subtract(int vx, int vy)
void
static Vector2D
toString()
-
Field Details
-
x
public int x -
y
public int y
-
-
Constructor Details
-
Vector2D
public Vector2D() -
Vector2D
public Vector2D(int x, int y) -
Vector2D
-
-
Method Details
-
set
public void set(int x, int y) -
set
-
setZero
public void setZero() -
getComponents
public int[] getComponents() -
getLength
public double getLength() -
getLengthSqrt
public int getLengthSqrt() -
distanceSq
public int distanceSq(int vx, int vy) -
distanceSq
-
normalize
public void normalize() -
getNormalized
-
add
-
add
public void add(int vx, int vy) -
add
-
getAdded
-
subtract
-
subtract
public void subtract(int vx, int vy) -
subtract
-
getSubtracted
-
multiply
public void multiply(int scalar) -
getMultiplied
-
divide
public void divide(int scalar) -
getDivided
-
getPerp
-
dot
-
dot
public int dot(int vx, int vy) -
dot
-
cross
-
cross
public int cross(int vx, int vy) -
cross
-
reverse
public void reverse() -
getReversed
-
equalValue
-
clone
-
equals
-
toString
-