org.wilmascope.forcelayout
Class RepulsionlessSpring
java.lang.Object
org.wilmascope.patterns.Prototype
org.wilmascope.forcelayout.Force
org.wilmascope.forcelayout.RepulsionlessSpring
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class RepulsionlessSpring
- extends Force
A Force
for use by nodes connected by an edge.
Attempts to restore the distance between nodes to the natural length of that edge.
- See Also:
- Serialized Form
Method Summary |
void |
calculate()
Calculate node deltas due to spring forces
between all nodes connected by an edge |
void |
setCluster(Cluster root)
|
void |
setRepulsionForce(RepulsionSpring repulsion)
set the repulsion force object to use if we are to ignore the effects
of repulsion accross edges connected by springs... |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
RepulsionlessSpring
public RepulsionlessSpring(float strengthConstant)
- Creates a new
Spring
with the given strength
- Parameters:
strengthConstant
- k in Hooke's Law
setCluster
public void setCluster(Cluster root)
- Specified by:
setCluster
in class Force
setRepulsionForce
public void setRepulsionForce(RepulsionSpring repulsion)
- set the repulsion force object to use if we are to ignore the effects
of repulsion accross edges connected by springs... this can be done since
the spring between edges can arguably be said to already separate the
nodes enough. Note that we actually have to recalculate the repulsion
accross the nodes so there is some minor cost to setting repulsion not
null.
calculate
public void calculate()
- Calculate node deltas due to spring forces
between all nodes connected by an edge
- Specified by:
calculate
in class Force