|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.geom.spring.SpringSystem
public class SpringSystem
An implementation of a spring system, particularly useful for modelling cloth dynamics.
The spring system assumes that it is operating over the top of some underlying geometry. As such, it tries to minimise the performance impacts by directly operating on the same array that is used by the geometry itself during rendering. The arrays that are passed to the system are not copied, just directly referenced and each node in the system acts as a .
Constructor Summary | |
---|---|
SpringSystem()
Create a new default spring system. |
Method Summary | |
---|---|
void |
addRectField(int width,
int height,
float[] pos,
float[] norm)
Add a retangular field of spring node location points to this field. |
void |
evaluateNormals()
Update the normals now following in any post-processing after the update. |
void |
getGravity(float[] grav)
Get the currently set gravity strength and direction vector. |
SpringNode |
getNode(int index)
Get the node at the given index. |
int |
getNodeCount()
Get the number of nodes that this system is currently maintaining. |
float |
getSpringConstant()
Get the currently set spring constant setting. |
void |
resetNaturalLengths()
Regenerate the natural lengths between the various nodes based on the current separation between each node's current position and it's connections. |
void |
setCustomSpringField(SpringNode[] nodes,
int numValid)
Create a custom spring field to be evaluated. |
void |
setGravity(float[] grav)
Set a new gravity strength and direction vector. |
void |
setSpringConstant(float val)
Set a new value for how stretchy the springs are. |
void |
update(float dTime)
Time to update all the interactions between the springs and nodes. |
void |
update(float dTime,
SpringEvaluatorCallback callback)
Time to update all the interactions between the springs and nodes. |
void |
update(float dTime,
SpringEvaluatorCallback callback,
float[] attribs)
Time to update all the interactions between the springs and nodes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SpringSystem()
Method Detail |
---|
public void addRectField(int width, int height, float[] pos, float[] norm)
width
- The number of points in the width of the fieldheight
- The number of points in the height of the fieldpos
- An array of positions, one per location to work onnorm
- An array of normals, one per location to work onpublic void setCustomSpringField(SpringNode[] nodes, int numValid)
nodes
- The list of nodes to usenumValid
- The number of valid entries in the list to usepublic void resetNaturalLengths()
public void update(float dTime)
dTime
- The delta in time between the last update and thispublic void update(float dTime, SpringEvaluatorCallback callback)
dTime
- The delta in time between the last update and thiscallback
- A per-node extra processing if needed callbackpublic void update(float dTime, SpringEvaluatorCallback callback, float[] attribs)
dTime
- The time delta from last evaluationcallback
- A per-node extra processing if needed callbackattribs
- Any per-node attribute info that is useful for the callbackpublic void evaluateNormals()
public SpringNode getNode(int index)
index
- The index of the spring node to fetch
public int getNodeCount()
public void setGravity(float[] grav)
grav
- The new values to use for gravitypublic void getGravity(float[] grav)
grav
- an array to copy the values intopublic void setSpringConstant(float val)
val
- The new values to use for the constantpublic float getSpringConstant()
|
j3d.org Code | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |