hmi.animation
Class VJoint

java.lang.Object
  extended by hmi.xml.XMLStructureAdapter
      extended by hmi.animation.VJoint
All Implemented Interfaces:
VObject, XMLStructure, Cloneable

public class VJoint
extends XMLStructureAdapter
implements VObject, Cloneable

VJoint represent virtual joints...


Nested Class Summary
 
Nested classes/interfaces inherited from interface hmi.animation.VObject
VObject.Predicate
 
Field Summary
private  ArrayList<VJoint> children
           
static int DEFAULTCAPACITY
           
private  float[] globalMatrix
           
private  boolean hasSharedBuffers
           
private  String id
           
private  float[] localMatrix
           
private static Logger logger
           
private  String name
           
private  VJoint parent
           
(package private)  float[] q2
           
(package private)  float[] qp
           
(package private)  float[] qw
           
private  float[] rotation
           
private  float[] scaleMatrix
           
private  float[] scaleVec
           
private  Mat3f.ScalingType scalingType
           
private  String sid
           
static int TAB
           
private  float[] translation
           
private  boolean validLocalMatrix
           
private static String XMLTAG
           
 
Fields inherited from class hmi.xml.XMLStructureAdapter
ATTRIBUTE_TOKEN_DELIMITERS, COMMA_SEPARATOR, DECODEDARRAYSIZE, DEFAULT_RECOVER_MODE, NEWLINE, SYSTEMNEWLINE, TAB_STRING
 
Constructor Summary
VJoint()
          Creates a new VJoint, with null name and default capacity.
VJoint(String id)
          Creates a new VJoint, with specified id and default capacity.
VJoint(String id, int capacity)
          Creates a new VJoint, with specified id and specified capacity.
VJoint(XMLTokenizer tokenizer)
          Creates a new VJoint from XML
 
Method Summary
 void addChild(VJoint newChild)
          Adds a a child part to this VJoint.
 void affineTransform(float[] ma)
          ma: 4x4 affine matrix of form T(tA) o U replace local transform L by ma o L o ma-inv replace translation t by U(t)
 StringBuilder appendAttributes(StringBuilder buf)
          appends the id, sid, name XML attributes to buf.
 StringBuilder appendContent(StringBuilder buf, XMLFormatting fmt)
          Appends a String to buf that encodes the contents for the XML encoding.
 void calculateMatrices()
          Equivalent to calculateMatrices(Matf4.ID)
 void calculateMatrices(float[] parentGlobalMatrix)
          Performs a recursive tree walk over the scene graph with this VJoint as root, calculating the global and local matrices for all visited VObjects, automaticly setting all local matrices The calculation per VJoint is: globalMatrix' = parent.globalMatrix * localMatrix.
 void clearLocalAffineTransform()
          Sets the local affine transform to identity.
 void clearLocalLinearTransform()
          Sets the local linear transform to identity.
 void clearRotation()
           
 void clearScale()
           
 void clearTranslation()
           
 VJoint clone()
          Clones the VJoint, creates a new VJoint with the id, sid, name, translation and rotation Use @see{cloneTree} to recursively clone the VJoint and all its children
 VJoint cloneTree()
          Clones a VJoint tree, copies the id, sid, name, translation and rotation of the clone, and generates clones for all the children of this VJoint
 void decodeAttributes(HashMap<String,String> attrMap, XMLTokenizer tokenizer)
          decodes the id and sid XML attributes.
 void decodeContent(XMLTokenizer tokenizer)
          decodes the XML contents, i.e. the XML between the STag and ETag of the encoding.
private  void decomposeLocalMatrix()
           
 boolean equivId(VJoint vj)
          returns true iff VJoint vj has the same non-null Id or the same non-null sid.
 boolean equivName(VJoint vj)
          returns true iff VJoint vj has the same non-null Id or the same non-null sid or the same non-null name.
 void getAngularVelocity(float[] v)
          Returns the current velocity vector in the form of a float array of length 3
 void getAngularVelocity(float[] vc, int vcIndex)
          Returns the current velocity vector in the form of a float array of length 3
 List<VJoint> getChildren()
          Returns the List of child VJoints
 float[] getGlobalMatrix()
          Returns a reference to the global transform matrix.
 boolean getHasSharedBuffers()
           
 String getId()
          Returns an interned String that specifies the id.
 String getIds()
           
 float[] getLocalMatrix()
          Returns (a reference to) the current local 4X4 transform matrix.
 String getName()
          Returns an interned String that specifies the name.
 VJoint getParent()
          Returns the parent of this VJoint; possibly null
 VJoint getPart(String partIdent)
          Returns the result of a depth first search for some part identified by either id, sid, or name.
 VJoint getPartById(String partId)
          Returns the result of a depth first search for some part identified by either id.
 VJoint getPartBySid(String partSid)
          Returns the result of a breadth first search for some part identified by sid.
 List<VJoint> getParts()
           
 List<VJoint> getParts(VObject.Predicate select)
           
 List<VJoint> getParts(VObject.Predicate select, VObject.Predicate prune)
           
 List<VJoint> getParts(VObject.Predicate select, VObject.Predicate prune, ArrayList<VJoint> list)
           
 List<VJoint> getPath(VJoint target)
          Gets the VJoint path from target to this joint, including target and this joint
private  boolean getPath(VJoint target, List<VJoint> path)
           
 void getPathRotation(VJoint rootJoint, float[] quat)
          Calculates the "path" rotation, for the scene graph path starting at the specified root VJoint, and ending in this VJoint.
 void getPathTransformMatrix(VJoint rootObject, float[] m)
          Calculates the transform matrix for the scene graph path starting at the specified root VJoint, and ending in this VJoint.
 void getPathTranslation(VJoint rootJoint, float[] vec)
          Calculates the "path" translation, for the scene graph path starting at the specified root VJoint, and ending in this VJoint.
 float[] getPosition()
          returns the Vec3f position of this VJoint.
 float[] getPosition(float[] positionVec)
          returns the Vec3f position of this VJoint When the specified positionVec is non-null, this Vec3f is used and returned, otherwise a new Vec3f is allocated.
 float[] getRelativePositionFrom(VJoint ancestorJoint)
          returns a Vec3f array with the position of this VJoint relative to the specified ancestor joint.
 void getRotation(float[] r)
          Returns the current rotation quaternion in a float array of length four.
 void getRotation(float[] r, int index)
          Returns the current rotation quaternion in a float array of length four.
 float[] getRotationBuffer()
          Returns the current rotation buffer, in the form of a float array of length four.
 void getScale(float[] r)
          Returns the current scale vector in a float array of length three.
 void getScale(float[] r, int index)
          Returns the current scale vector.
 Mat3f.ScalingType getScalingType()
          Return the scaling type: IDENTITY (i.e. no scaling), ALIGNED (i.e. vector scaling), or SKEW (matrix scaling).
 String getSid()
          Returns an interned String that specifies the sid.
 float[] getSkewMatrix()
          Returns the current skewing matrix, in the form of a Mat3f array.
 void getTranslation(float[] t)
          Returns the current translation vector in the form of a float array of length 3
 void getTranslation(float[] vc, int vcIndex)
          Returns the current translation vector in the form of a float array of length 3
 float[] getTranslationBuffer()
          Returns the current translation buffer, in the form of a float array of length three.
 void getVelocity(float[] v)
          Unsupported VObject methods: /** Returns the current velocity vector in the form of a float array of length 3
 void getVelocity(float[] vc, int vcIndex)
          Returns the current velocity vector in the form of a float array of length 3
 List<VJoint> getVObjectPath(VJoint root)
          Returns the path from the specified root node to this VJoint in the form of a List of VObjects.
private  List<VJoint> getVObjectPath(VJoint root, List<VJoint> path)
           
 String getXMLTag()
          returns the XML tag for XML encoding
 String globalMatrixToString()
           
 boolean hasRotation()
           
 boolean hasScaling()
           
 boolean hasTranslation()
           
private  String idts(String s)
           
 boolean isRigid()
          Returns true when the local transform is a rigid transform, i.e. includes no scaling
 String localMatrixToString()
           
 VJoint masterClone()
          Make a master clone.
 VJoint masterCloneTree()
          master-Clones a VJoint tree, copies the id, sid, name, translation and rotation of the clone, and generates master clones for all the children of this VJoint
private  void newLine(StringBuilder buf, int tab)
           
 void pathTransform(VJoint rootJoint, float[] pt)
          Calculates the "path" transform on point "pt", where all local transforms along a scene graph path are applied.
 void removeChild(VJoint vo)
          Removes child part, if present.
 void rotate(float[] rq)
          pre- multiplies the current rotation with the specified rotation.
 void rotateAxisAngle(float ax, float ay, float az, float angle)
          pre- multiplies the current rotation with the specified rotation, specified by axis (ax, ay, az) and an angle in radians.
 void rotateJoint(float[] rq)
          Rotates the scenegraph, starting at this VJoint, around the origin.
 void rotateScaleJoint(float[] rq, float scale)
          Rotates the scenegraph, starting at this VJoint, around the origin.
 void scale(float s)
           
 void scale(float sx, float sy, float sz)
           
private  VJoint searchPart(String searchId)
           
private  VJoint searchPartById(String searchId)
           
private  VJoint searchPartBySid(String searchSid)
           
 void setAngularVelocity(float[] v)
          Sets the current velocity vector from a float array, which should have length 3.
 void setAngularVelocity(float[] vc, int vcIndex)
          Sets the current velocity vector by copying three floats from float array va, starting at the specified index.
 void setAngularVelocity(float wx, float wy, float wz)
          Sets the current angular velocity vector from three floats.
 void setAxisAngle(float ax, float ay, float az, float angle)
          Sets the current rotation quaternion derived from a rotation axis (ax, ay, az) and a rotation angle angle, specified in radians.
 void setId(String id)
          Sets the id for this VJoint.
 void setLocalMatrix(float[] matrix4f)
          Sets the rotation quaternion, translation vector, scaling, as well as the local transform matrix, from the specified 4 X 4 matrix, in the form of a Mat4f float array.
 void setLocalTransform(float[] matrix)
          Sets the local 4X4 transform matrix, and decomposes it into a rotation, translation, and scaling.
 void setName(String name)
          Sets the name for this VJoint.
 void setParent(VJoint parent)
          Sets the parent of this VJoint, which could be null.
 void setPathRotation(float[] q, VJoint rootJoint)
          Sets the rotation to q, in the coordinate system of rootJoint
 void setRollPitchYawDegrees(float roll, float pitch, float yaw)
          Sets the rotation from roll-pitch-yaw angles, specified in degrees(!)
 void setRotation(float[] ra)
          Sets the current rotation quaternion from a float array, which should have length 4.
 void setRotation(float[] ra, int raIndex)
          Sets the current rotation quaternion by copying four floats from float array ra, starting at the specified index.
 void setRotation(float qs, float qx, float qy, float qz)
          Sets the current rotation quaternion from four floats.
 void setRotationBuffer(float[] rot)
          Sets the rotation buffer.
 void setScale(float s)
          Sets the current scale vector from a float array sa, which should have length 3.
 void setScale(float[] sa)
          Sets the current scale vector from a float array sa, which should have length 3.
 void setScale(float[] sa, int saIndex)
          Sets the current scale vector by copying three floats from float array sa, starting at the specified index.
 void setScale(float sx, float sy, float sz)
          Sets the current scale vector from a float array sa, which should have length 3.
 void setSid(String sid)
          Sets the sid for this VJoint.
 void setSkewMatrix(float[] matrix)
          Sets the skewing matrix, in the form of a Mat3f matrix.
 void setTranslation(float[] ta)
          Sets the current translation vector from a float array, which should have length 3.
 void setTranslation(float[] ta, int taIndex)
          Sets the current translation vector by copying three floats from float array ta, starting at the specified index.
 void setTranslation(float tx, float ty, float tz)
          Sets the current translation vector from three floats.
 void setTranslationBuffer(float[] ta)
          Sets the translation buffer.
 void setVelocity(float[] v)
          Sets the current velocity vector from a float array, which should have length 3.
 void setVelocity(float[] vc, int vcIndex)
          Sets the current velocity vector by copying three floats from float array va, starting at the specified index.
 void setVelocity(float vx, float vy, float vz)
          Sets the current velocity vector from three floats.
 String showSkeleton()
           
 String showSkeleton(int level)
           
private  void showSkeleton(int tab, int level, StringBuilder buf)
           
 VJoint slaveClone()
          make a slave clone. a slave clone is one that, just before executing calculatematrices, grabs translation and rotation from the original vjoint from which it was cloned.
 VJoint slaveCloneTree()
          Slave-Clones a VJoint tree, copies the id, sid, name, translation and rotation of the clone, and generates slave clones for all the children of this VJoint
 String toString()
          the default toString() method returns the result of toXMLSTring()
 void translate(float[] tvec)
          Adds the specified translation vector to the current translation
static String xmlTag()
          The XML tag for XML encoding
 
Methods inherited from class hmi.xml.XMLStructureAdapter
appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttribute, appendAttributes, appendAttributeString, appendAttributeString, appendBooleans, appendCloseEmptyTag, appendCloseSTag, appendComment, appendContent, appendDoubleElement, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendEmptyTag, appendETag, appendETag, appendFloatArrayElement, appendFloatElement, appendFloats, appendIntArrayElement, appendIntElement, appendInts, appendLongElement, appendNewLine, appendNewLine, appendNewLine, appendOpenSTag, appendOptionalDoubleElement, appendOptionalFloatElement, appendOptionalIntElement, appendOptionalLongElement, appendSpaces, appendSpaces, appendSTag, appendSTag, appendSTag, appendStringArrayElement, appendStrings, appendSystemNewLine, appendTab, appendTextElement, appendXML, appendXML, appendXML, appendXML, appendXML, appendXMLStructure, appendXMLStructureList, appendXMLTextElementList, countTokens, countTokens, decodeAttribute, decodeAttribute, decodeBoolean, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeBooleanArray, decodeDouble, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeDoubleArray, decodeFloat, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeFloatArray, decodeInt, decodeIntArray, decodeIntArray, decodeIntArray, decodeIntArray, decodeLong, decodeStringArray, decodeStringArray, decodeStringArray, decodeStringArray, decodeXMLStructureList, decodeXMLValueElement, getNamespace, getOptionalAttribute, getOptionalAttribute, getOptionalBooleanAttribute, getOptionalDoubleAttribute, getOptionalFloatAttribute, getOptionalIntAttribute, getOptionalLongAttribute, getRequiredAttribute, getRequiredBooleanAttribute, getRequiredDoubleAttribute, getRequiredFloatAttribute, getRequiredIntAttribute, getRequiredLongAttribute, getTagLine, hasContent, parseXMLElement, postProcess, preProcess, readXML, readXML, readXML, setConsoleAttributeEnabled, setDefaultRecoverMode, setRecoverMode, spaces, toXMLString, toXMLString, toXMLString, toXMLString, toXMLString, toXMLString, writeXML, writeXML, writeXML, writeXML
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static Logger logger

id

private String id

sid

private String sid

name

private String name

parent

private VJoint parent

children

private ArrayList<VJoint> children

DEFAULTCAPACITY

public static final int DEFAULTCAPACITY
See Also:
Constant Field Values

translation

private float[] translation

rotation

private float[] rotation

scalingType

private Mat3f.ScalingType scalingType

scaleVec

private float[] scaleVec

scaleMatrix

private float[] scaleMatrix

localMatrix

private final float[] localMatrix

globalMatrix

private final float[] globalMatrix

validLocalMatrix

private boolean validLocalMatrix

hasSharedBuffers

private boolean hasSharedBuffers

qw

float[] qw

qp

float[] qp

q2

float[] q2

TAB

public static final int TAB
See Also:
Constant Field Values

XMLTAG

private static final String XMLTAG
See Also:
Constant Field Values
Constructor Detail

VJoint

public VJoint()
Creates a new VJoint, with null name and default capacity.


VJoint

public VJoint(String id)
Creates a new VJoint, with specified id and default capacity.


VJoint

public VJoint(String id,
              int capacity)
Creates a new VJoint, with specified id and specified capacity. The latter specifies the initial capacity of the children List.


VJoint

public VJoint(XMLTokenizer tokenizer)
       throws IOException
Creates a new VJoint from XML

Throws:
IOException
Method Detail

setId

public void setId(String id)
Sets the id for this VJoint.

Specified by:
setId in interface VObject

setSid

public void setSid(String sid)
Sets the sid for this VJoint.

Specified by:
setSid in interface VObject

setName

public void setName(String name)
Sets the name for this VJoint.

Specified by:
setName in interface VObject

getId

public String getId()
Returns an interned String that specifies the id.

Specified by:
getId in interface VObject

getSid

public String getSid()
Returns an interned String that specifies the sid.

Specified by:
getSid in interface VObject

getName

public String getName()
Returns an interned String that specifies the name.

Specified by:
getName in interface VObject

getIds

public String getIds()

equivId

public boolean equivId(VJoint vj)
returns true iff VJoint vj has the same non-null Id or the same non-null sid. The name is not considered.


equivName

public boolean equivName(VJoint vj)
returns true iff VJoint vj has the same non-null Id or the same non-null sid or the same non-null name.


getScalingType

public Mat3f.ScalingType getScalingType()
Return the scaling type: IDENTITY (i.e. no scaling), ALIGNED (i.e. vector scaling), or SKEW (matrix scaling).


getParent

public VJoint getParent()
Returns the parent of this VJoint; possibly null


setParent

public void setParent(VJoint parent)
Sets the parent of this VJoint, which could be null.


addChild

public void addChild(VJoint newChild)
Adds a a child part to this VJoint.


removeChild

public void removeChild(VJoint vo)
Removes child part, if present.


getChildren

public List<VJoint> getChildren()
Returns the List of child VJoints


getPart

public VJoint getPart(String partIdent)
Returns the result of a depth first search for some part identified by either id, sid, or name.


searchPart

private VJoint searchPart(String searchId)

getPartById

public VJoint getPartById(String partId)
Returns the result of a depth first search for some part identified by either id.


searchPartById

private VJoint searchPartById(String searchId)

getPartBySid

public VJoint getPartBySid(String partSid)
Returns the result of a breadth first search for some part identified by sid.


searchPartBySid

private VJoint searchPartBySid(String searchSid)

getParts

public List<VJoint> getParts()

getParts

public List<VJoint> getParts(VObject.Predicate select)

getParts

public List<VJoint> getParts(VObject.Predicate select,
                             VObject.Predicate prune)

getParts

public List<VJoint> getParts(VObject.Predicate select,
                             VObject.Predicate prune,
                             ArrayList<VJoint> list)

getVObjectPath

private List<VJoint> getVObjectPath(VJoint root,
                                    List<VJoint> path)

clone

public VJoint clone()
Clones the VJoint, creates a new VJoint with the id, sid, name, translation and rotation Use @see{cloneTree} to recursively clone the VJoint and all its children

Overrides:
clone in class Object

cloneTree

public VJoint cloneTree()
Clones a VJoint tree, copies the id, sid, name, translation and rotation of the clone, and generates clones for all the children of this VJoint

Returns:
the clone

masterClone

public VJoint masterClone()
Make a master clone. A master clone is one that controls the rotation and translation of the original vjoint from which it was cloned. Use @see{masterCloneTree} to recursively clone the VJoint and all its children


masterCloneTree

public VJoint masterCloneTree()
master-Clones a VJoint tree, copies the id, sid, name, translation and rotation of the clone, and generates master clones for all the children of this VJoint

Returns:
the clone

slaveClone

public VJoint slaveClone()
make a slave clone. a slave clone is one that, just before executing calculatematrices, grabs translation and rotation from the original vjoint from which it was cloned. Use @see{slaveCloneTree} to recursively clone the VJoint and all its children


slaveCloneTree

public VJoint slaveCloneTree()
Slave-Clones a VJoint tree, copies the id, sid, name, translation and rotation of the clone, and generates slave clones for all the children of this VJoint

Returns:
the clone

getVObjectPath

public List<VJoint> getVObjectPath(VJoint root)
Returns the path from the specified root node to this VJoint in the form of a List of VObjects. If the root is null, or if the specified root node is not an ancestor of this VJoint, the path starts at the root of the scenegraph.


getTranslation

public void getTranslation(float[] t)
Returns the current translation vector in the form of a float array of length 3

Specified by:
getTranslation in interface VObject

getTranslation

public void getTranslation(float[] vc,
                           int vcIndex)
Returns the current translation vector in the form of a float array of length 3

Specified by:
getTranslation in interface VObject

getTranslationBuffer

public float[] getTranslationBuffer()
Returns the current translation buffer, in the form of a float array of length three. The buffer contains a translation vector, used to calculate the transformation matrix for this VJoint.


setTranslationBuffer

public void setTranslationBuffer(float[] ta)
Sets the translation buffer. Should be taken from another VJoint.translation


setTranslation

public void setTranslation(float[] ta)
Sets the current translation vector from a float array, which should have length 3.

Specified by:
setTranslation in interface VObject

setTranslation

public void setTranslation(float[] ta,
                           int taIndex)
Sets the current translation vector by copying three floats from float array ta, starting at the specified index.

Specified by:
setTranslation in interface VObject

setTranslation

public void setTranslation(float tx,
                           float ty,
                           float tz)
Sets the current translation vector from three floats.

Specified by:
setTranslation in interface VObject

clearTranslation

public void clearTranslation()

translate

public void translate(float[] tvec)
Adds the specified translation vector to the current translation


hasTranslation

public boolean hasTranslation()

setRotation

public void setRotation(float[] ra)
Sets the current rotation quaternion from a float array, which should have length 4. The order is (s, x, y, z), where s is the real part, x, y, z are the imaginary parts.

Specified by:
setRotation in interface VObject

setPathRotation

public void setPathRotation(float[] q,
                            VJoint rootJoint)
Sets the rotation to q, in the coordinate system of rootJoint


setRotation

public void setRotation(float[] ra,
                        int raIndex)
Sets the current rotation quaternion by copying four floats from float array ra, starting at the specified index.

Specified by:
setRotation in interface VObject

getRotation

public void getRotation(float[] r)
Returns the current rotation quaternion in a float array of length four. The order is (s, x, y, z), where s is the scalar part, x, y, z are the imaginary parts.

Specified by:
getRotation in interface VObject

getRotation

public void getRotation(float[] r,
                        int index)
Returns the current rotation quaternion in a float array of length four. The order is (s, x, y, z), where s is the scalar part, x, y, z are the imaginary parts.

Specified by:
getRotation in interface VObject

getRotationBuffer

public float[] getRotationBuffer()
Returns the current rotation buffer, in the form of a float array of length four. The buffer contains a rotation quaternion, used to calculate the rotation matrix for this VJoint. The order of the quaternion elements is (s, x, y, z), where s is the scalar part, and x, y, z are the imaginary parts.


setRotationBuffer

public void setRotationBuffer(float[] rot)
Sets the rotation buffer. Should be taken from another VJoint.rotation


setRotation

public void setRotation(float qs,
                        float qx,
                        float qy,
                        float qz)
Sets the current rotation quaternion from four floats. qs is the real part, qx, qy, qz the imaginary parts.

Specified by:
setRotation in interface VObject

clearRotation

public void clearRotation()

setAxisAngle

public void setAxisAngle(float ax,
                         float ay,
                         float az,
                         float angle)
Sets the current rotation quaternion derived from a rotation axis (ax, ay, az) and a rotation angle angle, specified in radians. The axis need not have length one. If all parameters are zero, the rotation is set to the identity quaternion (1,0,0,0).

Specified by:
setAxisAngle in interface VObject

setRollPitchYawDegrees

public void setRollPitchYawDegrees(float roll,
                                   float pitch,
                                   float yaw)
Sets the rotation from roll-pitch-yaw angles, specified in degrees(!)


rotate

public void rotate(float[] rq)
pre- multiplies the current rotation with the specified rotation.


rotateAxisAngle

public void rotateAxisAngle(float ax,
                            float ay,
                            float az,
                            float angle)
pre- multiplies the current rotation with the specified rotation, specified by axis (ax, ay, az) and an angle in radians.


hasRotation

public boolean hasRotation()

rotateJoint

public void rotateJoint(float[] rq)
Rotates the scenegraph, starting at this VJoint, around the origin. (N.B> the nornmale rotate/setRotation methods use the joint center as the center of rotation. This method rotates around the origin. So, it is NOT just the joint rotation that is affected, but also the translation vector. The net effect is that the translation vector is rotated with the specified rotation, and that the existing rotation is premultiplied with the specified rotation.


rotateScaleJoint

public void rotateScaleJoint(float[] rq,
                             float scale)
Rotates the scenegraph, starting at this VJoint, around the origin. (N.B> the nornmale rotate/setRotation methods use the joint center as the center of rotation. This method rotates around the origin. So, it is NOT just the joint rotation that is affected, but also the translation vector. The net effect is that the translation vector is rotated with the specified rotation, and that the existing rotation is premultiplied with the specified rotation.


affineTransform

public void affineTransform(float[] ma)
ma: 4x4 affine matrix of form T(tA) o U replace local transform L by ma o L o ma-inv replace translation t by U(t)


isRigid

public boolean isRigid()
Returns true when the local transform is a rigid transform, i.e. includes no scaling


setScale

public void setScale(float s)
Sets the current scale vector from a float array sa, which should have length 3. If it is null, or if all three scale factors are 1.0, then the local scale is set to null, and no scaling is applied.


setScale

public void setScale(float sx,
                     float sy,
                     float sz)
Sets the current scale vector from a float array sa, which should have length 3. If it is null, or if all three scale factors are 1.0, then the local scale is set to null, and no scaling is applied.


scale

public void scale(float sx,
                  float sy,
                  float sz)

scale

public void scale(float s)

clearScale

public void clearScale()

setScale

public void setScale(float[] sa)
Sets the current scale vector from a float array sa, which should have length 3. If it is null, or if all three scale factors are 1.0, then the local scale is set to null, and no scaling is applied.

Specified by:
setScale in interface VObject

setScale

public void setScale(float[] sa,
                     int saIndex)
Sets the current scale vector by copying three floats from float array sa, starting at the specified index.

Specified by:
setScale in interface VObject

getScale

public void getScale(float[] r)
Returns the current scale vector in a float array of length three.

Specified by:
getScale in interface VObject

getScale

public void getScale(float[] r,
                     int index)
Returns the current scale vector.

Specified by:
getScale in interface VObject

setSkewMatrix

public void setSkewMatrix(float[] matrix)
Sets the skewing matrix, in the form of a Mat3f matrix.


getSkewMatrix

public float[] getSkewMatrix()
Returns the current skewing matrix, in the form of a Mat3f array.


hasScaling

public boolean hasScaling()

getLocalMatrix

public final float[] getLocalMatrix()
Returns (a reference to) the current local 4X4 transform matrix. When necessary, this will (re)calculate the local matrix from the current rotation quaternion, translation, and scaling. M = T o R o S Direct modification of the local matrix via this reference should not occur.


setLocalTransform

public void setLocalTransform(float[] matrix)
Sets the local 4X4 transform matrix, and decomposes it into a rotation, translation, and scaling. Note: this is NOT the preferred way for setting the transform: it is slow, due to the polar decomposition, needed to extract the rotation and scaling. The preferred way is to set rotation, translation, and scaling direcly, by means of methods like setRotation(), setTranslation(), and setScale().


decomposeLocalMatrix

private void decomposeLocalMatrix()

clearLocalAffineTransform

public void clearLocalAffineTransform()
Sets the local affine transform to identity. That is, no rotation, no scaling, no translation remains


clearLocalLinearTransform

public void clearLocalLinearTransform()
Sets the local linear transform to identity. That is, no rotation, no scaling remains, but the translation part is not affected.


setLocalMatrix

public final void setLocalMatrix(float[] matrix4f)
Sets the rotation quaternion, translation vector, scaling, as well as the local transform matrix, from the specified 4 X 4 matrix, in the form of a Mat4f float array. (I.e. a 4 X 4 matrix, stored in a float array in row-major order).


getGlobalMatrix

public final float[] getGlobalMatrix()
Returns a reference to the global transform matrix.


localMatrixToString

public String localMatrixToString()

globalMatrixToString

public String globalMatrixToString()

calculateMatrices

public void calculateMatrices()
Equivalent to calculateMatrices(Matf4.ID)


calculateMatrices

public void calculateMatrices(float[] parentGlobalMatrix)
Performs a recursive tree walk over the scene graph with this VJoint as root, calculating the global and local matrices for all visited VObjects, automaticly setting all local matrices The calculation per VJoint is: globalMatrix' = parent.globalMatrix * localMatrix. For this (root) VJoint, the "parent's" global matrix is specified by means of the parentGlobalMatrix parameter.


getPathTransformMatrix

public void getPathTransformMatrix(VJoint rootObject,
                                   float[] m)
Calculates the transform matrix for the scene graph path starting at the specified root VJoint, and ending in this VJoint. The resulting matrix is stored in m. If rootObject == null, m will be set to the transform matrix for the complete scenegraph path up (but not including) to the world root.


pathTransform

public void pathTransform(VJoint rootJoint,
                          float[] pt)
Calculates the "path" transform on point "pt", where all local transforms along a scene graph path are applied. The specified rootJoint acts as the frame of reference, and local transfomation matrices from descendant from this reference joint up to and including this VJoint are applied to the specified point pt, which should be a vector of length three. Note that the local transform of the root joint is not applied, so, if the root joint is actually the parent of this VJoint, only the local transform is applied. When the root joint happens to be this VJoint itself, pt will not be transformed at all. It is allowed to specify a null rootJoint; in this case all local tranforms, starting AFTER the world root of the scene graph up to and including this VJoint, are applied.


getPath

private boolean getPath(VJoint target,
                        List<VJoint> path)

getPath

public List<VJoint> getPath(VJoint target)
Gets the VJoint path from target to this joint, including target and this joint


getPathRotation

public void getPathRotation(VJoint rootJoint,
                            float[] quat)
Calculates the "path" rotation, for the scene graph path starting at the specified root VJoint, and ending in this VJoint. The resulting quaternion is stored in quat. If rootJoint == null the complete scenegraph path starting at (but not including) the world root will be used.


getPathTranslation

public void getPathTranslation(VJoint rootJoint,
                               float[] vec)
Calculates the "path" translation, for the scene graph path starting at the specified root VJoint, and ending in this VJoint. The resulting vector is stored in vec, which should be a length three float array. If rootJoint == null the complete scenegraph path will be used.


getPosition

public float[] getPosition()
returns the Vec3f position of this VJoint.


getPosition

public float[] getPosition(float[] positionVec)
returns the Vec3f position of this VJoint When the specified positionVec is non-null, this Vec3f is used and returned, otherwise a new Vec3f is allocated.


getRelativePositionFrom

public float[] getRelativePositionFrom(VJoint ancestorJoint)
returns a Vec3f array with the position of this VJoint relative to the specified ancestor joint.


getVelocity

public void getVelocity(float[] v)
Unsupported VObject methods: /** Returns the current velocity vector in the form of a float array of length 3

Specified by:
getVelocity in interface VObject

getVelocity

public void getVelocity(float[] vc,
                        int vcIndex)
Returns the current velocity vector in the form of a float array of length 3

Specified by:
getVelocity in interface VObject

setVelocity

public void setVelocity(float[] v)
Sets the current velocity vector from a float array, which should have length 3.

Specified by:
setVelocity in interface VObject

setVelocity

public void setVelocity(float[] vc,
                        int vcIndex)
Sets the current velocity vector by copying three floats from float array va, starting at the specified index.

Specified by:
setVelocity in interface VObject

setVelocity

public void setVelocity(float vx,
                        float vy,
                        float vz)
Sets the current velocity vector from three floats.

Specified by:
setVelocity in interface VObject

getAngularVelocity

public void getAngularVelocity(float[] v)
Returns the current velocity vector in the form of a float array of length 3

Specified by:
getAngularVelocity in interface VObject

getAngularVelocity

public void getAngularVelocity(float[] vc,
                               int vcIndex)
Returns the current velocity vector in the form of a float array of length 3

Specified by:
getAngularVelocity in interface VObject

setAngularVelocity

public void setAngularVelocity(float[] v)
Sets the current velocity vector from a float array, which should have length 3.

Specified by:
setAngularVelocity in interface VObject

setAngularVelocity

public void setAngularVelocity(float[] vc,
                               int vcIndex)
Sets the current velocity vector by copying three floats from float array va, starting at the specified index.

Specified by:
setAngularVelocity in interface VObject

setAngularVelocity

public void setAngularVelocity(float wx,
                               float wy,
                               float wz)
Sets the current angular velocity vector from three floats.

Specified by:
setAngularVelocity in interface VObject

idts

private final String idts(String s)

newLine

private final void newLine(StringBuilder buf,
                           int tab)

toString

public String toString()
Description copied from class: XMLStructureAdapter
the default toString() method returns the result of toXMLSTring()

Overrides:
toString in class XMLStructureAdapter

showSkeleton

public String showSkeleton()

showSkeleton

public String showSkeleton(int level)

showSkeleton

private void showSkeleton(int tab,
                          int level,
                          StringBuilder buf)

getHasSharedBuffers

public boolean getHasSharedBuffers()

appendAttributes

public StringBuilder appendAttributes(StringBuilder buf)
appends the id, sid, name XML attributes to buf.

Overrides:
appendAttributes in class XMLStructureAdapter

decodeAttributes

public void decodeAttributes(HashMap<String,String> attrMap,
                             XMLTokenizer tokenizer)
decodes the id and sid XML attributes.

Overrides:
decodeAttributes in class XMLStructureAdapter

appendContent

public StringBuilder appendContent(StringBuilder buf,
                                   XMLFormatting fmt)
Description copied from class: XMLStructureAdapter
Appends a String to buf that encodes the contents for the XML encoding. MUST BE OVERWRITTEN BY IMPLEMENTATIONS. (The default implementation appends nothing). The encoding should start on a new line, using indentation equal to tab. There should be no newline after the encoding.

Overrides:
appendContent in class XMLStructureAdapter

decodeContent

public void decodeContent(XMLTokenizer tokenizer)
                   throws IOException
Description copied from class: XMLStructureAdapter
decodes the XML contents, i.e. the XML between the STag and ETag of the encoding. MUST BE OVERWRITTEN BY IMPLEMENTATIONS.

Overrides:
decodeContent in class XMLStructureAdapter
Throws:
IOException

xmlTag

public static String xmlTag()
The XML tag for XML encoding


getXMLTag

public String getXMLTag()
returns the XML tag for XML encoding

Specified by:
getXMLTag in interface XMLStructure
Overrides:
getXMLTag in class XMLStructureAdapter