|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.math.Vector4f
public class Vector4f
Defines 4-element floating point vector.
Field Summary | ||
---|---|---|
static int |
ANIMATION_PROPERTY_W
Used to animate the w component. |
|
static int |
ANIMATION_PROPERTY_X
Used to animate the x component. |
|
static int |
ANIMATION_PROPERTY_XW
Used to animate the x and w components. |
|
static int |
ANIMATION_PROPERTY_XY
Used to animate the x and y components. |
|
static int |
ANIMATION_PROPERTY_XYW
Used to animate the x, y and w components. |
|
static int |
ANIMATION_PROPERTY_XYZ
Used to animate the x, y and z components. |
|
static int |
ANIMATION_PROPERTY_XYZW
Used to animate the x, y, z and w components. |
|
static int |
ANIMATION_PROPERTY_XZ
Used to animate the x and z components. |
|
static int |
ANIMATION_PROPERTY_XZW
Used to animate the x, z and w components. |
|
static int |
ANIMATION_PROPERTY_Y
Used to animate the y component. |
|
static int |
ANIMATION_PROPERTY_YW
Used to animate the x and w components. |
|
static int |
ANIMATION_PROPERTY_YZ
Used to animate the y and z components. |
|
static int |
ANIMATION_PROPERTY_YZW
Used to animate the y, z and w components. |
|
static int |
ANIMATION_PROPERTY_Z
Used to animate the z component. |
|
static int |
ANIMATION_PROPERTY_ZW
Used to animate the x and w components. |
|
static Vector4f |
ONE
The 4-element vector of 1s. |
|
static Vector4f |
UNIT_W
The 4-element unit vector along the w axis. |
|
static Vector4f |
UNIT_X
The 4-element unit vector along the x axis. |
|
static Vector4f |
UNIT_Y
The 4-element unit vector along the y axis. |
|
static Vector4f |
UNIT_Z
The 4-element unit vector along the z axis. |
|
static Vector4f |
ZERO
The 4-element zero vector. |
|
float |
w
The w-coordinate. |
|
float |
x
The x-coordinate. |
|
float |
y
The y-coordinate. |
|
float |
z
The z-coordinate. |
Constructor Summary | ||
---|---|---|
Vector4f()
Constructs a new vector initialized to all zeros. |
||
Vector4f(float x,
float y,
float z,
float w)
Constructs a new vector initialized to the specified values. |
||
Vector4f(float[] array,
int offset)
Constructs a new vector from the values in the specified array. |
||
Vector4f(Vector4f v)
Constructs a new vector that is a copy of the specified vector. |
||
Vector4f(Vector4f p1,
Vector4f p2)
Constructs a vector that describes the direction between the given points. |
Method Summary | ||
---|---|---|
void |
add(Vector4f v)
Adds the elements of the specified vector to this one. |
|
static void |
add(Vector4f v1,
Vector4f v2,
Vector4f dst)
Adds the specified vectors and stores the result in dst . |
|
static float |
angle(Vector4f v1,
Vector4f v2)
Returns the angle (in radians) between the specified vectors. |
|
void |
clamp(Vector4f min,
Vector4f max)
Clamps this vector within the specified range. |
|
static void |
clamp(Vector4f v,
Vector4f min,
Vector4f max,
Vector4f dst)
Clamps the specified vector within the specified range and returns it in dst . |
|
float |
distance(Vector4f v)
Returns the distance between this vector and v . |
|
float |
distanceSquared(Vector4f v)
Returns the squared distance between this vector and v . |
|
float |
dot(Vector4f v)
Returns the dot product of this vector and the specified vector. |
|
static float |
dot(Vector4f v1,
Vector4f v2)
Returns the dot produce between the specified vectors. |
|
boolean |
equals(Object obj)
Determines if the specified object is of type Vector4f and all of its elements are equal to the elements of this Vector4f. |
|
boolean |
equals(Vector4f v)
Returns true if all elements of the specified Vector4f are equal to the elements of this Vector4f. |
|
int |
getAnimationPropertyComponentCount(int property)
Gets the number of components of the specified property. |
|
void |
getAnimationValue(int property,
AnimationValue value)
Gets the value or values of the specified property. |
|
int |
hashCode()
Returns a hash code based on the elements of this vector. |
|
float |
length()
Computes the length of this vector. |
|
float |
lengthSquared()
Returns the squared length of this vector. |
|
void |
negate()
Negates this vector. |
|
void |
normalize()
Normalizes this vector. |
|
void |
normalize(Vector4f dst)
Normalizes this vector and stores the result in dst . |
|
void |
scale(float scalar)
Scales all elements of this vector by the specified value. |
|
void |
set(float x,
float y,
float z,
float w)
Sets the elements of this vector to the specified values. |
|
void |
set(float[] array,
int offset)
Sets the elements of this vector from the values in the specified array. |
|
void |
set(Vector4f v)
Sets the elements of this vector to those in the specified vector. |
|
void |
set(Vector4f p1,
Vector4f p2)
Sets this vector to the directional vector between the given points. |
|
void |
setAnimationValue(int property,
AnimationValue value)
Sets the value or values of the specified property. |
|
void |
subtract(Vector4f v)
Subtracts this vector and the specified vector as (this - v)
and stores the result in this . |
|
static void |
subtract(Vector4f v1,
Vector4f v2,
Vector4f dst)
Subtracts the specified vectors and stores the result in dst . |
|
String |
toString()
Returns a String representation of the elements of this vector. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public float x
public float y
public float z
public float w
public static final int ANIMATION_PROPERTY_X
public static final int ANIMATION_PROPERTY_Y
public static final int ANIMATION_PROPERTY_Z
public static final int ANIMATION_PROPERTY_W
public static final int ANIMATION_PROPERTY_XY
public static final int ANIMATION_PROPERTY_YZ
public static final int ANIMATION_PROPERTY_XZ
public static final int ANIMATION_PROPERTY_XW
public static final int ANIMATION_PROPERTY_YW
public static final int ANIMATION_PROPERTY_ZW
public static final int ANIMATION_PROPERTY_XYZ
public static final int ANIMATION_PROPERTY_XYW
public static final int ANIMATION_PROPERTY_XZW
public static final int ANIMATION_PROPERTY_YZW
public static final int ANIMATION_PROPERTY_XYZW
public static final Vector4f ONE
public static final Vector4f UNIT_X
public static final Vector4f UNIT_Y
public static final Vector4f UNIT_Z
public static final Vector4f UNIT_W
public static final Vector4f ZERO
Constructor Detail |
---|
public Vector4f()
public Vector4f(float[] array, int offset)
array
- an array containing the elements of the vector in the order x, y, z.offset
- the offset into the array of the x
element
IllegalArgumentException
- If offset
is less than zero or
offset + 3
is greater than or equal to array.length
.
NullPointerException
- If array
is null
.public Vector4f(float x, float y, float z, float w)
x
- the x-coordiantey
- the y-coordinatez
- the z-coordinatew
- the w-coordinatepublic Vector4f(Vector4f p1, Vector4f p2)
The new vector describes the direction vector from p1
to p2
,
computed as p2 - p1
.
p1
- the first pointp2
- the second point
NullPointerException
- If p1
or p2
is null
.public Vector4f(Vector4f v)
v
- the vector to copy
NullPointerException
- If v
is null
.Method Detail |
---|
public static float angle(Vector4f v1, Vector4f v2)
v1
- the first vectorv2
- the second vector
NullPointerException
- If v1
or v2
is null
.public final void add(Vector4f v)
v
- the vector to add
NullPointerException
- If v
is null
.public static void add(Vector4f v1, Vector4f v2, Vector4f dst)
dst
.
v1
- the first vectorv2
- the second vectordst
- a vector to store the result in
NullPointerException
- If v1
, v2
, or dst
is null
.public final void clamp(Vector4f min, Vector4f max)
min
- The minimum value.max
- The maximum value.
IllegalArgumentException
- If min
is greater than max
.
NullPointerException
- If min
or max
is null
.public static void clamp(Vector4f v, Vector4f min, Vector4f max, Vector4f dst)
dst
.
v
- The vector to clamp.min
- The minimum value.max
- The maximum value.dst
- A vector to store the result in.
IllegalArgumentException
- If min
is greater than max
.
NullPointerException
- If min
, max
, or dst
is null
.public final float distance(Vector4f v)
v
.
v
- the other vector
v
NullPointerException
- If v
is null
.distanceSquared
public final float distanceSquared(Vector4f v)
v
.
When it is not neccessary to get the exact distance between two vectors
(for example, when simply comparing the distance between different vectors),
it is advised to use this method instead of distance
.
v
- the other vector
v
.
NullPointerException
- If v
is null
.distance
public final float dot(Vector4f v)
v
- the vector to compute the dot product with
NullPointerException
- If v
is null
.public static float dot(Vector4f v1, Vector4f v2)
v1
- the first vectorv2
- the second vector
NullPointerException
- If v1
or v2
is null
.public final float length()
lengthSquared
public final float lengthSquared()
When it is not neccessary to get the exact length of a vector (for example,
when simply comparing the lengths of different vectors), it is advised to
use this method instead of length
.
length
public final void negate()
public final void normalize()
This method normalizes this Vector4f so that it is of unit length (in other words, the length of the vector after calling this method will be 1.0f). If the vector already has unit length or if the length of the vector is zero, this method does nothing.
public final void normalize(Vector4f dst)
dst
.
If the vector already has unit length or if the length of the vector
is zero, this method simply copies the current vector into dst
.
dst
- the destination vector
NullPointerException
- If dst
is null
.public final void scale(float scalar)
scalar
- the scalar valuepublic final void set(float x, float y, float z, float w)
x
- the new x-coordinatey
- the new y-coordinatez
- the new z-coordinatew
- the new w-coordinatepublic final void set(float[] array, int offset)
array
- an array containing the elements of the vector in the order x, y, z.offset
- the offset into the array of the x
element
IllegalArgumentException
- If offset
is less than zero or
offset + 3
is greater than or equal to array.length
.
NullPointerException
- If array
is null
.public final void set(Vector4f v)
v
- the vector to copy
NullPointerException
- If v
is null
.public final void set(Vector4f p1, Vector4f p2)
This result of this vector describes the direction from p1
to p2
,
computed as p2 - p1
.
p1
- the first pointp2
- the second point
NullPointerException
- If p1
or p2 is null
.- Since:
- BlackBerry API 6.0.0
public final void subtract(Vector4f v)
(this - v)
and stores the result in this
.
v
- the vector to subtract
NullPointerException
- If v
is null
.public static void subtract(Vector4f v1, Vector4f v2, Vector4f dst)
dst
.
The resulting vector is computed as (v1 - v2)
.
v1
- the first vectorv2
- the second vectordst
- the destination vector
NullPointerException
- If v1
, v2
, or dst
is null
.public void getAnimationValue(int property, AnimationValue value)
Animatable
Gets the value or values of the specified property.
Used by the Animation framework to get the values of the specified property on the Animatable
.
The implementer must set the value of the specified target property in the AnimationValue
parameter.
getAnimationValue
in interface Animatable
property
- The property to get the current value or values of.value
- An AnimationValue
used to store the returned property values.Animatable.getAnimationValue(int,AnimationValue)
public void setAnimationValue(int property, AnimationValue value)
Animatable
Sets the value or values of the specified property.
Used by the Animation framework to update the value or values of the specified target property on the Animatable
with the currently calculated animation value. The implementer must update the current value or values of the given target property
with the values in the AnimationValue
parameter.
setAnimationValue
in interface Animatable
property
- The property to set the current value or values of.value
- The AnimationValue
used to specify the value or values to set.Animatable.setAnimationValue(int,AnimationValue)
public int getAnimationPropertyComponentCount(int property)
Animatable
Gets the number of components of the specified property.
The implementer must define the component size of every animatable property defined for theAnimatable
.
getAnimationPropertyComponentCount
in interface Animatable
property
- The property to retrieve the component count for.
Animatable.getAnimationPropertyComponentCount(int)
public boolean equals(Object obj)
equals
in class Object
obj
- the object to compare
NullPointerException
- If obj
is null
.Boolean.hashCode()
,
Hashtable
public boolean equals(Vector4f v)
v
- the vector to compare
NullPointerException
- If v
is null
.public int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
Hashtable
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.