qCC_db  version 2.5.4 (Qt) - 19 Apr 2014
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
ccOctreeFrustrumIntersector Class Reference
Collaboration diagram for ccOctreeFrustrumIntersector:
Collaboration graph
[legend]

Public Types

enum  OctreeCellVisibility { CELL_OUTSIDE_FRUSTRUM = 0, CELL_INSIDE_FRUSTRUM = 1, CELL_INTERSECT_FRUSTRUM = 2 }
 Definition of the state of a cell compared to a frustrum. More...
 

Public Member Functions

 ccOctreeFrustrumIntersector ()
 Default constructor.
 
bool build (CCLib::DgmOctree *octree)
 Prepares structure for frustrum filtering.
 
OctreeCellVisibility positionFromFrustum (CCLib::DgmOctree::OctreeCellCodeType truncatedCode, uchar level) const
 Returns the cell visibility.
 
void computeFrustumIntersectionWithOctree (std::vector< std::pair< unsigned, CCVector3 > > &pointsToTest, std::vector< unsigned > &inCameraFrustrum, const float planesCoefficients[6][4], const CCVector3 ptsFrustrum[8], const CCVector3 edges[6], const CCVector3 &center)
 Compute intersection betwen the octree and a frustrum and send back the indices of 3D points inside the frustrum or in cells interescting it. More...
 
void computeFrustumIntersectionByLevel (unsigned char level, CCLib::DgmOctree::OctreeCellCodeType parentTruncatedCode, OctreeCellVisibility parentResult, const float planesCoefficients[6][4], const CCVector3 ptsFrustrum[8], const CCVector3 edges[6], const CCVector3 &center)
 Compute intersection betwen the octree and the height children cells of a parent cell. More...
 
OctreeCellVisibility separatingAxisTest (const CCVector3 &bbMin, const CCVector3 &bbMax, const float planesCoefficients[6][4], const CCVector3 frustrumCorners[8], const CCVector3 frustrumEdges[6], const CCVector3 &frustrumCenter)
 Separating Axis Test. More...
 

Protected Attributes

CCLib::DgmOctree * m_associatedOctree
 
std::set
< CCLib::DgmOctree::OctreeCellCodeType > 
m_cellsBuilt [CCLib::DgmOctree::MAX_OCTREE_LEVEL+1]
 
std::set
< CCLib::DgmOctree::OctreeCellCodeType > 
m_cellsInFrustum [CCLib::DgmOctree::MAX_OCTREE_LEVEL+1]
 
std::set
< CCLib::DgmOctree::OctreeCellCodeType > 
m_cellsIntersectFrustum [CCLib::DgmOctree::MAX_OCTREE_LEVEL+1]
 

Member Enumeration Documentation

Definition of the state of a cell compared to a frustrum.

OUTSIDE : the celle is completely outside the frustrum (no intersection, no inclusion) INSIDE : the cell is completely inside the frustrum INTERSECT : other cases –> the frustrum is completely inside the cell OR the frustrum and the cell have an intersection

Member Function Documentation

void ccOctreeFrustrumIntersector::computeFrustumIntersectionByLevel ( unsigned char  level,
CCLib::DgmOctree::OctreeCellCodeType  parentTruncatedCode,
OctreeCellVisibility  parentResult,
const float  planesCoefficients[6][4],
const CCVector3  ptsFrustrum[8],
const CCVector3  edges[6],
const CCVector3 &  center 
)

Compute intersection betwen the octree and the height children cells of a parent cell.

Parameters
levelcurrent level
parentTruncatedCodetruncated code of the parent cell (at level-1)
parentResultcontains in which class the parent cell has been classified (OUTSIDE, INTERSECTING, INSIDE)
planesCoefficientscoefficients (a, b, c and d) of the six frustrum planes (0:right, 1:bottom, 2:left, 3:top, 4:near, 5:far)
ptsFrustrum3D coordinates of the eight corners of the frustrum (global coordinates sytem)
edges3D coordinates (global coordinates sytem) of the six director vector of the frustrum edges
center3D coordinates of the frustrum center (global coordinates sytem) ; this is the center of the circumscribed sphere
void ccOctreeFrustrumIntersector::computeFrustumIntersectionWithOctree ( std::vector< std::pair< unsigned, CCVector3 > > &  pointsToTest,
std::vector< unsigned > &  inCameraFrustrum,
const float  planesCoefficients[6][4],
const CCVector3  ptsFrustrum[8],
const CCVector3  edges[6],
const CCVector3 &  center 
)

Compute intersection betwen the octree and a frustrum and send back the indices of 3D points inside the frustrum or in cells interescting it.

Every cells of each level of the octree will be classified as INSIDE, OUTSIDE or INTERSECTING the frustrum. Their truncated code are then stored in m_cellsInFrustum (for cells INSIDE) or m_cellsIntersectFrustum (for cells INTERSECTING).

Parameters
pointsToTestcontains the indice and 3D position (global coordinates system) of every 3D points stored in an INTERSECTING cell
inCameraFrustrumcontains the indice of every 3D points stored in an INSIDE cell
planesCoefficientscoefficients (a, b, c and d) of the six frustrum planes (0:right, 1:bottom, 2:left, 3:top, 4:near, 5:far)
ptsFrustrum3D coordinates of the eight corners of the frustrum (global coordinates sytem)
edges3D coordinates (global coordinates sytem) of the six director vector of the frustrum edges
center3D coordinates of the frustrum center (global coordinates sytem) ; this is the center of the circumscribed sphere
ccOctreeFrustrumIntersector::OctreeCellVisibility ccOctreeFrustrumIntersector::separatingAxisTest ( const CCVector3 &  bbMin,
const CCVector3 &  bbMax,
const float  planesCoefficients[6][4],
const CCVector3  frustrumCorners[8],
const CCVector3  frustrumEdges[6],
const CCVector3 &  frustrumCenter 
)

Separating Axis Test.

See "Detecting intersection of a rectangular solid and a convex polyhedron" of Ned Greene See "OBBTree: A Hierarchical Structure for Rapid Interference Detection" of S. Gottschalk, M. C. Lin and D. Manocha

Parameters
bbMinminimum coordinates of the cell
bbMaxmaximum coordinates of the cell
planesCoefficientscoefficients (a, b, c and d) of the six frustrum planes (0:right, 1:bottom, 2:left, 3:top, 4:near, 5:far)
frustrumCorners3D coordinates of the eight corners of the frustrum (global coordinates sytem)
frustrumEdges3D coordinates (global coordinates sytem) of the six director vector of the frustrum edges
frustrumCenter3D coordinates of the frustrum center (global coordinates sytem) ; this is the center of the circumscribed sphere

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