maspack.geometry
Class OBBTree

java.lang.Object
  extended by maspack.geometry.BVTree
      extended by maspack.geometry.OBBTree
All Implemented Interfaces:
GLRenderable

public class OBBTree
extends BVTree


Field Summary
 boolean debug
           
static int myDefaultMaxLeafElems
           
static OBB.Method myDefaultMethod
           
 
Fields inherited from interface maspack.render.GLRenderable
TRANSLUCENT, TWO_DIMENSIONAL
 
Constructor Summary
OBBTree()
           
OBBTree(MeshBase mesh)
           
OBBTree(MeshBase mesh, int maxLeafElems)
           
OBBTree(MeshBase mesh, int maxLeafElems, double margin)
           
OBBTree(MeshBase mesh, OBB.Method method)
           
OBBTree(MeshBase mesh, OBB.Method method, int maxLeafElems, double margin)
           
 
Method Summary
 void build(Boundable[] elems, int num)
          Builds a bounding volume tree for a set of elements.
 int getDepth()
           
 OBB getRoot()
          Returns the root bounding volume for this tree
 int numNodes()
          Returns the number of nodes in this tree.
 int recursiveDepth(BVNode node, int level)
           
 int recursiveNumNodes(BVNode node)
           
 void recursiveRender(GLRenderer renderer, int flags, BVNode node, int level)
           
 void render(GLRenderer renderer, int flags)
          Render this object using Open GL via the JOGL.
 void setMethod(OBB.Method method)
          Sets the method used to generate the OBBs within the tree.
 void update()
          Updates the bounding volumes in this tree to ensure that they properly contain their enclosed elements.
 
Methods inherited from class maspack.geometry.BVTree
build, build, getBvhToWorld, getBvhToWorld, getCenter, getLeafNodes, getMargin, getMaxLeafElements, getRadius, getRenderHints, intersectLine, intersectLineSegment, intersectPlane, intersectPoint, intersectSphere, intersectTree, intersectTree, numberNodes, prerender, print, print, printElement, printNumLeafFaces, setBvhToWorld, setMargin, setMaxLeafElements, updateBounds
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myDefaultMaxLeafElems

public static int myDefaultMaxLeafElems

myDefaultMethod

public static OBB.Method myDefaultMethod

debug

public boolean debug
Constructor Detail

OBBTree

public OBBTree()

OBBTree

public OBBTree(MeshBase mesh,
               OBB.Method method,
               int maxLeafElems,
               double margin)

OBBTree

public OBBTree(MeshBase mesh,
               int maxLeafElems,
               double margin)

OBBTree

public OBBTree(MeshBase mesh,
               OBB.Method method)

OBBTree

public OBBTree(MeshBase mesh,
               int maxLeafElems)

OBBTree

public OBBTree(MeshBase mesh)
Method Detail

setMethod

public void setMethod(OBB.Method method)
Sets the method used to generate the OBBs within the tree. This setting will take effect upon to next call to build.

Parameters:
method - new method to be used to generate the OBBs

getRoot

public OBB getRoot()
Description copied from class: BVTree
Returns the root bounding volume for this tree

Specified by:
getRoot in class BVTree
Returns:
root bounding volume

build

public void build(Boundable[] elems,
                  int num)
Description copied from class: BVTree
Builds a bounding volume tree for a set of elements.

Specified by:
build in class BVTree
Parameters:
elems - elements around which this tree is to be built.
num - number of elements

recursiveRender

public void recursiveRender(GLRenderer renderer,
                            int flags,
                            BVNode node,
                            int level)

recursiveDepth

public int recursiveDepth(BVNode node,
                          int level)

getDepth

public int getDepth()

render

public void render(GLRenderer renderer,
                   int flags)
Description copied from class: BVTree
Render this object using Open GL via the JOGL.

Specified by:
render in interface GLRenderable
Overrides:
render in class BVTree
Parameters:
renderer - renderer object which is used to perform the rendering. Provides pointers to GL and GLU, along with helper functions.
flags - supplies flags that may be used to control different aspects of the rendering. Flags are defined in GLRenderer and currently include GLRenderer.SELECTED, GLRenderer.VERTEX_COLORING, GLRenderer.HSV_COLOR_INTERPOLATION, GLRenderer.SORT_FACES, and GLRenderer.CLEAR_MESH_DISPLAY_LISTS.

numNodes

public int numNodes()
Description copied from class: BVTree
Returns the number of nodes in this tree.

Overrides:
numNodes in class BVTree
Returns:
number of nodes in the tree

recursiveNumNodes

public int recursiveNumNodes(BVNode node)

update

public void update()
Description copied from class: BVTree
Updates the bounding volumes in this tree to ensure that they properly contain their enclosed elements. This should be called when the positions of the elements changes (such when the vertices of mesh change position).

Specified by:
update in class BVTree
See Also:
BVTree.setMargin(double)