|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.math.Transform3D
public class Transform3D
Defines a 3-dimensional transformation.
Note: When using the scale, rotate, and translate methods,
only the transform's corresponding scale, rotation, or translation component is updated (it is not as if the
scale, rotate, or translate is applied to the transform's matrix).
For example, if the user calls t.rotateX(angle), this updates t's internal
rotation component by rotating it by angle radians about the x-axis. The following
code demonstrates this more clearly:
// Create a non-identity transform and get a copy of its matrix.Transform3D t1 = new Transform3D(new Vector3f(1.2f, 1.7f, 0.5f), new Quaternion4f(), new Vector3f(10.0f, -2.0f, 0.0f)); Matrix4f t2 = new Matrix4f(t1.getMatrix());// Rotate the transform's rotation component by 35 degrees about the X axis and get the new matrix.t1.rotateX((float)Math.toRadians(35.0f)); Matrix4f t1Matrix = t1.getMatrix();// Multiply t1's original matrix by a matrix representing the same rotation as above.Matrix4f rotateX = new Matrix4f(); Matrix4f.createRotationX((float)Math.toRadians(35.0f), rotateX); t2.multiply(rotateX);// At this point, t1Matrix is not equal to t2!if (t1Matrix.equals(t2)) throw new RuntimeException();
Note: To construct a Transform3D from a transformation matrix stored as a Matrix4f,
first decompose the Matrix4f into its separate translation, scale, and rotation
components using Matrix4f.decompose(Vector3f, Quaternion4f, Vector3f) and then
pass those arguments to the appropriate constructor or set methods of Transform3D.
Matrix4f.decompose(Vector3f, Quaternion4f, Vector3f)| Field Summary | ||
|---|---|---|
static int |
ANIMATION_PROPERTY_ROTATE
Used to animate the rotation component(as quaternion). |
|
static int |
ANIMATION_PROPERTY_SCALE
Used to animate the scale component. |
|
static int |
ANIMATION_PROPERTY_TRANSFORM
Used to animate the all transformation components translation, rotation(as quaternion) and scale. |
|
static int |
ANIMATION_PROPERTY_TRANSLATE
Used to animate the translation component. |
|
static int |
ANIMATION_PROPERTY_TRANSLATE_ROTATE
Used to animate the translation-rotation component. |
|
| Constructor Summary | ||
|---|---|---|
Transform3D()
Constructs the identity transform. |
||
Transform3D(Transform3D transform)
Constructs a new transform from the given transform. |
||
Transform3D(Vector3f scale,
Matrix4f rotation,
Vector3f translation)
Constructs a new transform from the specified values. |
||
Transform3D(Vector3f scale,
Quaternion4f rotation,
Vector3f translation)
Constructs a new transform from the specified values. |
||
| Method Summary | ||
|---|---|---|
boolean |
equals(Object obj)
Determines if the specified object is of type Transform3D and all of its elements are equal to the elements of this transform. |
|
boolean |
equals(Transform3D transform)
Returns true if all elements of the specified transform are equal to the elements of this transform. |
|
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. |
|
Matrix4f |
getMatrix()
Gets the matrix corresponding to this transform. |
|
void |
getMatrix(Matrix4f matrix)
Gets the matrix corresponding to this transform in the specified matrix. |
|
void |
getRotation(Matrix4f rotation)
Gets the rotation component of this transform in the specified matrix. |
|
void |
getRotation(Quaternion4f rotation)
Gets the rotation component of this transform in the specified quaternion. |
|
float |
getRotationAsAxisAngle(Vector3f axis)
Gets the axis of rotation, and stores the axis of rotation of this transform in the specified Vector3f
|
|
void |
getScale(Vector3f scale)
Gets the scale component of this transform in the specified vector. |
|
void |
getTranslation(Vector3f translation)
Gets the translation component of this transform in the specified vector. |
|
int |
hashCode()
Returns a hash code based on the elements of this transform. |
|
void |
rotate(Matrix4f rotation)
Rotates this transform's rotation component by the given rotation. |
|
void |
rotate(Matrix4f rotation,
Transform3D dst)
Rotates this transform's rotation component by the given rotation and stores the result in the given destination transform. |
|
void |
rotate(Quaternion4f rotation)
Rotates this transform's rotation component by the given rotation. |
|
void |
rotate(Quaternion4f rotation,
Transform3D dst)
Rotates this transform's rotation component by the given rotation and stores the result in the given destination transform. |
|
void |
rotate(Vector3f axis,
float angle)
Rotates this transform's rotation component by the given rotation (defined as an axis angle rotation). |
|
void |
rotate(Vector3f axis,
float angle,
Transform3D dst)
Rotates this transform's rotation component by the given rotation (defined as an axis angle rotation) and stores the result in the given destination transform. |
|
void |
rotateX(float angle)
Rotates this transform's rotation component by the given angle about the x-axis. |
|
void |
rotateX(float angle,
Transform3D dst)
Rotates this transform's rotation component by the given angle about the x-axis and stores the result in the given destination transform. |
|
void |
rotateY(float angle)
Rotates this transform's rotation component by the given angle about the y-axis. |
|
void |
rotateY(float angle,
Transform3D dst)
Rotates this transform's rotation component by the given angle about the y-axis and stores the result in the given destination transform. |
|
void |
rotateZ(float angle)
Rotates this transform's rotation component by the given angle about the z-axis. |
|
void |
rotateZ(float angle,
Transform3D dst)
Rotates this transform's rotation component by the given angle about the z-axis and stores the result in the given destination transform. |
|
void |
scale(float scale)
Scales this transform's scale component by the given factor along all axes. |
|
void |
scale(float sx,
float sy,
float sz)
Scales this transform's scale component by the given factors along each axis. |
|
void |
scale(float sx,
float sy,
float sz,
Transform3D dst)
Scales this transform's scale component by the given factors along each axis and stores the result in the given destination transform. |
|
void |
scale(float scale,
Transform3D dst)
Scales this transform's scale component by the given factor along all axes and stores the result in the given destination transform. |
|
void |
scale(Vector3f scale)
Scales this transform's scale component by the given scale vector. |
|
void |
scale(Vector3f scale,
Transform3D dst)
Scales this transform's scale component by the given scale vector and stores the result in the given destination transform. |
|
void |
scaleX(float sx)
Scales this transform's scale component by the given scale factor along the x axis. |
|
void |
scaleX(float sx,
Transform3D dst)
Scales this transform's scale component by the given scale factor along the x axis and stores the result in the given destination transform. |
|
void |
scaleY(float sy)
Scales this transform's scale component by the given scale factor along the y axis. |
|
void |
scaleY(float sy,
Transform3D dst)
Scales this transform's scale component by the given scale factor along the y axis and stores the result in the given destination transform. |
|
void |
scaleZ(float sz)
Scales this transform's scale component by the given scale factor along the z axis. |
|
void |
scaleZ(float sz,
Transform3D dst)
Scales this transform's scale component by the given scale factor along the z axis and stores the result in the given destination transform. |
|
void |
set(Transform3D transform)
Sets this transform to the specified transform. |
|
void |
set(Vector3f scale,
Matrix4f rotation,
Vector3f translation)
Sets the transform to the specified values. |
|
void |
set(Vector3f scale,
Quaternion4f rotation,
Vector3f translation)
Sets the transform to the specified values. |
|
void |
setAnimationValue(int property,
AnimationValue value)
Sets the value or values of the specified property. |
|
void |
setRotation(Matrix4f rotation)
Sets the rotation component for this transform to the specified values. |
|
void |
setRotation(Quaternion4f rotation)
Sets the rotation component for this transform to the specified values. |
|
void |
setScale(float scale)
Sets the scale factor along all axes for this transform to the specified value. |
|
void |
setScale(float sx,
float sy,
float sz)
Sets the scale component of this transform to the specified values. |
|
void |
setScale(Vector3f scale)
Sets the scale component of this transform to the specified scale vector. |
|
void |
setTranslation(float tx,
float ty,
float tz)
Sets the translation component for this transform to the specified values. |
|
void |
setTranslation(Vector3f translation)
Sets the translation component for this transform to the specified translation vector. |
|
String |
toString()
Returns a String representation of this transform. |
|
void |
transformBounds(Bounds bounds)
Transforms the specified bounds and stores the result in the original bounding object. |
|
void |
transformBounds(Bounds bounds,
Bounds dst)
Transforms the specified bounds and stores the result in the specified destination bounding object. |
|
void |
transformNormal(Vector3f normal)
Transforms the specified normal vector and stores the result in the original vector. |
|
void |
transformNormal(Vector3f normal,
Vector3f dst)
Transforms the specified normal vector and stores the result in the specified destination normal vector. |
|
void |
transformPlane(Plane plane)
Transforms the specified plane and stores the result in the original plane. |
|
void |
transformPlane(Plane plane,
Plane dst)
Transforms the specified plane and stores the result in the specified destination plane. |
|
void |
transformPoint(Vector3f point)
Transforms the specified point and stores the result in the original point. |
|
void |
transformPoint(Vector3f point,
Vector3f dst)
Transforms the specified point and stores the result in the specified destination point. |
|
void |
transformRay(Ray ray)
Transforms the specified ray and stores the result in the original ray. |
|
void |
transformRay(Ray ray,
Ray dst)
Transforms the specified ray and stores the result in the specified destination ray. |
|
void |
transformVector(Vector3f vector)
Transforms the specified vector and stores the result in the original vector. |
|
void |
transformVector(Vector3f vector,
Vector3f dst)
Transforms the specified vector and stores the result in the specified destination vector. |
|
void |
translate(float tx,
float ty,
float tz)
Translates this transform's translation component by the given values along each axis. |
|
void |
translate(float tx,
float ty,
float tz,
Transform3D dst)
Translates this transform's translation component by the given values along each axis and stores the result in the given destination transform. |
|
void |
translate(Vector3f translation)
Translates this transform's translation component by the given translation vector. |
|
void |
translate(Vector3f translation,
Transform3D dst)
Translates this transform's translation component by the given translation vector and stores the result in the given destination transform. |
|
void |
translateX(float tx)
Translates this transform's translation component by the given value along the x axis. |
|
void |
translateX(float tx,
Transform3D dst)
Translates this transform's translation component by the given value along the x axis and stores the result in the given destination transform. |
|
void |
translateY(float ty)
Translates this transform's translation component by the given value along the y axis. |
|
void |
translateY(float ty,
Transform3D dst)
Translates this transform's translation component by the given value along the y axis and stores the result in the given destination transform. |
|
void |
translateZ(float tz)
Translates this transform's translation component by the given value along the z axis. |
|
void |
translateZ(float tz,
Transform3D dst)
Translates this transform's translation component by the given value along the z axis and stores the result in the given destination transform. |
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int ANIMATION_PROPERTY_TRANSLATE
Required AnimationKeyframeSequence data format:
float[] data =
{
translation.x,translation.y,translation.z
}
public static final int ANIMATION_PROPERTY_ROTATE
Required AnimationKeyframeSequence data format:
float[] data =
{
rotation.x, rotation.y, rotation.z, rotation.w
}
public static final int ANIMATION_PROPERTY_SCALE
Required AnimationKeyframeSequence data format:
float[] data =
{
scale.x, scale.y, scale.z
}
public static final int ANIMATION_PROPERTY_TRANSLATE_ROTATE
Required AnimationKeyframeSequence data format:
float[] data =
{
translation.x, translation.y, translation.z,
rotation.x, rotation.y, rotation.z, rotation.w
}
public static final int ANIMATION_PROPERTY_TRANSFORM
float[] data =
{
translation.x, translation.y, translation.z,
rotation.x, rotation.y, rotation.z, rotation.w,
scale.x, scale.y, scale.z
}
| Constructor Detail |
|---|
public Transform3D()
public Transform3D(Vector3f scale,
Quaternion4f rotation,
Vector3f translation)
scale - The scale vector.rotation - The rotation quaternion.translation - The translation vector.
NullPointerException - If scale, rotation, or translation is null.
public Transform3D(Vector3f scale,
Matrix4f rotation,
Vector3f translation)
scale - The scale vector.rotation - The rotation matrix.translation - The translation vector.
NullPointerException - If scale, rotation, or translation is null.public Transform3D(Transform3D transform)
transform - The transform to copy.
NullPointerException - If transform is null.| Method Detail |
|---|
public void getMatrix(Matrix4f matrix)
matrix - The matrix to store the transformation matrix in.
NullPointerException - If matrix is null.public Matrix4f getMatrix()
Note: The matrix returned from this method is mathematically equivalent to this transform only as long as this transform is not changed (i.e. by calling set(), setScale(), translate(), rotateX(), etc.). Once the transform has been changed, the user must call getMatrix() again to get the updated matrix. Also note that changing the matrix returned from this method does not change this transform.
public void getScale(Vector3f scale)
scale - The vector to store the scale in.
NullPointerException - If scale is null.public void getRotation(Matrix4f rotation)
rotation - The matrix to store the rotation in.
NullPointerException - If rotation is null.public void getRotation(Quaternion4f rotation)
rotation - The quaternion to store the rotation in.
NullPointerException - If rotation is null.public float getRotationAsAxisAngle(Vector3f axis)
Vector3f
axis - The Vector3f to store the axis of rotation.
NullPointerException - If axis is null.public void getTranslation(Vector3f translation)
translation - The vector to store the translation in.
NullPointerException - If translation is null.public void rotate(Matrix4f rotation)
rotation - The rotation to rotate by (as a matrix).
NullPointerException - If rotation is null.
public void rotate(Matrix4f rotation,
Transform3D dst)
rotation - The rotation to rotate by (as a matrix).dst - The destination transform.
NullPointerException - If rotation or dst is null.public void rotate(Quaternion4f rotation)
rotation - The rotation to rotate by (as a quaternion).
NullPointerException - If rotation is null.
public void rotate(Quaternion4f rotation,
Transform3D dst)
rotation - The rotation to rotate by (as a quaternion).dst - The destination transform.
NullPointerException - If rotation, dst is null.
public void rotate(Vector3f axis,
float angle)
axis - The axis to rotate about.angle - The angle to rotate by.
NullPointerException - If axis is null.
public void rotate(Vector3f axis,
float angle,
Transform3D dst)
axis - The axis to rotate about.angle - The angle to rotate by.dst - The destination transform.
NullPointerException - If axis, dst is null.public void rotateX(float angle)
angle - The angle to rotate by about the x-axis.
public void rotateX(float angle,
Transform3D dst)
angle - The angle to rotate by about the x-axis.dst - The destination transform.
NullPointerException - If dst is null.public void rotateY(float angle)
angle - The angle to rotate by about the y-axis.
public void rotateY(float angle,
Transform3D dst)
angle - The angle to rotate by about the y-axis.dst - The destination transform.
NullPointerException - If dst is null.public void rotateZ(float angle)
angle - The angle to rotate by about the z-axis.
public void rotateZ(float angle,
Transform3D dst)
angle - The angle to rotate by about the z-axis.dst - The destination transform.
NullPointerException - If dst is null.public void scale(float scale)
scale - The factor to scale by.
public void scale(float scale,
Transform3D dst)
scale - The factor to scale by.dst - The destination transform.
NullPointerException - If dst is null.
public void scale(float sx,
float sy,
float sz)
sx - The factor to scale by in the x direction.sy - The factor to scale by in the y direction.sz - The factor to scale by in the z direction.
public void scale(float sx,
float sy,
float sz,
Transform3D dst)
sx - The factor to scale by in the x direction.sy - The factor to scale by in the y direction.sz - The factor to scale by in the z direction.dst - The destination transform.
NullPointerException - If dst is null.public void scale(Vector3f scale)
scale - The vector to scale by.
NullPointerException - If scale is null.
public void scale(Vector3f scale,
Transform3D dst)
scale - The vector to scale by.dst - The destination transform.
NullPointerException - If scale or dst is null.public void scaleX(float sx)
sx - The scale factor along the x axis.
public void scaleX(float sx,
Transform3D dst)
sx - The scale factor along the x axis.dst - The destination transform.
NullPointerException - If dst is null.public void scaleY(float sy)
sy - The scale factor along the y axis.
public void scaleY(float sy,
Transform3D dst)
sy - The scale factor along the y axis.dst - The destination transform.
NullPointerException - If dst is null.public void scaleZ(float sz)
sz - The scale factor along the z axis.
public void scaleZ(float sz,
Transform3D dst)
sz - The scale factor along the z axis.dst - The destination transform.
NullPointerException - If dst is null.
public void set(Vector3f scale,
Matrix4f rotation,
Vector3f translation)
scale - The scale vector.rotation - The rotation matrix.translation - The translation vector.
NullPointerException - If scale, rotation, or translation is null.
public void set(Vector3f scale,
Quaternion4f rotation,
Vector3f translation)
scale - The scale vector.rotation - The rotation quaternion.translation - The translation vector.
NullPointerException - If scale, rotation, or translation is null.public void set(Transform3D transform)
transform - The transform to set this transform to.
NullPointerException - If transform is null.public void setScale(Vector3f scale)
scale - The scale vector.
NullPointerException - If scale is null.
public void setScale(float sx,
float sy,
float sz)
sx - The scale factor along the x axis.sy - The scale factor along the y axis.sz - The scale factor along the z axis.public void setScale(float scale)
scale - The scale factor along all axes.public void setRotation(Matrix4f rotation)
rotation - The rotation as a matrix.
NullPointerException - If rotation is null.public void setRotation(Quaternion4f rotation)
rotation - The rotation as a quaternion.
NullPointerException - If rotation is null.public void setTranslation(Vector3f translation)
translation - The translation vector.
NullPointerException - If translation is null.
public void setTranslation(float tx,
float ty,
float tz)
tx - The translation amount in the x direction.ty - The translation amount in the y direction.tz - The translation amount in the z direction.public void transformBounds(Bounds bounds)
bounds - The bounds to transform.
NullPointerException - If bounds is null.
public void transformBounds(Bounds bounds,
Bounds dst)
bounds - The bounds to transform.dst - The bounding object to store the result in.
IllegalArgumentException - If bounds is not the same type of bounding object as dst.
NullPointerException - If bounds or dst is null.public void transformPoint(Vector3f point)
point - The point to transform.
NullPointerException - If point is null.
public void transformPoint(Vector3f point,
Vector3f dst)
point - The point to transform.dst - The point to store the result in.
NullPointerException - If point or dst is null.public void transformVector(Vector3f vector)
vector - The vector to transform.
NullPointerException - If vector is null.
public void transformVector(Vector3f vector,
Vector3f dst)
vector - The vector to transform.dst - The vector to store the result in.
NullPointerException - If vector or dst is null.public void transformNormal(Vector3f normal)
normal - The normal vector to transform.
NullPointerException - If normal is null.
public void transformNormal(Vector3f normal,
Vector3f dst)
normal - The normal vector to transform.dst - The normal vector to store the result in.
NullPointerException - If normal or dst is null.public void transformPlane(Plane plane)
plane - The plane to transform.
NullPointerException - If plane is null.
public void transformPlane(Plane plane,
Plane dst)
plane - The plane to transform.dst - The plane to store the result in.
NullPointerException - If plane or dst is null.public void transformRay(Ray ray)
ray - The ray to transform.
NullPointerException - If ray is null.
public void transformRay(Ray ray,
Ray dst)
ray - The ray to transform.dst - The ray to store the result in.
NullPointerException - If ray or dst is null.
public void translate(float tx,
float ty,
float tz)
tx - The amount to translate along the x axis.ty - The amount to translate along the y axis.tz - The amount to translate along the z axis.
public void translate(float tx,
float ty,
float tz,
Transform3D dst)
tx - The amount to translate along the x axis.ty - The amount to translate along the y axis.tz - The amount to translate along the z axis.dst - The destination transform.
NullPointerException - If dst is null.public void translate(Vector3f translation)
translation - The amount to translate.
NullPointerException - If translation is null.
public void translate(Vector3f translation,
Transform3D dst)
translation - The amount to translate.dst - The destination transform.
NullPointerException - If translation or dst is null.public void translateX(float tx)
tx - The amount to translate along the x axis.
public void translateX(float tx,
Transform3D dst)
tx - The amount to translate along the x axis.dst - The destination transform.
NullPointerException - If dst is null.public void translateY(float ty)
ty - The amount to translate along the y axis.
public void translateY(float ty,
Transform3D dst)
ty - The amount to translate along the y axis.dst - The destination transform.
NullPointerException - If dst is null.public void translateZ(float tz)
tz - The amount to translate along the z axis.
public void translateZ(float tz,
Transform3D dst)
tz - The amount to translate along the z axis.dst - The destination transform.
NullPointerException - If dst is null.public boolean equals(Object obj)
equals in class Objectobj - The object to compare.
true if this transform is equal to obj;
false otherwise.
NullPointerException - If obj is null.Boolean.hashCode(),
Hashtablepublic boolean equals(Transform3D transform)
transform - The transform to compare.
true if this transform is equal to transform;
false otherwise.
NullPointerException - If transform is null.public int hashCode()
hashCode in class ObjectObject.equals(java.lang.Object),
Hashtablepublic String toString()
toString in class Object
public void getAnimationValue(int property,
AnimationValue value)
AnimatableGets 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 Animatableproperty - 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)
AnimatableSets 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 Animatableproperty - 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)
AnimatableGets 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 Animatableproperty - The property to retrieve the component count for.
Animatable.getAnimationPropertyComponentCount(int)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal