com.jme.math
Class Spring

java.lang.Object
  extended bycom.jme.math.Spring

public class Spring
extends java.lang.Object

Spring defines a single spring connecting two SpringNodes in a SpringSystem.

Version:
$Id: Spring.java,v 1.1 2004/11/29 21:24:56 renanse Exp $
Author:
Joshua Slack

Field Summary
 SpringNode node1
          First node connected by this Spring.
 SpringNode node2
          Second node connected by this Spring.
 
Constructor Summary
Spring(SpringNode node1, SpringNode node2, float restLength)
          Public constructor.
 
Method Summary
 float getRestLength()
          Return the rest length of this Spring.
 void setRestLength(float restLength)
          Set the rest length of this Spring.
 void update()
          Updates the positions of the nodes connected by this spring based on spring force calculations.
 void updateTotalMassFromNodes()
          Computes the spring collective mass from the node using inverted masses for stability
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

node1

public SpringNode node1
First node connected by this Spring.


node2

public SpringNode node2
Second node connected by this Spring.

Constructor Detail

Spring

public Spring(SpringNode node1,
              SpringNode node2,
              float restLength)
Public constructor.

Parameters:
node1 - SpringNode
node2 - SpringNode
restLength - float
Method Detail

setRestLength

public void setRestLength(float restLength)
Set the rest length of this Spring. Also, calculates and sets the squared rest length field.

Parameters:
restLength - float

getRestLength

public float getRestLength()
Return the rest length of this Spring.

Returns:
float

updateTotalMassFromNodes

public void updateTotalMassFromNodes()
Computes the spring collective mass from the node using inverted masses for stability


update

public void update()
Updates the positions of the nodes connected by this spring based on spring force calculations. Relaxation method idea came from paper on physics system of Hitman game.