com.sun.jimi.core.util
Class OctreeNode

java.lang.Object
  |
  +--com.sun.jimi.core.util.OctreeNode

public class OctreeNode
extends java.lang.Object

This class is the core class of the Octree Color reduction system.

This class represents colours as a path from root of Octree to Leaf. This octree has been implemented for encoding of 24 bit colors made up of 8 bit components of red/green/blue. The colour components are encoded from Most Significant bit down to least significant bit for each of the Red/Green/Blue components.

Each node contains the sum of all Red/Green/Blue color components of all nodes and colors added to the octree below this node. Therefore the average colour for all those components can be calculated at anytime by dividing by count.

This class calls several procedures in the OctreeCallback class for the purposes of creating OctreeNode objects, releasing of OctreeNode objects, marking of OctreeNode objects for later reduction.

Possible future optimisation might be to remember last color added and if next is same color then just bump count and details for the node.

The following data redundancy currently exists internally childCount == 0 is same as leaf == true.


Field Summary
static int numNodes
          debug trace count of these nodes allocated
 
Method Summary
 void dump(java.lang.String pre)
          Debug method to dump entire octree in a useful trace form Simply call on root node root.dump("")
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

numNodes

public static int numNodes
debug trace count of these nodes allocated
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

dump

public void dump(java.lang.String pre)
Debug method to dump entire octree in a useful trace form Simply call on root node root.dump("")