public class TRTransform
extends java.lang.Object
This is a reworking of class SGMatrix with restrictions: we allow transforms composed from translations and rotations (only) -- that is, with no scaling.
Hence each homogeneous transform is represented by a matrix with
the following features:
- The bottom row is [0 0 0 1].
- Its determinant is 1.
- The upper-left 3 x 3 submatrix represents a rotation
(whose determinant is also 1).
- The upper-right 3 x 1 column vector represents a translation.
We represent the transform by a 3 x 4 matrix (that is, the values in the 4th row are left implicit). In addition we allow a quaternion to be associated with the transform, corresponding to its rotation component. The presence of this quaternion allows products to be computed more efficiently.
Constructor and Description |
---|
TRTransform()
Default constructor, giving the identity transform.
|
TRTransform(float[] marray)
Constructs this transform using the given transformation array
(that is, using the array itself, not a copy); in this case
there is NO associated rotation quaternion.
|
TRTransform(Quaternion qrot)
Constructs a transformation from the given rotation quaternion
qrot (which is copied) and a zero translation.
|
Modifier and Type | Method and Description |
---|---|
TRTransform |
getInverse()
Returns a new transformation representing the inverse of this
one; note that the new transform does NOT have a rotation
quaternion.
|
float[] |
mat()
Returns the RT array for this transform.
|
Quaternion |
quat()
Returns the rotation quaternion for this transform.
|
void |
rotateVector(Vector3f vec)
Applies the rotation part of this transform to the given
vector vec, updating the vector itself with the result.
|
void |
rotateVector(Vector3f vec,
float[] vecout)
Applies the rotation part of this transform to
the given vector vec, giving the result in vecout.
|
void |
set(float[] rot,
float[] trans)
Resets this transformation from the given rotation and
translation arrays (rot and trans).
|
void |
set(float X,
float Y,
float Z,
float angledeg)
Sets this transform to represent a rotation of angledeg degrees
around the axis vector (X,Y,Z), which MUST have unit length,
with a zero translation.
|
void |
set(Quaternion qrot)
Resets this transformation from the given rotation qrot and
a zero transformation.
|
void |
setComposition(TRTransform xpre,
float[] rot,
float[] trans)
Resets this transformation as the composition of the given
transform with that represented by the given rotation and
translation arrays.
|
void |
setComposition(TRTransform xpre,
Quaternion qrot)
Resets this transformation as the composition of the given
transform with the given rotation (and a zero translation).
|
java.lang.String |
toString() |
void |
transformPoint(Vector3f pt)
Applies this transform to the given point, pt.
|
void |
transformPoint(Vector3f pt,
float[] ptout)
Applies this transform to the given point pt, giving
the result in ptout.
|
public TRTransform()
public TRTransform(float[] marray)
public TRTransform(Quaternion qrot)
public float[] mat()
public Quaternion quat()
public void set(Quaternion qrot)
public void set(float[] rot, float[] trans)
public void setComposition(TRTransform xpre, float[] rot, float[] trans)
public void setComposition(TRTransform xpre, Quaternion qrot)
public void transformPoint(Vector3f pt)
public void transformPoint(Vector3f pt, float[] ptout)
public void rotateVector(Vector3f vec, float[] vecout)
public void rotateVector(Vector3f vec)
public TRTransform getInverse()
public void set(float X, float Y, float Z, float angledeg)
public java.lang.String toString()
toString
in class java.lang.Object