|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jme.math.SpringSystem
SpringSystem is a set of springs and nodes that
act and update as a cohesive unit.
| Field Summary | |
protected java.util.ArrayList |
nodes
Array of SpringNodes in this system. |
protected java.util.ArrayList |
springs
Array of Springs in this system. |
| Constructor Summary | |
SpringSystem()
Public constructor useful for creating custom SpringSystems. |
|
| Method Summary | |
void |
addForce(SpringNodeForce force)
Add an external force to this system. |
void |
addNode(SpringNode node)
Add a SpringNode to this system. |
void |
addSpring(Spring spring)
Add a Spring to this system. |
void |
addSpring(SpringNode node1,
SpringNode node2)
Create and add a Spring to this system given two nodes. |
void |
calcForces(float dt)
Calculate all external forces to be applied on the system nodes. |
static SpringSystem |
createRectField(int width,
int height,
Vector3f[] verts,
Vector3f[] normals,
float particleMass)
Convienence method for creating a rectangular system of springs and nodes. |
SpringNode |
getNode(int index)
Grab a specific node from this system. |
int |
getNodeCount()
Return the number of nodes in this system. |
int |
getRelaxLoops()
Return how many times each spring is updated per SpringSystem update. |
Spring |
getSpring(int index)
Grab a specific spring from this system. |
int |
getSpringCount()
Return the number of springs in this system. |
boolean |
removeForce(SpringNodeForce force)
Remove a force from this system. |
boolean |
removeNode(SpringNode node)
Remove a given SpringNode from this system. |
boolean |
removeSpring(Spring spring)
Remove a given Spring from this system. |
void |
setRelaxLoops(int relaxLoops)
Set how many times the springs are updated per SpringSystem update. |
void |
update(float dt)
Update the SpringNodes and Springs in this System. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.ArrayList nodes
protected java.util.ArrayList springs
| Constructor Detail |
public SpringSystem()
| Method Detail |
public SpringNode getNode(int index)
index - int
public int getNodeCount()
public void addNode(SpringNode node)
node - SpringNodepublic boolean removeNode(SpringNode node)
node - SpringNode
public Spring getSpring(int index)
index - int
public int getSpringCount()
public void addSpring(SpringNode node1,
SpringNode node2)
node1 - SpringNodenode2 - SpringNodepublic void addSpring(Spring spring)
spring - Springpublic boolean removeSpring(Spring spring)
spring - Spring
public void setRelaxLoops(int relaxLoops)
relaxLoops - int should be at least 2 for stability.public int getRelaxLoops()
public void addForce(SpringNodeForce force)
force - SpringNodeForcepublic boolean removeForce(SpringNodeForce force)
force - SpringNodeForce
public static SpringSystem createRectField(int width,
int height,
Vector3f[] verts,
Vector3f[] normals,
float particleMass)
width - number of nodes wideheight - number of nodes highverts - a precreated array of vertices. These should be setup
from left to right, top to bottom.normals - a precreated array to use as normals. Should be ordered
the same as the verts array.particleMass - a mass applied to each individual node. Total system
mass would equals particleMass x width x height. (i.e. particale mass x
getNodeCount())
public void calcForces(float dt)
dt - change in time since last call to this function in ms.public void update(float dt)
dt - float
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||