Aviatrix3D
2.0 Dev

org.j3d.renderer.aviatrix3d.geom.volume
Class OctTree

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.Node
          extended byorg.j3d.aviatrix3d.BaseNode
              extended byorg.j3d.renderer.aviatrix3d.geom.volume.OctTree
All Implemented Interfaces:
Cullable

public class OctTree
extends BaseNode
implements Cullable

Node that implements a simple OctTree-style data structure useful for volume rendering of large datasets.

The core implementation is a fairly simplistic distance-based algorithm to determine when the level sets should be changed over. The class uses a single Node object for the low-detail model, and allows the provision of a set of nodes for the next detail level, allowing for nesting of the tree objects if required.

For describing the high-detail geometry, there is no specific geometric representation implied by this node. There are just up to 8 children that can be supplied, and that the user should make sure to place them in the correct octant location using transformations as required.

For bounds calculation, the bounds of the low-res model are used.

Version:
$Revision: 1.2 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.Node
bounds, implicitBounds, INVALID_BOUNDS, parent
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_NOT_LIVE_MESSAGE, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
OctTree()
          Create a new empty instance of the oct tree.
 
Method Summary
 void cullChildren(CullInstructions output, javax.vecmath.Matrix4f vworldTx, javax.vecmath.Matrix4f viewTransform, javax.vecmath.Vector4f[] frustumPlanes, float angularRes)
          Check this node for children to traverse.
 void getHighDetail(Node[] geom)
          Get the currently set low-detail geometry structure.
 Node getLowDetail()
          Get the currently set low-detail geometry structure.
 float getRange()
          Get the currently set range at which the high detail model will be shown.
 int numHighDetailGeom()
          Get the number of valid high-detail children in use by this node.
 void setHighDetail(Node[] geom, int numValid)
          Set the low-detail geometry instance to use.
 void setLowDetail(Node geom)
          Set the low-detail geometry instance to use.
 void setRange(float distance)
          Set the range at which this geometry should change from low-detail to high-detail models.
 
Methods inherited from class org.j3d.aviatrix3d.BaseNode
checkForCyclicChild, checkForCyclicParent, clearUpdateHandler, removeParent, setLive, setParent, setUpdateHandler
 
Methods inherited from class org.j3d.aviatrix3d.Node
boundsChanged, checkForCyclicParent, getBounds, getParent, markBoundsDirty, recomputeBounds, removeParent, setBounds, setLive, setParent, updateBounds, updateParentBounds
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, dataChanged, getUserData, isLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OctTree

public OctTree()
Create a new empty instance of the oct tree. The range is set to zero, meaning it will always display the low res data, unless the user changes the range.

Method Detail

cullChildren

public void cullChildren(CullInstructions output,
                         javax.vecmath.Matrix4f vworldTx,
                         javax.vecmath.Matrix4f viewTransform,
                         javax.vecmath.Vector4f[] frustumPlanes,
                         float angularRes)
Check this node for children to traverse. The angular resolution is defined as Field Of View (in radians) / viewport width in pixels.

Specified by:
cullChildren in interface Cullable
Parameters:
output - Fill in the child information here
vworldTx - The transformation from the root of the scene to this node according to the current traversal path
viewTransform - The transformation from the root of the scene graph to the active viewpoint
frustumPlanes - Listing of frustum planes in the order: right, left, bottom, top, far, near
angularRes - Angular resolution of the screen, or 0 if not calculable from the available data.

setRange

public void setRange(float distance)
              throws java.lang.IllegalArgumentException,
                     InvalidWriteTimingException
Set the range at which this geometry should change from low-detail to high-detail models. The range should be a non-negative value. A range value of zero will imply that the low detail geometry will always be shown. Range is treated as a spherical distance from the center of the local coordinate system of this geometry.

Parameters:
distance - The range at which the geometry should swap
Throws:
java.lang.IllegalArgumentException - The range value was negative
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getRange

public float getRange()
Get the currently set range at which the high detail model will be shown.

Returns:
A non-negative range value

setLowDetail

public void setLowDetail(Node geom)
                  throws InvalidWriteTimingException
Set the low-detail geometry instance to use. Setting a null value will clear the currently set geometry. The low detail can be any form of scene graph desired.

Parameters:
geom - The sub scene graph to use for the low-detail geometry
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getLowDetail

public Node getLowDetail()
Get the currently set low-detail geometry structure. If none is set, null is returned.

Returns:
The current geometry structure or null

setHighDetail

public void setHighDetail(Node[] geom,
                          int numValid)
                   throws InvalidWriteTimingException
Set the low-detail geometry instance to use. Setting a null value will clear the currently set geometry. The low detail can be any form of scene graph desired.

Parameters:
geom - The sub scene graph list to use for the high-detail geometry
numValid - The number of valid bits of geometry to use from the array
Throws:
java.lang.IllegalArgumentException - numValid was outside [0, 8]
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

numHighDetailGeom

public int numHighDetailGeom()
Get the number of valid high-detail children in use by this node.

Returns:
A number between 0 and 8

getHighDetail

public void getHighDetail(Node[] geom)
Get the currently set low-detail geometry structure. If none is set, null is returned.

Parameters:
geom - An array to copy the values into

Aviatrix3D
2.0 Dev

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - 2005 j3d.org