|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.geom.Point2D
game.physics.Vector2D
Nested Class Summary |
Nested classes inherited from class java.awt.geom.Point2D |
java.awt.geom.Point2D.Double, java.awt.geom.Point2D.Float |
Constructor Summary | |
Vector2D()
|
|
Vector2D(double x,
double y)
|
|
Vector2D(Vector2D vector)
|
Method Summary | |
void |
add(double scalar,
Vector2D v)
Adds a scalar multiple of another vector to this one. |
void |
add(Vector2D v)
Adds another vector to this one. |
double |
getDotProduct(Vector2D v)
|
double |
getMagnitude()
|
double |
getX()
|
double |
getY()
|
void |
multiply(double scalar)
Multiplies this vector by a scalar. |
void |
setLocation(double x,
double y)
|
void |
setMagnitude(double m)
|
void |
subtract(double scalar,
Vector2D v)
Subtracts a scalar multiple of another vector from this one. |
void |
subtract(Vector2D v)
Subtracts another vector from this one. |
java.lang.String |
toString()
|
void |
zero()
Sets X and Y to 0. |
Methods inherited from class java.awt.geom.Point2D |
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, equals, hashCode, setLocation |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Vector2D()
public Vector2D(Vector2D vector)
public Vector2D(double x, double y)
Method Detail |
public double getX()
Point2D.getX()
public double getY()
Point2D.getY()
public void setLocation(double x, double y)
Point2D.setLocation(double, double)
public void zero()
public void add(Vector2D v)
v
- the vector to addpublic void add(double scalar, Vector2D v)
scalar
- the factor to multiply v byv
- the vector to addpublic void subtract(Vector2D v)
v
- the vector to subtractpublic void subtract(double scalar, Vector2D v)
scalar
- the factor to multiply y byv
- the vector to subtractpublic void multiply(double scalar)
scalar
- the factor to multiply bypublic double getDotProduct(Vector2D v)
public double getMagnitude()
public void setMagnitude(double m)
public java.lang.String toString()
Object.toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |