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/a02291.html | 586 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 586 insertions(+) create mode 100644 docs/doxygen/nel/a02291.html (limited to 'docs/doxygen/nel/a02291.html') diff --git a/docs/doxygen/nel/a02291.html b/docs/doxygen/nel/a02291.html new file mode 100644 index 00000000..db4a4545 --- /dev/null +++ b/docs/doxygen/nel/a02291.html @@ -0,0 +1,586 @@ + + +NeL: NLMISC::CBSphere class Reference + + + +
+

NLMISC::CBSphere Class Reference

#include <bsphere.h> +

+


Detailed Description

+A bounding Sphere.
Author:
Lionel Berenguier

+Nevrax France

+
Date:
2000
+ +

+ +

+Definition at line 45 of file bsphere.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 CBSphere (const CVector &center, float radius)
 Constructor.

 CBSphere ()
 Empty Constructor.

bool include (const CBSphere &s) const
 Does the sphere include TOTALY this sphere?

bool include (const CVector &p) const
 Does the sphere include this point?

bool intersect (const CBSphere &s) const
 Does the sphere intersect the other?

void setUnion (const CBSphere &sa, const CBSphere &sb)
 Build the union of the 2 sphere ans set to *this. work if this==s1 || this==s2.

transform
void applyTransform (const CMatrix &mat, CBSphere &res)
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.


Data Fields

CVector Center
float Radius
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLMISC::CBSphere::CBSphere  )  [inline]
+
+ + + + + +
+   + + +

+Empty Constructor. +

+ +

+Definition at line 52 of file bsphere.h. +

+

00052 {}
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
NLMISC::CBSphere::CBSphere const CVector center,
float  radius
[inline]
+
+ + + + + +
+   + + +

+Constructor. +

+ +

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

+

00054 : Center(center), Radius(radius) {}
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CBSphere::applyTransform const CMatrix mat,
CBSphere res
+
+ + + + + +
+   + + +

+compute res= mat * this. NB: radius is maximized, taking max of the 3 axis of the matrix. NB: this may be false if the matrix is not orthogonal... +

+Definition at line 88 of file bsphere.cpp. +

+References NLMISC::CMatrix::getI(), NLMISC::CMatrix::getJ(), NLMISC::CMatrix::getK(), NLMISC::CMatrix::getScaleUniform(), NLMISC::CMatrix::hasScalePart(), NLMISC::CMatrix::hasScaleUniform(), res, and NLMISC::CVector::sqrnorm(). +

+Referenced by NL3D::CSkeletonShape::clip(), NL3D::CSegRemanenceShape::clip(), NL3D::CMeshMRMSkinnedGeom::clip(), NL3D::CMeshMRMGeom::clip(), NL3D::CMeshGeom::clip(), and NL3D::CSkeletonModel::computeWorldBBoxForShadow(). +

+

00089 {
+00090         res.Center= mat*Center;
+00091 
+00092         if(!mat.hasScalePart())
+00093                 res.Radius= Radius;
+00094         else
+00095         {
+00096                 if(mat.hasScaleUniform())
+00097                         res.Radius= Radius*mat.getScaleUniform();
+00098                 else
+00099                 {
+00100                         // must compute max of 3 axis.
+00101                         float   m, mx;
+00102                         CVector i,j,k;
+00103                         i= mat.getI();
+00104                         j= mat.getJ();
+00105                         k= mat.getK();
+00106                         // take the max of the 3 axis.
+00107                         m= i.sqrnorm();
+00108                         mx= m;
+00109                         m= j.sqrnorm();
+00110                         mx= max(m, mx);
+00111                         m= k.sqrnorm();
+00112                         mx= max(m, mx);
+00113 
+00114                         // result.
+00115                         res.Radius= Radius * (float)sqrt(mx);
+00116                 }
+00117         }
+00118 }
+
+

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

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

+ +

+Definition at line 50 of file bsphere.cpp. +

+Referenced by NL3D::CVegetableClipBlock::clip(), NL3D::CTessBlock::clip(), and NL3D::CZone::clipPatchs(). +

+

00051 {
+00052         // assume normalized planes.
+00053 
+00054         // if( SpherMax OUT )   return false.
+00055         float   d= p*Center;
+00056         if(d>Radius)
+00057                 return false;
+00058 
+00059         return true;
+00060 }
+
+

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

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

+ +

+Definition at line 37 of file bsphere.cpp. +

+

00038 {
+00039         // assume normalized planes.
+00040 
+00041         // if( SpherMax OUT )   return false.
+00042         float   d= p*Center;
+00043         if(d<-Radius)
+00044                 return false;
+00045 
+00046         return true;
+00047 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CBSphere::include const CBSphere s  )  const
+
+ + + + + +
+   + + +

+Does the sphere include TOTALY this sphere? +

+ +

+Definition at line 69 of file bsphere.cpp. +

+References s, and NLMISC::sqr(). +

+

00070 {
+00071         // if smaller than s, how could we include it???
+00072         if(Radius<=s.Radius)
+00073                 return false;
+00074         float   r2= (s.Center-Center).sqrnorm();
+00075         // Because of prec test, Radius-s.Radius>0.
+00076         return  r2<=sqr(Radius-s.Radius);
+00077 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CBSphere::include const CVector p  )  const
+
+ + + + + +
+   + + +

+Does the sphere include this point? +

+ +

+Definition at line 63 of file bsphere.cpp. +

+References NLMISC::sqr(), and NLMISC::CVector::sqrnorm(). +

+Referenced by NL3D::CLightingManager::addDynamicLight(), NL3D::CZoneLighter::CPointLightRT::testRaytrace(), and NL3D::CInstanceLighter::CPointLightRT::testRaytrace(). +

+

00064 {
+00065         float   r2= (p-Center).sqrnorm();
+00066         return (r2<=sqr(Radius));
+00067 }
+
+

+ + + + +
+ + + + + + + + + + +
bool NLMISC::CBSphere::intersect const CBSphere s  )  const
+
+ + + + + +
+   + + +

+Does the sphere intersect the other? +

+ +

+Definition at line 79 of file bsphere.cpp. +

+References s, and NLMISC::sqr(). +

+Referenced by NL3D::CLandscape::buildCollideFaces(), NL3D::CLandscape::computeDynamicLighting(), and NL3D::CMiniCol::setCenter(). +

+

00080 {
+00081         float   r2= (s.Center-Center).sqrnorm();
+00082 
+00083         return r2<=sqr(Radius+s.Radius);
+00084 
+00085 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLMISC::CBSphere::setUnion const CBSphere sa,
const CBSphere sb
+
+ + + + + +
+   + + +

+Build the union of the 2 sphere ans set to *this. work if this==s1 || this==s2. +

+ +

+Definition at line 122 of file bsphere.cpp. +

+References Center, NLMISC::CVector::normalize(), and Radius. +

+

00123 {
+00124         float   r2= (sb.Center-sa.Center).norm();
+00125 
+00126         // Name Sphere 0 the biggest one, and Sphere 1 the other
+00127         const CBSphere  *s0;
+00128         const CBSphere  *s1;
+00129         if(sa.Radius>sb.Radius)
+00130         {
+00131                 s0= &sa;
+00132                 s1= &sb;
+00133         }
+00134         else
+00135         {
+00136                 s0= &sb;
+00137                 s1= &sa;
+00138         }
+00139         float   r0= s0->Radius;
+00140         float   r1= s1->Radius;
+00141 
+00142         // If Sphere1 is included into Sphere0, then the union is simply Sphere0
+00143         if(r2<=(r0-r1))
+00144         {
+00145                 *this= *s0;
+00146         }
+00147         else
+00148         {
+00149                 /* Compute the Union sphere Diameter. It is D= r0 + r2 + r1 
+00150                         do the draw, works for intersect and don't intersect case, 
+00151                         acknowledge that Sphere1 not included inton Sphere0
+00152                 */
+00153                 float   diameter= r0 + r2 + r1;
+00154 
+00155                 // compute dir from big center to small one.
+00156                 CVector dir= s1->Center - s0->Center;
+00157                 dir.normalize();
+00158 
+00159                 // Then finally set Radius and center
+00160                 Center= s0->Center + dir * (diameter/2 - r0);
+00161                 Radius= diameter/2;
+00162         }
+00163 }
+
+


Field Documentation

+

+ + + + +
+ + +
CVector NLMISC::CBSphere::Center +
+
+ + + + + +
+   + + +

+ +

+Definition at line 48 of file bsphere.h. +

+Referenced by NL3D::CLightingManager::addDynamicLight(), NL3D::CZoneLighter::addStaticPointLight(), NL3D::CInstanceLighter::addStaticPointLight(), NL3D::CMiniCol::addZone(), NL3D::CSkeletonShape::clip(), NL3D::CSegRemanenceShape::clip(), NL3D::CMeshMRMSkinnedGeom::clip(), NL3D::CMeshMRMGeom::clip(), NL3D::CMeshGeom::clip(), NL3D::CTessBlock::clipFar(), NL3D::CClipTrav::clipSkeletonShadowMaps(), NL3D::CPatchDLMPointLight::compile(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CInstanceLighter::compilePointLightRT(), NL3D::CPatch::computeNewFar(), NL3D::CSkeletonModel::computeWorldBBoxForShadow(), NL3D::CVegetableClipBlock::extendSphere(), NL3D::CTessBlock::extendSphereCompile(), NL3D::CZoneLighter::CPredPointLightToPoint::operator()(), NL3D::CInstanceLighter::CPredPointLightToPoint::operator()(), NL3D::CInstanceLighter::processIGPointLightRT(), NL3D::CZoneLighter::processZonePointLightRT(), NL3D::CMiniCol::removeLandScapePart(), NL3D::CMiniCol::setCenter(), setUnion(), NL3D::CZoneLighter::CPointLightRT::testRaytrace(), NL3D::CInstanceLighter::CPointLightRT::testRaytrace(), and NL3D::CVegetableClipBlock::updateSphere().

+

+ + + + +
+ + +
float NLMISC::CBSphere::Radius +
+
+ + + + + +
+   + + +

+ +

+Definition at line 49 of file bsphere.h. +

+Referenced by NL3D::CLightingManager::addDynamicLight(), NL3D::CZoneLighter::addStaticPointLight(), NL3D::CInstanceLighter::addStaticPointLight(), NL3D::CMiniCol::addZone(), NL3D::CSkeletonShape::clip(), NL3D::CSegRemanenceShape::clip(), NL3D::CMeshMRMSkinnedGeom::clip(), NL3D::CMeshMRMGeom::clip(), NL3D::CMeshGeom::clip(), NL3D::CTessBlock::clipFar(), NL3D::CClipTrav::clipSkeletonShadowMaps(), NL3D::CPatchDLMPointLight::compile(), NL3D::CZoneLighter::compilePointLightRT(), NL3D::CInstanceLighter::compilePointLightRT(), NL3D::CPatch::computeNewFar(), NL3D::CSkeletonModel::computeWorldBBoxForShadow(), NL3D::CVegetableClipBlock::extendSphere(), NL3D::CTessBlock::extendSphereCompile(), NL3D::CInstanceLighter::processIGPointLightRT(), NL3D::CMiniCol::removeLandScapePart(), setUnion(), NL3D::CSkeletonModel::updateSkinRenderLists(), and NL3D::CVegetableClipBlock::updateSphere().

+


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