|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmr3d.lang.Vector3D
The class Vector3D is able to represent a homogeneous vector.
| Field Summary | |
int |
h
homogeneous coordinate of the vector |
int |
x
x-coordinate of the vector |
int |
y
y-coordinate of the vector |
int |
z
z-coordinate of the vector |
| Fields inherited from interface mr3d.debug.Debugable |
ERROR_INT, ERROR_STRING |
| Constructor Summary | |
Vector3D()
Creates a vector with all components set to 0. |
|
Vector3D(int newX,
int newY,
int newZ,
int newH)
Creates a vector using the specified values. |
|
| Method Summary | |
Vector3D |
add(Vector3D addVec)
Adds this the components of this vector to the compontens of the specified one and returns the result vector. |
Vector3D |
clone()
Returns a copy of this vector. |
Vector3D |
cross(Vector3D crossVector)
Calculates the cross product of this vector with a specified one. |
Vector3D |
div(int divider)
Divides a the vector by a specified number. |
int |
dot(Vector3D aVector)
Calculates the scalar product of two vectors. |
boolean |
equals(Vector3D otherVector)
Compares this vector with a another specified one and return the result of the test. |
boolean |
isEmpty()
Returns the result of the test if the vector components exept h are 0. |
Vector3D |
mul(int factor)
Multiplies the vector all components with a specified factor. |
void |
resetTozero()
Resets the vector components to zero. |
void |
selfDiv(int divider)
Devides this vector by a specified number and stores the result in this vector. |
void |
selfMul(int factor)
Multiplies this vector with a specified factor and stores the result in this vector. |
void |
set(int newX,
int newY,
int newZ,
int newH)
Sets the vector components according to the specified parameters. |
Vector3D |
sub(Vector3D subVec)
Subtracts a vector from this vector and returns the result. |
void |
toConsole()
Prints the contents of the object to the Java console. |
void |
toConsole(java.lang.String msgString)
Prints the contents of the object to the Java console together with an information string. |
int |
velocity()
Returns the velocity of the vector. |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public int h
public int x
public int y
public int z
| Constructor Detail |
public Vector3D()
public Vector3D(int newX,
int newY,
int newZ,
int newH)
newX - x-coordinate of the vectornewY - y-coordinate of the vectornewZ - z-coordinate of the vectornewH - homogeneous coordinate of the vector| Method Detail |
public Vector3D add(Vector3D addVec)
addVec - the vector that will be added to this vector
public Vector3D clone()
public Vector3D cross(Vector3D crossVector)
Example
crossProd = Vector1 x Vector2
can be realized with
Vector3D crossProd = Vector1.cross(Vector2);
crossVector - the vector to be
public Vector3D div(int divider)
divider - number by which the vector components are
devided
public int dot(Vector3D aVector)
aVector - the other vector of which the scalar
product is calculated from
public boolean equals(Vector3D otherVector)
public boolean isEmpty()
public Vector3D mul(int factor)
factor - is multiplied with the vector elements
public void resetTozero()
public void selfDiv(int divider)
divider - number by which the vector components
are devidedpublic void selfMul(int factor)
factor - is multiplied with the vector elements
public void set(int newX,
int newY,
int newZ,
int newH)
public Vector3D sub(Vector3D subVec)
subVec - the vector that will be added to this vector
public void toConsole()
Debugable
toConsole in interface Debugablepublic void toConsole(java.lang.String msgString)
Debugable
toConsole in interface Debugablepublic int velocity()
SQRT(x^2 + y^2 + z^2);
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||