|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.motorola.iden.micro3d.Vector3D
The Vector3D
class is a container for a 3D integer vector.
An object of type Vector3D
contains three integer values that
specify the X, Y, and Z-coordinates. For each of the coordinates the valid
range is -32768 to 32767. Values that are smaller than -32768 will be
automatically adjusted to -32768 (Vector3D.MIN_VALUE
).
Similarly, values greater than 32767 will be automatically adjusted to
32767 (Vector3D.MAX_VALUE
).
Field Summary | |
static int |
MAX_VALUE
The maximum value for x, y, and z that can be stored in the Vector3D . |
static int |
MIN_VALUE
The minimum value for x, y, and z that can be stored in the Vector3D . |
Constructor Summary | |
Vector3D()
Creates a Vector3D object with x, y, and z values set to 0. |
|
Vector3D(int x,
int y,
int z)
Creates a Vector3D object with the specified x, y, and z values.
|
Method Summary | |
int |
getX()
Returns the x value of this Vector3D object.
|
int |
getY()
Returns the y value of this Vector3D object.
|
int |
getZ()
Returns the z value of this Vector3D object.
|
int |
innerProduct(Vector3D multiplier)
Returns the inner, or dot, product of this Vector3D with
the specified Vector3D .
|
void |
normalize()
Normalizes this Vector3D object. |
static Vector3D |
normalize(Vector3D vector)
Normalizes the specified Vector3D object. |
void |
outerProduct(Vector3D multiplier)
Calculates the outer, or cross, product of this Vector3D with
the specified Vector3D . |
static Vector3D |
outerProduct(Vector3D multiplicand,
Vector3D multiplier)
Calculates the outer, or cross, product of the specified Vector3D objects. |
void |
set(int x,
int y,
int z)
Sets the x, y, and z values of this Vector3D object.
|
void |
setX(int x)
Sets the x value of this Vector3D object.
|
void |
setY(int y)
Sets the y value of this Vector3D object.
|
void |
setZ(int z)
Sets the z value of this Vector3D object.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MIN_VALUE
Vector3D
. The minumum value is -32768.public static final int MAX_VALUE
Vector3D
. The maximum value is 32767.Constructor Detail |
public Vector3D()
Vector3D
object with x, y, and z values set to 0.public Vector3D(int x, int y, int z)
Vector3D
object with the specified x, y, and z values.
Values within the vector must be within the range -32768 and 32767.
If any of the specified values are less than -32768 they will be automatically
adjusted to -32768 (Vector3D.MIN_VALUE
). Similarly, any values
greater than 32767 will be automatically adjusted to 32767 (
Vector3D.MAX_VALUE
).
x
- the value for the x component of this vector.y
- the value for the y component of this vector.z
- the value for the z component of this vector.MIN_VALUE
,
MAX_VALUE
Method Detail |
public int getX()
Vector3D
object.
public void setX(int x)
Vector3D
object.
The specified value must be within the range -32768 and 32767.
If any of the specified values are less than -32768 they will be automatically
adjusted to -32768 (Vector3D.MIN_VALUE
). Similarly, any values
greater than 32767 will be automatically adjusted to 32767 (
Vector3D.MAX_VALUE
).
x
- the value for the x component of this vector.MIN_VALUE
,
MAX_VALUE
public int getY()
Vector3D
object.
public void setY(int y)
Vector3D
object.
The specified value must be within the range -32768 and 32767.
If any of the specified values are less than -32768 they will be automatically
adjusted to -32768 (Vector3D.MIN_VALUE
). Similarly, any values
greater than 32767 will be automatically adjusted to 32767 (
Vector3D.MAX_VALUE
).
y
- the value for the y component of this vector.MIN_VALUE
,
MAX_VALUE
public int getZ()
Vector3D
object.
public void setZ(int z)
Vector3D
object.
The specified value must be within the range -32768 and 32767.
If any of the specified values are less than -32768 they will be automatically
adjusted to -32768 (Vector3D.MIN_VALUE
). Similarly, any values
greater than 32767 will be automatically adjusted to 32767 (
Vector3D.MAX_VALUE
).
z
- the value for the z component of this vector.MIN_VALUE
,
MAX_VALUE
public void set(int x, int y, int z)
Vector3D
object.
The specified values must be within the range -32768 and 32767.
If any of the specified values are less than -32768 they will be automatically
adjusted to -32768 (Vector3D.MIN_VALUE
). Similarly, any values
greater than 32767 will be automatically adjusted to 32767 (
Vector3D.MAX_VALUE
).
x
- the value for the x component of this vector.y
- the value for the y component of this vector.z
- the value for the z component of this vector.MIN_VALUE
,
MAX_VALUE
public void normalize()
Vector3D
object. This method does not do
anything if this vector is a zero vector. A zero vector is a vector of
length 0, and thus has all components equal to zero.
public static Vector3D normalize(Vector3D vector) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
Vector3D
object. This method
returns a new Vector3D
object which contains the normalized
vector. If a zero vector is specified, this method throws
IllegalArgumentException
. A zero vector is a vector of
length 0, and thus has all components equal to zero.
Vector3D
containing the normalized
Vector3D
specified.java.lang.NullPointerException
- if the specified vector is null
.java.lang.IllegalArgumentException
- if the specified vector is a zero vector.public void outerProduct(Vector3D multiplier) throws java.lang.NullPointerException
Vector3D
with
the specified Vector3D
. The result is stored in the object
the method was called on.
multiplier
- the Vector3D
serving as the multiplier.java.lang.NullPointerException
- if the specified multiplier is null
.public static Vector3D outerProduct(Vector3D multiplicand, Vector3D multiplier) throws java.lang.NullPointerException
Vector3D
objects. The result is returned as a new
Vector3D
object.
multiplicand
- the Vector3D
serving as the multiplicand.multiplier
- the Vector3D
serving as the multiplier.Vector3D
containing the outer product.java.lang.NullPointerException
- if either of the specified parameters
are null
.public int innerProduct(Vector3D multiplier) throws java.lang.NullPointerException
Vector3D
with
the specified Vector3D
.
multiplier
- the Vector3D
serving as the multiplier.java.lang.NullPointerException
- if the multiplier is null
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |