generativedesign
Class Spring
java.lang.Object
generativedesign.Spring
public class Spring
- extends Object
Elasic connection between two nodes.
Constructor Summary |
Spring(Node theFromNode,
Node theToNode)
|
Spring(Node theFromNode,
Node theToNode,
float theLength,
float theStiffness,
float theDamping)
|
id
public String id
fromNode
public Node fromNode
toNode
public Node toNode
length
public float length
stiffness
public float stiffness
damping
public float damping
Spring
public Spring(Node theFromNode,
Node theToNode)
- Parameters:
theFromNode
- Node from which the spring startstheToNode
- 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 startstheToNode
- Node to which the spring goestheLength
- Target length of the springtheStiffness
- Value from 0 to 1. 0: no forces will be applied, 1: high spring forcestheDamping
- Value from 0 to 1. 0: no damping of force, 1: complete damping of force
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