Bubba-3D  0.9.0
Awesome game engine!
Public Member Functions | List of all members
Octree Class Reference

Public Member Functions

 Octree ()
 
 Octree (chag::float3 origin, chag::float3 halfVector)
 
void insertTriangle (Triangle *t)
 
void insertAll (std::vector< Triangle * > &triangles)
 
bool hasChildren ()
 
void getChildren (std::vector< Octree * > *octs)
 
void clearChildren ()
 
int getOctantContainingPoint (const chag::float3 &point)
 
int getTriangleCount ()
 
int getTriangleCountRecursively ()
 
std::vector< Triangle * > * getTriangles ()
 
int getNumberOfSubTrees ()
 
void getTrianglesInsersectedByRayCast (chag::float3 rayOrigin, chag::float3 rayVector, std::vector< Triangle * > *triangleList)
 
AABBgetAABB ()
 

Detailed Description

Definition at line 32 of file Octree.h.

Constructor & Destructor Documentation

Octree::Octree ( )

Initiates the Octree with default values for origin and halfVector. Should NOT be used unless you really want a small Octree. // TODO(Bubbad) Make Octree resize after insertions to make this constructor useful

Definition at line 24 of file Octree.cpp.

Octree::Octree ( chag::float3  origin,
chag::float3  halfVector 
)

Initiates a Octree that can contain triangles that are at within the cube of size 2*halfVector that is centered around the specified origin.

Parameters
originThe center position of the Octree
halfVectorHalf the length of the surrounding cube

Definition at line 35 of file Octree.cpp.

Member Function Documentation

void Octree::clearChildren ( )

Removes all the Octrees children and their triangles

Definition at line 50 of file Octree.cpp.

AABB * Octree::getAABB ( )

NOTE: The AABB is not transformed.

Definition at line 149 of file Octree.cpp.

void Octree::getChildren ( std::vector< Octree * > *  octs)

Fills the specified list with all the Octrees child Octrees

Parameters
octsList to be filled

Definition at line 128 of file Octree.cpp.

int Octree::getNumberOfSubTrees ( )
Returns
Recursivly searches the Octrees child Octrees and count how many sub trees there are.

Definition at line 165 of file Octree.cpp.

int Octree::getTriangleCountRecursively ( )
Returns
The triangle count of this Octree + the triangle count of all its child Octrees

Definition at line 153 of file Octree.cpp.

std::vector< Triangle * > * Octree::getTriangles ( )
Returns
A list of the triangles contained in this level of the Octree

Definition at line 83 of file Octree.cpp.

void Octree::getTrianglesInsersectedByRayCast ( chag::float3  rayOrigin,
chag::float3  rayVector,
std::vector< Triangle * > *  triangleList 
)

Recursively searches the Octree for triangles hit by the ray cast

Parameters
triangleListA list to be filled with all intersected triangles

Definition at line 222 of file Octree.cpp.

bool Octree::hasChildren ( )

return True if the Octree is recursed and have triangles in deeper levels, false otherwise

Definition at line 124 of file Octree.cpp.


The documentation for this class was generated from the following files: