ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ccOctreeFrustumIntersector Class Reference

#include <ecvCameraSensor.h>

Collaboration diagram for ccOctreeFrustumIntersector:

Public Types

enum  OctreeCellVisibility { CELL_OUTSIDE_FRUSTUM = 0 , CELL_INSIDE_FRUSTUM = 1 , CELL_INTERSECT_FRUSTUM = 2 }
 Definition of the state of a cell compared to a frustum. More...
 

Public Member Functions

 ccOctreeFrustumIntersector ()
 Default constructor. More...
 
bool build (cloudViewer::DgmOctree *octree)
 Prepares structure for frustum filtering. More...
 
OctreeCellVisibility positionFromFrustum (cloudViewer::DgmOctree::CellCode truncatedCode, unsigned char level) const
 Returns the cell visibility. More...
 
void computeFrustumIntersectionWithOctree (std::vector< std::pair< unsigned, CCVector3 >> &pointsToTest, std::vector< unsigned > &inCameraFrustum, const float planesCoefficients[6][4], const CCVector3 ptsFrustum[8], const CCVector3 edges[6], const CCVector3 &center)
 
void computeFrustumIntersectionByLevel (unsigned char level, cloudViewer::DgmOctree::CellCode parentTruncatedCode, OctreeCellVisibility parentResult, const float planesCoefficients[6][4], const CCVector3 ptsFrustum[8], const CCVector3 edges[6], const CCVector3 &center)
 
OctreeCellVisibility separatingAxisTest (const CCVector3 &bbMin, const CCVector3 &bbMax, const float planesCoefficients[6][4], const CCVector3 frustumCorners[8], const CCVector3 frustumEdges[6], const CCVector3 &frustumCenter)
 Separating Axis Test. More...
 

Protected Attributes

cloudViewer::DgmOctreem_associatedOctree
 
std::unordered_set< cloudViewer::DgmOctree::CellCodem_cellsBuilt [cloudViewer::DgmOctree::MAX_OCTREE_LEVEL+1]
 
std::unordered_set< cloudViewer::DgmOctree::CellCodem_cellsInFrustum [cloudViewer::DgmOctree::MAX_OCTREE_LEVEL+1]
 
std::unordered_set< cloudViewer::DgmOctree::CellCodem_cellsIntersectFrustum [cloudViewer::DgmOctree::MAX_OCTREE_LEVEL+1]
 

Detailed Description

Definition at line 618 of file ecvCameraSensor.h.

Member Enumeration Documentation

◆ OctreeCellVisibility

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

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

Enumerator
CELL_OUTSIDE_FRUSTUM 
CELL_INSIDE_FRUSTUM 
CELL_INTERSECT_FRUSTUM 

Definition at line 626 of file ecvCameraSensor.h.

Constructor & Destructor Documentation

◆ ccOctreeFrustumIntersector()

ccOctreeFrustumIntersector::ccOctreeFrustumIntersector ( )
inline

Default constructor.

Definition at line 633 of file ecvCameraSensor.h.

Member Function Documentation

◆ build()

bool ccOctreeFrustumIntersector::build ( cloudViewer::DgmOctree octree)

Prepares structure for frustum filtering.

◆ computeFrustumIntersectionByLevel()

void ccOctreeFrustumIntersector::computeFrustumIntersectionByLevel ( unsigned char  level,
cloudViewer::DgmOctree::CellCode  parentTruncatedCode,
OctreeCellVisibility  parentResult,
const float  planesCoefficients[6][4],
const CCVector3  ptsFrustum[8],
const CCVector3  edges[6],
const CCVector3 center 
)

Compute intersection between 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 frustum planes (0:right, 1:bottom, 2:left, 3:top, 4:near, 5:far)
ptsFrustum3D coordinates of the eight corners of the frustum (global coordinates system)
edges3D coordinates (global coordinates system) of the six director vector of the frustum edges
center3D coordinates of the frustum center (global coordinates system) ; this is the center of the circumscribed sphere

◆ computeFrustumIntersectionWithOctree()

void ccOctreeFrustumIntersector::computeFrustumIntersectionWithOctree ( std::vector< std::pair< unsigned, CCVector3 >> &  pointsToTest,
std::vector< unsigned > &  inCameraFrustum,
const float  planesCoefficients[6][4],
const CCVector3  ptsFrustum[8],
const CCVector3  edges[6],
const CCVector3 center 
)

Compute intersection between the octree and a frustum and send back the indices of 3D points inside the frustum or in cells interescting it. Every cells of each level of the octree will be classified as INSIDE, OUTSIDE or INTERSECTING the frustum. 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
inCameraFrustumcontains the indice of every 3D points stored in an INSIDE cell
planesCoefficientscoefficients (a, b, c and d) of the six frustum planes (0:right, 1:bottom, 2:left, 3:top, 4:near, 5:far)
ptsFrustum3D coordinates of the eight corners of the frustum (global coordinates system)
edges3D coordinates (global coordinates system) of the six director vector of the frustum edges
center3D coordinates of the frustum center (global coordinates system) ; this is the center of the circumscribed sphere

◆ positionFromFrustum()

OctreeCellVisibility ccOctreeFrustumIntersector::positionFromFrustum ( cloudViewer::DgmOctree::CellCode  truncatedCode,
unsigned char  level 
) const
inline

◆ separatingAxisTest()

OctreeCellVisibility ccOctreeFrustumIntersector::separatingAxisTest ( const CCVector3 bbMin,
const CCVector3 bbMax,
const float  planesCoefficients[6][4],
const CCVector3  frustumCorners[8],
const CCVector3  frustumEdges[6],
const CCVector3 frustumCenter 
)

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 frustum planes (0:right, 1:bottom, 2:left, 3:top, 4:near, 5:far)
frustumCorners3D coordinates of the eight corners of the frustum (global coordinates system)
frustumEdges3D coordinates (global coordinates system) of the six director vector of the frustum edges
frustumCenter3D coordinates of the frustum center (global coordinates system) ; this is the center of the circumscribed sphere

Member Data Documentation

◆ m_associatedOctree

cloudViewer::DgmOctree* ccOctreeFrustumIntersector::m_associatedOctree
protected

Definition at line 722 of file ecvCameraSensor.h.

Referenced by positionFromFrustum().

◆ m_cellsBuilt

std::unordered_set<cloudViewer::DgmOctree::CellCode> ccOctreeFrustumIntersector::m_cellsBuilt[cloudViewer::DgmOctree::MAX_OCTREE_LEVEL+1]
protected

Definition at line 726 of file ecvCameraSensor.h.

◆ m_cellsInFrustum

std::unordered_set<cloudViewer::DgmOctree::CellCode> ccOctreeFrustumIntersector::m_cellsInFrustum[cloudViewer::DgmOctree::MAX_OCTREE_LEVEL+1]
protected

Definition at line 729 of file ecvCameraSensor.h.

Referenced by positionFromFrustum().

◆ m_cellsIntersectFrustum

std::unordered_set<cloudViewer::DgmOctree::CellCode> ccOctreeFrustumIntersector::m_cellsIntersectFrustum[cloudViewer::DgmOctree::MAX_OCTREE_LEVEL+ 1]
protected

Definition at line 732 of file ecvCameraSensor.h.

Referenced by positionFromFrustum().


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