|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mascotcapsule.micro3d.v3.Vector3D
This class handles 3D vectors. The components of the vectors are fixed-point decimal numbers in which 1.0 is equivalent to 4096 units. The vector length is 4096 after normalization using the unit() method. When performing the various calculations, the results when values exceed the range of int and overflow are not defined.
Field Summary | |
int |
x
x component of the vector |
int |
y
y component of the vector |
int |
z
z component if the vector |
Constructor Summary | |
Vector3D()
Creates a vector object. |
|
Vector3D(int x,
int y,
int z)
Specifies the values of all elements and creates a vector object. |
|
Vector3D(Vector3D v)
Creates a vector object. |
Method Summary | |
int |
getX()
Gets the value of the x component settings. |
int |
getY()
Gets the value of the y component settings. |
int |
getZ()
Gets the value of the z component settings. |
int |
innerProduct(Vector3D v)
Calculates the inner product between this vector and the specified vector. |
static int |
innerProduct(Vector3D v1,
Vector3D v2)
Calculates the inner products of the specified 2 vectors. |
void |
outerProduct(Vector3D v)
Calculates the outer product between this vector and the specified vector. |
static Vector3D |
outerProduct(Vector3D v1,
Vector3D v2)
Calculates the outer products of the 2 specified vectors. |
void |
set(int x,
int y,
int z)
Enters values for all elements. |
void |
set(Vector3D v)
Copies the content of other vector objects. |
void |
setX(int x)
Enters the x component setting. |
void |
setY(int y)
Enters the y component setting. |
void |
setZ(int z)
Enters the z component setting. |
void |
unit()
Normalizes (make a unit quantity) this vector. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public int x
public int y
public int z
Constructor Detail |
public Vector3D()
public Vector3D(Vector3D v)
v
- Other vector objects
java.lang.NullPointerException
- Whe argument is null.public Vector3D(int x, int y, int z)
x
- Value of x componenty
- Value of y componentz
- Value of z componentMethod Detail |
public final void unit()
public final int getX()
public final int getY()
public final int getZ()
public final void setX(int x)
x
- Value of x componentpublic final void setY(int y)
y
- Value of y componentpublic final void setZ(int z)
z
- Value of z componentpublic final void set(Vector3D v)
v
- Other vector objects
java.lang.NullPointerException
- When the argument is null.public final void set(int x, int y, int z)
x
- Value of x componenty
- Value of y componentz
- Value of z componentpublic final int innerProduct(Vector3D v)
v
- Vector object
java.lang.NullPointerException
- When argument v is null.public final void outerProduct(Vector3D v)
v
- Vector object
java.lang.NullPointerException
- When argument v is null.public static final int innerProduct(Vector3D v1, Vector3D v2)
v1
- Vector object 1v2
- Vector object 2
java.lang.NullPointerException
- When argument v1 or v2 is null.public static final Vector3D outerProduct(Vector3D v1, Vector3D v2)
v1
- Vector object 1v2
- Vector object 2
java.lang.NullPointerException
- When argument v1 or v2 is null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |