|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcdx.Vector3d
public final class Vector3d
The Vector3d
class implements a 3-dimensional vector that
can represent the position or velocity of an object within a 3D space.
This implementation uses public, non-final fields to avoid as much object
creation as possible. Java does not have value types per se, but these
vector classes are the closest thing that is possible.
Field Summary | |
---|---|
float |
x
Fields for the x, y and z coordinates of the vector. |
float |
y
Fields for the x, y and z coordinates of the vector. |
float |
z
Fields for the x, y and z coordinates of the vector. |
Constructor Summary | |
---|---|
Vector3d()
The default constructor for the Vector3d class returns an
object representing the zero vector. |
|
Vector3d(float x,
float y,
float z)
The main constructor for the Vector3d class takes the three
coordinates as parameters and produces an object representing that vector. |
|
Vector3d(Vector3d v)
The secondary constructor for the Vector3d class takes a
vector to copy into this new instance and returns an instance that
represents a copy of that vector. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
Check the equality of two objects |
boolean |
equals(Vector3d b)
Check the equality of two Vector3d objects |
int |
hashCode()
The hashfunction for Vector3d |
void |
set(float x,
float y,
float z)
The set method is basically a convenience method that sets
the internal values of the coordinates. |
void |
set(Vector3d val)
The set is basically a convenience method that sets the internal values of the coordinates copying them from another vector. |
java.lang.String |
toString()
Convert the value of a Vector3d to a string |
void |
zero()
The zero method is a convenience method to zero the
coordinates of the vector. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public float x
public float y
public float z
Constructor Detail |
---|
public Vector3d()
Vector3d
class returns an
object representing the zero vector.
public Vector3d(float x, float y, float z)
Vector3d
class takes the three
coordinates as parameters and produces an object representing that vector.
x
- the coordinate on the x (east-west) axisy
- the coordinate on the y (north-south) axisz
- the coordinate on the z (elevation) axispublic Vector3d(Vector3d v)
Vector3d
class takes a
vector to copy into this new instance and returns an instance that
represents a copy of that vector.
v
- the vector to copy into this new instanceMethod Detail |
---|
public void set(float x, float y, float z)
set
method is basically a convenience method that sets
the internal values of the coordinates.
x
- the coordinate on the x (east-west) axisy
- the coordinate on the y (north-south) axisz
- the coordinate on the z (elevation) axispublic void set(Vector3d val)
set
is basically a convenience method that sets the internal values of the coordinates copying them from another vector.
val
- the value of the vectorpublic void zero()
zero
method is a convenience method to zero the
coordinates of the vector.
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public boolean equals(Vector3d b)
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |