Class Transform3D
- java.lang.Object
-
- javax.media.j3d.Transform3D
-
public class Transform3D extends java.lang.Object
A generalized transform object represented internally as a 4x4 double-precision floating point matrix. The mathematical representation is row major, as in traditional matrix mathematics. A Transform3D is used to perform translations, rotations, and scaling and shear effects.A transform has an associated type, and all type classification is left to the Transform3D object. A transform will typically have multiple types, unless it is a general, unclassifiable matrix, in which case it won't be assigned a type.
The Transform3D type is internally computed when the transform object is constructed and updated any time it is modified. A matrix will typically have multiple types. For example, the type associated with an identity matrix is the result of ORing all of the types, except for ZERO and NEGATIVE_DETERMINANT, together. There are public methods available to get the ORed type of the transformation, the sign of the determinant, and the least general matrix type. The matrix type flags are defined as follows:
- ZERO - zero matrix. All of the elements in the matrix have the value 0.
- IDENTITY - identity matrix. A matrix with ones on its main diagonal and zeros every where else.
- SCALE - the matrix is a uniform scale matrix - there are no rotational or translation components.
- ORTHOGONAL - the four row vectors that make up an orthogonal matrix form a basis, meaning that they are mutually orthogonal. The scale is unity and there are no translation components.
- RIGID - the upper 3 X 3 of the matrix is orthogonal, and there is a translation component-the scale is unity.
- CONGRUENT - this is an angle- and length-preserving matrix, meaning that it can translate, rotate, and reflect about an axis, and scale by an amount that is uniform in all directions. These operations preserve the distance between any two points, and the angle between any two intersecting lines.
- AFFINE - an affine matrix can translate, rotate, reflect, scale anisotropically, and shear. Lines remain straight, and parallel lines remain parallel, but the angle between intersecting lines can change.
-
NEGATIVE_DETERMINANT - this matrix has a negative determinant.
An orthogonal matrix with a positive determinant is a rotation
matrix. An orthogonal matrix with a negative determinant is a
reflection and rotation matrix.
[ m00 m01 m02 m03 ] [ x ] [ x' ] [ m10 m11 m12 m13 ] . [ y ] = [ y' ] [ m20 m21 m22 m23 ] [ z ] [ z' ] [ m30 m31 m32 m33 ] [ w ] [ w' ] x' = m00 . x+m01 . y+m02 . z+m03 . w y' = m10 . x+m11 . y+m12 . z+m13 . w z' = m20 . x+m21 . y+m22 . z+m23 . w w' = m30 . x+m31 . y+m32 . z+m33 . w
Note: When transforming a Point3f or a Point3d, the input w is set to 1. When transforming a Vector3f or Vector3d, the input w is set to 0.
-
-
Field Summary
Fields Modifier and Type Field Description static int
AFFINE
An affine matrix can translate, rotate, reflect, scale anisotropically, and shear.static int
CONGRUENT
This is an angle and length preserving matrix, meaning that it can translate, rotate, and reflect about an axis, and scale by an amount that is uniform in all directions.static int
IDENTITY
An identity matrix.static int
NEGATIVE_DETERMINANT
This matrix has a negative determinant; an orthogonal matrix with a positive determinant is a rotation matrix; an orthogonal matrix with a negative determinant is a reflection and rotation matrix.static int
ORTHOGONAL
The four row vectors that make up an orthogonal matrix form a basis, meaning that they are mutually orthogonal; an orthogonal matrix with positive determinant is a pure rotation matrix; a negative determinant indicates a rotation and a reflection.static int
RIGID
This matrix is a rotation and a translation with unity scale; The upper 3x3 of the matrix is orthogonal, and there is a translation component.static int
SCALE
A Uniform scale matrix with no translation or other off-diagonal components.static int
TRANSLATION
A translation-only matrix with ones on the diagonal.static int
ZERO
A zero matrix.
-
Constructor Summary
Constructors Constructor Description Transform3D()
Constructs and initializes a transform to the identity matrix.Transform3D(double[] matrix)
Constructs and initializes a transform from the double precision array of length 16; the top row of the matrix is initialized to the first four elements of the array, and so on.Transform3D(float[] matrix)
Constructs and initializes a transform from the float array of length 16; the top row of the matrix is initialized to the first four elements of the array, and so on.Transform3D(Transform3D t1)
Constructs and initializes a transform from the Transform3D object.Transform3D(javax.vecmath.GMatrix m1)
Constructs a transform and initializes it to the upper 4 x 4 of the GMatrix argument.Transform3D(javax.vecmath.Matrix3d m1, javax.vecmath.Vector3d t1, double s)
Constructs and initializes a transform from the rotation matrix, translation, and scale values.Transform3D(javax.vecmath.Matrix3f m1, javax.vecmath.Vector3d t1, double s)
Constructs and initializes a transform from the rotation matrix, translation, and scale values.Transform3D(javax.vecmath.Matrix3f m1, javax.vecmath.Vector3f t1, float s)
Constructs and initializes a transform from the rotation matrix, translation, and scale values.Transform3D(javax.vecmath.Matrix4d m1)
Constructs and initializes a transform from the 4 x 4 matrix.Transform3D(javax.vecmath.Matrix4f m1)
Constructs and initializes a transform from the 4 x 4 matrix.Transform3D(javax.vecmath.Quat4d q1, javax.vecmath.Vector3d t1, double s)
Constructs and initializes a transform from the quaternion, translation, and scale values.Transform3D(javax.vecmath.Quat4f q1, javax.vecmath.Vector3d t1, double s)
Constructs and initializes a transform from the quaternion, translation, and scale values.Transform3D(javax.vecmath.Quat4f q1, javax.vecmath.Vector3f t1, float s)
Constructs and initializes a transform from the quaternion, translation, and scale values.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
add(Transform3D t1)
Adds this transform to transform t1 and places the result into this: this = this + t1.void
add(Transform3D t1, Transform3D t2)
Adds transforms t1 and t2 and places the result into this transform.double
determinant()
Calculates and returns the determinant of this transform.boolean
epsilonEquals(Transform3D t1, double epsilon)
Returns true if the L-infinite distance between this matrix and matrix m1 is less than or equal to the epsilon parameter, otherwise returns false.boolean
equals(java.lang.Object o1)
Returns true if the Object o1 is of type Transform3D and all of the data members of o1 are equal to the corresponding data members in this Transform3D.boolean
equals(Transform3D t1)
Returns true if all of the data members of transform t1 are equal to the corresponding data members in this Transform3D.void
frustum(double left, double right, double bottom, double top, double near, double far)
Creates a perspective projection transform that mimics a standard, camera-based, view-model.void
get(double[] matrix)
Places the values of this transform into the double precision array of length 16.void
get(float[] matrix)
Places the values of this transform into the single precision array of length 16.void
get(javax.vecmath.Matrix3d m1)
Places the normalized rotational component of this transform into the 3x3 matrix argument.double
get(javax.vecmath.Matrix3d m1, javax.vecmath.Vector3d t1)
Places the normalized rotational component of this transform into the matrix parameter; place the translational component into the vector parameter.void
get(javax.vecmath.Matrix3f m1)
Places the normalized rotational component of this transform into the 3x3 matrix argument.double
get(javax.vecmath.Matrix3f m1, javax.vecmath.Vector3d t1)
Places the normalized rotational component of this transform into the matrix parameter; place the translational component into the vector parameter.float
get(javax.vecmath.Matrix3f m1, javax.vecmath.Vector3f t1)
Places the normalized rotational component of this transform into the matrix parameter; place the translational component into the vector parameter.void
get(javax.vecmath.Matrix4d matrix)
Places the values of this transform into the double precision matrix argument.void
get(javax.vecmath.Matrix4f matrix)
Places the values of this transform into the single precision matrix argument.void
get(javax.vecmath.Quat4d q1)
Places the quaternion equivalent of the normalized rotational component of this transform into the quaternion parameter.double
get(javax.vecmath.Quat4d q1, javax.vecmath.Vector3d t1)
Places the quaternion equivalent of the normalized rotational component of this transform into the quaternion parameter; places the translational component into the Vector parameter.void
get(javax.vecmath.Quat4f q1)
Places the quaternion equivalent of the normalized rotational component of this transform into the quaternion parameter.double
get(javax.vecmath.Quat4f q1, javax.vecmath.Vector3d t1)
Places the quaternion equivalent of the normalized rotational component of this transform into the quaternion parameter; places the translational component into the Vector parameter.float
get(javax.vecmath.Quat4f q1, javax.vecmath.Vector3f t1)
Places the quaternion equivalent of the normalized rotational component of this transform into the quaternion parameter; places the translational component into the Vector parameter.void
get(javax.vecmath.Vector3d trans)
Retrieves the translational components of this transform.void
get(javax.vecmath.Vector3f trans)
Retrieves the translational components of this transform.boolean
getAutoNormalize()
Returns the state of auto-normalization.int
getBestType()
Returns the least general type of this matrix; the order of generality from least to most is: ZERO, IDENTITY, SCALE/TRANSLATION, ORTHOGONAL, RIGID, CONGRUENT, AFFINE.boolean
getDeterminantSign()
Returns the sign of the determinant of this matrix; a return value of true indicates a non-negative determinant; a return value of false indicates a negative determinant.void
getRotationScale(javax.vecmath.Matrix3d m1)
Gets the upper 3x3 values of this matrix and places them into the matrix m1.void
getRotationScale(javax.vecmath.Matrix3f m1)
Gets the upper 3x3 values of this matrix and places them into the matrix m1.double
getScale()
Returns the uniform scale factor of this matrix.void
getScale(javax.vecmath.Vector3d scale)
Gets the possibly non-uniform scale components of the current transform and places them into the scale vector.int
getType()
Returns the type of this matrix as an or'ed bitmask of of all of the type classifications to which it belongs.int
hashCode()
Returns a hash code value based on the data values in this object.void
invert()
Inverts this transform in place.void
invert(Transform3D t1)
Sets the value of this transform to the inverse of the passed Transform3D parameter.void
lookAt(javax.vecmath.Point3d eye, javax.vecmath.Point3d center, javax.vecmath.Vector3d up)
Helping function that specifies the position and orientation of a view matrix.void
mul(double scalar)
Multiplies each element of this transform by a scalar.void
mul(double scalar, Transform3D t1)
Multiplies each element of transform t1 by a scalar and places the result into this.void
mul(Transform3D t1)
Sets the value of this transform to the result of multiplying itself with transform t1 (this = this * t1).void
mul(Transform3D t1, Transform3D t2)
Sets the value of this transform to the result of multiplying transform t1 by transform t2 (this = t1*t2).void
mulInverse(Transform3D t1)
Multiplies this transform by the inverse of transform t1.void
mulInverse(Transform3D t1, Transform3D t2)
Multiplies transform t1 by the inverse of transform t2.void
mulTransposeBoth(Transform3D t1, Transform3D t2)
Multiplies the transpose of transform t1 by the transpose of transform t2 and places the result into this transform (this = transpose(t1) * transpose(t2)).void
mulTransposeLeft(Transform3D t1, Transform3D t2)
Multiplies the transpose of transform t1 by transform t2 and places the result into this matrix (this = transpose(t1) * t2).void
mulTransposeRight(Transform3D t1, Transform3D t2)
Multiplies transform t1 by the transpose of transform t2 and places the result into this transform (this = t1 * transpose(t2)).void
normalize()
Normalizes the rotational components (upper 3x3) of this matrix in place using a Singular Value Decomposition (SVD).void
normalize(Transform3D t1)
Normalizes the rotational components (upper 3x3) of transform t1 using a Singular Value Decomposition (SVD), and places the result into this transform.void
normalizeCP()
Normalizes the rotational components (upper 3x3) of this transform in place using a Cross Product (CP) normalization.void
normalizeCP(Transform3D t1)
Normalizes the rotational components (upper 3x3) of transform t1 using a Cross Product (CP) normalization, and places the result into this transform.void
ortho(double left, double right, double bottom, double top, double near, double far)
Creates an orthographic projection transform that mimics a standard, camera-based, view-model.void
perspective(double fovx, double aspect, double zNear, double zFar)
Creates a perspective projection transform that mimics a standard, camera-based, view-model.void
rotX(double angle)
Sets the value of this transform to a counter clockwise rotation about the x axis.void
rotY(double angle)
Sets the value of this transform to a counter clockwise rotation about the y axis.void
rotZ(double angle)
Sets the value of this transform to a counter clockwise rotation about the z axis.void
scaleAdd(double s, Transform3D t1)
Scales this transform by a Uniform scale matrix with scale factor s and then adds transform t1 (this = S*this + t1).void
scaleAdd(double s, Transform3D t1, Transform3D t2)
Scales transform t1 by a Uniform scale matrix with scale factor s and then adds transform t2 (this = S*t1 + t2).void
set(double scale)
Sets the value of this transform to a uniform scale; all of the matrix values are modified.void
set(double[] matrix)
Sets the matrix values of this transform to the matrix values in the double precision array parameter.void
set(double scale, javax.vecmath.Vector3d v1)
Sets the value of this transform to a scale and translation matrix; the scale is not applied to the translation and all of the matrix values are modified.void
set(float[] matrix)
Sets the matrix values of this transform to the matrix values in the single precision array parameter.void
set(float scale, javax.vecmath.Vector3f v1)
Sets the value of this transform to a scale and translation matrix; the scale is not applied to the translation and all of the matrix values are modified.void
set(Transform3D t1)
Sets the matrix, type, and state of this transform to the matrix, type, and state of transform t1.void
set(javax.vecmath.AxisAngle4d a1)
Sets the value of this transform to the matrix conversion of the double precision axis-angle argument; all of the matrix values are modified.void
set(javax.vecmath.AxisAngle4f a1)
Sets the value of this transform to the matrix conversion of the single precision axis-angle argument; all of the matrix values are modified.void
set(javax.vecmath.GMatrix matrix)
Sets the matrix values of this transform to the matrix values in the upper 4x4 corner of the GMatrix parameter.void
set(javax.vecmath.Matrix3d m1)
Sets the rotational component (upper 3x3) of this transform to the matrix values in the double precision Matrix3d argument; the other elements of this transform are initialized as if this were an identity matrix (ie, affine matrix with no translational component).void
set(javax.vecmath.Matrix3d m1, javax.vecmath.Vector3d t1, double s)
Sets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale s.void
set(javax.vecmath.Matrix3f m1)
Sets the rotational component (upper 3x3) of this transform to the matrix values in the single precision Matrix3f argument; the other elements of this transform are initialized as if this were an identity matrix (i.e., affine matrix with no translational component).void
set(javax.vecmath.Matrix3f m1, javax.vecmath.Vector3d t1, double s)
Sets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale s.void
set(javax.vecmath.Matrix3f m1, javax.vecmath.Vector3f t1, float s)
Sets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale s.void
set(javax.vecmath.Matrix4d m1)
Sets the matrix values of this transform to the matrix values in the double precision Matrix4d argument.void
set(javax.vecmath.Matrix4f m1)
Sets the matrix values of this transform to the matrix values in the single precision Matrix4f argument.void
set(javax.vecmath.Quat4d q1)
Sets the value of this transform to the matrix conversion of the double precision quaternion argument; the non-rotational components are set as if this were an identity matrix.void
set(javax.vecmath.Quat4d q1, javax.vecmath.Vector3d t1, double s)
Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.void
set(javax.vecmath.Quat4f q1)
Sets the value of this transform to the matrix conversion of the single precision quaternion argument; the non-rotational components are set as if this were an identity matrix.void
set(javax.vecmath.Quat4f q1, javax.vecmath.Vector3d t1, double s)
Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.void
set(javax.vecmath.Quat4f q1, javax.vecmath.Vector3f t1, float s)
Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.void
set(javax.vecmath.Vector3d trans)
Sets the translational value of this matrix to the Vector3d paramter values, and sets the other components of the matrix as if this transform were an identity matrix.void
set(javax.vecmath.Vector3d v1, double scale)
Sets the value of this transform to a scale and translation matrix; the translation is scaled by the scale factor and all of the matrix values are modified.void
set(javax.vecmath.Vector3f trans)
Sets the translational value of this matrix to the Vector3f parameter values, and sets the other components of the matrix as if this transform were an identity matrix.void
set(javax.vecmath.Vector3f v1, float scale)
Sets the value of this transform to a scale and translation matrix; the translation is scaled by the scale factor and all of the matrix values are modified.void
setAutoNormalize(boolean autoNormalize)
Sets a flag that enables or disables automatic SVD normalization.void
setEuler(javax.vecmath.Vector3d euler)
Sets the rotational component (upper 3x3) of this transform to the rotation matrix converted from the Euler angles provided; the other non-rotational elements are set as if this were an identity matrix.void
setIdentity()
Sets this transform to the identity matrix.void
setNonUniformScale(double xScale, double yScale, double zScale)
Deprecated.Use setScale(Vector3d) instead of setNonUniformScale; note that the setScale only modifies the scale componentvoid
setRotation(javax.vecmath.AxisAngle4d a1)
Sets the rotational component (upper 3x3) of this transform to the matrix equivalent values of the axis-angle argument; the other elements of this transform are unchanged; any pre-existing scale in the transform is preserved.void
setRotation(javax.vecmath.AxisAngle4f a1)
Sets the rotational component (upper 3x3) of this transform to the matrix equivalent values of the axis-angle argument; the other elements of this transform are unchanged; any pre-existing scale in the transform is preserved.void
setRotation(javax.vecmath.Matrix3d m1)
Sets the rotational component (upper 3x3) of this transform to the matrix values in the double precision Matrix3d argument; the other elements of this transform are unchanged; any pre-existing scale will be preserved; the argument matrix m1 will be checked for proper normalization when this transform is internally classified.void
setRotation(javax.vecmath.Matrix3f m1)
Sets the rotational component (upper 3x3) of this transform to the matrix values in the single precision Matrix3f argument; the other elements of this transform are unchanged; any pre-existing scale will be preserved; the argument matrix m1 will be checked for proper normalization when this transform is internally classified.void
setRotation(javax.vecmath.Quat4d q1)
Sets the rotational component (upper 3x3) of this transform to the matrix equivalent values of the quaternion argument; the other elements of this transform are unchanged; any pre-existing scale in the transform is preserved.void
setRotation(javax.vecmath.Quat4f q1)
Sets the rotational component (upper 3x3) of this transform to the matrix equivalent values of the quaternion argument; the other elements of this transform are unchanged; any pre-existing scale in the transform is preserved.void
setRotationScale(javax.vecmath.Matrix3d m1)
Replaces the upper 3x3 matrix values of this transform with the values in the matrix m1.void
setRotationScale(javax.vecmath.Matrix3f m1)
Replaces the upper 3x3 matrix values of this transform with the values in the matrix m1.void
setScale(double scale)
Sets the scale component of the current transform; any existing scale is first factored out of the existing transform before the new scale is applied.void
setScale(javax.vecmath.Vector3d scale)
Sets the possibly non-uniform scale component of the current transform; any existing scale is first factored out of the existing transform before the new scale is applied.void
setTranslation(javax.vecmath.Vector3d trans)
Replaces the translational components of this transform to the values in the Vector3d argument; the other values of this transform are not modified.void
setTranslation(javax.vecmath.Vector3f trans)
Replaces the translational components of this transform to the values in the Vector3f argument; the other values of this transform are not modified.void
setZero()
Sets this transform to all zeros.void
sub(Transform3D t1)
Subtracts transform t1 from this transform and places the result into this: this = this - t1.void
sub(Transform3D t1, Transform3D t2)
Subtracts transform t2 from transform t1 and places the result into this: this = t1 - t2.java.lang.String
toString()
Returns the matrix elements of this transform as a string.void
transform(javax.vecmath.Point3d point)
Transforms the point parameter with this transform and places the result back into point.void
transform(javax.vecmath.Point3d point, javax.vecmath.Point3d pointOut)
Transforms the point parameter with this transform and places the result into pointOut.void
transform(javax.vecmath.Point3f point)
Transforms the point parameter with this transform and places the result back into point.void
transform(javax.vecmath.Point3f point, javax.vecmath.Point3f pointOut)
Transforms the point parameter with this transform and places the result into pointOut.void
transform(javax.vecmath.Vector3d normal)
Transforms the normal parameter by this transform and places the value back into normal.void
transform(javax.vecmath.Vector3d normal, javax.vecmath.Vector3d normalOut)
Transforms the normal parameter by this transform and places the value into normalOut.void
transform(javax.vecmath.Vector3f normal)
Transforms the normal parameter by this transform and places the value back into normal.void
transform(javax.vecmath.Vector3f normal, javax.vecmath.Vector3f normalOut)
Transforms the normal parameter by this transform and places the value into normalOut.void
transform(javax.vecmath.Vector4d vec)
Transform the vector vec using this Transform and place the result back into vec.void
transform(javax.vecmath.Vector4d vec, javax.vecmath.Vector4d vecOut)
Transform the vector vec using this transform and place the result into vecOut.void
transform(javax.vecmath.Vector4f vec)
Transform the vector vec using this Transform and place the result back into vec.void
transform(javax.vecmath.Vector4f vec, javax.vecmath.Vector4f vecOut)
Transform the vector vec using this Transform and place the result into vecOut.void
transpose()
Transposes this matrix in place.void
transpose(Transform3D t1)
Transposes transform t1 and places the value into this transform.
-
-
-
Field Detail
-
ZERO
public static final int ZERO
A zero matrix.- See Also:
- Constant Field Values
-
IDENTITY
public static final int IDENTITY
An identity matrix.- See Also:
- Constant Field Values
-
SCALE
public static final int SCALE
A Uniform scale matrix with no translation or other off-diagonal components.- See Also:
- Constant Field Values
-
TRANSLATION
public static final int TRANSLATION
A translation-only matrix with ones on the diagonal.- See Also:
- Constant Field Values
-
ORTHOGONAL
public static final int ORTHOGONAL
The four row vectors that make up an orthogonal matrix form a basis, meaning that they are mutually orthogonal; an orthogonal matrix with positive determinant is a pure rotation matrix; a negative determinant indicates a rotation and a reflection.- See Also:
- Constant Field Values
-
RIGID
public static final int RIGID
This matrix is a rotation and a translation with unity scale; The upper 3x3 of the matrix is orthogonal, and there is a translation component.- See Also:
- Constant Field Values
-
CONGRUENT
public static final int CONGRUENT
This is an angle and length preserving matrix, meaning that it can translate, rotate, and reflect about an axis, and scale by an amount that is uniform in all directions. These operations preserve the distance between any two points and the angle between any two intersecting lines.- See Also:
- Constant Field Values
-
AFFINE
public static final int AFFINE
An affine matrix can translate, rotate, reflect, scale anisotropically, and shear. Lines remain straight, and parallel lines remain parallel, but the angle between intersecting lines can change. In order for a transform to be classified as affine, the 4th row must be: [0, 0, 0, 1].- See Also:
- Constant Field Values
-
NEGATIVE_DETERMINANT
public static final int NEGATIVE_DETERMINANT
This matrix has a negative determinant; an orthogonal matrix with a positive determinant is a rotation matrix; an orthogonal matrix with a negative determinant is a reflection and rotation matrix.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Transform3D
public Transform3D(javax.vecmath.Matrix4f m1)
Constructs and initializes a transform from the 4 x 4 matrix. The type of the constructed transform will be classified automatically.- Parameters:
m1
- the 4 x 4 transformation matrix
-
Transform3D
public Transform3D(javax.vecmath.Matrix4d m1)
Constructs and initializes a transform from the 4 x 4 matrix. The type of the constructed transform will be classified automatically.- Parameters:
m1
- the 4 x 4 transformation matrix
-
Transform3D
public Transform3D(Transform3D t1)
Constructs and initializes a transform from the Transform3D object.- Parameters:
t1
- the transformation object to be copied
-
Transform3D
public Transform3D()
Constructs and initializes a transform to the identity matrix.
-
Transform3D
public Transform3D(float[] matrix)
Constructs and initializes a transform from the float array of length 16; the top row of the matrix is initialized to the first four elements of the array, and so on. The type of the transform object is classified internally.- Parameters:
matrix
- a float array of 16
-
Transform3D
public Transform3D(double[] matrix)
Constructs and initializes a transform from the double precision array of length 16; the top row of the matrix is initialized to the first four elements of the array, and so on. The type of the transform is classified internally.- Parameters:
matrix
- a float array of 16
-
Transform3D
public Transform3D(javax.vecmath.Quat4d q1, javax.vecmath.Vector3d t1, double s)
Constructs and initializes a transform from the quaternion, translation, and scale values. The scale is applied only to the rotational components of the matrix (upper 3 x 3) and not to the translational components of the matrix.- Parameters:
q1
- the quaternion value representing the rotational componentt1
- the translational component of the matrixs
- the scale value applied to the rotational components
-
Transform3D
public Transform3D(javax.vecmath.Quat4f q1, javax.vecmath.Vector3d t1, double s)
Constructs and initializes a transform from the quaternion, translation, and scale values. The scale is applied only to the rotational components of the matrix (upper 3 x 3) and not to the translational components of the matrix.- Parameters:
q1
- the quaternion value representing the rotational componentt1
- the translational component of the matrixs
- the scale value applied to the rotational components
-
Transform3D
public Transform3D(javax.vecmath.Quat4f q1, javax.vecmath.Vector3f t1, float s)
Constructs and initializes a transform from the quaternion, translation, and scale values. The scale is applied only to the rotational components of the matrix (upper 3 x 3) and not to the translational components of the matrix.- Parameters:
q1
- the quaternion value representing the rotational componentt1
- the translational component of the matrixs
- the scale value applied to the rotational components
-
Transform3D
public Transform3D(javax.vecmath.GMatrix m1)
Constructs a transform and initializes it to the upper 4 x 4 of the GMatrix argument. If the parameter matrix is smaller than 4 x 4, the remaining elements in the transform matrix are assigned to zero.- Parameters:
m1
- the GMatrix
-
Transform3D
public Transform3D(javax.vecmath.Matrix3f m1, javax.vecmath.Vector3d t1, double s)
Constructs and initializes a transform from the rotation matrix, translation, and scale values. The scale is applied only to the rotational component of the matrix (upper 3x3) and not to the translational component of the matrix.- Parameters:
m1
- the rotation matrix representing the rotational componentt1
- the translational component of the matrixs
- the scale value applied to the rotational components
-
Transform3D
public Transform3D(javax.vecmath.Matrix3d m1, javax.vecmath.Vector3d t1, double s)
Constructs and initializes a transform from the rotation matrix, translation, and scale values. The scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components of the matrix.- Parameters:
m1
- the rotation matrix representing the rotational componentt1
- the translational component of the matrixs
- the scale value applied to the rotational components
-
Transform3D
public Transform3D(javax.vecmath.Matrix3f m1, javax.vecmath.Vector3f t1, float s)
Constructs and initializes a transform from the rotation matrix, translation, and scale values. The scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components of the matrix.- Parameters:
m1
- the rotation matrix representing the rotational componentt1
- the translational component of the matrixs
- the scale value applied to the rotational components
-
-
Method Detail
-
getType
public final int getType()
Returns the type of this matrix as an or'ed bitmask of of all of the type classifications to which it belongs.- Returns:
- or'ed bitmask of all of the type classifications of this transform
-
getBestType
public final int getBestType()
Returns the least general type of this matrix; the order of generality from least to most is: ZERO, IDENTITY, SCALE/TRANSLATION, ORTHOGONAL, RIGID, CONGRUENT, AFFINE. If the matrix is ORTHOGONAL, calling the method getDeterminantSign() will yield more information.- Returns:
- the least general matrix type
-
getDeterminantSign
public final boolean getDeterminantSign()
Returns the sign of the determinant of this matrix; a return value of true indicates a non-negative determinant; a return value of false indicates a negative determinant. A value of true will be returned if the determinant is NaN. In general, an orthogonal matrix with a positive determinant is a pure rotation matrix; an orthogonal matrix with a negative determinant is a both a rotation and a reflection matrix.- Returns:
- determinant sign : true means non-negative, false means negative
-
setAutoNormalize
public final void setAutoNormalize(boolean autoNormalize)
Sets a flag that enables or disables automatic SVD normalization. If this flag is enabled, an automatic SVD normalization of the rotational components (upper 3x3) of this matrix is done after every subsequent matrix operation that modifies this matrix. This is functionally equivalent to calling normalize() after every subsequent call, but may be less computationally expensive. The default value for this parameter is false.- Parameters:
autoNormalize
- the boolean state of auto normalization
-
getAutoNormalize
public final boolean getAutoNormalize()
Returns the state of auto-normalization.- Returns:
- boolean state of auto-normalization
-
toString
public java.lang.String toString()
Returns the matrix elements of this transform as a string.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the matrix elements of this transform
-
setIdentity
public final void setIdentity()
Sets this transform to the identity matrix.
-
setZero
public final void setZero()
Sets this transform to all zeros.
-
add
public final void add(Transform3D t1)
Adds this transform to transform t1 and places the result into this: this = this + t1.- Parameters:
t1
- the transform to be added to this transform
-
add
public final void add(Transform3D t1, Transform3D t2)
Adds transforms t1 and t2 and places the result into this transform.- Parameters:
t1
- the transform to be addedt2
- the transform to be added
-
sub
public final void sub(Transform3D t1)
Subtracts transform t1 from this transform and places the result into this: this = this - t1.- Parameters:
t1
- the transform to be subtracted from this transform
-
sub
public final void sub(Transform3D t1, Transform3D t2)
Subtracts transform t2 from transform t1 and places the result into this: this = t1 - t2.- Parameters:
t1
- the left transformt2
- the right transform
-
transpose
public final void transpose()
Transposes this matrix in place.
-
transpose
public final void transpose(Transform3D t1)
Transposes transform t1 and places the value into this transform. The transform t1 is not modified.- Parameters:
t1
- the transform whose transpose is placed into this transform
-
set
public final void set(javax.vecmath.Quat4f q1)
Sets the value of this transform to the matrix conversion of the single precision quaternion argument; the non-rotational components are set as if this were an identity matrix.- Parameters:
q1
- the quaternion to be converted
-
set
public final void set(javax.vecmath.Quat4d q1)
Sets the value of this transform to the matrix conversion of the double precision quaternion argument; the non-rotational components are set as if this were an identity matrix.- Parameters:
q1
- the quaternion to be converted
-
setRotation
public final void setRotation(javax.vecmath.Matrix3d m1)
Sets the rotational component (upper 3x3) of this transform to the matrix values in the double precision Matrix3d argument; the other elements of this transform are unchanged; any pre-existing scale will be preserved; the argument matrix m1 will be checked for proper normalization when this transform is internally classified.- Parameters:
m1
- the double precision 3x3 matrix
-
setRotation
public final void setRotation(javax.vecmath.Matrix3f m1)
Sets the rotational component (upper 3x3) of this transform to the matrix values in the single precision Matrix3f argument; the other elements of this transform are unchanged; any pre-existing scale will be preserved; the argument matrix m1 will be checked for proper normalization when this transform is internally classified.- Parameters:
m1
- the single precision 3x3 matrix
-
setRotation
public final void setRotation(javax.vecmath.Quat4f q1)
Sets the rotational component (upper 3x3) of this transform to the matrix equivalent values of the quaternion argument; the other elements of this transform are unchanged; any pre-existing scale in the transform is preserved.- Parameters:
q1
- the quaternion that specifies the rotation
-
setRotation
public final void setRotation(javax.vecmath.Quat4d q1)
Sets the rotational component (upper 3x3) of this transform to the matrix equivalent values of the quaternion argument; the other elements of this transform are unchanged; any pre-existing scale in the transform is preserved.- Parameters:
q1
- the quaternion that specifies the rotation
-
set
public final void set(javax.vecmath.AxisAngle4f a1)
Sets the value of this transform to the matrix conversion of the single precision axis-angle argument; all of the matrix values are modified.- Parameters:
a1
- the axis-angle to be converted (x, y, z, angle)
-
set
public final void set(javax.vecmath.AxisAngle4d a1)
Sets the value of this transform to the matrix conversion of the double precision axis-angle argument; all of the matrix values are modified.- Parameters:
a1
- the axis-angle to be converted (x, y, z, angle)
-
setRotation
public final void setRotation(javax.vecmath.AxisAngle4d a1)
Sets the rotational component (upper 3x3) of this transform to the matrix equivalent values of the axis-angle argument; the other elements of this transform are unchanged; any pre-existing scale in the transform is preserved.- Parameters:
a1
- the axis-angle to be converted (x, y, z, angle)
-
setRotation
public final void setRotation(javax.vecmath.AxisAngle4f a1)
Sets the rotational component (upper 3x3) of this transform to the matrix equivalent values of the axis-angle argument; the other elements of this transform are unchanged; any pre-existing scale in the transform is preserved.- Parameters:
a1
- the axis-angle to be converted (x, y, z, angle)
-
rotX
public void rotX(double angle)
Sets the value of this transform to a counter clockwise rotation about the x axis. All of the non-rotational components are set as if this were an identity matrix.- Parameters:
angle
- the angle to rotate about the X axis in radians
-
rotY
public void rotY(double angle)
Sets the value of this transform to a counter clockwise rotation about the y axis. All of the non-rotational components are set as if this were an identity matrix.- Parameters:
angle
- the angle to rotate about the Y axis in radians
-
rotZ
public void rotZ(double angle)
Sets the value of this transform to a counter clockwise rotation about the z axis. All of the non-rotational components are set as if this were an identity matrix.- Parameters:
angle
- the angle to rotate about the Z axis in radians
-
set
public final void set(javax.vecmath.Vector3f trans)
Sets the translational value of this matrix to the Vector3f parameter values, and sets the other components of the matrix as if this transform were an identity matrix.- Parameters:
trans
- the translational component
-
set
public final void set(javax.vecmath.Vector3d trans)
Sets the translational value of this matrix to the Vector3d paramter values, and sets the other components of the matrix as if this transform were an identity matrix.- Parameters:
trans
- the translational component
-
setScale
public final void setScale(double scale)
Sets the scale component of the current transform; any existing scale is first factored out of the existing transform before the new scale is applied.- Parameters:
scale
- the new scale amount
-
setScale
public final void setScale(javax.vecmath.Vector3d scale)
Sets the possibly non-uniform scale component of the current transform; any existing scale is first factored out of the existing transform before the new scale is applied.- Parameters:
scale
- the new x,y,z scale values
-
setNonUniformScale
public final void setNonUniformScale(double xScale, double yScale, double zScale)
Deprecated.Use setScale(Vector3d) instead of setNonUniformScale; note that the setScale only modifies the scale componentReplaces the current transform with a non-uniform scale transform. All values of the existing transform are replaced.- Parameters:
xScale
- the new X scale amountyScale
- the new Y scale amountzScale
- the new Z scale amount
-
setTranslation
public final void setTranslation(javax.vecmath.Vector3f trans)
Replaces the translational components of this transform to the values in the Vector3f argument; the other values of this transform are not modified.- Parameters:
trans
- the translational component
-
setTranslation
public final void setTranslation(javax.vecmath.Vector3d trans)
Replaces the translational components of this transform to the values in the Vector3d argument; the other values of this transform are not modified.- Parameters:
trans
- the translational component
-
set
public final void set(javax.vecmath.Quat4d q1, javax.vecmath.Vector3d t1, double s)
Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.- Parameters:
q1
- the rotation expressed as a quaterniont1
- the translations
- the scale value
-
set
public final void set(javax.vecmath.Quat4f q1, javax.vecmath.Vector3d t1, double s)
Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.- Parameters:
q1
- the rotation expressed as a quaterniont1
- the translations
- the scale value
-
set
public final void set(javax.vecmath.Quat4f q1, javax.vecmath.Vector3f t1, float s)
Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.- Parameters:
q1
- the rotation expressed as a quaterniont1
- the translations
- the scale value
-
set
public final void set(javax.vecmath.Matrix3f m1, javax.vecmath.Vector3f t1, float s)
Sets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale s. The scale is only applied to the rotational component of the matrix (upper 3x3) and not to the translational component of the matrix.- Parameters:
m1
- the rotation matrixt1
- the translations
- the scale value
-
set
public final void set(javax.vecmath.Matrix3f m1, javax.vecmath.Vector3d t1, double s)
Sets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale s. The scale is only applied to the rotational component of the matrix (upper 3x3) and not to the translational component of the matrix.- Parameters:
m1
- the rotation matrixt1
- the translations
- the scale value
-
set
public final void set(javax.vecmath.Matrix3d m1, javax.vecmath.Vector3d t1, double s)
Sets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale s. The scale is only applied to the rotational component of the matrix (upper 3x3) and not to the translational component of the matrix.- Parameters:
m1
- the rotation matrixt1
- the translations
- the scale value
-
set
public final void set(javax.vecmath.GMatrix matrix)
Sets the matrix values of this transform to the matrix values in the upper 4x4 corner of the GMatrix parameter. If the parameter matrix is smaller than 4x4, the remaining elements in the transform matrix are assigned to zero. The transform matrix type is classified internally by the Transform3D class.- Parameters:
matrix
- the general matrix from which the Transform3D matrix is derived
-
set
public final void set(Transform3D t1)
Sets the matrix, type, and state of this transform to the matrix, type, and state of transform t1.- Parameters:
t1
- the transform to be copied
-
set
public final void set(double[] matrix)
Sets the matrix values of this transform to the matrix values in the double precision array parameter. The matrix type is classified internally by the Transform3D class.- Parameters:
matrix
- the double precision array of length 16 in row major format
-
set
public final void set(float[] matrix)
Sets the matrix values of this transform to the matrix values in the single precision array parameter. The matrix type is classified internally by the Transform3D class.- Parameters:
matrix
- the single precision array of length 16 in row major format
-
set
public final void set(javax.vecmath.Matrix4d m1)
Sets the matrix values of this transform to the matrix values in the double precision Matrix4d argument. The transform type is classified internally by the Transform3D class.- Parameters:
m1
- the double precision 4x4 matrix
-
set
public final void set(javax.vecmath.Matrix4f m1)
Sets the matrix values of this transform to the matrix values in the single precision Matrix4f argument. The transform type is classified internally by the Transform3D class.- Parameters:
m1
- the single precision 4x4 matrix
-
set
public final void set(javax.vecmath.Matrix3f m1)
Sets the rotational component (upper 3x3) of this transform to the matrix values in the single precision Matrix3f argument; the other elements of this transform are initialized as if this were an identity matrix (i.e., affine matrix with no translational component).- Parameters:
m1
- the single precision 3x3 matrix
-
set
public final void set(javax.vecmath.Matrix3d m1)
Sets the rotational component (upper 3x3) of this transform to the matrix values in the double precision Matrix3d argument; the other elements of this transform are initialized as if this were an identity matrix (ie, affine matrix with no translational component).- Parameters:
m1
- the double precision 3x3 matrix
-
setEuler
public final void setEuler(javax.vecmath.Vector3d euler)
Sets the rotational component (upper 3x3) of this transform to the rotation matrix converted from the Euler angles provided; the other non-rotational elements are set as if this were an identity matrix. The euler parameter is a Vector3d consisting of three rotation angles applied first about the X, then Y then Z axis. These rotations are applied using a static frame of reference. In other words, the orientation of the Y rotation axis is not affected by the X rotation and the orientation of the Z rotation axis is not affected by the X or Y rotation.- Parameters:
euler
- the Vector3d consisting of three rotation angles about X,Y,Z
-
get
public final void get(double[] matrix)
Places the values of this transform into the double precision array of length 16. The first four elements of the array will contain the top row of the transform matrix, etc.- Parameters:
matrix
- the double precision array of length 16
-
get
public final void get(float[] matrix)
Places the values of this transform into the single precision array of length 16. The first four elements of the array will contain the top row of the transform matrix, etc.- Parameters:
matrix
- the single precision array of length 16
-
get
public final void get(javax.vecmath.Matrix3d m1)
Places the normalized rotational component of this transform into the 3x3 matrix argument.- Parameters:
m1
- the matrix into which the rotational component is placed
-
get
public final void get(javax.vecmath.Matrix3f m1)
Places the normalized rotational component of this transform into the 3x3 matrix argument.- Parameters:
m1
- the matrix into which the rotational component is placed
-
get
public final void get(javax.vecmath.Quat4f q1)
Places the quaternion equivalent of the normalized rotational component of this transform into the quaternion parameter.- Parameters:
q1
- the quaternion into which the rotation component is placed
-
get
public final void get(javax.vecmath.Quat4d q1)
Places the quaternion equivalent of the normalized rotational component of this transform into the quaternion parameter.- Parameters:
q1
- the quaternion into which the rotation component is placed
-
get
public final void get(javax.vecmath.Matrix4d matrix)
Places the values of this transform into the double precision matrix argument.- Parameters:
matrix
- the double precision matrix
-
get
public final void get(javax.vecmath.Matrix4f matrix)
Places the values of this transform into the single precision matrix argument.- Parameters:
matrix
- the single precision matrix
-
get
public final double get(javax.vecmath.Quat4d q1, javax.vecmath.Vector3d t1)
Places the quaternion equivalent of the normalized rotational component of this transform into the quaternion parameter; places the translational component into the Vector parameter.- Parameters:
q1
- the quaternion representing the rotationt1
- the translation component- Returns:
- the scale component of this transform
-
get
public final float get(javax.vecmath.Quat4f q1, javax.vecmath.Vector3f t1)
Places the quaternion equivalent of the normalized rotational component of this transform into the quaternion parameter; places the translational component into the Vector parameter.- Parameters:
q1
- the quaternion representing the rotationt1
- the translation component- Returns:
- the scale component of this transform
-
get
public final double get(javax.vecmath.Quat4f q1, javax.vecmath.Vector3d t1)
Places the quaternion equivalent of the normalized rotational component of this transform into the quaternion parameter; places the translational component into the Vector parameter.- Parameters:
q1
- the quaternion representing the rotationt1
- the translation component- Returns:
- the scale component of this transform
-
get
public final double get(javax.vecmath.Matrix3d m1, javax.vecmath.Vector3d t1)
Places the normalized rotational component of this transform into the matrix parameter; place the translational component into the vector parameter.- Parameters:
m1
- the normalized matrix representing the rotationt1
- the translation component- Returns:
- the scale component of this transform
-
get
public final float get(javax.vecmath.Matrix3f m1, javax.vecmath.Vector3f t1)
Places the normalized rotational component of this transform into the matrix parameter; place the translational component into the vector parameter.- Parameters:
m1
- the normalized matrix representing the rotationt1
- the translation component- Returns:
- the scale component of this transform
-
get
public final double get(javax.vecmath.Matrix3f m1, javax.vecmath.Vector3d t1)
Places the normalized rotational component of this transform into the matrix parameter; place the translational component into the vector parameter.- Parameters:
m1
- the normalized matrix representing the rotationt1
- the translation component- Returns:
- the scale component of this transform
-
getScale
public final double getScale()
Returns the uniform scale factor of this matrix. If the matrix has non-uniform scale factors, the largest of the x, y, and z scale factors will be returned.- Returns:
- the scale factor of this matrix
-
getScale
public final void getScale(javax.vecmath.Vector3d scale)
Gets the possibly non-uniform scale components of the current transform and places them into the scale vector.- Parameters:
scale
- the vector into which the x,y,z scale values will be placed
-
get
public final void get(javax.vecmath.Vector3f trans)
Retrieves the translational components of this transform.- Parameters:
trans
- the vector that will receive the translational component
-
get
public final void get(javax.vecmath.Vector3d trans)
Retrieves the translational components of this transform.- Parameters:
trans
- the vector that will receive the translational component
-
invert
public final void invert(Transform3D t1)
Sets the value of this transform to the inverse of the passed Transform3D parameter. This method uses the transform type to determine the optimal algorithm for inverting transform t1.- Parameters:
t1
- the transform to be inverted- Throws:
javax.vecmath.SingularMatrixException
- thrown if transform t1 is not invertible
-
invert
public final void invert()
Inverts this transform in place. This method uses the transform type to determine the optimal algorithm for inverting this transform.- Throws:
javax.vecmath.SingularMatrixException
- thrown if this transform is not invertible
-
determinant
public final double determinant()
Calculates and returns the determinant of this transform.- Returns:
- the double precision determinant
-
set
public final void set(double scale)
Sets the value of this transform to a uniform scale; all of the matrix values are modified.- Parameters:
scale
- the scale factor for the transform
-
set
public final void set(double scale, javax.vecmath.Vector3d v1)
Sets the value of this transform to a scale and translation matrix; the scale is not applied to the translation and all of the matrix values are modified.- Parameters:
scale
- the scale factor for the transformv1
- the translation amount
-
set
public final void set(float scale, javax.vecmath.Vector3f v1)
Sets the value of this transform to a scale and translation matrix; the scale is not applied to the translation and all of the matrix values are modified.- Parameters:
scale
- the scale factor for the transformv1
- the translation amount
-
set
public final void set(javax.vecmath.Vector3d v1, double scale)
Sets the value of this transform to a scale and translation matrix; the translation is scaled by the scale factor and all of the matrix values are modified.- Parameters:
v1
- the translation amountscale
- the scale factor for the transform AND the translation
-
set
public final void set(javax.vecmath.Vector3f v1, float scale)
Sets the value of this transform to a scale and translation matrix; the translation is scaled by the scale factor and all of the matrix values are modified.- Parameters:
v1
- the translation amountscale
- the scale factor for the transform AND the translation
-
mul
public final void mul(double scalar)
Multiplies each element of this transform by a scalar.- Parameters:
scalar
- the scalar multiplier
-
mul
public final void mul(double scalar, Transform3D t1)
Multiplies each element of transform t1 by a scalar and places the result into this. Transform t1 is not modified.- Parameters:
scalar
- the scalar multipliert1
- the original transform
-
mul
public final void mul(Transform3D t1)
Sets the value of this transform to the result of multiplying itself with transform t1 (this = this * t1).- Parameters:
t1
- the other transform
-
mul
public final void mul(Transform3D t1, Transform3D t2)
Sets the value of this transform to the result of multiplying transform t1 by transform t2 (this = t1*t2).- Parameters:
t1
- the left transformt2
- the right transform
-
mulInverse
public final void mulInverse(Transform3D t1)
Multiplies this transform by the inverse of transform t1. The final value is placed into this matrix (this = this*t1^-1).- Parameters:
t1
- the matrix whose inverse is computed.
-
mulInverse
public final void mulInverse(Transform3D t1, Transform3D t2)
Multiplies transform t1 by the inverse of transform t2. The final value is placed into this matrix (this = t1*t2^-1).- Parameters:
t1
- the left transform in the multiplicationt2
- the transform whose inverse is computed.
-
mulTransposeRight
public final void mulTransposeRight(Transform3D t1, Transform3D t2)
Multiplies transform t1 by the transpose of transform t2 and places the result into this transform (this = t1 * transpose(t2)).- Parameters:
t1
- the transform on the left hand side of the multiplicationt2
- the transform whose transpose is computed
-
mulTransposeLeft
public final void mulTransposeLeft(Transform3D t1, Transform3D t2)
Multiplies the transpose of transform t1 by transform t2 and places the result into this matrix (this = transpose(t1) * t2).- Parameters:
t1
- the transform whose transpose is computedt2
- the transform on the right hand side of the multiplication
-
mulTransposeBoth
public final void mulTransposeBoth(Transform3D t1, Transform3D t2)
Multiplies the transpose of transform t1 by the transpose of transform t2 and places the result into this transform (this = transpose(t1) * transpose(t2)).- Parameters:
t1
- the transform on the left hand side of the multiplicationt2
- the transform on the right hand side of the multiplication
-
normalize
public final void normalize()
Normalizes the rotational components (upper 3x3) of this matrix in place using a Singular Value Decomposition (SVD). This operation ensures that the column vectors of this matrix are orthogonal to each other. The primary use of this method is to correct for floating point errors that accumulate over time when concatenating a large number of rotation matrices. Note that the scale of the matrix is not altered by this method.
-
normalize
public final void normalize(Transform3D t1)
Normalizes the rotational components (upper 3x3) of transform t1 using a Singular Value Decomposition (SVD), and places the result into this transform. This operation ensures that the column vectors of this matrix are orthogonal to each other. The primary use of this method is to correct for floating point errors that accumulate over time when concatenating a large number of rotation matrices. Note that the scale of the matrix is not altered by this method.- Parameters:
t1
- the source transform, which is not modified
-
normalizeCP
public final void normalizeCP()
Normalizes the rotational components (upper 3x3) of this transform in place using a Cross Product (CP) normalization. This operation ensures that the column vectors of this matrix are orthogonal to each other. The primary use of this method is to correct for floating point errors that accumulate over time when concatenating a large number of rotation matrices. Note that the scale of the matrix is not altered by this method.
-
normalizeCP
public final void normalizeCP(Transform3D t1)
Normalizes the rotational components (upper 3x3) of transform t1 using a Cross Product (CP) normalization, and places the result into this transform. This operation ensures that the column vectors of this matrix are orthogonal to each other. The primary use of this method is to correct for floating point errors that accumulate over time when concatenating a large number of rotation matrices. Note that the scale of the matrix is not altered by this method.- Parameters:
t1
- the transform to be normalized
-
equals
public boolean equals(Transform3D t1)
Returns true if all of the data members of transform t1 are equal to the corresponding data members in this Transform3D.- Parameters:
t1
- the transform with which the comparison is made- Returns:
- true or false
-
equals
public boolean equals(java.lang.Object o1)
Returns true if the Object o1 is of type Transform3D and all of the data members of o1 are equal to the corresponding data members in this Transform3D.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o1
- the object with which the comparison is made.- Returns:
- true or false
-
epsilonEquals
public boolean epsilonEquals(Transform3D t1, double epsilon)
Returns true if the L-infinite distance between this matrix and matrix m1 is less than or equal to the epsilon parameter, otherwise returns false. The L-infinite distance is equal to MAX[i=0,1,2,3 ; j=0,1,2,3 ; abs[(this.m(i,j) - m1.m(i,j)]- Parameters:
t1
- the transform to be compared to this transformepsilon
- the threshold value
-
hashCode
public int hashCode()
Returns a hash code value based on the data values in this object. Two different Transform3D objects with identical data values (i.e., Transform3D.equals returns true) will return the same hash number. Two Transform3D objects with different data members may return the same hash value, although this is not likely.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the integer hash code value
-
transform
public final void transform(javax.vecmath.Vector4d vec, javax.vecmath.Vector4d vecOut)
Transform the vector vec using this transform and place the result into vecOut.- Parameters:
vec
- the double precision vector to be transformedvecOut
- the vector into which the transformed values are placed
-
transform
public final void transform(javax.vecmath.Vector4d vec)
Transform the vector vec using this Transform and place the result back into vec.- Parameters:
vec
- the double precision vector to be transformed
-
transform
public final void transform(javax.vecmath.Vector4f vec, javax.vecmath.Vector4f vecOut)
Transform the vector vec using this Transform and place the result into vecOut.- Parameters:
vec
- the single precision vector to be transformedvecOut
- the vector into which the transformed values are placed
-
transform
public final void transform(javax.vecmath.Vector4f vec)
Transform the vector vec using this Transform and place the result back into vec.- Parameters:
vec
- the single precision vector to be transformed
-
transform
public final void transform(javax.vecmath.Point3d point, javax.vecmath.Point3d pointOut)
Transforms the point parameter with this transform and places the result into pointOut. The fourth element of the point input paramter is assumed to be one.- Parameters:
point
- the input point to be transformedpointOut
- the transformed point
-
transform
public final void transform(javax.vecmath.Point3d point)
Transforms the point parameter with this transform and places the result back into point. The fourth element of the point input paramter is assumed to be one.- Parameters:
point
- the input point to be transformed
-
transform
public final void transform(javax.vecmath.Vector3d normal, javax.vecmath.Vector3d normalOut)
Transforms the normal parameter by this transform and places the value into normalOut. The fourth element of the normal is assumed to be zero.- Parameters:
normal
- the input normal to be transformednormalOut
- the transformed normal
-
transform
public final void transform(javax.vecmath.Vector3d normal)
Transforms the normal parameter by this transform and places the value back into normal. The fourth element of the normal is assumed to be zero.- Parameters:
normal
- the input normal to be transformed
-
transform
public final void transform(javax.vecmath.Point3f point, javax.vecmath.Point3f pointOut)
Transforms the point parameter with this transform and places the result into pointOut. The fourth element of the point input paramter is assumed to be one.- Parameters:
point
- the input point to be transformedpointOut
- the transformed point
-
transform
public final void transform(javax.vecmath.Point3f point)
Transforms the point parameter with this transform and places the result back into point. The fourth element of the point input paramter is assumed to be one.- Parameters:
point
- the input point to be transformed
-
transform
public final void transform(javax.vecmath.Vector3f normal, javax.vecmath.Vector3f normalOut)
Transforms the normal parameter by this transform and places the value into normalOut. The fourth element of the normal is assumed to be zero. Note: For correct lighting results, if a transform has uneven scaling surface normals should transformed by the inverse transpose of the transform. This the responsibility of the application and is not done automatically by this method.- Parameters:
normal
- the input normal to be transformednormalOut
- the transformed normal
-
transform
public final void transform(javax.vecmath.Vector3f normal)
Transforms the normal parameter by this transform and places the value back into normal. The fourth element of the normal is assumed to be zero. Note: For correct lighting results, if a transform has uneven scaling surface normals should transformed by the inverse transpose of the transform. This the responsibility of the application and is not done automatically by this method.- Parameters:
normal
- the input normal to be transformed
-
setRotationScale
public final void setRotationScale(javax.vecmath.Matrix3f m1)
Replaces the upper 3x3 matrix values of this transform with the values in the matrix m1.- Parameters:
m1
- the matrix that will be the new upper 3x3
-
setRotationScale
public final void setRotationScale(javax.vecmath.Matrix3d m1)
Replaces the upper 3x3 matrix values of this transform with the values in the matrix m1.- Parameters:
m1
- the matrix that will be the new upper 3x3
-
scaleAdd
public final void scaleAdd(double s, Transform3D t1, Transform3D t2)
Scales transform t1 by a Uniform scale matrix with scale factor s and then adds transform t2 (this = S*t1 + t2).- Parameters:
s
- the scale factort1
- the transform to be scaledt2
- the transform to be added
-
scaleAdd
public final void scaleAdd(double s, Transform3D t1)
Scales this transform by a Uniform scale matrix with scale factor s and then adds transform t1 (this = S*this + t1).- Parameters:
s
- the scale factort1
- the transform to be added
-
getRotationScale
public final void getRotationScale(javax.vecmath.Matrix3f m1)
Gets the upper 3x3 values of this matrix and places them into the matrix m1.- Parameters:
m1
- the matrix that will hold the values
-
getRotationScale
public final void getRotationScale(javax.vecmath.Matrix3d m1)
Gets the upper 3x3 values of this matrix and places them into the matrix m1.- Parameters:
m1
- the matrix that will hold the values
-
lookAt
public void lookAt(javax.vecmath.Point3d eye, javax.vecmath.Point3d center, javax.vecmath.Vector3d up)
Helping function that specifies the position and orientation of a view matrix. The inverse of this transform can be used to control the ViewPlatform object within the scene graph.- Parameters:
eye
- the location of the eyecenter
- a point in the virtual world where the eye is lookingup
- an up vector specifying the frustum's up direction
-
frustum
public void frustum(double left, double right, double bottom, double top, double near, double far)
Creates a perspective projection transform that mimics a standard, camera-based, view-model. This transform maps coordinates from Eye Coordinates (EC) to Clipping Coordinates (CC). Note that unlike the similar function in OpenGL, the clipping coordinates generated by the resulting transform are in a right-handed coordinate system (as are all other coordinate systems in Java 3D).The frustum function-call establishes a view model with the eye at the apex of a symmetric view frustum. The arguments define the frustum and its associated perspective projection: (left, bottom, -near) and (right, top, -near) specify the point on the near clipping plane that maps onto the lower-left and upper-right corners of the window respectively, assuming the eye is located at (0, 0, 0).
- Parameters:
left
- the vertical line on the left edge of the near clipping plane mapped to the left edge of the graphics windowright
- the vertical line on the right edge of the near clipping plane mapped to the right edge of the graphics windowbottom
- the horizontal line on the bottom edge of the near clipping plane mapped to the bottom edge of the graphics windowtop
- the horizontal line on the top edge of the nearnear
- the distance to the frustum's near clipping plane. This value must be positive, (the value -near is the location of the near clip plane).far
- the distance to the frustum's far clipping plane. This value must be positive, and must be greater than near.
-
perspective
public void perspective(double fovx, double aspect, double zNear, double zFar)
Creates a perspective projection transform that mimics a standard, camera-based, view-model. This transform maps coordinates from Eye Coordinates (EC) to Clipping Coordinates (CC). Note that unlike the similar function in OpenGL, the clipping coordinates generated by the resulting transform are in a right-handed coordinate system (as are all other coordinate systems in Java 3D). Also note that the field of view is specified in radians.- Parameters:
fovx
- specifies the field of view in the x direction, in radiansaspect
- specifies the aspect ratio and thus the field of view in the x direction. The aspect ratio is the ratio of x to y, or width to height.zNear
- the distance to the frustum's near clipping plane. This value must be positive, (the value -zNear is the location of the near clip plane).zFar
- the distance to the frustum's far clipping plane
-
ortho
public void ortho(double left, double right, double bottom, double top, double near, double far)
Creates an orthographic projection transform that mimics a standard, camera-based, view-model. This transform maps coordinates from Eye Coordinates (EC) to Clipping Coordinates (CC). Note that unlike the similar function in OpenGL, the clipping coordinates generated by the resulting transform are in a right-handed coordinate system (as are all other coordinate systems in Java 3D).- Parameters:
left
- the vertical line on the left edge of the near clipping plane mapped to the left edge of the graphics windowright
- the vertical line on the right edge of the near clipping plane mapped to the right edge of the graphics windowbottom
- the horizontal line on the bottom edge of the near clipping plane mapped to the bottom edge of the graphics windowtop
- the horizontal line on the top edge of the near clipping plane mapped to the top edge of the graphics windownear
- the distance to the frustum's near clipping plane (the value -near is the location of the near clip plane)far
- the distance to the frustum's far clipping plane
-
-