com.jme.bounding
Class OBBTree

java.lang.Object
  extended bycom.jme.bounding.OBBTree

public class OBBTree
extends java.lang.Object

Started Date: Sep 5, 2004

This class is used exclusivly by the TriMesh object. There is no need for users to call functions on this class directly. It is a tree of OBB objects that represent a model's bound.

Author:
Jack Lindamood

Field Summary
 OBB2 bounds
          Untransformed bounds of this tree.
static int maxPerLeaf
          The max number of triangles in a leaf.
 OBB2 worldBounds
          This tree's bounds after transformation.
 
Constructor Summary
OBBTree()
           
 
Method Summary
 void construct(TriMesh parent)
          Recreates this OBBTree's information for the given TriMesh.
 void createTree(int start, int end)
          Creates an OBB tree recursivly from the tris's array of triangles.
 boolean intersect(OBBTree collisionTree)
          Returns true if this OBBTree intersects the given OBBTree.
 boolean intersect(OBBTree collisionTree, java.util.ArrayList aList, java.util.ArrayList bList)
          Stores in the given array list all indexes of triangle intersection between the two OBBTree.
 void intersect(Ray toTest, java.util.ArrayList triList)
          Stores in the given array list all indexes of triangle intersection between this tree and a given ray.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxPerLeaf

public static int maxPerLeaf
The max number of triangles in a leaf.


bounds

public OBB2 bounds
Untransformed bounds of this tree.


worldBounds

public OBB2 worldBounds
This tree's bounds after transformation.

Constructor Detail

OBBTree

public OBBTree()
Method Detail

construct

public void construct(TriMesh parent)
Recreates this OBBTree's information for the given TriMesh.

Parameters:
parent - The trimesh that this OBBTree should represent.

createTree

public void createTree(int start,
                       int end)
Creates an OBB tree recursivly from the tris's array of triangles.

Parameters:
start - The start index of the tris array, inclusive.
end - The end index of the tris array, exclusive.

intersect

public boolean intersect(OBBTree collisionTree)
Returns true if this OBBTree intersects the given OBBTree.

Parameters:
collisionTree - The Tree to test.
Returns:
True if they intersect.

intersect

public boolean intersect(OBBTree collisionTree,
                         java.util.ArrayList aList,
                         java.util.ArrayList bList)
Stores in the given array list all indexes of triangle intersection between the two OBBTree.

Parameters:
collisionTree - The tree to test this one against.
aList - The arraylist to hold indexes of this OBBTree's triangle intersections.
bList - The arraylist to hold indexes of the testing OBBTree's triangle intersections.
Returns:
True if there was an intersection.

intersect

public void intersect(Ray toTest,
                      java.util.ArrayList triList)
Stores in the given array list all indexes of triangle intersection between this tree and a given ray.

Parameters:
triList - The arraylist to hold indexes of this OBBTree's triangle intersections.