ccvisu
Class MinimizerBarnesHut.OctTree

java.lang.Object
  extended byccvisu.MinimizerBarnesHut.OctTree
Enclosing class:
MinimizerBarnesHut

private class MinimizerBarnesHut.OctTree
extends java.lang.Object

Octtree for graph nodes with positions in 3D space. Contains all graph nodes that are located in a given cuboid in 3D space.

Author:
Andreas Noack

Field Summary
private  MinimizerBarnesHut.OctTree[] children
          Children of this tree node.
private  int index
          For leafs, the unique index of the graph node; for non-leafs -1.
private  float[] maxPos
          Maximum coordinates of the cuboid in each of the 3 dimensions.
private  float[] minPos
          Minimum coordinates of the cuboid in each of the 3 dimensions.
private  float[] position
          Barycenter of the contained graph nodes.
private  float weight
          Total weight of the contained graph nodes.
 
Constructor Summary
private MinimizerBarnesHut.OctTree(int index, float[] position, float weight, float[] minPos, float[] maxPos)
          Creates an octtree containing one graph node.
 
Method Summary
private  void addNode(int nodeIndex, float[] nodePos, float nodeWeight)
          Adds a graph node to the octtree.
private  void addNode2(int nodeIndex, float[] nodePos, float nodeWeight)
          Adds a graph node to the octtree, without changing the position and weight of the root.
private  void moveNode(float[] oldPos, float[] newPos, float nodeWeight)
          Updates the positions of the octtree nodes when the position of a graph node has changed.
private  float width()
          Returns the maximum extension of the octtree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

index

private int index
For leafs, the unique index of the graph node; for non-leafs -1.


children

private MinimizerBarnesHut.OctTree[] children
Children of this tree node.


position

private float[] position
Barycenter of the contained graph nodes.


weight

private float weight
Total weight of the contained graph nodes.


minPos

private float[] minPos
Minimum coordinates of the cuboid in each of the 3 dimensions.


maxPos

private float[] maxPos
Maximum coordinates of the cuboid in each of the 3 dimensions.

Constructor Detail

MinimizerBarnesHut.OctTree

private MinimizerBarnesHut.OctTree(int index,
                                   float[] position,
                                   float weight,
                                   float[] minPos,
                                   float[] maxPos)
Creates an octtree containing one graph node.

Parameters:
index - Unique index of the graph node.
position - Position of the graph node.
weight - Weight of the graph node.
minPos - Minimum coordinates of the cuboid.
maxPos - Maximum coordinates of the cuboid.
Method Detail

addNode

private void addNode(int nodeIndex,
                     float[] nodePos,
                     float nodeWeight)
Adds a graph node to the octtree.

Parameters:
nodeIndex - Unique index of the graph node.
nodePos - Position of the graph node.
nodeWeight - Weight of the graph node.

addNode2

private void addNode2(int nodeIndex,
                      float[] nodePos,
                      float nodeWeight)
Adds a graph node to the octtree, without changing the position and weight of the root.

Parameters:
nodeIndex - Unique index of the graph node.
nodePos - Position of the graph node.
nodeWeight - Weight of the graph node.

moveNode

private void moveNode(float[] oldPos,
                      float[] newPos,
                      float nodeWeight)
Updates the positions of the octtree nodes when the position of a graph node has changed.

Parameters:
oldPos - Previous position of the graph node.
newPos - New position of the graph node.
nodeWeight - Weight of the graph node.

width

private float width()
Returns the maximum extension of the octtree.

Returns:
Maximum over all dimensions of the extension of the octtree.