From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a02157.html | 1813 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1813 insertions(+) create mode 100644 docs/doxygen/nel/a02157.html (limited to 'docs/doxygen/nel/a02157.html') diff --git a/docs/doxygen/nel/a02157.html b/docs/doxygen/nel/a02157.html new file mode 100644 index 00000000..5a409875 --- /dev/null +++ b/docs/doxygen/nel/a02157.html @@ -0,0 +1,1813 @@ + + +NeL: NLMISC::CAABBoxExt class Reference + + + +
+

NLMISC::CAABBoxExt Class Reference

#include <aabbox.h> +

+

Inheritance diagram for NLMISC::CAABBoxExt: +

+ +NLMISC::CAABBox + +

Detailed Description

+An Extended Axis Aligned Bouding Box. Sphere Min/Max Radius is stored for improved clip test.
Author:
Lionel Berenguier

+Nevrax France

+
Date:
2000
+ +

+ +

+Definition at line 159 of file aabbox.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Misc

void computeIntersection (const CAABBox &b1, const CAABBox &b2)
void makePyramid (CPlane planes[6]) const
 Build the equivalent polytope of planes.

CAABBox computeAABBoxUnion (const CAABBox &b1, const CAABBox &b2)
CAABBox transformAABBox (const CMatrix &mat, const CAABBox &box)

Public Member Functions

 CAABBoxExt (const CAABBox &o)
 Constructor from a normal BBox.

 CAABBoxExt ()
 Empty bbox Constructor.

void serial (NLMISC::IStream &f)
Clip
bool clipBack (const CPlane &p) const
 Is the bbox partially in back of the plane?? p MUST be normalized.

bool clipFront (const CPlane &p) const
 Is the bbox partially in front of the plane?? p MUST be normalized.

bool intersect (const CVector &a, const CVector &b, const CVector &c) const
 Does the bbox intersect the triangle ABC.

bool intersect (const CAABBoxExt &box) const
 Does the bbox intersect the bbox box.

Gets.
CAABBox getAABBox () const
 Return a simple Axis Aligned Bounding Box (no radius inside).

const CVectorgetCenter () const
 Return a simple Axis Aligned Bounding Box (no radius inside).

const CVectorgetHalfSize () const
 Return a simple Axis Aligned Bounding Box (no radius inside).

CVector getMax () const
 Return a simple Axis Aligned Bounding Box (no radius inside).

CVector getMin () const
 Return a simple Axis Aligned Bounding Box (no radius inside).

float getRadius () const
 Return the (stored!!) radius of the bbox.

CVector getSize () const
 Return the size of the bbox.

Builds.
CAABBoxExtoperator= (const CAABBox &o)
void setCenter (const CVector &center)
void setHalfSize (const CVector &hs)
void setMinMax (const CVector &bmin, const CVector &bmax)
 Build the bbox, with a min/max style bbox.

void setSize (const CVector &s)
 Set the size of the bbox (ie 2* the halfSize).


Protected Member Functions

void updateRadius ()

Protected Attributes

float RadiusMax
float RadiusMin

Private Member Functions

Clip
bool clipSegment (CVector &a, CVector &b) const
 clip the segment by the bbox. return false if don't intersect. a and b are modified.

bool include (const CAABBox &box) const
 Does the bbox include entirely this bbox.

bool include (const CVector &a) const
 Does the bbox include this point.

bool intersect (const CVector &a, const CVector &b) const
 Does the bbox instersect the segment AB.

bool intersect (const CBSphere &s) const
 Does the bbox instersect the sphere s.

bool intersect (const CAABBox &box) const
 Does the bbox intersect the bbox box.

Builds.
void extend (const CVector &v)
Gets.
void getMax (CVector &ret) const
void getMin (CVector &ret) const
void getSize (CVector &ret) const

Private Attributes

CVector Center
 The center of the bbox.

CVector HalfSize
 The size/2 of the bbox.

+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLMISC::CAABBoxExt::CAABBoxExt  )  [inline]
+
+ + + + + +
+   + + +

+Empty bbox Constructor. +

+ +

+Definition at line 174 of file aabbox.h. +

+References RadiusMax, and RadiusMin. +

+

00174 {RadiusMin= RadiusMax=0;}
+
+

+ + + + +
+ + + + + + + + + + +
NLMISC::CAABBoxExt::CAABBoxExt const CAABBox o  )  [inline]
+
+ + + + + +
+   + + +

+Constructor from a normal BBox. +

+ +

+Definition at line 176 of file aabbox.h. +

+References RadiusMax, and RadiusMin. +

+

00176 {RadiusMin= RadiusMax=0; *this=o;}
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CAABBoxExt::clipBack const CPlane p  )  const
+
+ + + + + +
+   + + +

+Is the bbox partially in back of the plane?? p MUST be normalized. +

+ +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 319 of file aabbox.cpp. +

+References RadiusMax, and RadiusMin. +

+Referenced by NL3D::CZone::clip(), NL3D::CQuadGridClipClusterQTreeNode::clip(), NL3D::CMeshMRMSkinnedGeom::clip(), NL3D::CMeshMRMGeom::clip(), and NL3D::CMeshGeom::clip(). +

+

00320 {
+00321         // Assume normalized planes.
+00322 
+00323         // if( SpherMax OUT )   return false.
+00324         float   d= p*Center;
+00325         if(d>RadiusMax)
+00326                 return false;
+00327         // if( SphereMin IN )   return true;
+00328         if(d<RadiusMin)
+00329                 return true;
+00330 
+00331         // else, standard clip box.
+00332         return CAABBox::clipBack(p);
+00333 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CAABBoxExt::clipFront const CPlane p  )  const
+
+ + + + + +
+   + + +

+Is the bbox partially in front of the plane?? p MUST be normalized. +

+ +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 301 of file aabbox.cpp. +

+References RadiusMax, and RadiusMin. +

+Referenced by NL3D::CZone::clip(), and NL3D::CQuadGridClipClusterQTreeNode::clip(). +

+

00302 {
+00303         // Assume normalized planes.
+00304 
+00305         // if( SpherMax OUT )   return false.
+00306         float   d= p*Center;
+00307         if(d<-RadiusMax)
+00308                 return false;
+00309         // if( SphereMin IN )   return true;
+00310         if(d>-RadiusMin)
+00311                 return true;
+00312 
+00313         // else, standard clip box.
+00314         return CAABBox::clipFront(p);
+00315 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLMISC::CAABBox::clipSegment CVector a,
CVector b
const [inherited]
+
+ + + + + +
+   + + +

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

+ +

+Definition at line 156 of file aabbox.cpp. +

+References NLMISC::CPlane::clipSegmentBack(), NLMISC::CAABBox::include(), NLMISC::CAABBox::makePyramid(), and uint. +

+

00157 {
+00158         // Trivial test. If both are in, they are inchanged
+00159         if(include(a) && include(b))
+00160                 return true;
+00161         // Else, must clip the segment againts the pyamid.
+00162         CPlane          planes[6];
+00163         makePyramid(planes);
+00164         CVector         p0=a , p1=b;
+00165         // clip the segment against all planes
+00166         for(uint i=0;i<6;i++)
+00167         {
+00168                 if(!planes[i].clipSegmentBack(p0, p1))
+00169                         return false;
+00170         }
+00171         // get result
+00172         a= p0;
+00173         b= p1;
+00174         return true;
+00175 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
CAABBox NLMISC::CAABBox::computeAABBoxUnion const CAABBox b1,
const CAABBox b2
[static, inherited]
+
+ + + + + +
+   + + +

+Compute the union of 2 bboxs, that is the aabbox that contains the 2 others. Should end up in NLMISC +

+Definition at line 231 of file aabbox.cpp. +

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

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

+

00232 {       
+00233         CAABBox result;
+00234         CVector min, max;
+00235         CVector min1 = b1.getMin() 
+00236                     ,max1 = b1.getMax() 
+00237                         ,min2 = b2.getMin() 
+00238                     ,max2 = b2.getMax();
+00239         max.maxof(max1, max2);
+00240         min.minof(min1, min2);
+00241         result.setMinMax(min, max);
+00242         return result;
+00243 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CAABBox::computeIntersection const CAABBox b1,
const CAABBox b2
[inherited]
+
+ + + + + +
+   + + +

+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 chit. +

+Definition at line 247 of file aabbox.cpp. +

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

+

00248 {
+00249         CVector min1 = b1.getMin(), max1 = b1.getMax(),
+00250                         min2 = b2.getMin(), max2 = b2.getMax();
+00251         CVector minr, maxr;
+00252 
+00253         // don't test if intersect or not.
+00254         maxr.minof(max1, max2);
+00255         minr.maxof(min1, min2);
+00256 
+00257         setMinMax(minr, maxr);
+00258 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CAABBox::extend const CVector v  )  [inherited]
+
+ + + + + +
+   + + +

+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 215 of file aabbox.cpp. +

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

+Referenced by NL3D::CMiniCol::addFaces(), NL3D::CPatch::addTileTrianglesInBBox(), NL3D::CShadowPolyReceiver::addTriangle(), NL3D::CZone::applyHeightField(), NL3D::CZone::build(), NL3D::CVisualCollisionManager::CMeshCol::build(), NLPACS::CEdgeQuad::build(), NLPACS::CChainQuad::build(), NL3D::CCameraCol::build(), NL3D::CShadowMap::buildClipInfoFromMatrix(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CInstanceLighter::compilePointLightRT(), NL3D::CSkeletonModel::computeCurrentBBox(), NL3D::CSkeletonModel::computeRenderedBBox(), NLPACS::computeRetriever(), NL3D::CInstanceLighter::computeSunContribution(), NLPACS::computeSurfaceQuadTree(), NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater(), NLPACS::CCollisionMeshBuild::computeTrivialTranslation(), NLPACS::CGlobalRetriever::doMove(), NL3D::CVegetableClipBlock::extendBBoxOnly(), NL3D::CTessBlock::extendSphereAdd(), NL3D::CPatchDLMContext::generate(), NL3D::CMiniCol::getGroundNormal(), 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(). +

+

00216 {
+00217         CVector         bmin= getMin(), bmax= getMax();
+00218 
+00219         bmin.minof(bmin, v);
+00220         bmax.maxof(bmax, v);
+00221         setMinMax(bmin, bmax);
+00222 }
+
+

+ + + + +
+ + + + + + + + + +
CAABBox NLMISC::CAABBoxExt::getAABBox  )  const [inline]
+
+ + + + + +
+   + + +

+Return a simple Axis Aligned Bounding Box (no radius inside). +

+ +

+Definition at line 206 of file aabbox.h. +

+References getCenter(), getHalfSize(), NLMISC::CAABBox::setCenter(), and NLMISC::CAABBox::setHalfSize(). +

+Referenced by NL3D::CLandscape::addZone(), NL3D::CZoneLighter::buildZoneInformation(), NL3D::CSegRemanenceShape::getAABBox(), NL3D::CMeshMRMSkinned::getAABBox(), NL3D::CMeshMRM::getAABBox(), NL3D::CMesh::getAABBox(), and NL3D::CLandscape::removeZone(). +

+

00206 { CAABBox box; box.setCenter(getCenter()); box.setHalfSize(getHalfSize()); return box; }
+
+

+ + + + +
+ + + + + + + + + +
const CVector& NLMISC::CAABBoxExt::getCenter  )  const [inline]
+
+ + + + + +
+   + + +

+Return a simple Axis Aligned Bounding Box (no radius inside). +

+ +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 199 of file aabbox.h. +

+Referenced by NL3D::CMiniCol::addZone(), NL3D::CLandscape::buildCollideFaces(), NL3D::CSegRemanenceShape::clip(), NL3D::CQuadGridClipClusterQTreeNode::clip(), NL3D::CMeshMRMSkinnedGeom::clip(), NL3D::CMeshMRMGeom::clip(), NL3D::CMeshGeom::clip(), NL3D::CZone::computeBBScaleBias(), getAABBox(), NL3D::CZoneLighter::light(), and NL3D::CQuadGridClipClusterQTreeNode::noFrustumClip(). +

+

00199 {return Center;}
+
+

+ + + + +
+ + + + + + + + + +
const CVector& NLMISC::CAABBoxExt::getHalfSize  )  const [inline]
+
+ + + + + +
+   + + +

+Return a simple Axis Aligned Bounding Box (no radius inside). +

+ +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 200 of file aabbox.h. +

+Referenced by NL3D::CZone::computeBBScaleBias(), and getAABBox(). +

+

00200 {return HalfSize;}
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CAABBox::getMax CVector ret  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 89 of file aabbox.h. +

+References NLMISC::CAABBox::HalfSize. +

+

00089 {ret= Center+HalfSize;}
+
+

+ + + + +
+ + + + + + + + + +
CVector NLMISC::CAABBoxExt::getMax  )  const [inline]
+
+ + + + + +
+   + + +

+Return a simple Axis Aligned Bounding Box (no radius inside). +

+ +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 198 of file aabbox.h. +

+Referenced by InitZBuffer(). +

+

00198 {return CAABBox::getMax();}
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CAABBox::getMin CVector ret  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 88 of file aabbox.h. +

+References NLMISC::CAABBox::HalfSize. +

+

00088 {ret= Center-HalfSize;}
+
+

+ + + + +
+ + + + + + + + + +
CVector NLMISC::CAABBoxExt::getMin  )  const [inline]
+
+ + + + + +
+   + + +

+Return a simple Axis Aligned Bounding Box (no radius inside). +

+ +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 197 of file aabbox.h. +

+Referenced by InitZBuffer(). +

+

00197 {return CAABBox::getMin();}
+
+

+ + + + +
+ + + + + + + + + + +
float NLMISC::CAABBoxExt::getRadius void   )  const [inline]
+
+ + + + + +
+   + + +

+Return the (stored!!) radius of the bbox. +

+ +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 204 of file aabbox.h. +

+References RadiusMax. +

+Referenced by NL3D::CMiniCol::addZone(), NL3D::CLandscape::buildCollideFaces(), NL3D::CSegRemanenceShape::clip(), NL3D::CQuadGridClipClusterQTreeNode::clip(), NL3D::CMeshMRMSkinnedGeom::clip(), NL3D::CMeshMRMGeom::clip(), NL3D::CMeshGeom::clip(), NL3D::CMeshMRMSkinnedGeom::compileRunTime(), NL3D::CMeshMRMGeom::compileRunTime(), NL3D::CMeshGeom::compileRunTime(), and NL3D::CQuadGridClipClusterQTreeNode::noFrustumClip(). +

+

00204 {return RadiusMax;}
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CAABBox::getSize CVector ret  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 94 of file aabbox.h. +

+References NLMISC::CAABBox::HalfSize. +

+

00094 {ret= HalfSize*2;}
+
+

+ + + + +
+ + + + + + + + + + +
CVector NLMISC::CAABBoxExt::getSize void   )  const [inline]
+
+ + + + + +
+   + + +

+Return the size of the bbox. +

+ +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 202 of file aabbox.h. +

+

00202 {return HalfSize*2;}
+
+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CAABBox::include const CAABBox box  )  const [inherited]
+
+ + + + + +
+   + + +

+Does the bbox include entirely this bbox. +

+ +

+Definition at line 94 of file aabbox.cpp. +

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

+

00095 {
+00096         if(Center.x+HalfSize.x < box.Center.x+box.HalfSize.x)   return false;
+00097         if(Center.x-HalfSize.x > box.Center.x-box.HalfSize.x)   return false;
+00098         if(Center.y+HalfSize.y < box.Center.y+box.HalfSize.y)   return false;
+00099         if(Center.y-HalfSize.y > box.Center.y-box.HalfSize.y)   return false;
+00100         if(Center.z+HalfSize.z < box.Center.z+box.HalfSize.z)   return false;
+00101         if(Center.z-HalfSize.z > box.Center.z-box.HalfSize.z)   return false;
+00102         return true;
+00103 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CAABBox::include const CVector a  )  const [inherited]
+
+ + + + + +
+   + + +

+Does the bbox include this point. +

+ +

+Definition at line 81 of file aabbox.cpp. +

+References NLMISC::CAABBox::HalfSize, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. +

+Referenced by NLPACS::CSurfaceQuadTree::addVertex(), NL3D::CLandscape::addZone(), NLMISC::CAABBox::clipSegment(), NL3D::CVegetableClipBlock::extendBBoxOnly(), NL3D::CTessBlock::extendSphereAdd(), NL3D::CMiniCol::getGroundNormal(), NLPACS::CSurfaceQuadTree::getInterpZ(), NLPACS::CSurfaceQuadTree::getLeaf(), NLMISC::CAABBox::intersect(), NLPACS::CGlobalRetriever::retrievePosition(), NL3D::CVisualCollisionEntity::testComputeLandscape(), and NLPACS::CGlobalRetriever::testPosition(). +

+

00082 {
+00083         if(Center.x+HalfSize.x<a.x)     return false;
+00084         if(Center.x-HalfSize.x>a.x)     return false;
+00085         if(Center.y+HalfSize.y<a.y)     return false;
+00086         if(Center.y-HalfSize.y>a.y)     return false;
+00087         if(Center.z+HalfSize.z<a.z)     return false;
+00088         if(Center.z-HalfSize.z>a.z)     return false;
+00089         return true;
+00090 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLMISC::CAABBox::intersect const CVector a,
const CVector b
const [inherited]
+
+ + + + + +
+   + + +

+Does the bbox instersect the segment AB. +

+ +

+Definition at line 137 of file aabbox.cpp. +

+References NLMISC::CPlane::clipSegmentBack(), NLMISC::CAABBox::include(), NLMISC::CAABBox::makePyramid(), and uint. +

+

00138 {
+00139         // Trivial test.
+00140         if(include(a) || include(b))
+00141                 return true;
+00142         // Else, must test if the segment intersect the pyamid.
+00143         CPlane          planes[6];
+00144         makePyramid(planes);
+00145         CVector         p0=a , p1=b;
+00146         // clip the segment against all planes
+00147         for(uint i=0;i<6;i++)
+00148         {
+00149                 if(!planes[i].clipSegmentBack(p0, p1))
+00150                         return false;
+00151         }
+00152         return true;
+00153 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CAABBox::intersect const CBSphere s  )  const [inherited]
+
+ + + + + +
+   + + +

+Does the bbox instersect the sphere s. +

+ +

+Definition at line 178 of file aabbox.cpp. +

+References NLMISC::CAABBox::HalfSize, s, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. +

+

00179 {
+00180         if (Center.x + HalfSize.x < s.Center.x - s.Radius) return false; 
+00181         if (Center.y + HalfSize.y < s.Center.y - s.Radius) return false; 
+00182         if (Center.z + HalfSize.z < s.Center.z - s.Radius) return false; 
+00183 
+00184         if (Center.x - HalfSize.x > s.Center.x + s.Radius) return false; 
+00185         if (Center.y - HalfSize.y > s.Center.y + s.Radius) return false; 
+00186         if (Center.z - HalfSize.z > s.Center.z + s.Radius) return false; 
+00187 
+00188         return true;
+00189 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CAABBox::intersect const CAABBox box  )  const [inherited]
+
+ + + + + +
+   + + +

+Does the bbox intersect the bbox box. +

+ +

+Definition at line 107 of file aabbox.cpp. +

+References NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. +

+Referenced by NL3D::CPatch::addPatchBlocksInBBoxRecurs(), NL3D::CPatch::addTileTrianglesInBBox(), NL3D::CPatch::addTrianglesInBBoxRecurs(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CVisualCollisionManager::CMeshCol::getCameraCollision(), NL3D::CMiniCol::getFaces(), and NL3D::CZoneLighter::makeQuadGridFromWaterShapes(). +

+

00108 {
+00109         CVector mina = getMin(), maxa = getMax(),
+00110                         minb = box.getMin(), maxb = box.getMax();
+00111 
+00112         return ! ( mina.x > maxb.x ||
+00113                            mina.y > maxb.y ||
+00114                            mina.z > maxb.z ||
+00115                            minb.x > maxa.x ||
+00116                            minb.y > maxa.y ||
+00117                            minb.z > maxa.z);
+00118 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLMISC::CAABBoxExt::intersect const CVector a,
const CVector b,
const CVector c
const [inline]
+
+ + + + + +
+   + + +

+Does the bbox intersect the triangle ABC. +

+ +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 219 of file aabbox.h. +

+

00220                 {return CAABBox::intersect(a,b,c);}
+
+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CAABBoxExt::intersect const CAABBoxExt box  )  const [inline]
+
+ + + + + +
+   + + +

+Does the bbox intersect the bbox box. +

+ +

+Definition at line 216 of file aabbox.h. +

+Referenced by NL3D::CLandscape::buildCollideFaces(). +

+

00217                 {return CAABBox::intersect(box);}
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CAABBox::makePyramid CPlane  planes[6]  )  const [inherited]
+
+ + + + + +
+   + + +

+Build the equivalent polytope of planes. +

+ +

+Definition at line 194 of file aabbox.cpp. +

+References NLMISC::CAABBox::HalfSize, and NLMISC::CPlane::make(). +

+Referenced by NLMISC::CAABBox::clipSegment(), and NLMISC::CAABBox::intersect(). +

+

00195 {
+00196         planes[0].make(CVector(-1,0,0), Center-HalfSize);
+00197         planes[1].make(CVector(+1,0,0), Center+HalfSize);
+00198         planes[2].make(CVector(0,-1,0), Center-HalfSize);
+00199         planes[3].make(CVector(0,+1,0), Center+HalfSize);
+00200         planes[4].make(CVector(0,0,-1), Center-HalfSize);
+00201         planes[5].make(CVector(0,0,+1), Center+HalfSize);
+00202 }
+
+

+ + + + +
+ + + + + + + + + + +
CAABBoxExt& NLMISC::CAABBoxExt::operator= const CAABBox o  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 191 of file aabbox.h. +

+References NLMISC::CAABBox::getCenter(), NLMISC::CAABBox::getHalfSize(), and updateRadius(). +

+

00191 {Center= o.getCenter(); HalfSize= o.getHalfSize(); updateRadius(); return (*this);}
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CAABBoxExt::serial NLMISC::IStream f  ) 
+
+ + + + + +
+   + + +

+ +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 337 of file aabbox.cpp. +

+References NLMISC::IStream::isReading(), and updateRadius(). +

+

00338 {
+00339         CAABBox::serial(f);
+00340         if(f.isReading())
+00341                 updateRadius();
+00342 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CAABBoxExt::setCenter const CVector center  )  [inline]
+
+ + + + + +
+   + + +

+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)... +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 181 of file aabbox.h. +

+Referenced by NL3D::CMeshMRMSkinnedGeom::build(), NL3D::CMeshMRMGeom::build(), NL3D::CMeshGeom::build(), and NL3D::CSegRemanenceShape::CSegRemanenceShape(). +

+

00181 {Center= center;}
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CAABBoxExt::setHalfSize const CVector hs  )  [inline]
+
+ + + + + +
+   + + +

+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)... +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 182 of file aabbox.h. +

+References updateRadius(). +

+Referenced by NL3D::CZone::computeBBScaleBias(), and NL3D::CSegRemanenceShape::CSegRemanenceShape(). +

+

00182 {HalfSize= hs; updateRadius();}
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CAABBoxExt::setMinMax const CVector bmin,
const CVector bmax
[inline]
+
+ + + + + +
+   + + +

+Build the bbox, with a min/max style bbox. +

+ +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 185 of file aabbox.h. +

+References updateRadius(). +

+

00186         {
+00187                 Center= (bmin+bmax)/2;
+00188                 HalfSize= bmax-Center;
+00189                 updateRadius();
+00190         }
+
+

+ + + + +
+ + + + + + + + + + +
void NLMISC::CAABBoxExt::setSize const CVector s  )  [inline]
+
+ + + + + +
+   + + +

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

+ +

+Reimplemented from NLMISC::CAABBox. +

+Definition at line 183 of file aabbox.h. +

+References s, and updateRadius(). +

+Referenced by NL3D::CMeshMRMSkinnedGeom::build(), NL3D::CMeshMRMGeom::build(), and NL3D::CMeshGeom::build(). +

+

00183 {HalfSize= s/2;  updateRadius();}
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
CAABBox NLMISC::CAABBox::transformAABBox const CMatrix mat,
const CAABBox box
[static, inherited]
+
+ + + + + +
+   + + +

+Apply a matrix on an aabbox

Returns:
an aabbox, bigger or equal to parameter, after the matrix multiplication
+ +

+Definition at line 262 of file aabbox.cpp. +

+References NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), min, NLMISC::CVector::set(), NLMISC::CAABBox::setMinMax(), uint, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. +

+Referenced by NL3D::CCluster::applyMatrix(), NL3D::CShadowMap::buildCasterCameraMatrix(), NL3D::CMeshInstance::computeWorldBBoxForShadow(), NL3D::CParticleSystem::forceComputeBBox(), NL3D::CZoneLighter::makeQuadGridFromWaterShapes(), and NL3D::CCluster::setWorldMatrix(). +

+

00263 {
+00264         // TODO : optimize this a bit if possible...
+00265         CAABBox result; 
+00266 
+00267         /* OMG. Old code was false!!  
+00268                 if we have ht= M * h
+00269                 then CVector(-ht.x, ht.y, ht.z) != M * CVector(-h.x, h.y, h.z) !!!!
+00270         */
+00271         // compute corners.
+00272         CVector p[8];
+00273         CVector min= box.getMin();
+00274         CVector max= box.getMax();
+00275         p[0].set(min.x, min.y, min.z);
+00276         p[1].set(max.x, min.y, min.z);
+00277         p[2].set(min.x, max.y, min.z);
+00278         p[3].set(max.x, max.y, min.z);
+00279         p[4].set(min.x, min.y, max.z);
+00280         p[5].set(max.x, min.y, max.z);
+00281         p[6].set(min.x, max.y, max.z);
+00282         p[7].set(max.x, max.y, max.z);
+00283         CVector tmp;
+00284         min = max = mat * p[0];
+00285         // transform corners.
+00286         for(uint i=1;i<8;i++)
+00287         {
+00288                 tmp= mat * p[i];
+00289                 min.minof(min, tmp);
+00290                 max.maxof(max, tmp);
+00291         }
+00292 
+00293         result.setMinMax(min, max);
+00294         
+00295         return result;  
+00296 }
+
+

+ + + + +
+ + + + + + + + + +
void NLMISC::CAABBoxExt::updateRadius  )  [inline, protected]
+
+ + + + + +
+   + + +

+ +

+Definition at line 164 of file aabbox.h. +

+References NLMISC::minof(), RadiusMax, RadiusMin, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. +

+Referenced by operator=(), serial(), setHalfSize(), setMinMax(), and setSize(). +

+

00165         {
+00166                 // The bounding sphere.
+00167                 RadiusMax= CAABBox::getRadius();
+00168                 // The including sphere.
+00169                 RadiusMin= NLMISC::minof((float)fabs(HalfSize.x), (float)fabs(HalfSize.y), (float)fabs(HalfSize.z));
+00170         }
+
+


Field Documentation

+

+ + + + +
+ + +
CVector NLMISC::CAABBox::Center [protected, inherited] +
+
+ + + + + +
+   + + +

+The center of the bbox. +

+ +

+Definition at line 54 of file aabbox.h. +

+Referenced by NLMISC::CAABBox::include().

+

+ + + + +
+ + +
CVector NLMISC::CAABBox::HalfSize [protected, inherited] +
+
+ + + + + +
+   + + +

+The size/2 of the bbox. +

+ +

+Definition at line 56 of file aabbox.h. +

+Referenced by NLMISC::CAABBox::CAABBox(), NLMISC::CAABBox::clipBack(), NLMISC::CAABBox::clipFront(), NLMISC::CAABBox::getHalfSize(), NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), NLMISC::CAABBox::getRadius(), NLMISC::CAABBox::getSize(), NLMISC::CAABBox::include(), NLMISC::CAABBox::intersect(), NLMISC::CAABBox::makePyramid(), NLMISC::CAABBox::serial(), NLMISC::CAABBox::setHalfSize(), NLMISC::CAABBox::setMinMax(), and NLMISC::CAABBox::setSize().

+

+ + + + +
+ + +
float NLMISC::CAABBoxExt::RadiusMax [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 162 of file aabbox.h. +

+Referenced by CAABBoxExt(), clipBack(), clipFront(), getRadius(), and updateRadius().

+

+ + + + +
+ + +
float NLMISC::CAABBoxExt::RadiusMin [protected] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 162 of file aabbox.h. +

+Referenced by CAABBoxExt(), clipBack(), clipFront(), and updateRadius().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 13:01:16 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1