|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--netwar.utils.Point3D
This class is used to represent a location or vector in gamespace. A Point3D can be translated into a Point2D using the internal transform matrix, and that matrix can be manipulated for zooming and changes in angle.
Note that the get_ functions return a new Point2D/3D while the do_ funtions affect this Point3D.
| Field Summary | |
float |
x
X-axis value or length. |
float |
y
Y-axis value or length. |
float |
z
Z-axis value or length. |
| Constructor Summary | |
Point3D()
Constructor for the orgin. |
|
Point3D(double X,
double Y,
double Z)
Constructs a Point3D, converting the doubles to floats. |
|
Point3D(float X,
float Y,
float Z)
Constructs a Point3D |
|
Point3D(Point3D v)
Copy constructor |
|
| Method Summary | |
Point3D |
doCrossProduct(Point3D v)
Evalutates the cross (vector) product of two vectors. |
Point3D |
doDifference(Point3D v)
Returns the vector difference of this Point3D and the given Point3D. |
Point3D |
doProduct(float scalar)
Returns a new Point3D that is the scalar product of this one. |
Point3D |
doSum(Point3D v)
Returns the sum of this Point3D and the given vector. |
boolean |
equals(float X,
float Y,
float Z)
Implementation of Object.equals(). |
boolean |
equals(Point3D p)
Implementation of Object.equals(). |
Point3D |
getCrossProduct(Point3D v)
Evalutates the cross (vector) product of two vectors. |
Point3D |
getDifference(Point3D v)
Returns the vector difference of this Point3D and the given Point3D. |
float |
getDotProduct(Point3D v)
Evalutates the dot (scalar) product of two vectors. |
float |
getLength()
Returns the distance to the orgin, or, returns the length of the vector. |
float |
getLengthSquared()
Same as getLength() without the square root. |
Point2D |
getPoint2D()
Converts this gamespace point into a 2D screenspace point using the transform matrix. |
static Point2D |
getPoint2D(Point3D v)
Converts this gamespace point into a 2D screenspace point using the transform matrix. |
static Point3D |
getPoint3D(int x,
int y)
Converts a 2D screenspace point into a 3D gamespace point using the transform matrix. |
static Point3D |
getPoint3D(Point2D pt)
Converts a 2D screenspace point into a 3D gamespace point using the transform matrix. |
Point3D |
getProduct(float scalar)
Returns a new Point3D that is the scalar product of this one. |
static float |
getScale()
Returns the current scaling value. |
Point3D |
getSum(Point3D v)
Returns the sum of this Point3D and the given vector. |
void |
Normalize()
Changes the length of this vector to 1. |
Point3D |
set(float X,
float Y,
float Z)
Sets this point from the given information. |
Point3D |
set(Point3D p)
Sets this point as a copy of the given one. |
static void |
translate(int x,
int y)
Adjusts the transform matrix in the (x,y,0) direction. |
static void |
zoom(float factor,
int halfwidth,
int halfheight)
Adjusts the transform matrix in the (0,0,z) direction. |
| 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
public float z
| Constructor Detail |
public Point3D()
public Point3D(float X,
float Y,
float Z)
X - X-axis value or length.Y - Y-axis value or length.Z - Z-axis value or length.
public Point3D(double X,
double Y,
double Z)
X - X-axis value or length.Y - Y-axis value or length.Z - Z-axis value or length.public Point3D(Point3D v)
v - Copy.| Method Detail |
public Point3D getProduct(float scalar)
scalar - Multiplierpublic float getDotProduct(Point3D v)
v - Secound vector in the dot product operation.public Point3D getCrossProduct(Point3D v)
v - Secound vector in the cross product operation.public Point3D getSum(Point3D v)
v - The vector to add to this.public Point3D getDifference(Point3D v)
v - The secound point in this operation that the returned vector points to. (this + returned = v)public Point3D doProduct(float scalar)
scalar - Multiplier.public Point3D doCrossProduct(Point3D v)
v - Secound vector in the cross product operation.public Point3D doSum(Point3D v)
v - The vector to add to this.public Point3D doDifference(Point3D v)
v - The secound point in this operation that the returned vector points to. (prethis + postthis = v)public void Normalize()
public float getLength()
getLengthSquared()public float getLengthSquared()
getLength()public Point2D getPoint2D()
public static Point2D getPoint2D(Point3D v)
v - The point to convert.public static Point3D getPoint3D(Point2D pt)
pt - A Point2D in screen space.
public static Point3D getPoint3D(int x,
int y)
x - The x-axis value in screen space.y - The x-axis value in screen space.public boolean equals(Point3D p)
p - The reference Point3D with which to compare.
public boolean equals(float X,
float Y,
float Z)
X - The x-axis value with which to compare.Y - The y-axis value with which to compare.Z - The z-axis value with which to compare.public Point3D set(Point3D p)
p - The Point3D to copy.
public Point3D set(float X,
float Y,
float Z)
X - The new x-axis value.Y - The new y-axis value.Z - The new z-axis value.
public static void translate(int x,
int y)
x - Change in the x direction.y - Change in the y direction.
public static void zoom(float factor,
int halfwidth,
int halfheight)
factor - The magnification factor.halfwidth - Half the width of the screen, in screenspacehalfheight - Half the height of the screen, in screenspace.public static float getScale()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||