Collision::Leaf Class Reference

A leaf contains actual geometry, in the form of a list of triangles. More...

#include <collisionModel.h>

Inheritance diagram for Collision::Leaf:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void addTriangle (Triangle t)
void clearTriangles ()
void computeBbox ()
int getNumTriangles () const
const std::list< Triangle > * getTriangles () const
bool isLeaf () const
 Leaf ()
 Just a stub.
Branchsplit ()
 Splits this leaf into 2 children; returns a new branch with the new children.

Private Member Functions

void areaWeightedCovarianceMatrix (double covMat[3][3])
 Computes the covariance matrix of all triangles weighted by triangle area.
void balancedSplit (vec3 axis, double sepPoint, Leaf *child1, Leaf *child2)
 Distributes triangles between children based on projection of triangle centroid.
void computeBboxAA ()
void computeBboxOO ()
void fitBox (const mat3 &R, vec3 &center, vec3 &halfSize)
position getMeanVertex ()
double getMedianProjection (const vec3 &axis)
 Finds the median projection point of all vertices unto a given axis.
void optimalSplit (const vec3 &x, const vec3 &y, const vec3 &z, Leaf *child1, Leaf *child2)
 Computes the split point along the given axis that ensures min volume of child bounding boxes.
void randomSplit (Leaf *child1, Leaf *child2)
 Ensures equal number of triangles per child by distributing triangles randomly.

Private Attributes

std::list< TrianglemTriangles

Static Private Attributes

static const int MAX_LEAF_TRIANGLES = 1
 The Bbox hierarchy is built until all leaves have at most this many triangles.
static const double TOLERANCE = 1.0e-2
 Added around bounding boxes to guarantee they enclose the contents.

Detailed Description

A leaf contains actual geometry, in the form of a list of triangles.

The leaf is the only type of node that contains actual geoemtry. It also knows how to compute its own bounding box and to split itself into children.

Definition at line 81 of file collisionModel.h.


Constructor & Destructor Documentation

Collision::Leaf::Leaf (  )  [inline]

Just a stub.

Definition at line 105 of file collisionModel.h.


Member Function Documentation

void Collision::Leaf::addTriangle ( Triangle  t  )  [inline]

Definition at line 109 of file collisionModel.h.

void Collision::Leaf::areaWeightedCovarianceMatrix ( double  covMat[3][3]  )  [private]

Computes the covariance matrix of all triangles weighted by triangle area.

Formula taken from "Real Time Collision Detection" by C. Ericson

Definition at line 127 of file collisionModel.cpp.

void Collision::Leaf::balancedSplit ( vec3  axis,
double  sepPoint,
Leaf child1,
Leaf child2 
) [private]

Distributes triangles between children based on projection of triangle centroid.

Splits triangles based on the location of their centroid.

Definition at line 314 of file collisionModel.cpp.

void Collision::Leaf::clearTriangles (  )  [inline]

Definition at line 112 of file collisionModel.h.

void Collision::Leaf::computeBbox (  )  [inline]

Definition at line 110 of file collisionModel.h.

void Collision::Leaf::computeBboxAA (  )  [private]

Definition at line 223 of file collisionModel.cpp.

void Collision::Leaf::computeBboxOO (  )  [private]

Definition at line 161 of file collisionModel.cpp.

void Collision::Leaf::fitBox ( const mat3 R,
vec3 center,
vec3 halfSize 
) [private]

Definition at line 92 of file collisionModel.cpp.

position Collision::Leaf::getMeanVertex (  )  [private]

Definition at line 44 of file collisionModel.cpp.

double Collision::Leaf::getMedianProjection ( const vec3 axis  )  [private]

Finds the median projection point of all vertices unto a given axis.

Definition at line 59 of file collisionModel.cpp.

int Collision::Leaf::getNumTriangles (  )  const [inline]

Definition at line 111 of file collisionModel.h.

const std::list<Triangle>* Collision::Leaf::getTriangles (  )  const [inline]

Definition at line 113 of file collisionModel.h.

bool Collision::Leaf::isLeaf (  )  const [inline, virtual]

Implements Collision::Node.

Definition at line 106 of file collisionModel.h.

void Collision::Leaf::optimalSplit ( const vec3 x,
const vec3 y,
const vec3 z,
Leaf child1,
Leaf child2 
) [private]

Computes the split point along the given axis that ensures min volume of child bounding boxes.

The split is done along the given x axis, and the optimal child bounding boxes are aligned with the x,y,z axes. Of course, there is no guarantee that the children will actually build their own bboxes along those axes; as they will do their own principal components they might end up with boxes aligned differently.

Definition at line 361 of file collisionModel.cpp.

void Collision::Leaf::randomSplit ( Leaf child1,
Leaf child2 
) [private]

Ensures equal number of triangles per child by distributing triangles randomly.

Assigns triangles to the two children randomly

Definition at line 334 of file collisionModel.cpp.

Branch * Collision::Leaf::split (  )  [virtual]

Splits this leaf into 2 children; returns a new branch with the new children.

The split process goes through the followins stages:

  • if this leaf has a single triangle, return NULL
  • choose a split axis and point
  • divide the triangles between the children
  • if one child has no triangles, split again, this time at random
  • ask each child to compute its bounding box
  • create and return a new branch with the 2 new children

Reimplemented from Collision::Node.

Definition at line 242 of file collisionModel.cpp.


Member Data Documentation

const int Collision::Leaf::MAX_LEAF_TRIANGLES = 1 [static, private]

The Bbox hierarchy is built until all leaves have at most this many triangles.

Definition at line 86 of file collisionModel.h.

std::list<Triangle> Collision::Leaf::mTriangles [private]

Definition at line 88 of file collisionModel.h.

const double Collision::Leaf::TOLERANCE = 1.0e-2 [static, private]

Added around bounding boxes to guarantee they enclose the contents.

Definition at line 84 of file collisionModel.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


graspit
Author(s):
autogenerated on Wed Jan 25 11:00:32 2012