jarp
Class Bone

java.lang.Object
  extended by jarp.Bone

public class Bone
extends java.lang.Object

A bone in the ARP avatar's skeleton hierarchy.


Field Summary
static double DEGS_TO_RADS
           
static int LLRA_4CC
           
static int LUPA_4CC
           
static double RADS_TO_DEGS
           
static int RLRA_4CC
           
static int RUPA_4CC
           
 
Constructor Summary
Bone()
          Default constructor.
Bone(JAInputStream jins)
          Constructs this Bone from the given stream.
 
Method Summary
 void addChild(Bone cb)
          Adds the given bone to this bone's dynamic children list.
 void assignNewPRData(CASTRSet newpr, float scale)
          Update this bone's PR-Set data (which is relative to its parent).
 void computeGlobalTransforms()
          Computes this bone's (gobal) transformation matrix from its parent's transform and its own current PR-set, and then does the same recursively for its descendants in the hierarchy.
 void computeGlobalTransforms(float rootOffset)
          Throws an exception if this is not the root bone; otherwise, computes this root bone's (gobal) transformation matrix from the given offset and its own current TR-set, and then does the same recursively for its descendants in the hierarchy.
 boolean doesSliding()
          Indicate if this bone does sliding.
 boolean doSelfSliding()
          Returns this bone's self-sliding flag value.
 boolean doSkinSliding()
          Returns this bone's skin-sliding flag value.
 void fixChildren()
          Sets up the child-bones array for this bone (on the assumption that its dynamic children list is now frozen).
 int get4CC()
          Returns this bone's Four-CC name.
 Bone[] getChildBones()
          Returns this bone's child-bones array.
 Vector3f getGlobalPosition()
          Returns the global position vector for this bone.
 void getGlobalPosition(Vector3f result)
          Sets the given result vector to the global position vector for this bone.
 float getLength()
          Returns this bone's length.
 Bone getParent()
          Returns this bone's parent bone.
 int getParent4CC()
          Returns the Four-CC name of this bone's parent.
 java.lang.String getPRString()
          Returns the string describing this bone's current PR-Set.
 float[] getRotation()
          Returns this bone's current (relative) rotation data.
 float[] getRotationInDegrees()
          Returns "Euler" angles (in degrees) for this bone's rotation, derived from its current TR-set (that is, relative rotation).
 void getRotationInX(Quaternion q)
          Sets the given quaternion to represent the "rotation-round-X-axis" factor in this bone's rotation.
 TRTransform getTransform()
          Returns this bone's current (global) transform.
 float[] getTranslation()
          Returns this bone's current (relative) translation data.
 boolean isRoot()
          Determines whether or not this bone is at the root of its hierarchy (by testing whether or not it has a parent).
 void lookAt(float camx, float camy, float camz, float lookatx, float lookaty, float lookatz)
          Adjusts this bone for viewing by camera with given parameters.
 boolean parentDoesSkinSliding()
          Indicate if this bone's parent (if any) does skin-sliding.
 void save(JAOutputStream jouts)
          Saves basic data for this Bone, and recursively for its child-bones to the given output stream.
 void setParent(Bone prnt)
          Sets this bone's parent.
 void setRotation(float[] rot)
          Sets our rotation to be the given one (that is, the reference, not the data, is copied).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RADS_TO_DEGS

public static double RADS_TO_DEGS

DEGS_TO_RADS

public static double DEGS_TO_RADS

LUPA_4CC

public static int LUPA_4CC

RUPA_4CC

public static int RUPA_4CC

LLRA_4CC

public static int LLRA_4CC

RLRA_4CC

public static int RLRA_4CC
Constructor Detail

Bone

public Bone()
Default constructor.


Bone

public Bone(JAInputStream jins)
     throws java.io.IOException
Constructs this Bone from the given stream.

Throws:
java.io.IOException
Method Detail

setParent

public void setParent(Bone prnt)
Sets this bone's parent.


getTransform

public TRTransform getTransform()
Returns this bone's current (global) transform.


getParent

public Bone getParent()
Returns this bone's parent bone.


isRoot

public boolean isRoot()
Determines whether or not this bone is at the root of its hierarchy (by testing whether or not it has a parent).


getRotation

public float[] getRotation()
Returns this bone's current (relative) rotation data.


getTranslation

public float[] getTranslation()
Returns this bone's current (relative) translation data.


getChildBones

public Bone[] getChildBones()
Returns this bone's child-bones array.


get4CC

public int get4CC()
Returns this bone's Four-CC name.


getParent4CC

public int getParent4CC()
Returns the Four-CC name of this bone's parent.


getLength

public float getLength()
Returns this bone's length.


doesSliding

public boolean doesSliding()
Indicate if this bone does sliding.


parentDoesSkinSliding

public boolean parentDoesSkinSliding()
Indicate if this bone's parent (if any) does skin-sliding.


doSelfSliding

public boolean doSelfSliding()
Returns this bone's self-sliding flag value.


doSkinSliding

public boolean doSkinSliding()
Returns this bone's skin-sliding flag value.


getPRString

public java.lang.String getPRString()
Returns the string describing this bone's current PR-Set.


setRotation

public void setRotation(float[] rot)
Sets our rotation to be the given one (that is, the reference, not the data, is copied).


addChild

public void addChild(Bone cb)
Adds the given bone to this bone's dynamic children list.


fixChildren

public void fixChildren()
Sets up the child-bones array for this bone (on the assumption that its dynamic children list is now frozen).


save

public void save(JAOutputStream jouts)
          throws java.io.IOException
Saves basic data for this Bone, and recursively for its child-bones to the given output stream.

Throws:
java.io.IOException

getGlobalPosition

public Vector3f getGlobalPosition()
Returns the global position vector for this bone. NB This assumes that this bone's global transform matrix has already been computed for its current PR-Set.


getGlobalPosition

public void getGlobalPosition(Vector3f result)
Sets the given result vector to the global position vector for this bone. NB This assumes that this bone's global transform matrix has already been computed for its current PR-Set.


assignNewPRData

public void assignNewPRData(CASTRSet newpr,
                            float scale)
Update this bone's PR-Set data (which is relative to its parent).


computeGlobalTransforms

public void computeGlobalTransforms(float rootOffset)
                             throws JAException
Throws an exception if this is not the root bone; otherwise, computes this root bone's (gobal) transformation matrix from the given offset and its own current TR-set, and then does the same recursively for its descendants in the hierarchy.

Throws:
JAException

computeGlobalTransforms

public void computeGlobalTransforms()
Computes this bone's (gobal) transformation matrix from its parent's transform and its own current PR-set, and then does the same recursively for its descendants in the hierarchy.


getRotationInX

public void getRotationInX(Quaternion q)
Sets the given quaternion to represent the "rotation-round-X-axis" factor in this bone's rotation.


getRotationInDegrees

public float[] getRotationInDegrees()
Returns "Euler" angles (in degrees) for this bone's rotation, derived from its current TR-set (that is, relative rotation). [## CURRENTLY UNUSED ##]


lookAt

public void lookAt(float camx,
                   float camy,
                   float camz,
                   float lookatx,
                   float lookaty,
                   float lookatz)
Adjusts this bone for viewing by camera with given parameters.