Class: Graphomaton::Layout::ForceTree
- Inherits:
-
Object
- Object
- Graphomaton::Layout::ForceTree
- Defined in:
- lib/graphomaton/layout/force_tree.rb
Defined Under Namespace
Classes: Node
Constant Summary collapse
- DEFAULT_THETA =
0.6- LEAF_CAPACITY =
4- MAX_DEPTH =
20
Instance Method Summary collapse
- #force_on(name, position, coefficient, theta: DEFAULT_THETA, &coincident_delta) ⇒ Object
-
#initialize(positions) ⇒ ForceTree
constructor
A new instance of ForceTree.
Constructor Details
#initialize(positions) ⇒ ForceTree
Returns a new instance of ForceTree.
15 16 17 18 |
# File 'lib/graphomaton/layout/force_tree.rb', line 15 def initialize(positions) @root = build_root(positions) positions.each { |name, position| insert(@root, name, position, 0) } end |
Instance Method Details
#force_on(name, position, coefficient, theta: DEFAULT_THETA, &coincident_delta) ⇒ Object
20 21 22 |
# File 'lib/graphomaton/layout/force_tree.rb', line 20 def force_on(name, position, coefficient, theta: DEFAULT_THETA, &coincident_delta) force_from_node(@root, name, position, coefficient.to_f, theta.to_f, coincident_delta) end |