org.openmali.vecmath2
Class AxisAngle3f

java.lang.Object
  extended by org.openmali.vecmath2.TupleNf<Tuple3f>
      extended by org.openmali.vecmath2.Tuple3f
          extended by org.openmali.vecmath2.AxisAngle3f
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, TupleInterface<Tuple3f>

public class AxisAngle3f
extends Tuple3f
implements java.io.Externalizable, java.lang.Cloneable

A 4 element axis angle represented by single precision floating point x,y,z,angle components. An axis angle is a rotation of angle (radians) about the vector (x,y,z). Inspired by Kenji Hiranabe's AxisAngle3f implementation

See Also:
Serialized Form

Field Summary
static AxisAngle3f ZERO
           
 
Fields inherited from class org.openmali.vecmath2.TupleNf
isDirty, roTrick, values
 
Constructor Summary
  AxisAngle3f()
          Constructs and initializes a AxisAngle3f to (0,0,1,0).
  AxisAngle3f(AxisAngle3f aa3f)
          Constructs and initializes a AxisAngle3f from the specified AxisAngle3f.
protected AxisAngle3f(boolean readOnly)
          Constructs and initializes a AxisAngle3f to (0,0,1,0).
protected AxisAngle3f(boolean readOnly, AxisAngle3f aa3f)
          Constructs and initializes a AxisAngle3f from the specified AxisAngle3f.
protected AxisAngle3f(boolean readOnly, float[] values)
          Constructs and initializes an AxisAngle3f from the components contained in the array.
protected AxisAngle3f(boolean readOnly, float x, float y, float z, float angle)
          Constructs and initializes an AxisAngle3f from the specified x, y, z, and angle.
protected AxisAngle3f(boolean readOnly, Tuple3f axis, float angle)
          Constructs and initializes an AxisAngle3f from the specified axis and angle.
  AxisAngle3f(float[] values)
          Constructs and initializes an AxisAngle3f from the components contained in the array.
  AxisAngle3f(float x, float y, float z, float angle)
          Constructs and initializes an AxisAngle3f from the specified x, y, z, and angle.
  AxisAngle3f(Tuple3f axis, float angle)
          Constructs and initializes an AxisAngle3f from the specified axis and angle.
 
Method Summary
 AxisAngle3f addAngle(float v)
          Adds v to this tuple's angle value.
 AxisAngle3f clone()
          Creates and returns a copy of this object.
 int deserialize(int pos, byte[] buffer)
          Deserializes this instanc'es data from the byte array.
 AxisAngle3f divAngle(float v)
          Divides this tuple's angle value by v.
 boolean epsilonEquals(AxisAngle3f aa3f, float epsilon)
          Returns true if the L-infinite distance between this axis-angle and axis-angle t1 is less than or equal to the epsilon parameter, otherwise returns false.
 boolean equals(AxisAngle3f aa3f)
          Returns true if all of the data members of AxisAngle3f t1 are equal to the corresponding data members in this.
 boolean equals(java.lang.Object o)
          Returns true if the Object o1 is of type AxisAngle3f and all of the data members of o1 are equal to the corresponding data members in this AxisAngle3f.
static AxisAngle3f fromPool()
          Allocates an AxisAngle3f instance from the pool.
static AxisAngle3f fromPool(AxisAngle3f aa)
          Allocates an AxisAngle3f instance from the pool.
static AxisAngle3f fromPool(float x, float y, float z, float angle)
          Allocates an AxisAngle3f instance from the pool.
 void get(float[] buffer)
          Gets the value of this axis angle into the array a of length four in x,y,z,angle order.
 float getAngle()
           
protected  int getSerializationBufferSize()
          
 int hashCode()
          Returns a hash number based on the data values in this object.
 AxisAngle3f mulAngle(float v)
          Multiplies this tuple's angle value with v.
static AxisAngle3f newReadOnly()
          Constructs and initializes a AxisAngle3f to (0,0,1,0).
static AxisAngle3f newReadOnly(AxisAngle3f aa3f)
          Constructs and initializes a AxisAngle3f from the specified AxisAngle3f.
static AxisAngle3f newReadOnly(float[] values)
          Constructs and initializes an AxisAngle3f from the components contained in the array.
static AxisAngle3f newReadOnly(float x, float y, float z, float angle)
          Constructs and initializes an AxisAngle3f from the specified x, y, z, and angle.
static AxisAngle3f newReadOnly(Tuple3f axis, float angle)
          Constructs and initializes an AxisAngle3f from the specified axis and angle.
 int serialize(int pos, byte[] buffer)
          Serializes this instanc'es data into the byte array.
 void set(AxisAngle3f aa3f)
          Sets the value of this axis angle to the value of axis angle t1.
 AxisAngle3f set(float[] values)
          Sets the value of this axis angle from the 4 values specified in the array.
 void set(float x, float y, float z, float angle)
          Sets the value of this axis angle to the specified x,y,z,angle.
 void set(Matrix3f mat)
          Sets the value of this axis-angle to the rotational component of the passed matrix.
 void set(Matrix4f mat)
          Sets the value of this axis-angle to the rotational component of the passed matrix.
 void set(Quaternion4f quat)
          Sets the value of this axis-angle to the rotational equivalent of the passed quaternion.
 void set(Tuple3f axis, float angle)
          Sets the value of this AxisAngle3f to the specified axis and angle.
 void setAngle(float angle)
          Sets the value of the angle of this tuple.
 AxisAngle3f subAngle(float v)
          Subtracts v from this tuple's angle value.
static void toPool(AxisAngle3f o)
          Stores the given AxisAngle3f instance in the pool.
 java.lang.String toString()
          Returns a string that contains the values of this AxisAngle3f.
 
Methods inherited from class org.openmali.vecmath2.Tuple3f
add, addX, addY, addZ, asReadOnly, div, divX, divY, divZ, fromPool, fromPool, getReadOnly, getX, getY, getZ, mul, mulX, mulY, mulZ, newReadOnly, newReadOnly, scale, set, setX, setY, setZ, sub, subX, subY, subZ, toPool, x, x, y, y, z, z
 
Methods inherited from class org.openmali.vecmath2.TupleNf
absolute, absolute, add, add, addValue, clamp, clamp, clampMax, clampMax, clampMin, clampMin, div, divValue, epsilonEquals, equals, fill, get, get, getSize, getValue, interpolate, interpolate, isDirty, isReadOnly, mul, mulValue, negate, negate, readExternal, readFromBuffer, readFromBuffer, readFromBuffer, readFromBuffer, round, round, scale, scale, scaleAdd, scaleAdd, set, set, setClean, setValue, setZero, sub, sub, subValue, writeExternal, writeToBuffer, writeToBuffer, writeToBuffer, writeToBuffer
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 
Methods inherited from interface org.openmali.vecmath2.TupleInterface
absolute, absolute, add, add, addValue, clamp, clamp, clampMax, clampMax, clampMin, clampMin, div, divValue, epsilonEquals, fill, get, get, getSize, getValue, interpolate, interpolate, isDirty, isReadOnly, mul, mulValue, negate, negate, round, round, scale, scale, scaleAdd, scaleAdd, set, set, setClean, setValue, setZero, sub, sub, subValue
 

Field Detail

ZERO

public static final AxisAngle3f ZERO
Constructor Detail

AxisAngle3f

protected AxisAngle3f(boolean readOnly,
                      float x,
                      float y,
                      float z,
                      float angle)
Constructs and initializes an AxisAngle3f from the specified x, y, z, and angle.

Parameters:
readOnly -
x - the x coordinate
y - the y coordinate
z - the z coordinate
angle - the angle.

AxisAngle3f

protected AxisAngle3f(boolean readOnly,
                      float[] values)
Constructs and initializes an AxisAngle3f from the components contained in the array.

Parameters:
readOnly -
values - the array of length 4 containing x,y,z,angle in order

AxisAngle3f

protected AxisAngle3f(boolean readOnly,
                      AxisAngle3f aa3f)
Constructs and initializes a AxisAngle3f from the specified AxisAngle3f.

Parameters:
readOnly -
aa3f - the AxisAngle3f containing the initialization x y z angle data

AxisAngle3f

protected AxisAngle3f(boolean readOnly,
                      Tuple3f axis,
                      float angle)
Constructs and initializes an AxisAngle3f from the specified axis and angle.

Parameters:
readOnly -
axis - the axis
angle - the angle

AxisAngle3f

protected AxisAngle3f(boolean readOnly)
Constructs and initializes a AxisAngle3f to (0,0,1,0).

Parameters:
readOnly -

AxisAngle3f

public AxisAngle3f(float x,
                   float y,
                   float z,
                   float angle)
Constructs and initializes an AxisAngle3f from the specified x, y, z, and angle.

Parameters:
x - the x coordinate
y - the y coordinate
z - the z coordinate
angle - the angle.

AxisAngle3f

public AxisAngle3f(float[] values)
Constructs and initializes an AxisAngle3f from the components contained in the array.

Parameters:
values - the array of length 4 containing x,y,z,angle in order

AxisAngle3f

public AxisAngle3f(AxisAngle3f aa3f)
Constructs and initializes a AxisAngle3f from the specified AxisAngle3f.

Parameters:
aa3f - the AxisAngle3f containing the initialization x y z angle data

AxisAngle3f

public AxisAngle3f(Tuple3f axis,
                   float angle)
Constructs and initializes an AxisAngle3f from the specified axis and angle.

Parameters:
axis - the axis
angle - the angle

AxisAngle3f

public AxisAngle3f()
Constructs and initializes a AxisAngle3f to (0,0,1,0).

Method Detail

setAngle

public final void setAngle(float angle)
Sets the value of the angle of this tuple.

Parameters:
angle -

getAngle

public final float getAngle()
Returns:
the value of the angle of this tuple.

set

public final void set(Tuple3f axis,
                      float angle)
Sets the value of this AxisAngle3f to the specified axis and angle.

Parameters:
axis - the axis
angle - the angle

set

public final void set(float x,
                      float y,
                      float z,
                      float angle)
Sets the value of this axis angle to the specified x,y,z,angle.

Parameters:
x - the x coordinate
y - the y coordinate
z - the z coordinate
angle - the angle

set

public final AxisAngle3f set(float[] values)
Sets the value of this axis angle from the 4 values specified in the array.

Specified by:
set in interface TupleInterface<Tuple3f>
Overrides:
set in class TupleNf<Tuple3f>
Parameters:
values - the array of length 4 containing x,y,z,angle in order
Returns:
itself

set

public final void set(AxisAngle3f aa3f)
Sets the value of this axis angle to the value of axis angle t1.

Parameters:
aa3f - the axis angle to be copied

get

public final void get(float[] buffer)
Gets the value of this axis angle into the array a of length four in x,y,z,angle order.

Specified by:
get in interface TupleInterface<Tuple3f>
Overrides:
get in class TupleNf<Tuple3f>
Parameters:
buffer - the array of length four

set

public final void set(Matrix4f mat)
Sets the value of this axis-angle to the rotational component of the passed matrix.

Parameters:
mat - the matrix4f

set

public final void set(Matrix3f mat)
Sets the value of this axis-angle to the rotational component of the passed matrix.

Parameters:
mat - the matrix3f

set

public final void set(Quaternion4f quat)
Sets the value of this axis-angle to the rotational equivalent of the passed quaternion.

Parameters:
quat - the Quat4f

addAngle

public final AxisAngle3f addAngle(float v)
Adds v to this tuple's angle value.

Parameters:
v -
Returns:
itself

subAngle

public final AxisAngle3f subAngle(float v)
Subtracts v from this tuple's angle value.

Parameters:
v -
Returns:
itself

mulAngle

public final AxisAngle3f mulAngle(float v)
Multiplies this tuple's angle value with v.

Parameters:
v -
Returns:
itself

divAngle

public final AxisAngle3f divAngle(float v)
Divides this tuple's angle value by v.

Parameters:
v -
Returns:
itself

toString

public java.lang.String toString()
Returns a string that contains the values of this AxisAngle3f. The form is (x,y,z,angle).

Overrides:
toString in class TupleNf<Tuple3f>
Returns:
the String representation

hashCode

public int hashCode()
Returns a hash number based on the data values in this object. Two different AxisAngle3f objects with identical data values (ie, returns true for equals(AxisAngle3f) ) will return the same hash number. Two vectors with different data members may return the same hash value, although this is not likely.

Overrides:
hashCode in class TupleNf<Tuple3f>
Returns:
the integer hash value

equals

public boolean equals(AxisAngle3f aa3f)
Returns true if all of the data members of AxisAngle3f t1 are equal to the corresponding data members in this.

Parameters:
aa3f - the AxisAngle with which the comparison is made

equals

public boolean equals(java.lang.Object o)
Returns true if the Object o1 is of type AxisAngle3f and all of the data members of o1 are equal to the corresponding data members in this AxisAngle3f.

Overrides:
equals in class Tuple3f
Parameters:
o - the object with which the comparison is made.
Returns:
true or false

epsilonEquals

public boolean epsilonEquals(AxisAngle3f aa3f,
                             float epsilon)
Returns true if the L-infinite distance between this axis-angle and axis-angle t1 is less than or equal to the epsilon parameter, otherwise returns false. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2), abs(angle1-angle2)].

Parameters:
aa3f - the axis-angle to be compared to this axis-angle
epsilon - the threshold value

clone

public AxisAngle3f clone()
Creates and returns a copy of this object.

Overrides:
clone in class Tuple3f
Returns:
a clone of this instance.
See Also:
Cloneable

serialize

public int serialize(int pos,
                     byte[] buffer)
Serializes this instanc'es data into the byte array.

Overrides:
serialize in class TupleNf<Tuple3f>
Returns:
the incremented position

deserialize

public int deserialize(int pos,
                       byte[] buffer)
Deserializes this instanc'es data from the byte array.

Overrides:
deserialize in class TupleNf<Tuple3f>
Returns:
the incremented position

getSerializationBufferSize

protected int getSerializationBufferSize()

Overrides:
getSerializationBufferSize in class TupleNf<Tuple3f>
Returns:
the necessary size for a serialization byte array.

newReadOnly

public static AxisAngle3f newReadOnly(float x,
                                      float y,
                                      float z,
                                      float angle)
Constructs and initializes an AxisAngle3f from the specified x, y, z, and angle.

Parameters:
x - the x coordinate
y - the y coordinate
z - the z coordinate
angle - the angle.

newReadOnly

public static AxisAngle3f newReadOnly(float[] values)
Constructs and initializes an AxisAngle3f from the components contained in the array.

Parameters:
values - the array of length 4 containing x,y,z,angle in order

newReadOnly

public static AxisAngle3f newReadOnly(AxisAngle3f aa3f)
Constructs and initializes a AxisAngle3f from the specified AxisAngle3f.

Parameters:
aa3f - the AxisAngle3f containing the initialization x y z angle data

newReadOnly

public static AxisAngle3f newReadOnly(Tuple3f axis,
                                      float angle)
Constructs and initializes an AxisAngle3f from the specified axis and angle.

Parameters:
axis - the axis
angle - the angle

newReadOnly

public static AxisAngle3f newReadOnly()
Constructs and initializes a AxisAngle3f to (0,0,1,0).


fromPool

public static AxisAngle3f fromPool()
Allocates an AxisAngle3f instance from the pool.


fromPool

public static AxisAngle3f fromPool(float x,
                                   float y,
                                   float z,
                                   float angle)
Allocates an AxisAngle3f instance from the pool.


fromPool

public static AxisAngle3f fromPool(AxisAngle3f aa)
Allocates an AxisAngle3f instance from the pool.


toPool

public static void toPool(AxisAngle3f o)
Stores the given AxisAngle3f instance in the pool.

Parameters:
o -