NLMISC::CAABBox Class Reference

An Axis Aligned Bounding Box. More...

#include <aabbox.h>

Inherited by NLMISC::CAABBoxExt [private].

List of all members.

Public Member Functions

 CAABBox ()
 Empty bbox Constructor. (for AABBoxExt::getRadius() correctness).
void serial (NLMISC::IStream &f)
Builds.



void setCenter (const CVector &center)
void setHalfSize (const CVector &hs)
void setSize (const CVector &s)
 Set the size of the bbox (ie 2* the halfSize).
void setMinMax (const CVector &bmin, const CVector &bmax)
 Build the bbox, with a min/max style bbox.
void extend (const CVector &v)
 extend the bbox so it contains v.
Gets.



CVector getMin () const
CVector getMax () const
void getMin (CVector &ret) const
void getMax (CVector &ret) const
const CVectorgetCenter () const
const CVectorgetHalfSize () const
CVector getSize () const
 Return the size of the bbox.
void getSize (CVector &ret) const
float getRadius () const
 Return the radius of the bbox.
Clip



bool clipFront (const CPlane &p) const
 Is the bbox partially in front of the plane??
bool clipBack (const CPlane &p) const
 Is the bbox partially in back of the plane??
bool include (const CVector &a) const
 Does the bbox include this point.
bool include (const CAABBox &box) const
 Does the bbox include entirely this bbox.
bool intersect (const CAABBox &box) const
 Does the bbox intersect the bbox box.
bool intersect (const CVector &a, const CVector &b, const CVector &c) const
 Does the bbox intersect the triangle ABC.
bool intersect (const CBSphere &s) const
 Does the bbox instersect the sphere s.
bool intersect (const CVector &a, const CVector &b) const
 Does the bbox instersect the segment AB.
bool clipSegment (CVector &a, CVector &b) const
 clip the segment by the bbox. return false if don't intersect. a and b are modified.

Protected Attributes

CVector Center
 The center of the bbox.
CVector HalfSize
 The size/2 of the bbox.

Misc



void makePyramid (CPlane planes[6]) const
 Build the equivalent polytope of planes.
void computeIntersection (const CAABBox &b1, const CAABBox &b2)
 Compute the intersection of 2 bboxs.
static CAABBox computeAABBoxUnion (const CAABBox &b1, const CAABBox &b2)
 Compute the union of 2 bboxs, that is the aabbox that contains the 2 others.
static CAABBox transformAABBox (const CMatrix &mat, const CAABBox &box)
 Apply a matrix on an aabbox.

Detailed Description

An Axis Aligned Bounding Box.

Note: Center/HalfSize set to private, to have same manipulation for CAABBox and CAABBoxExt.

Author:
Lionel Berenguier
Nevrax France
Date:
2000

Definition at line 48 of file aabbox.h.


Constructor & Destructor Documentation

NLMISC::CAABBox::CAABBox (  )  [inline]

Empty bbox Constructor. (for AABBoxExt::getRadius() correctness).

Definition at line 59 of file aabbox.h.


Member Function Documentation

bool NLMISC::CAABBox::clipBack ( const CPlane p  )  const
bool NLMISC::CAABBox::clipFront ( const CPlane p  )  const

Is the bbox partially in front of the plane??

Reimplemented in NLMISC::CAABBoxExt.

Definition at line 37 of file aabbox.cpp.

References Center, HalfSize, NLMISC::CVector::set(), NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

bool NLMISC::CAABBox::clipSegment ( CVector a,
CVector b 
) const

clip the segment by the bbox. return false if don't intersect. a and b are modified.

Definition at line 154 of file aabbox.cpp.

References include(), and makePyramid().

CAABBox NLMISC::CAABBox::computeAABBoxUnion ( const CAABBox b1,
const CAABBox b2 
) [static]

Compute the union of 2 bboxs, that is the aabbox that contains the 2 others.

Compute the union of 2 aabboxes, that is the aabbox that contains the 2.

Should end up in NLMISC

Definition at line 233 of file aabbox.cpp.

References getMax(), getMin(), NLMISC::CVector::maxof(), min, NLMISC::CVector::minof(), and setMinMax().

Referenced by NL3D::CPSLocated::computeBBox(), NL3D::CSkeletonModel::computeWorldBBoxForShadow(), NL3D::CParticleSystem::forceComputeBBox(), and NL3D::CPatchDLMContext::generate().

void NLMISC::CAABBox::computeIntersection ( const CAABBox b1,
const CAABBox b2 
)

Compute the intersection of 2 bboxs.

NB: this methods suppose the intersection exist, and doesn't check it (use intersect() to check). If !intersect, *this is still modified and the result bbox is big shit.

Definition at line 249 of file aabbox.cpp.

References getMax(), getMin(), NLMISC::CVector::maxof(), NLMISC::CVector::minof(), and setMinMax().

void NLMISC::CAABBox::extend ( const CVector v  ) 

extend the bbox so it contains v.

Warning!! By default, a bbox is the vector 0,0,0. So set the first vertex with setCenter() or else the bbox will be the extension of v and (0,0,0)...

Definition at line 217 of file aabbox.cpp.

References getMax(), getMin(), NLMISC::CVector::minof(), and setMinMax().

Referenced by NL3D::CMiniCol::addFaces(), NL3D::CPatch::addTileTrianglesInBBox(), NL3D::CShadowPolyReceiver::addTriangle(), NL3D::CZone::applyHeightField(), NLPACS::CEdgeQuad::build(), NLPACS::CChainQuad::build(), NL3D::CZone::build(), NL3D::CVisualCollisionMesh::build(), NL3D::CShapeInfo::build(), NL3D::CPackedZone32::build(), NL3D::CPackedWorld::build(), NL3D::CCameraCol::build(), NL3D::CShadowMap::buildClipInfoFromMatrix(), NL3D::CCameraCol::buildRay(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CInstanceLighter::compilePointLightRT(), NL3D::CSkeletonModel::computeCurrentBBox(), NL3D::CSkeletonModel::computeRenderedBBox(), NL3D::CInstanceLighter::computeSunContribution(), NLPACS::computeSurfaceQuadTree(), NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater(), NLPACS::CCollisionMeshBuild::computeTrivialTranslation(), NL3D::CVisualCollisionMesh::computeWorldBBox(), NLPACS::CGlobalRetriever::doMove(), NL3D::CVegetableClipBlock::extendBBoxOnly(), NL3D::CTessBlock::extendSphereAdd(), NL3D::CPatchDLMContext::generate(), NL3D::CMiniCol::getGroundNormal(), NL3D::CMeshMRMSkinnedGeom::getSkinBoneBBox(), NL3D::CMeshMRMGeom::getSkinBoneBBox(), NLPACS::CLocalRetriever::initFaceGrid(), NL3D::CQuadGridClipClusterQTreeNode::insertModel(), NL3D::CQuadGridClipManager::linkModel(), NL3D::makeBBox(), NLPACS::CGlobalRetriever::makeInstance(), NL3D::CCluster::makeVolume(), NLPACS::CGlobalRetriever::testBBoxMove(), NLPACS::CGlobalRetriever::testBBoxRot(), and NLPACS::CGlobalRetriever::testCylinderMove().

const CVector& NLMISC::CAABBox::getCenter (  )  const [inline]
const CVector& NLMISC::CAABBox::getHalfSize (  )  const [inline]
void NLMISC::CAABBox::getMax ( CVector ret  )  const [inline]

Definition at line 91 of file aabbox.h.

References Center, and HalfSize.

CVector NLMISC::CAABBox::getMax (  )  const [inline]

Reimplemented in NLMISC::CAABBoxExt.

Definition at line 89 of file aabbox.h.

References Center, and HalfSize.

Referenced by NL3D::CVisualCollisionMesh::CStaticGrid::add(), NL3D::CMiniCol::addFaces(), NL3D::CVisualCollisionManager::addMeshInstanceCollision(), NL3D::CShadowMapManager::addShadowReceiver(), NL3D::CShadowPolyReceiver::addTriangle(), NL3D::CLandscape::addZone(), NLPACS::CEdgeQuad::build(), NLPACS::CChainQuad::build(), NL3D::CPackedZone32::build(), NL3D::CPackedWorld::build(), NL3D::CLandscape::buildPatchBlocksInBBox(), NL3D::CLandscape::buildTrianglesInBBox(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CInstanceLighter::compilePointLightRT(), computeAABBoxUnion(), NL3D::CLandscape::computeDynamicLighting(), computeIntersection(), NL3D::CInstanceLighter::computeSunContribution(), NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater(), NL3D::CPSUtil::displayBBox(), extend(), NLSOUND::CClusteredSound::getAABoxNearestPos(), NL3D::CVisualCollisionManager::getCameraCollision(), NL3D::CShadowPolyReceiver::getCameraCollision(), NL3D::CMiniCol::getFaces(), NL3D::CVisualCollisionManager::getMeshs(), NL3D::CVisualCollisionManager::getRayCollision(), NLPACS::CMoveContainer::init(), NL3D::CQuadGridClipClusterQTreeNode::init(), NLPACS::CLocalRetriever::initFaceGrid(), intersect(), NLPACS::CGlobalRetriever::makeInstance(), NL3D::CZoneLighter::makeQuadGridFromWaterShapes(), NL3D::CVisualCollisionManager::receiveShadowMap(), NL3D::CClipTrav::registerCluster(), NL3D::CMiniCol::removeLandScapePart(), NL3D::CLandscape::removeZone(), NL3D::CShadowPolyReceiver::render(), NL3D::CShadowMapManager::renderProject(), NLPACS::CLocalRetriever::retrieveAccuratePosition(), NLPACS::CLocalRetriever::retrievePosition(), NL3D::CVisualCollisionMesh::CStaticGrid::select(), NLPACS::CEdgeQuad::selectEdges(), NLPACS::CChainQuad::selectEdges(), NLPACS::CGlobalRetriever::selectInstances(), and transformAABBox().

void NLMISC::CAABBox::getMin ( CVector ret  )  const [inline]

Definition at line 90 of file aabbox.h.

References Center, and HalfSize.

CVector NLMISC::CAABBox::getMin (  )  const [inline]

Reimplemented in NLMISC::CAABBoxExt.

Definition at line 88 of file aabbox.h.

References Center, and HalfSize.

Referenced by NL3D::CVisualCollisionMesh::CStaticGrid::add(), NL3D::CMiniCol::addFaces(), NL3D::CVisualCollisionManager::addMeshInstanceCollision(), NL3D::CShadowMapManager::addShadowReceiver(), NL3D::CShadowPolyReceiver::addTriangle(), NL3D::CLandscape::addZone(), NL3D::CPackedZone32::appendSelection(), NL3D::CPackedZone16::appendSelection(), NLPACS::CEdgeQuad::build(), NLPACS::CChainQuad::build(), NL3D::CPackedZone32::build(), NL3D::CPackedWorld::build(), NL3D::CShadowMap::buildCasterCameraMatrix(), NL3D::CLandscape::buildPatchBlocksInBBox(), NL3D::CLandscape::buildTrianglesInBBox(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CInstanceLighter::compilePointLightRT(), computeAABBoxUnion(), NL3D::CLandscape::computeDynamicLighting(), computeIntersection(), NL3D::CInstanceLighter::computeSunContribution(), NL3D::CVisualCollisionMesh::CStaticGrid::create(), NL3D::CPSUtil::displayBBox(), extend(), NLSOUND::CClusteredSound::getAABoxNearestPos(), NL3D::CVisualCollisionManager::getCameraCollision(), NL3D::CShadowPolyReceiver::getCameraCollision(), NL3D::CMiniCol::getFaces(), NL3D::CVisualCollisionManager::getMeshs(), NL3D::CVisualCollisionManager::getRayCollision(), NLPACS::CMoveContainer::init(), NL3D::CQuadGridClipClusterQTreeNode::init(), NLPACS::CLocalRetriever::initFaceGrid(), intersect(), NLPACS::CGlobalRetriever::makeInstance(), NL3D::CZoneLighter::makeQuadGridFromWaterShapes(), NL3D::CVisualCollisionManager::receiveShadowMap(), NL3D::CClipTrav::registerCluster(), NL3D::CMiniCol::removeLandScapePart(), NL3D::CLandscape::removeZone(), NL3D::CShadowPolyReceiver::render(), NL3D::CShadowMapManager::renderProject(), NLPACS::CLocalRetriever::retrieveAccuratePosition(), NLPACS::CLocalRetriever::retrievePosition(), NL3D::CVisualCollisionMesh::CStaticGrid::select(), NLPACS::CEdgeQuad::selectEdges(), NLPACS::CChainQuad::selectEdges(), NLPACS::CGlobalRetriever::selectInstances(), and transformAABBox().

float NLMISC::CAABBox::getRadius ( void   )  const [inline]
void NLMISC::CAABBox::getSize ( CVector ret  )  const [inline]

Definition at line 96 of file aabbox.h.

References HalfSize.

CVector NLMISC::CAABBox::getSize ( void   )  const [inline]

Return the size of the bbox.

Reimplemented in NLMISC::CAABBoxExt.

Definition at line 95 of file aabbox.h.

References HalfSize.

Referenced by NL3D::CShadowMap::buildCasterCameraMatrix(), NL3D::CVisualCollisionMesh::CStaticGrid::create(), and NL3D::CQuadGridClipManager::profile().

bool NLMISC::CAABBox::include ( const CAABBox box  )  const

Does the bbox include entirely this bbox.

Definition at line 92 of file aabbox.cpp.

References Center, HalfSize, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

bool NLMISC::CAABBox::include ( const CVector a  )  const
bool NLMISC::CAABBox::intersect ( const CVector a,
const CVector b 
) const

Does the bbox instersect the segment AB.

Definition at line 135 of file aabbox.cpp.

References include(), and makePyramid().

bool NLMISC::CAABBox::intersect ( const CBSphere s  )  const

Does the bbox instersect the sphere s.

Definition at line 176 of file aabbox.cpp.

References NLMISC::CBSphere::Center, Center, HalfSize, NLMISC::CBSphere::Radius, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

bool NLMISC::CAABBox::intersect ( const CVector a,
const CVector b,
const CVector c 
) const

Does the bbox intersect the triangle ABC.

Reimplemented in NLMISC::CAABBoxExt.

Definition at line 119 of file aabbox.cpp.

References NLMISC::CPolygon::clip(), NLMISC::CPolygon::getNumVertices(), include(), and makePyramid().

bool NLMISC::CAABBox::intersect ( const CAABBox box  )  const
void NLMISC::CAABBox::makePyramid ( CPlane  planes[6]  )  const

Build the equivalent polytope of planes.

Definition at line 192 of file aabbox.cpp.

References Center, HalfSize, and NLMISC::CPlane::make().

Referenced by clipSegment(), and intersect().

void NLMISC::CAABBox::serial ( NLMISC::IStream f  ) 

Reimplemented in NLMISC::CAABBoxExt.

Definition at line 204 of file aabbox.cpp.

References Center, HalfSize, NLMISC::IStream::serial(), NLMISC::IStream::serialVersion(), and void().

void NLMISC::CAABBox::setCenter ( const CVector center  )  [inline]

Reimplemented in NLMISC::CAABBoxExt.

Definition at line 68 of file aabbox.h.

References Center.

Referenced by NL3D::CMiniCol::addFaces(), NL3D::CPatch::addTileTrianglesInBBox(), NL3D::CShadowPolyReceiver::addTriangle(), NL3D::CZone::applyHeightField(), NLPACS::CEdgeQuad::build(), NLPACS::CChainQuad::build(), NL3D::CZone::build(), NL3D::CVisualCollisionMesh::build(), NL3D::CCameraCol::build(), NL3D::CShadowMap::buildClipInfoFromMatrix(), NL3D::CCameraCol::buildRay(), NL3D::CPatchDLMPointLight::compile(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CInstanceLighter::compilePointLightRT(), NL3D::CSkeletonModel::computeCurrentBBox(), NL3D::CSkeletonModel::computeRenderedBBox(), NL3D::CInstanceLighter::computeSunContribution(), NLPACS::computeSurfaceQuadTree(), NLPACS::CCollisionMeshBuild::computeTrivialTranslation(), NL3D::CVisualCollisionMesh::computeWorldBBox(), NL3D::CSkeletonShape::CSkeletonShape(), NLPACS::CSurfaceQuadTree::CSurfaceQuadTree(), NL3D::CVisualCollisionEntity::doComputeLandscape(), NLPACS::CGlobalRetriever::doMove(), NL3D::CVegetableClipBlock::extendSphere(), NL3D::CTessBlock::extendSphereFirst(), NLPACS::CGlobalRetriever::findCollisionChains(), NL3D::CParticleSystem::forceComputeBBox(), NL3D::CPatchDLMContext::generate(), NL3D::CWaveMakerShape::getAABBox(), NL3D::CTransformShape::getAABBox(), NL3D::CTransform::getAABBox(), NL3D::IShape::getAABBox(), NL3D::CParticleSystemShape::getAABBox(), NL3D::CFlareShape::getAABBox(), NLMISC::CAABBoxExt::getAABBox(), NLPACS::IQuadNode::getBBox(), NL3D::CMiniCol::getGroundNormal(), NL3D::CTransform::getReceiverBBox(), NL3D::CLandscapeModel::getReceiverBBox(), NL3D::CMeshMRMSkinnedGeom::getSkinBoneBBox(), NL3D::CMeshMRMGeom::getSkinBoneBBox(), NLPACS::CSurfaceQuadTree::init(), NLPACS::CGlobalRetriever::init(), NL3D::CQuadGridClipClusterQTreeNode::init(), NLPACS::CLocalRetriever::initFaceGrid(), NL3D::CInstanceLighter::light(), NL3D::CQuadGridClipManager::linkModel(), NLPACS::CRetrieverInstance::make(), NL3D::makeBBox(), NL3D::CCluster::makeVolume(), NL3D::CVisualCollisionManager::receiveShadowMap(), NLPACS::CGlobalRetriever::refreshLrAround(), NLPACS::CGlobalRetriever::refreshLrAroundNow(), NL3D::CMiniCol::removeLandScapePart(), NL3D::CShadowPolyReceiver::render(), NL3D::CShadowMapManager::renderProject(), NLPACS::CGlobalRetriever::retrievePosition(), NLPACS::CGlobalRetriever::testBBoxMove(), NLPACS::CGlobalRetriever::testBBoxRot(), NLPACS::CGlobalRetriever::testCylinderMove(), and NLPACS::CSurfaceQuadTree::translate().

void NLMISC::CAABBox::setHalfSize ( const CVector hs  )  [inline]

Reimplemented in NLMISC::CAABBoxExt.

Definition at line 69 of file aabbox.h.

References HalfSize.

Referenced by NL3D::CPSUtil::addRadiusToAABBox(), NL3D::CLandscape::addZone(), NL3D::CZone::applyHeightField(), NL3D::CZone::build(), NL3D::CCameraCol::build(), NL3D::CShadowMap::buildCasterCameraMatrix(), NL3D::CShadowMap::buildClipInfoFromMatrix(), NL3D::CCameraCol::buildRay(), NL3D::CPatchDLMPointLight::compile(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CInstanceLighter::compilePointLightRT(), NL3D::CSkeletonModel::computeCurrentBBox(), NL3D::CSkeletonModel::computeRenderedBBox(), NL3D::CVisualCollisionEntity::CVisualCollisionEntity(), NL3D::CVisualCollisionEntity::doComputeLandscape(), NL3D::CVegetableClipBlock::extendSphere(), NL3D::CTessBlock::extendSphereFirst(), NL3D::CParticleSystem::forceComputeBBox(), NL3D::CWaveMakerShape::getAABBox(), NL3D::CTransformShape::getAABBox(), NL3D::CTransform::getAABBox(), NL3D::IShape::getAABBox(), NL3D::CParticleSystemShape::getAABBox(), NL3D::CFlareShape::getAABBox(), NLMISC::CAABBoxExt::getAABBox(), NLPACS::IQuadNode::getBBox(), NL3D::CTransform::getReceiverBBox(), NL3D::CLandscapeModel::getReceiverBBox(), NL3D::CMeshMRMSkinnedGeom::getSkinBoneBBox(), NL3D::CMeshMRMGeom::getSkinBoneBBox(), NLPACS::CSurfaceQuadTree::init(), NLPACS::CGlobalRetriever::init(), NL3D::CInstanceLighter::light(), NLPACS::CRetrieverInstance::make(), NLPACS::CGlobalRetriever::refreshLrAround(), NLPACS::CGlobalRetriever::refreshLrAroundNow(), NL3D::CMiniCol::removeLandScapePart(), NL3D::CLandscape::removeZone(), and NLPACS::CGlobalRetriever::retrievePosition().

void NLMISC::CAABBox::setMinMax ( const CVector bmin,
const CVector bmax 
) [inline]
void NLMISC::CAABBox::setSize ( const CVector s  )  [inline]

Set the size of the bbox (ie 2* the halfSize).

Reimplemented in NLMISC::CAABBoxExt.

Definition at line 71 of file aabbox.h.

References HalfSize.

Referenced by NL3D::CSkeletonShape::CSkeletonShape(), NLPACS::CSurfaceQuadTree::CSurfaceQuadTree(), and NL3D::CQuadGridClipClusterQTreeNode::init().

CAABBox NLMISC::CAABBox::transformAABBox ( const CMatrix mat,
const CAABBox box 
) [static]

Member Data Documentation


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

Generated on Thu Jan 7 08:30:17 2010 for NeL by  doxygen 1.6.1