jautil.geometry
Class TRUtil

java.lang.Object
  extended by jautil.geometry.TRUtil

public class TRUtil
extends java.lang.Object

A collection of (static) utility methods for translation and rotation data.


Field Summary
static float[] ID_ROT_ARRAY
          The array for the identity rotation (in the order: x, y, z, w).
static int IX_W
          Index of the W component of a vector/quaternion array.
static int IX_X
          Index of the X component of a vector/quaternion array.
static int IX_Y
          Index of the Y component of a vector/quaternion array.
static int IX_Z
          Index of the Z component of a vector/quaternion array.
static float METRES_TO_INCHES
          Scale factor converting metres to inches.
static int ROT_SIZE
          The number of elements in a rotation array, that is, in a quaternion.
static int TRANS_SIZE
          The number of elements in a translation array.
 
Constructor Summary
TRUtil()
           
 
Method Summary
static float[] clampWOfRotation(float[] rot)
          Returns the given rotation as long as its w component does not exceed 1; otherwise returns a new copy of the given rotation but with the copy's w value set to 1.
static double[] rotationDirectionAndAngle(float[] rot)
          Provides the given rotation data as a direction vector (that is, the 3 direction cosines), together with the angle of rotation about that vector (in degrees).
static void setRotation(float[] rdest, float[] rsrc)
          Copies the given source rotation to the given destination one.
static void setRotation(float[] rdest, Quaternion qsrc)
          Copies the given source quaternion rotation values to the given destination array.
static void setScaledTranslation(float[] tdest, float[] tsrc, float scale)
          Copies the given source translation to the given destination one.
static void setTranslation(float[] tdest, float[] tsrc)
          Copies the given source translation to the given destination one.
static java.lang.String stringForTR(int fourcc, float[] trans, float[] rot)
          Returns a string representation of the given translation and rotation data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRANS_SIZE

public static final int TRANS_SIZE
The number of elements in a translation array.

See Also:
Constant Field Values

ROT_SIZE

public static final int ROT_SIZE
The number of elements in a rotation array, that is, in a quaternion.

See Also:
Constant Field Values

IX_X

public static final int IX_X
Index of the X component of a vector/quaternion array.

See Also:
Constant Field Values

IX_Y

public static final int IX_Y
Index of the Y component of a vector/quaternion array.

See Also:
Constant Field Values

IX_Z

public static final int IX_Z
Index of the Z component of a vector/quaternion array.

See Also:
Constant Field Values

IX_W

public static final int IX_W
Index of the W component of a vector/quaternion array.

See Also:
Constant Field Values

ID_ROT_ARRAY

public static final float[] ID_ROT_ARRAY
The array for the identity rotation (in the order: x, y, z, w).


METRES_TO_INCHES

public static final float METRES_TO_INCHES
Scale factor converting metres to inches.

See Also:
Constant Field Values
Constructor Detail

TRUtil

public TRUtil()
Method Detail

setTranslation

public static void setTranslation(float[] tdest,
                                  float[] tsrc)
Copies the given source translation to the given destination one.


setScaledTranslation

public static void setScaledTranslation(float[] tdest,
                                        float[] tsrc,
                                        float scale)
Copies the given source translation to the given destination one.


setRotation

public static void setRotation(float[] rdest,
                               float[] rsrc)
Copies the given source rotation to the given destination one.


setRotation

public static void setRotation(float[] rdest,
                               Quaternion qsrc)
Copies the given source quaternion rotation values to the given destination array.


clampWOfRotation

public static float[] clampWOfRotation(float[] rot)
Returns the given rotation as long as its w component does not exceed 1; otherwise returns a new copy of the given rotation but with the copy's w value set to 1.


stringForTR

public static java.lang.String stringForTR(int fourcc,
                                           float[] trans,
                                           float[] rot)
Returns a string representation of the given translation and rotation data.


rotationDirectionAndAngle

public static double[] rotationDirectionAndAngle(float[] rot)
Provides the given rotation data as a direction vector (that is, the 3 direction cosines), together with the angle of rotation about that vector (in degrees). The direction cosines will all be zero when the angle of rotation is at or very close to zero.