public final class Vector2D
extends java.lang.Object
Constructor and Description |
---|
Vector2D(double x,
double y)
Creates a vector from the origin to the point (x, y).
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
double |
getAngle()
Gets the angle of this vector, in radians in the range (-pi, pi).
|
double |
getMagnitude()
Gets the magnitude of this vector.
|
double |
getX()
Gets the X-coordinate of this vector.
|
double |
getY()
Gets the Y-coordinate of this vector.
|
int |
hashCode() |
java.lang.String |
toString() |
public Vector2D(double x, double y)
x
- the X-coordinate of the vectory
- the Y-coordinate of the vectorpublic double getX()
public double getY()
public double getMagnitude()
public double getAngle()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object