com.jme.math.spring
Class SpringPoint

java.lang.Object
  extended by com.jme.math.spring.SpringPoint
All Implemented Interfaces:
Savable

public class SpringPoint
extends java.lang.Object
implements Savable

SpringPoint defines a single point in a SpringSystem.

Version:
$Id: SpringPoint.java 4131 2009-03-19 20:15:28Z blaine.dev $
Author:
Joshua Slack

Field Summary
 Vector3f acceleration
          Acceleration vector, zeroed and recalculated on each SpringSystem.calcForces(float).
 int index
          index of this point in the system.
 float invMass
          Inverse Mass of this point.
 float mass
          Mass of this point.
 Vector3f oldPos
          Previous Position of this point in space.
 Vector3f position
          Position of this point in space.
 
Constructor Summary
SpringPoint(Vector3f pos)
          Public constructor.
 
Method Summary
 java.lang.Class getClassTag()
           
 void read(JMEImporter e)
           
 void setMass(float m)
          Set the mass for this point.
 void update(float dt)
          Verlet update of point location.
 void write(JMEExporter e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

public int index
index of this point in the system. Needs to be set by the programmer. can be useful for derivatives of SpringpointForce that may apply force differently to different points based on location in the matrix.


mass

public float mass
Mass of this point.


invMass

public float invMass
Inverse Mass of this point.


position

public Vector3f position
Position of this point in space.


oldPos

public Vector3f oldPos
Previous Position of this point in space.


acceleration

public Vector3f acceleration
Acceleration vector, zeroed and recalculated on each SpringSystem.calcForces(float).

Constructor Detail

SpringPoint

public SpringPoint(Vector3f pos)
Public constructor.

Parameters:
pos - Vertex position of this point.
Method Detail

setMass

public void setMass(float m)
Set the mass for this point. Also calculates and stores the inverse mass to invMass field for future use.

Parameters:
m - float

update

public void update(float dt)
Verlet update of point location. Pretty stable. Updates position by using implied velocity derived from the distance travled since last update. Thus velocity and position do not get out of sync.

Parameters:
dt - float - change in time since last update.

write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Throws:
java.io.IOException

getClassTag

public java.lang.Class getClassTag()
Specified by:
getClassTag in interface Savable