generativedesign
Class Spring

java.lang.Object
  extended by generativedesign.Spring

public class Spring
extends Object

Elasic connection between two nodes.


Field Summary
 float damping
           
 Node fromNode
           
 String id
           
 float length
           
 float stiffness
           
 Node toNode
           
 
Constructor Summary
Spring(Node theFromNode, Node theToNode)
           
Spring(Node theFromNode, Node theToNode, float theLength, float theStiffness, float theDamping)
           
 
Method Summary
 float getDamping()
           
 Node getFromNode()
           
 String getID()
           
 float getLength()
           
 float getStiffness()
           
 Node getToNode()
           
 void setDamping(float theDamping)
           
 void setFromNode(Node theFromNode)
           
 void setID(String theID)
           
 void setLength(float theLength)
           
 void setStiffness(float theStiffness)
           
 void setToNode(Node theToNode)
           
 void update()
          Apply forces on spring and attached nodes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

public String id

fromNode

public Node fromNode

toNode

public Node toNode

length

public float length

stiffness

public float stiffness

damping

public float damping
Constructor Detail

Spring

public Spring(Node theFromNode,
              Node theToNode)
Parameters:
theFromNode - Node from which the spring starts
theToNode - Node to which the spring goes

Spring

public Spring(Node theFromNode,
              Node theToNode,
              float theLength,
              float theStiffness,
              float theDamping)
Parameters:
theFromNode - Node from which the spring starts
theToNode - Node to which the spring goes
theLength - Target length of the spring
theStiffness - Value from 0 to 1. 0: no forces will be applied, 1: high spring forces
theDamping - Value from 0 to 1. 0: no damping of force, 1: complete damping of force
Method Detail

update

public void update()
Apply forces on spring and attached nodes


getID

public String getID()

setID

public void setID(String theID)

getFromNode

public Node getFromNode()

setFromNode

public void setFromNode(Node theFromNode)

getToNode

public Node getToNode()

setToNode

public void setToNode(Node theToNode)

getLength

public float getLength()

setLength

public void setLength(float theLength)

getStiffness

public float getStiffness()

setStiffness

public void setStiffness(float theStiffness)

getDamping

public float getDamping()

setDamping

public void setDamping(float theDamping)


Processing Library generativedesign by Hartmut Bohnacker, Benedikt Gross. (c) 2015