diff options
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/a02291.html | 586 |
1 files changed, 586 insertions, 0 deletions
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 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLMISC::CBSphere class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLMISC::CBSphere Class Reference</h1><code>#include <<a class="el" href="a05505.html">bsphere.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +A bounding Sphere. <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2000 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a05505.html#l00045">45</a> of file <a class="el" href="a05505.html">bsphere.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02291.html#NLMISC_1_1CBSpherea0">CBSphere</a> (const <a class="el" href="a03128.html">CVector</a> &center, float radius)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NLMISC_1_1CBSpherea0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02291.html#NLMISC_1_1CBSpherea1">CBSphere</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Empty Constructor. <a href="#NLMISC_1_1CBSpherea1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02291.html#NLMISC_1_1CBSpherea2">include</a> (const <a class="el" href="a02291.html">CBSphere</a> &<a class="el" href="a04223.html#a626">s</a>) const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Does the sphere include TOTALY this sphere? <a href="#NLMISC_1_1CBSpherea2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02291.html#NLMISC_1_1CBSpherea3">include</a> (const <a class="el" href="a03128.html">CVector</a> &p) const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Does the sphere include this point? <a href="#NLMISC_1_1CBSpherea3"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02291.html#NLMISC_1_1CBSpherea4">intersect</a> (const <a class="el" href="a02291.html">CBSphere</a> &<a class="el" href="a04223.html#a626">s</a>) const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Does the sphere intersect the other? <a href="#NLMISC_1_1CBSpherea4"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02291.html#NLMISC_1_1CBSpherea5">setUnion</a> (const <a class="el" href="a02291.html">CBSphere</a> &sa, const <a class="el" href="a02291.html">CBSphere</a> &sb)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Build the union of the 2 sphere ans set to *this. work if this==s1 || this==s2. <a href="#NLMISC_1_1CBSpherea5"></a><br><br></td></tr> +<tr><td colspan="2"><div class="groupHeader">transform</div></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02291.html#NLMISC_1_1CBSpherez1929_0">applyTransform</a> (const <a class="el" href="a02851.html">CMatrix</a> &mat, <a class="el" href="a02291.html">CBSphere</a> &<a class="el" href="a04223.html#a643">res</a>)</td></tr> + +<tr><td colspan="2"><div class="groupHeader">Clip</div></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02291.html#NLMISC_1_1CBSpherez1931_0">clipBack</a> (const <a class="el" href="a03082.html">CPlane</a> &p) const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Is the bbox partially in back of the plane?? p MUST be normalized. <a href="#NLMISC_1_1CBSpherez1931_0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02291.html#NLMISC_1_1CBSpherez1931_1">clipFront</a> (const <a class="el" href="a03082.html">CPlane</a> &p) const </td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Is the bbox partially in front of the plane?? p MUST be normalized. <a href="#NLMISC_1_1CBSpherez1931_1"></a><br><br></td></tr> +<tr><td colspan=2><br><h2>Data Fields</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03128.html">CVector</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02291.html#NLMISC_1_1CBSphereo1">Radius</a></td></tr> + +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBSpherea1" doxytag="NLMISC::CBSphere::CBSphere" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLMISC::CBSphere::CBSphere </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Empty Constructor. +<p> + +<p> +Definition at line <a class="el" href="a05505.html#l00052">52</a> of file <a class="el" href="a05505.html">bsphere.h</a>. +<p> +<div class="fragment"><pre>00052 {} +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBSpherea0" doxytag="NLMISC::CBSphere::CBSphere" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLMISC::CBSphere::CBSphere </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>center</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>radius</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [inline]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Constructor. +<p> + +<p> +Definition at line <a class="el" href="a05505.html#l00054">54</a> of file <a class="el" href="a05505.html">bsphere.h</a>. +<p> +<div class="fragment"><pre>00054 : <a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>(center), <a class="code" href="a02291.html#NLMISC_1_1CBSphereo1">Radius</a>(radius) {} +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBSpherez1929_0" doxytag="NLMISC::CBSphere::applyTransform" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBSphere::applyTransform </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02851.html">CMatrix</a> & </td> + <td class="mdname" nowrap> <em>mat</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02291.html">CBSphere</a> & </td> + <td class="mdname" nowrap> <em>res</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +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... +<p> +Definition at line <a class="el" href="a05504.html#l00088">88</a> of file <a class="el" href="a05504.html">bsphere.cpp</a>. +<p> +References <a class="el" href="a05972.html#l00419">NLMISC::CMatrix::getI()</a>, <a class="el" href="a05972.html#l00427">NLMISC::CMatrix::getJ()</a>, <a class="el" href="a05972.html#l00435">NLMISC::CMatrix::getK()</a>, <a class="el" href="a05972.html#l00106">NLMISC::CMatrix::getScaleUniform()</a>, <a class="el" href="a05972.html#l00092">NLMISC::CMatrix::hasScalePart()</a>, <a class="el" href="a05972.html#l00102">NLMISC::CMatrix::hasScaleUniform()</a>, <a class="el" href="a05646.html#l01119">res</a>, and <a class="el" href="a06682.html#l00111">NLMISC::CVector::sqrnorm()</a>. +<p> +Referenced by <a class="el" href="a06395.html#l00216">NL3D::CSkeletonShape::clip()</a>, <a class="el" href="a06360.html#l00312">NL3D::CSegRemanenceShape::clip()</a>, <a class="el" href="a06011.html#l00505">NL3D::CMeshMRMSkinnedGeom::clip()</a>, <a class="el" href="a06005.html#l00856">NL3D::CMeshMRMGeom::clip()</a>, <a class="el" href="a05989.html#l00482">NL3D::CMeshGeom::clip()</a>, and <a class="el" href="a06393.html#l01987">NL3D::CSkeletonModel::computeWorldBBoxForShadow()</a>. +<p> +<div class="fragment"><pre>00089 { +00090 <a class="code" href="a04223.html#a643">res</a>.Center= mat*<a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>; +00091 +00092 <span class="keywordflow">if</span>(!mat.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1970_2">hasScalePart</a>()) +00093 <a class="code" href="a04223.html#a643">res</a>.Radius= <a class="code" href="a02291.html#NLMISC_1_1CBSphereo1">Radius</a>; +00094 <span class="keywordflow">else</span> +00095 { +00096 <span class="keywordflow">if</span>(mat.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1970_3">hasScaleUniform</a>()) +00097 <a class="code" href="a04223.html#a643">res</a>.Radius= <a class="code" href="a02291.html#NLMISC_1_1CBSphereo1">Radius</a>*mat.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1970_0">getScaleUniform</a>(); +00098 <span class="keywordflow">else</span> +00099 { +00100 <span class="comment">// must compute max of 3 axis.</span> +00101 <span class="keywordtype">float</span> m, mx; +00102 CVector i,j,k; +00103 i= mat.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1963_2">getI</a>(); +00104 j= mat.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1963_3">getJ</a>(); +00105 k= mat.<a class="code" href="a02851.html#NLMISC_1_1CMatrixz1963_4">getK</a>(); +00106 <span class="comment">// take the max of the 3 axis.</span> +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 <span class="comment">// result.</span> +00115 <a class="code" href="a04223.html#a643">res</a>.Radius= <a class="code" href="a02291.html#NLMISC_1_1CBSphereo1">Radius</a> * (<span class="keywordtype">float</span>)sqrt(mx); +00116 } +00117 } +00118 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBSpherez1931_0" doxytag="NLMISC::CBSphere::clipBack" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBSphere::clipBack </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03082.html">CPlane</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>p</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Is the bbox partially in back of the plane?? p MUST be normalized. +<p> + +<p> +Definition at line <a class="el" href="a05504.html#l00050">50</a> of file <a class="el" href="a05504.html">bsphere.cpp</a>. +<p> +Referenced by <a class="el" href="a06690.html#l00082">NL3D::CVegetableClipBlock::clip()</a>, <a class="el" href="a06491.html#l00146">NL3D::CTessBlock::clip()</a>, and <a class="el" href="a06758.html#l01038">NL3D::CZone::clipPatchs()</a>. +<p> +<div class="fragment"><pre>00051 { +00052 <span class="comment">// assume normalized planes.</span> +00053 +00054 <span class="comment">// if( SpherMax OUT ) return false.</span> +00055 <span class="keywordtype">float</span> d= p*<a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>; +00056 <span class="keywordflow">if</span>(d><a class="code" href="a02291.html#NLMISC_1_1CBSphereo1">Radius</a>) +00057 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00058 +00059 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00060 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBSpherez1931_1" doxytag="NLMISC::CBSphere::clipFront" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBSphere::clipFront </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03082.html">CPlane</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>p</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Is the bbox partially in front of the plane?? p MUST be normalized. +<p> + +<p> +Definition at line <a class="el" href="a05504.html#l00037">37</a> of file <a class="el" href="a05504.html">bsphere.cpp</a>. +<p> +<div class="fragment"><pre>00038 { +00039 <span class="comment">// assume normalized planes.</span> +00040 +00041 <span class="comment">// if( SpherMax OUT ) return false.</span> +00042 <span class="keywordtype">float</span> d= p*<a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>; +00043 <span class="keywordflow">if</span>(d<-<a class="code" href="a02291.html#NLMISC_1_1CBSphereo1">Radius</a>) +00044 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00045 +00046 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00047 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBSpherea2" doxytag="NLMISC::CBSphere::include" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBSphere::include </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02291.html">CBSphere</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>s</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Does the sphere include TOTALY this sphere? +<p> + +<p> +Definition at line <a class="el" href="a05504.html#l00069">69</a> of file <a class="el" href="a05504.html">bsphere.cpp</a>. +<p> +References <a class="el" href="a05646.html#l00977">s</a>, and <a class="el" href="a05587.html#l00107">NLMISC::sqr()</a>. +<p> +<div class="fragment"><pre>00070 { +00071 <span class="comment">// if smaller than s, how could we include it???</span> +00072 <span class="keywordflow">if</span>(<a class="code" href="a02291.html#NLMISC_1_1CBSphereo1">Radius</a><=<a class="code" href="a04223.html#a626">s</a>.Radius) +00073 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00074 <span class="keywordtype">float</span> r2= (<a class="code" href="a04223.html#a626">s</a>.Center-<a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>).sqrnorm(); +00075 <span class="comment">// Because of prec test, Radius-s.Radius>0.</span> +00076 <span class="keywordflow">return</span> r2<=<a class="code" href="a05378.html#a373">sqr</a>(Radius-<a class="code" href="a04223.html#a626">s</a>.Radius); +00077 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBSpherea3" doxytag="NLMISC::CBSphere::include" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBSphere::include </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>p</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Does the sphere include this point? +<p> + +<p> +Definition at line <a class="el" href="a05504.html#l00063">63</a> of file <a class="el" href="a05504.html">bsphere.cpp</a>. +<p> +References <a class="el" href="a05587.html#l00107">NLMISC::sqr()</a>, and <a class="el" href="a06682.html#l00111">NLMISC::CVector::sqrnorm()</a>. +<p> +Referenced by <a class="el" href="a05901.html#l00151">NL3D::CLightingManager::addDynamicLight()</a>, <a class="el" href="a06768.html#l03139">NL3D::CZoneLighter::CPointLightRT::testRaytrace()</a>, and <a class="el" href="a05824.html#l00954">NL3D::CInstanceLighter::CPointLightRT::testRaytrace()</a>. +<p> +<div class="fragment"><pre>00064 { +00065 <span class="keywordtype">float</span> r2= (p-<a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>).sqrnorm(); +00066 <span class="keywordflow">return</span> (r2<=<a class="code" href="a05378.html#a373">sqr</a>(Radius)); +00067 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBSpherea4" doxytag="NLMISC::CBSphere::intersect" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> bool NLMISC::CBSphere::intersect </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02291.html">CBSphere</a> & </td> + <td class="mdname1" valign="top" nowrap> <em>s</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap> const</td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Does the sphere intersect the other? +<p> + +<p> +Definition at line <a class="el" href="a05504.html#l00079">79</a> of file <a class="el" href="a05504.html">bsphere.cpp</a>. +<p> +References <a class="el" href="a05646.html#l00977">s</a>, and <a class="el" href="a05587.html#l00107">NLMISC::sqr()</a>. +<p> +Referenced by <a class="el" href="a05862.html#l02380">NL3D::CLandscape::buildCollideFaces()</a>, <a class="el" href="a05862.html#l03489">NL3D::CLandscape::computeDynamicLighting()</a>, and <a class="el" href="a06034.html#l00178">NL3D::CMiniCol::setCenter()</a>. +<p> +<div class="fragment"><pre>00080 { +00081 <span class="keywordtype">float</span> r2= (<a class="code" href="a04223.html#a626">s</a>.Center-<a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>).sqrnorm(); +00082 +00083 <span class="keywordflow">return</span> r2<=<a class="code" href="a05378.html#a373">sqr</a>(Radius+<a class="code" href="a04223.html#a626">s</a>.Radius); +00084 +00085 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBSpherea5" doxytag="NLMISC::CBSphere::setUnion" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLMISC::CBSphere::setUnion </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02291.html">CBSphere</a> & </td> + <td class="mdname" nowrap> <em>sa</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02291.html">CBSphere</a> & </td> + <td class="mdname" nowrap> <em>sb</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Build the union of the 2 sphere ans set to *this. work if this==s1 || this==s2. +<p> + +<p> +Definition at line <a class="el" href="a05504.html#l00122">122</a> of file <a class="el" href="a05504.html">bsphere.cpp</a>. +<p> +References <a class="el" href="a05505.html#l00048">Center</a>, <a class="el" href="a06682.html#l00119">NLMISC::CVector::normalize()</a>, and <a class="el" href="a05505.html#l00049">Radius</a>. +<p> +<div class="fragment"><pre>00123 { +00124 <span class="keywordtype">float</span> r2= (sb.Center-sa.Center).norm(); +00125 +00126 <span class="comment">// Name Sphere 0 the biggest one, and Sphere 1 the other</span> +00127 <span class="keyword">const</span> <a class="code" href="a02291.html#NLMISC_1_1CBSpherea1">CBSphere</a> *s0; +00128 <span class="keyword">const</span> <a class="code" href="a02291.html#NLMISC_1_1CBSpherea1">CBSphere</a> *s1; +00129 <span class="keywordflow">if</span>(sa.Radius>sb.Radius) +00130 { +00131 s0= &sa; +00132 s1= &sb; +00133 } +00134 <span class="keywordflow">else</span> +00135 { +00136 s0= &sb; +00137 s1= &sa; +00138 } +00139 <span class="keywordtype">float</span> r0= s0->Radius; +00140 <span class="keywordtype">float</span> r1= s1->Radius; +00141 +00142 <span class="comment">// If Sphere1 is included into Sphere0, then the union is simply Sphere0</span> +00143 <span class="keywordflow">if</span>(r2<=(r0-r1)) +00144 { +00145 *<span class="keyword">this</span>= *s0; +00146 } +00147 <span class="keywordflow">else</span> +00148 { +00149 <span class="comment">/* Compute the Union sphere Diameter. It is D= r0 + r2 + r1 </span> +00150 <span class="comment"> do the draw, works for intersect and don't intersect case, </span> +00151 <span class="comment"> acknowledge that Sphere1 not included inton Sphere0</span> +00152 <span class="comment"> */</span> +00153 <span class="keywordtype">float</span> diameter= r0 + r2 + r1; +00154 +00155 <span class="comment">// compute dir from big center to small one.</span> +00156 CVector dir= s1->Center - s0->Center; +00157 dir.normalize(); +00158 +00159 <span class="comment">// Then finally set Radius and center</span> +00160 <a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>= s0->Center + dir * (diameter/2 - r0); +00161 <a class="code" href="a02291.html#NLMISC_1_1CBSphereo1">Radius</a>= diameter/2; +00162 } +00163 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLMISC_1_1CBSphereo0" doxytag="NLMISC::CBSphere::Center" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03128.html">CVector</a> <a class="el" href="a02291.html#NLMISC_1_1CBSphereo0">NLMISC::CBSphere::Center</a> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05505.html#l00048">48</a> of file <a class="el" href="a05505.html">bsphere.h</a>. +<p> +Referenced by <a class="el" href="a05901.html#l00151">NL3D::CLightingManager::addDynamicLight()</a>, <a class="el" href="a06768.html#l03179">NL3D::CZoneLighter::addStaticPointLight()</a>, <a class="el" href="a05824.html#l00999">NL3D::CInstanceLighter::addStaticPointLight()</a>, <a class="el" href="a06034.html#l00116">NL3D::CMiniCol::addZone()</a>, <a class="el" href="a06395.html#l00216">NL3D::CSkeletonShape::clip()</a>, <a class="el" href="a06360.html#l00312">NL3D::CSegRemanenceShape::clip()</a>, <a class="el" href="a06011.html#l00505">NL3D::CMeshMRMSkinnedGeom::clip()</a>, <a class="el" href="a06005.html#l00856">NL3D::CMeshMRMGeom::clip()</a>, <a class="el" href="a05989.html#l00482">NL3D::CMeshGeom::clip()</a>, <a class="el" href="a06491.html#l00160">NL3D::CTessBlock::clipFar()</a>, <a class="el" href="a05555.html#l00532">NL3D::CClipTrav::clipSkeletonShadowMaps()</a>, <a class="el" href="a06163.html#l00052">NL3D::CPatchDLMPointLight::compile()</a>, <a class="el" href="a06768.html#l03202">NL3D::CZoneLighter::compilePointLightRT()</a>, <a class="el" href="a05824.html#l01023">NL3D::CInstanceLighter::compilePointLightRT()</a>, <a class="el" href="a06161.html#l00054">NL3D::CPatch::computeNewFar()</a>, <a class="el" href="a06393.html#l01987">NL3D::CSkeletonModel::computeWorldBBoxForShadow()</a>, <a class="el" href="a06690.html#l00062">NL3D::CVegetableClipBlock::extendSphere()</a>, <a class="el" href="a06491.html#l00122">NL3D::CTessBlock::extendSphereCompile()</a>, <a class="el" href="a06768.html#l03329">NL3D::CZoneLighter::CPredPointLightToPoint::operator()()</a>, <a class="el" href="a05824.html#l01140">NL3D::CInstanceLighter::CPredPointLightToPoint::operator()()</a>, <a class="el" href="a05824.html#l01161">NL3D::CInstanceLighter::processIGPointLightRT()</a>, <a class="el" href="a06768.html#l03346">NL3D::CZoneLighter::processZonePointLightRT()</a>, <a class="el" href="a06034.html#l00085">NL3D::CMiniCol::removeLandScapePart()</a>, <a class="el" href="a06034.html#l00178">NL3D::CMiniCol::setCenter()</a>, <a class="el" href="a05504.html#l00122">setUnion()</a>, <a class="el" href="a06768.html#l03139">NL3D::CZoneLighter::CPointLightRT::testRaytrace()</a>, <a class="el" href="a05824.html#l00954">NL3D::CInstanceLighter::CPointLightRT::testRaytrace()</a>, and <a class="el" href="a06690.html#l00055">NL3D::CVegetableClipBlock::updateSphere()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLMISC_1_1CBSphereo1" doxytag="NLMISC::CBSphere::Radius" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> float <a class="el" href="a02291.html#NLMISC_1_1CBSphereo1">NLMISC::CBSphere::Radius</a> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a05505.html#l00049">49</a> of file <a class="el" href="a05505.html">bsphere.h</a>. +<p> +Referenced by <a class="el" href="a05901.html#l00151">NL3D::CLightingManager::addDynamicLight()</a>, <a class="el" href="a06768.html#l03179">NL3D::CZoneLighter::addStaticPointLight()</a>, <a class="el" href="a05824.html#l00999">NL3D::CInstanceLighter::addStaticPointLight()</a>, <a class="el" href="a06034.html#l00116">NL3D::CMiniCol::addZone()</a>, <a class="el" href="a06395.html#l00216">NL3D::CSkeletonShape::clip()</a>, <a class="el" href="a06360.html#l00312">NL3D::CSegRemanenceShape::clip()</a>, <a class="el" href="a06011.html#l00505">NL3D::CMeshMRMSkinnedGeom::clip()</a>, <a class="el" href="a06005.html#l00856">NL3D::CMeshMRMGeom::clip()</a>, <a class="el" href="a05989.html#l00482">NL3D::CMeshGeom::clip()</a>, <a class="el" href="a06491.html#l00160">NL3D::CTessBlock::clipFar()</a>, <a class="el" href="a05555.html#l00532">NL3D::CClipTrav::clipSkeletonShadowMaps()</a>, <a class="el" href="a06163.html#l00052">NL3D::CPatchDLMPointLight::compile()</a>, <a class="el" href="a06768.html#l03202">NL3D::CZoneLighter::compilePointLightRT()</a>, <a class="el" href="a05824.html#l01023">NL3D::CInstanceLighter::compilePointLightRT()</a>, <a class="el" href="a06161.html#l00054">NL3D::CPatch::computeNewFar()</a>, <a class="el" href="a06393.html#l01987">NL3D::CSkeletonModel::computeWorldBBoxForShadow()</a>, <a class="el" href="a06690.html#l00062">NL3D::CVegetableClipBlock::extendSphere()</a>, <a class="el" href="a06491.html#l00122">NL3D::CTessBlock::extendSphereCompile()</a>, <a class="el" href="a05824.html#l01161">NL3D::CInstanceLighter::processIGPointLightRT()</a>, <a class="el" href="a06034.html#l00085">NL3D::CMiniCol::removeLandScapePart()</a>, <a class="el" href="a05504.html#l00122">setUnion()</a>, <a class="el" href="a06393.html#l01117">NL3D::CSkeletonModel::updateSkinRenderLists()</a>, and <a class="el" href="a06690.html#l00055">NL3D::CVegetableClipBlock::updateSphere()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a05505.html">bsphere.h</a><li><a class="el" href="a05504.html">bsphere.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 13:05:28 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |