|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectsimuLCS.Vector2D
Handles all the functions for 2D Vectors.
| Field Summary | |
private double |
x
|
private double |
y
|
| Constructor Summary | |
Vector2D()
Creates a vector (0,0) |
|
Vector2D(double xp,
double yp)
Creates a vector (xp,yp) |
|
Vector2D(java.awt.geom.Point2D p)
Creates a vector between (0,0) and the given point |
|
Vector2D(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
Creates the vector between two given points |
|
Vector2D(Vector2D v)
Creates a clone of a given vector |
|
| Method Summary | |
void |
add(Vector2D v)
Add the given vector to this vector (it modifies the vector) |
static Vector2D |
getCorrectedVector(Vector2D movVector,
Arena a,
Entity me,
java.awt.Graphics2D g)
Correct the vector so that it doesn't bring the Entity outside the Arena. |
double |
getNorm()
Get the norm of the Vector |
Vector2D |
getNormalLeft()
Get a perpendicular vector, on the left |
double |
getX()
|
double |
getY()
|
void |
multiplyByConstant(double d)
Change the scale of the vector by multiplying its coordinates by a contant |
void |
opposite()
Change the vector into its opposite |
void |
paint(java.awt.geom.Point2D p,
java.awt.Graphics2D g,
java.awt.Color c)
Paints the vector (useful for debugging) |
void |
setUnitVector(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
Set the Vector to the unit vector between the two points the previous values of the Vector are lost. |
void |
setX(double d)
|
void |
setY(double d)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private double x
private double y
| Constructor Detail |
public Vector2D()
public Vector2D(double xp,
double yp)
xp - yp - public Vector2D(java.awt.geom.Point2D p)
p -
public Vector2D(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
p1 - p2 - public Vector2D(Vector2D v)
v - | Method Detail |
public void add(Vector2D v)
v - public void opposite()
public void multiplyByConstant(double d)
d -
public void setUnitVector(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
p1 - p2 - public double getNorm()
public double getX()
public double getY()
public void setX(double d)
d - public void setY(double d)
d - public java.lang.String toString()
public void paint(java.awt.geom.Point2D p,
java.awt.Graphics2D g,
java.awt.Color c)
p - g - c - public Vector2D getNormalLeft()
public static Vector2D getCorrectedVector(Vector2D movVector,
Arena a,
Entity me,
java.awt.Graphics2D g)
a - me -
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||