|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--netwar.utils.Point2D
This class is used to represent a location or vector in screenspace. Although the structure holds two floats, you will generally call the getInt functions to get the integers because screenspace is in pixels. A Point2D can be translated into a Point3D with z = 0.
| Field Summary | |
float |
x
X-axis value or length. |
float |
y
Y-axis value or length. |
| Constructor Summary | |
Point2D()
Constructs a Point2D at the orgin. |
|
Point2D(float X,
float Y)
Constructs a Point2D at the given point. |
|
Point2D(Point2D p)
Constructs a Point2D at the given point. |
|
| Method Summary | |
int |
getIntx()
This method is a shortcut to Math.round(x) which returns an integer. |
int |
getInty()
This method is a shortcut to Math.round(y) which returns an integer. |
double |
getLength()
Returns the distance from the point to the orgin. |
Point2D |
getProduct(float scalar)
Returns a new Point2D that is the scalar product of this one. |
Point2D |
getSum(Point2D p)
Returns a new Point2D that is the sum of this one, and the given vector. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public float x
public float y
| Constructor Detail |
public Point2D()
public Point2D(float X,
float Y)
X - X-axis value or length.Y - Y-axis value or length.public Point2D(Point2D p)
p - Copy.| Method Detail |
public Point2D getProduct(float scalar)
scalar - Multiplierpublic Point2D getSum(Point2D p)
p - Vectorpublic double getLength()
public int getIntx()
public int getInty()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||