Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
GrayLib::cHexahedron Class Reference

#include <cHexahedron.h>

Classes

struct  BBOX_INDICES_t
 

Public Types

typedef float DVALUE_t
 Dimension value type. More...
 
typedef UINT PLANES_MASK_t
 Bit Mask of the 6 planes. More...
 

Public Member Functions

 cHexahedron () noexcept
 
 cHexahedron (const cBounds3f &bbox)
 
PLANES_MASK_t get_FullPlanesMask () const noexcept
 
void UpdateBBoxIndices ()
 need to be called after planes were changed if you want BBox testing More...
 
bool GetIntersection (const cBounds3f &box, OUT PLANES_MASK_t *planesMask=nullptr) const
 
bool GetIntersection (const cSpheref &sphere, OUT PLANES_MASK_t *planesMask=nullptr) const
 
template<class TYPE >
GINTERSECT_TYPE IntersectTest (const TYPE &obj) const
 
void TransformCoords (const cMatrix4x4f &m)
 to transform polyhedrons, multiply by transpose of inverse of actual transform More...
 
void TransformNormals (const cMatrix4x4f &m)
 
void SetNormalized ()
 set coords. More...
 
void SetBounds (const cBounds3f &bbox)
 
void SetW (const cHexahedron &frustum, const cVector3f &vPos)
 
void SetFrustum (const cMatrix4x4f &m, DVALUE_t fUnit=1)
 
 UNITTEST_FRIEND (cHexahedron)
 

Static Public Attributes

static const int k_NUMPLANES = 6
 Hexahedron, Frustum, (maybe cubic?) More...
 

Protected Attributes

BBOX_INDICES_t m_BBoxIndices [k_NUMPLANES]
 for fast bbox tests More...
 
cPlanef m_aPlanes [k_NUMPLANES]
 represent the bbox as a set of planes. More...
 

Detailed Description

a six sided 3d object. e.g. Hexahedron, Frustum, cubic. convex polyhedral space, represented as union of half-spaces, each half-space represented as plane

Member Typedef Documentation

◆ DVALUE_t

Dimension value type.

◆ PLANES_MASK_t

Bit Mask of the 6 planes.

Constructor & Destructor Documentation

◆ cHexahedron() [1/2]

GrayLib::cHexahedron::cHexahedron ( )
inlinenoexcept

◆ cHexahedron() [2/2]

GrayLib::cHexahedron::cHexahedron ( const cBounds3f &  bbox)

Member Function Documentation

◆ get_FullPlanesMask()

PLANES_MASK_t GrayLib::cHexahedron::get_FullPlanesMask ( ) const
inlinenoexcept

◆ GetIntersection() [1/2]

bool GrayLib::cHexahedron::GetIntersection ( const cBounds3f &  box,
OUT PLANES_MASK_t planesMask = nullptr 
) const

does the bbox intersect the frustum/hexahedron? very fast and 100% precise requires pre-setup indices though (UpdateBBoxIndices)

◆ GetIntersection() [2/2]

bool GrayLib::cHexahedron::GetIntersection ( const cSpheref sphere,
OUT PLANES_MASK_t planesMask = nullptr 
) const

does the sphere intersect the frustum/hexahedron?

◆ IntersectTest()

template<class TYPE >
GINTERSECT_TYPE GrayLib::cHexahedron::IntersectTest ( const TYPE obj) const
inline

TYPE = cBounds3f, cSpheref

◆ SetBounds()

void GrayLib::cHexahedron::SetBounds ( const cBounds3f &  bbox)

◆ SetFrustum()

void GrayLib::cHexahedron::SetFrustum ( const cMatrix4x4f m,
DVALUE_t  fUnit = 1 
)

this is frustum in projected coords, back transformed to make pyramidal (or cubic) convex polyhedron

  • m = projected view of the frustum. fUnit = 1, 0.8f = shrink frustum to test clipping

◆ SetNormalized()

void GrayLib::cHexahedron::SetNormalized ( )
inline

set coords.

usually this is not needed unless you want normalized plane normals all plane checks work perfectly without normalization

◆ SetW()

void GrayLib::cHexahedron::SetW ( const cHexahedron frustum,
const cVector3f vPos 
)

Offset coords.

◆ TransformCoords()

void GrayLib::cHexahedron::TransformCoords ( const cMatrix4x4f m)
inline

to transform polyhedrons, multiply by transpose of inverse of actual transform

4x4 mult. SetMul e.g. Make a unit bbox into a camera frustum.

◆ TransformNormals()

void GrayLib::cHexahedron::TransformNormals ( const cMatrix4x4f m)
inline

3x3 mult

◆ UNITTEST_FRIEND()

GrayLib::cHexahedron::UNITTEST_FRIEND ( cHexahedron  )

◆ UpdateBBoxIndices()

void GrayLib::cHexahedron::UpdateBBoxIndices ( )

need to be called after planes were changed if you want BBox testing

Member Data Documentation

◆ k_NUMPLANES

const int GrayLib::cHexahedron::k_NUMPLANES = 6
static

Hexahedron, Frustum, (maybe cubic?)

◆ m_aPlanes

cPlanef GrayLib::cHexahedron::m_aPlanes[k_NUMPLANES]
protected

represent the bbox as a set of planes.

◆ m_BBoxIndices

BBOX_INDICES_t GrayLib::cHexahedron::m_BBoxIndices[k_NUMPLANES]
protected

for fast bbox tests


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