j3d.org Code

org.j3d.geom.hanim
Class HAnimSegment

java.lang.Object
  extended by org.j3d.geom.hanim.HAnimObject
      extended by org.j3d.geom.hanim.HAnimSegment

public class HAnimSegment
extends HAnimObject

Representation of a H-Anim Segment object.

The segment object is defined by 6.5 Segment. Internationalisation Resource Names

Version:
$Revision: 1.5 $
Author:
Justin Couch

Field Summary
protected  float[] bboxCenter
          The current bboxCenter of the segment
protected  float[] bboxSize
          The current bboxSize of the segment
protected  java.lang.Object[] children
          The current collection of children nodes registered to this object.
protected  int numChildren
          The number of valid children of this object
 
Fields inherited from class org.j3d.geom.hanim.HAnimObject
errorReporter, name
 
Constructor Summary
HAnimSegment()
          Create a new, default instance of the segment.
 
Method Summary
 void addChild(java.lang.Object kid)
          Add a child node to the existing collection.
 void getBboxCenter(float[] val)
          Get the current value of the bboxCenter.
 void getBboxSize(float[] val)
          Get the current value of the bboxSize.
 void getCenterOfMass(float[] val)
          Get the current value of the centerOfMass.
 void getChildren(java.lang.Object[] vals)
          Get the current collection of children.
 void getCoord(float[] val)
          Get the current value of the coord.
 float getMass()
          Get the current value of the mass of the segment.
 void getMomentsOfInertia(float[] val)
          Get the current value of the momentsOfInertia.
 int numChildren()
          Get the number of currently valid children.
 int numCoord()
          Get the number of elements in coord
 int numMomentsOfInertia()
           
 void removeChild(java.lang.Object kid)
          Remove a child node from the existing collection.
 void setBboxCenter(float[] val)
          Set a new value for the bboxCenter of this segment.
 void setBboxSize(float[] val)
          Set a new value for the bboxSize of this segment.
 void setCenterOfMass(float[] val)
          Set a new value for the centerOfMass of this segment.
 void setChildren(java.lang.Object[] kids, int numValid)
          Replace the existing children with the new set of children.
 void setCoord(float[] val, int numElements)
          Set a new value for the coord of this joint.
 void setDisplacers(HAnimDisplacer[] kids, int numValid)
          Replace the existing displacers with the new set of displacers.
 void setMass(float val)
          Set a new value for the mass of this segment.
 void setMomentsOfInertia(float[] val, int numValid)
          Set a new value for the momentsOfInertia of this segment.
 
Methods inherited from class org.j3d.geom.hanim.HAnimObject
getName, setErrorReporter, setName, updateMatrix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bboxCenter

protected float[] bboxCenter
The current bboxCenter of the segment


bboxSize

protected float[] bboxSize
The current bboxSize of the segment


children

protected java.lang.Object[] children
The current collection of children nodes registered to this object.


numChildren

protected int numChildren
The number of valid children of this object

Constructor Detail

HAnimSegment

public HAnimSegment()
Create a new, default instance of the segment.

Method Detail

getMass

public float getMass()
Get the current value of the mass of the segment. A value of -1 indicates that no mass is available.

Returns:
A positive value or -1.

setMass

public void setMass(float val)
Set a new value for the mass of this segment. If no mass value is to be used, then a value of -1 should be set (the default).

Parameters:
val - The new mass value to use

getBboxCenter

public void getBboxCenter(float[] val)
Get the current value of the bboxCenter.

Parameters:
val - An array of at least length 3 to copy the value to

setBboxCenter

public void setBboxCenter(float[] val)
Set a new value for the bboxCenter of this segment. If the array is null or not long enough an exception is generated. The array must be at least 3 units long, and the bboxCenter is taken from the 1st three values.

Parameters:
val - The new bboxCenter value to use
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

getBboxSize

public void getBboxSize(float[] val)
Get the current value of the bboxSize.

Parameters:
val - An array of at least length 3 to copy the value to

setBboxSize

public void setBboxSize(float[] val)
Set a new value for the bboxSize of this segment. If the array is null or not long enough an exception is generated. The array must be at least 3 units long, and the bboxSize is taken from the 1st three values.

If the three values are all -1, then this will disable the use of the explicit bounds.

Parameters:
val - The new bboxSize value to use
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

getCenterOfMass

public void getCenterOfMass(float[] val)
Get the current value of the centerOfMass.

Parameters:
val - An array of at least length 3 to copy the value to

setCenterOfMass

public void setCenterOfMass(float[] val)
Set a new value for the centerOfMass of this segment. If the array is null or not long enough an exception is generated. The array must be at least 3 units long, and the centerOfMass is taken from the 1st three values.

Parameters:
val - The new centerOfMass value to use
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

numMomentsOfInertia

public int numMomentsOfInertia()

getMomentsOfInertia

public void getMomentsOfInertia(float[] val)
Get the current value of the momentsOfInertia.

Parameters:
val - An array of at least numMomentsOfInteria() in length

setMomentsOfInertia

public void setMomentsOfInertia(float[] val,
                                int numValid)
Set a new value for the momentsOfInertia of this segment. If the array is null or not long enough an exception is generated. The array must be at least 3 units long, and the momentsOfInertia is taken from the 1st three values.

Parameters:
val - The new momentsOfInertia value to use
numValid - The number of valid values to copy from the array
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

numCoord

public int numCoord()
Get the number of elements in coord

Returns:
The number of elements kept in the coordinates list

getCoord

public void getCoord(float[] val)
Get the current value of the coord.

Parameters:
val - An array of at least length of numCoord() * 3 to copy the values to

setCoord

public void setCoord(float[] val,
                     int numElements)
Set a new value for the coord of this joint. If the array is null or not long enough an exception is generated. The array must be at least a multiple of 3 units long.

Parameters:
val - The new coord value to use
numElements - The number of 3d-vectors in the array
Throws:
java.lang.IllegalArgumentException - The array is null or not long enough.

numChildren

public int numChildren()
Get the number of currently valid children.

Returns:
The number of values kept in the info list

getChildren

public void getChildren(java.lang.Object[] vals)
Get the current collection of children. If none are set, the array is unchanged.

Parameters:
vals - An array of at least length numChildren() to copy the values to

setChildren

public void setChildren(java.lang.Object[] kids,
                        int numValid)
Replace the existing children with the new set of children.

Parameters:
kids - The collection of child objects to now use
numValid - The number kids to copy from the given array

addChild

public void addChild(java.lang.Object kid)
Add a child node to the existing collection. Duplicates and null values are allowed.

Parameters:
kid - The new child instance to add

removeChild

public void removeChild(java.lang.Object kid)
Remove a child node from the existing collection. If there are duplicates, only the first instance is removed. Only reference comparisons are used.

Parameters:
kid - The child instance to remove

setDisplacers

public void setDisplacers(HAnimDisplacer[] kids,
                          int numValid)
Replace the existing displacers with the new set of displacers.

Parameters:
kids - The collection of child objects to now use
numValid - The number kids to copy from the given array

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org