Class BarnesHutQuadTree<T>
- java.lang.Object
-
- org.jungrapht.visualization.layout.quadtree.BarnesHutQuadTree<T>
-
public class BarnesHutQuadTree<T> extends Object
A QuadTree that can gather combined forces from visited nodes. Inspired by http://arborjs.org/docs/barnes-hut http://www.cs.princeton.edu/courses/archive/fall03/cs126/assignments/barnes-hut.html https://github.com/chindesaurus/BarnesHut-N-Body- Author:
- Tom Nelson
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BarnesHutQuadTree.Builder<T>
-
Constructor Summary
Constructors Constructor Description BarnesHutQuadTree()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyForcesTo(ForceObject<T> visitor)
static <T> BarnesHutQuadTree.Builder<T>
builder()
void
clear()
Rectangle
getBounds()
the bounds of this quad treeNode<T>
getRoot()
protected void
insert(ForceObject node)
void
rebuild(Collection<T> elements, Function<T,Double> masses, Function<T,Point> locations)
void
rebuild(Collection<T> elements, Function<T,Point> locations)
rebuild the quad tree with the nodes and location mappings of the passed LayoutModelString
toString()
-
-
-
Method Detail
-
builder
public static <T> BarnesHutQuadTree.Builder<T> builder()
-
getBounds
public Rectangle getBounds()
the bounds of this quad tree- Returns:
- the bounds of the entire quadtree
-
clear
public void clear()
-
applyForcesTo
public void applyForcesTo(ForceObject<T> visitor)
- Parameters:
visitor
- passedForceObject
will visit nodes in the quad tree and accumulate their forces
-
insert
protected void insert(ForceObject node)
-
rebuild
public void rebuild(Collection<T> elements, Function<T,Point> locations)
rebuild the quad tree with the nodes and location mappings of the passed LayoutModel- Parameters:
locations
- - mapping of elements to locations
-
rebuild
public void rebuild(Collection<T> elements, Function<T,Double> masses, Function<T,Point> locations)
-
-