Open CASCADE Technology  6.9.0
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
OpenGl_BVHTreeSelector Class Reference

BVHTreeSelector class provides a possibility to store parameters of view volume, such as its vertices and equations, and contains methods detecting if given AABB overlaps view volume. More...

#include <OpenGl_BVHTreeSelector.hxx>

Public Member Functions

 OpenGl_BVHTreeSelector ()
 Creates an empty selector object with parallel projection type by default. More...
 
void SetViewVolume (const Handle< Graphic3d_Camera > &theCamera)
 Retrieves view volume's planes equations and its vertices from projection and modelview matrices. More...
 
Standard_Boolean Intersect (const OpenGl_Vec4 &theMinPt, const OpenGl_Vec4 &theMaxPt) const
 Detects if AABB overlaps view volume using separating axis theorem (SAT). More...
 
void CacheClipPtsProjections ()
 Caches view volume's vertices projections along its normals and AABBs dimensions. Must be called at the beginning of each BVH tree traverse loop. More...
 
const Standard_Size ProjectionState ()
 Returnes the state of projection matrix previously saved in selector. More...
 
Standard_SizeChangeProjectionState ()
 Returnes the link for changing the state of projection matrix. More...
 
const Standard_Size ModelViewState ()
 Returnes the state of model view matrix previously saved in selector. More...
 
Standard_SizeChangeModelViewState ()
 Returnes the link for changing the state of model view matrix. More...
 

Protected Types

enum  {
  Plane_Top, Plane_Bottom, Plane_Left, Plane_Right,
  Plane_Near, Plane_Far, PlanesNB
}
 Enumerates planes of view volume. More...
 
enum  {
  ClipVert_LeftTopNear, ClipVert_LeftBottomNear, ClipVert_RightTopNear, ClipVert_RightBottomNear,
  ClipVert_LeftTopFar, ClipVert_LeftBottomFar, ClipVert_RightTopFar, ClipVert_RightBottomFar,
  ClipVerticesNB
}
 Enumerates vertices of view volume. More...
 

Protected Member Functions

Standard_ShortReal SignedPlanePointDistance (const OpenGl_Vec4 &theNormal, const OpenGl_Vec4 &thePnt)
 Calculates signed distance from plane to point. More...
 

Protected Attributes

OpenGl_Vec4 myClipPlanes [PlanesNB]
 Plane equations. More...
 
OpenGl_Vec4 myClipVerts [ClipVerticesNB]
 Vertices. More...
 
Standard_ShortReal myMaxClipProjectionPts [PlanesNB]
 Max view volume's vertices projections onto its normals. More...
 
Standard_ShortReal myMinClipProjectionPts [PlanesNB]
 Min view volume's vertices projections onto its normals. More...
 
Standard_ShortReal myMaxOrthoProjectionPts [3]
 Max view volume's vertices projections onto normalized dimensions of AABB. More...
 
Standard_ShortReal myMinOrthoProjectionPts [3]
 Min view volume's vertices projections onto normalized dimensions of AABB. More...
 
Standard_Boolean myIsProjectionParallel
 
Standard_Size myProjectionState
 
Standard_Size myModelViewState
 Caches the state of projection matrix to prevent unnecessary updates. More...
 

Detailed Description

BVHTreeSelector class provides a possibility to store parameters of view volume, such as its vertices and equations, and contains methods detecting if given AABB overlaps view volume.

Member Enumeration Documentation

anonymous enum
protected

Enumerates planes of view volume.

Enumerator
Plane_Top 
Plane_Bottom 
Plane_Left 
Plane_Right 
Plane_Near 
Plane_Far 
PlanesNB 
anonymous enum
protected

Enumerates vertices of view volume.

Enumerator
ClipVert_LeftTopNear 
ClipVert_LeftBottomNear 
ClipVert_RightTopNear 
ClipVert_RightBottomNear 
ClipVert_LeftTopFar 
ClipVert_LeftBottomFar 
ClipVert_RightTopFar 
ClipVert_RightBottomFar 
ClipVerticesNB 

Constructor & Destructor Documentation

OpenGl_BVHTreeSelector::OpenGl_BVHTreeSelector ( )

Creates an empty selector object with parallel projection type by default.

Member Function Documentation

void OpenGl_BVHTreeSelector::CacheClipPtsProjections ( )

Caches view volume's vertices projections along its normals and AABBs dimensions. Must be called at the beginning of each BVH tree traverse loop.

Standard_Size& OpenGl_BVHTreeSelector::ChangeModelViewState ( )
inline

Returnes the link for changing the state of model view matrix.

Standard_Size& OpenGl_BVHTreeSelector::ChangeProjectionState ( )
inline

Returnes the link for changing the state of projection matrix.

Standard_Boolean OpenGl_BVHTreeSelector::Intersect ( const OpenGl_Vec4 theMinPt,
const OpenGl_Vec4 theMaxPt 
) const

Detects if AABB overlaps view volume using separating axis theorem (SAT).

Parameters
theMinPt[in] maximum point of AABB.
theMaxPt[in] minimum point of AABB.
Returns
Standard_True, if AABB is in viewing area, Standard_False otherwise.
const Standard_Size OpenGl_BVHTreeSelector::ModelViewState ( )
inline

Returnes the state of model view matrix previously saved in selector.

const Standard_Size OpenGl_BVHTreeSelector::ProjectionState ( )
inline

Returnes the state of projection matrix previously saved in selector.

void OpenGl_BVHTreeSelector::SetViewVolume ( const Handle< Graphic3d_Camera > &  theCamera)

Retrieves view volume's planes equations and its vertices from projection and modelview matrices.

Standard_ShortReal OpenGl_BVHTreeSelector::SignedPlanePointDistance ( const OpenGl_Vec4 theNormal,
const OpenGl_Vec4 thePnt 
)
protected

Calculates signed distance from plane to point.

Parameters
theNormal[in] the plane's normal.
thePnt[in]

Field Documentation

OpenGl_Vec4 OpenGl_BVHTreeSelector::myClipPlanes[PlanesNB]
protected

Plane equations.

OpenGl_Vec4 OpenGl_BVHTreeSelector::myClipVerts[ClipVerticesNB]
protected

Vertices.

Standard_Boolean OpenGl_BVHTreeSelector::myIsProjectionParallel
protected
Standard_ShortReal OpenGl_BVHTreeSelector::myMaxClipProjectionPts[PlanesNB]
protected

Max view volume's vertices projections onto its normals.

Standard_ShortReal OpenGl_BVHTreeSelector::myMaxOrthoProjectionPts[3]
protected

Max view volume's vertices projections onto normalized dimensions of AABB.

Standard_ShortReal OpenGl_BVHTreeSelector::myMinClipProjectionPts[PlanesNB]
protected

Min view volume's vertices projections onto its normals.

Standard_ShortReal OpenGl_BVHTreeSelector::myMinOrthoProjectionPts[3]
protected

Min view volume's vertices projections onto normalized dimensions of AABB.

Standard_Size OpenGl_BVHTreeSelector::myModelViewState
protected

Caches the state of projection matrix to prevent unnecessary updates.

Standard_Size OpenGl_BVHTreeSelector::myProjectionState
protected

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