de.cau.cs.kieler.klay.force.model
Class EadesModel

java.lang.Object
  extended by de.cau.cs.kieler.core.alg.AbstractAlgorithm
      extended by de.cau.cs.kieler.klay.force.model.AbstractForceModel
          extended by de.cau.cs.kieler.klay.force.model.EadesModel
All Implemented Interfaces:
IAlgorithm

public class EadesModel
extends AbstractForceModel

A force model after the Eades approach.

Rating red

Constructor Summary
EadesModel()
           
 
Method Summary
static double attractive(double d, double s)
          Compute attraction force between the forcee and the forcer.
protected  KVector calcDisplacement(FParticle forcer, FParticle forcee)
          Calculate a displacement for the given particles.
protected  void initialize(FGraph graph)
          Initialize the force model with the given graph.
protected  boolean moreIterations(int count)
          Determine whether more iterations need to be performed.
 
Methods inherited from class de.cau.cs.kieler.klay.force.model.AbstractForceModel
avoidSamePosition, getGraph, getRandom, iterationDone, layout
 
Methods inherited from class de.cau.cs.kieler.core.alg.AbstractAlgorithm
getMonitor, reset, reset, setProgressMonitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EadesModel

public EadesModel()
Method Detail

initialize

protected void initialize(FGraph graph)
Initialize the force model with the given graph. Subclasses that override this must call the superclass method first.

Overrides:
initialize in class AbstractForceModel
Parameters:
graph - a force graph

moreIterations

protected boolean moreIterations(int count)
Determine whether more iterations need to be performed.

Specified by:
moreIterations in class AbstractForceModel
Parameters:
count - the current iterations count
Returns:
true if more iterations shall be done

calcDisplacement

protected KVector calcDisplacement(FParticle forcer,
                                   FParticle forcee)
Calculate a displacement for the given particles.

Specified by:
calcDisplacement in class AbstractForceModel
Parameters:
forcer - the particle that is causing the force
forcee - the particle that is affected by the force
Returns:
a displacement vector for the forcee, or null if no force is applied

attractive

public static double attractive(double d,
                                double s)
Compute attraction force between the forcee and the forcer.

Parameters:
d - the distance between the two particles
s - the spring length
Returns:
a force exerted on the forcee