diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a02930.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/a02930.html | 1193 |
1 files changed, 1193 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02930.html b/docs/doxygen/nel/a02930.html new file mode 100644 index 00000000..80def4ac --- /dev/null +++ b/docs/doxygen/nel/a02930.html @@ -0,0 +1,1193 @@ +<!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: NL3D::CMiniCol 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>NL3D::CMiniCol Class Reference</h1><code>#include <<a class="el" href="a06035.html">mini_col.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +This is a TEMPORARY collision "system". <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="a06035.html#l00054">54</a> of file <a class="el" href="a06035.html">mini_col.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>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniCola0">addZone</a> (<a class="el" href="a04558.html#a9">uint16</a> zoneId)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Add a zone to the collision system. Zone must be loaded into the landscape before. <a href="#NL3D_1_1CMiniCola0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniCola1">CMiniCol</a> ()</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#NL3D_1_1CMiniCola1"></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="a02930.html#NL3D_1_1CMiniCola2">getFaces</a> (std::vector< <a class="el" href="a03616.html">CTriangle</a> > &triresult, const <a class="el" href="a02156.html">CAABBox</a> &bbox)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniCola3">getGroundNormal</a> (const <a class="el" href="a03128.html">CVector</a> &pos, <a class="el" href="a03128.html">CVector</a> &normal, float hup=0.5, float hbot=1000)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniCola4">init</a> (<a class="el" href="a02702.html">CLandscape</a> *land, float radMin=100, float radDelta=50)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Init the size of the collision system, and init it with the landscape. <a href="#NL3D_1_1CMiniCola4"></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="a02930.html#NL3D_1_1CMiniCola5">removeZone</a> (<a class="el" href="a04558.html#a9">uint16</a> zoneId)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Remove a zone from the collision system. Zone do not have to be loaded into the landscape. <a href="#NL3D_1_1CMiniCola5"></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="a02930.html#NL3D_1_1CMiniCola6">setCenter</a> (const <a class="el" href="a03128.html">CVector</a> &center)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Reset the center of interset of the collision zone. <a href="#NL3D_1_1CMiniCola6"></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="a02930.html#NL3D_1_1CMiniCola7">snapToGround</a> (<a class="el" href="a03128.html">CVector</a> &pos, float hup=0.5, float hbot=1000)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>bool </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniCola8">testMove</a> (const <a class="el" href="a03128.html">CVector</a> &prec, <a class="el" href="a03128.html">CVector</a> &cur)</td></tr> + +<tr><td colspan=2><br><h2>Private Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef <a class="el" href="a03273.html">CQuadGrid</a>< <a class="el" href="a02931.html">CFace</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniColy0">TGrid</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::set< <a class="el" href="a02933.html">CZoneIdent</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniColy1">TZoneSet</a></td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniCold0">addFaces</a> (const std::vector< <a class="el" href="a03616.html">CTriangle</a> > &faces, <a class="el" href="a04558.html#a9">uint16</a> zoneId, <a class="el" href="a04558.html#a9">uint16</a> patchId)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniCold1">addLandscapePart</a> (<a class="el" href="a04558.html#a9">uint16</a> zoneId, <a class="el" href="a04558.html#a9">uint16</a> patchId)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniCold2">removeLandScapePart</a> (<a class="el" href="a04558.html#a9">uint16</a> zoneId, <a class="el" href="a04558.html#a9">uint16</a> patchId, const <a class="el" href="a02291.html">CBSphere</a> &sphere)</td></tr> + +<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03273.html">TGrid</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03321.html">CRefPtr</a>< <a class="el" href="a02702.html">CLandscape</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniColr1">_Landscape</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniColr2">_RadMax</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>float </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniColr3">_RadMin</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02930.html#NL3D_1_1CMiniColy1">TZoneSet</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02930.html#NL3D_1_1CMiniColr4">_Zones</a></td></tr> + +</table> +<hr><h2>Member Typedef Documentation</h2> +<a class="anchor" name="NL3D_1_1CMiniColy0" doxytag="NL3D::CMiniCol::TGrid" ></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"> typedef <a class="el" href="a03273.html">CQuadGrid</a><<a class="el" href="a02931.html">CFace</a>> <a class="el" href="a03273.html">NL3D::CMiniCol::TGrid</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06035.html#l00134">134</a> of file <a class="el" href="a06035.html">mini_col.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniColy1" doxytag="NL3D::CMiniCol::TZoneSet" ></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"> typedef std::set<<a class="el" href="a02933.html">CZoneIdent</a>> <a class="el" href="a02930.html#NL3D_1_1CMiniColy1">NL3D::CMiniCol::TZoneSet</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06035.html#l00135">135</a> of file <a class="el" href="a06035.html">mini_col.h</a>. </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NL3D_1_1CMiniCola1" doxytag="NL3D::CMiniCol::CMiniCol" ></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"> NL3D::CMiniCol::CMiniCol </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></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="a06034.html#l00047">47</a> of file <a class="el" href="a06034.html">mini_col.cpp</a>. +<p> +References <a class="el" href="a06035.html#l00139">_RadMax</a>, <a class="el" href="a06035.html#l00139">_RadMin</a>, <a class="el" href="a06300.html#l00433">NL3D::CQuadGrid< T >::create()</a>, and <a class="el" href="a06034.html#l00043">NL3D::GridEltSize</a>. +<p> +<div class="fragment"><pre>00048 { +00049 <a class="code" href="a02930.html#NL3D_1_1CMiniColr3">_RadMin</a>= 100; +00050 <a class="code" href="a02930.html#NL3D_1_1CMiniColr2">_RadMax</a>= 125; +00051 <a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz772_1">create</a>(GridSize, GridEltSize); +00052 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NL3D_1_1CMiniCold0" doxytag="NL3D::CMiniCol::addFaces" ></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 NL3D::CMiniCol::addFaces </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::vector< <a class="el" href="a03616.html">CTriangle</a> > & </td> + <td class="mdname" nowrap> <em>faces</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>zoneId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>patchId</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06034.html#l00056">56</a> of file <a class="el" href="a06034.html">mini_col.cpp</a>. +<p> +References <a class="el" href="a05384.html#l00215">NLMISC::CAABBox::extend()</a>, <a class="el" href="a06035.html#l00102">NL3D::CMiniCol::CFace::Face</a>, <a class="el" href="a05385.html#l00087">NLMISC::CAABBox::getMax()</a>, <a class="el" href="a05385.html#l00086">NLMISC::CAABBox::getMin()</a>, <a class="el" href="a06300.html#l00516">NL3D::CQuadGrid< T >::insert()</a>, <a class="el" href="a06170.html#l00036">NLMISC::CPlane::make()</a>, <a class="el" href="a06035.html#l00105">NL3D::CMiniCol::CFace::PatchId</a>, <a class="el" href="a06035.html#l00103">NL3D::CMiniCol::CFace::Plane</a>, <a class="el" href="a05385.html#l00066">NLMISC::CAABBox::setCenter()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a05981.html#l00098">uint16</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V0</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V1</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V2</a>, and <a class="el" href="a06035.html#l00104">NL3D::CMiniCol::CFace::ZoneId</a>. +<p> +Referenced by <a class="el" href="a06034.html#l00076">addLandscapePart()</a>. +<p> +<div class="fragment"><pre>00057 { +00058 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)faces.size();i++) +00059 { +00060 <span class="keyword">const</span> <a class="code" href="a03616.html">CTriangle</a> &f= faces[i]; +00061 CAABBox box; +00062 box.setCenter(f.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>); +00063 box.extend(f.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>); +00064 box.extend(f.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a>); +00065 CFace node; +00066 node.Face= f; +00067 node.Plane.make(f.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>, f.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>, f.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a>); +00068 node.ZoneId= zoneId; +00069 node.PatchId=patchId; +00070 <a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz774_2">insert</a>(box.getMin(), box.getMax(), node); +00071 } +00072 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniCold1" doxytag="NL3D::CMiniCol::addLandscapePart" ></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 NL3D::CMiniCol::addLandscapePart </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>zoneId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>patchId</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06034.html#l00076">76</a> of file <a class="el" href="a06034.html">mini_col.cpp</a>. +<p> +References <a class="el" href="a06034.html#l00056">addFaces()</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06034.html#l00178">setCenter()</a>. +<p> +<div class="fragment"><pre>00077 { +00078 vector<CTriangle> faces; +00079 <a class="code" href="a02930.html#NL3D_1_1CMiniColr1">_Landscape</a>->buildCollideFaces(zoneId, patchId, faces); +00080 <a class="code" href="a02930.html#NL3D_1_1CMiniCold0">addFaces</a>(faces, zoneId, patchId); +00081 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniCola0" doxytag="NL3D::CMiniCol::addZone" ></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 NL3D::CMiniCol::addZone </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname1" valign="top" nowrap> <em>zoneId</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Add a zone to the collision system. Zone must be loaded into the landscape before. +<p> + +<p> +Definition at line <a class="el" href="a06034.html#l00116">116</a> of file <a class="el" href="a06034.html">mini_col.cpp</a>. +<p> +References <a class="el" href="a06035.html#l00141">_Zones</a>, <a class="el" href="a05505.html#l00048">NLMISC::CBSphere::Center</a>, <a class="el" href="a05385.html#l00199">NLMISC::CAABBoxExt::getCenter()</a>, <a class="el" href="a06760.html#l00489">NL3D::CZone::getNumPatchs()</a>, <a class="el" href="a06758.html#l00911">NL3D::CZone::getPatchBSphere()</a>, <a class="el" href="a05385.html#l00204">NLMISC::CAABBoxExt::getRadius()</a>, <a class="el" href="a06760.html#l00491">NL3D::CZone::getZoneBB()</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a06035.html#l00126">NL3D::CMiniCol::CZoneIdent::Patchs</a>, <a class="el" href="a05505.html#l00049">NLMISC::CBSphere::Radius</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06035.html#l00124">NL3D::CMiniCol::CZoneIdent::Sphere</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a06035.html#l00123">NL3D::CMiniCol::CZoneIdent::ZoneId</a>. +<p> +<div class="fragment"><pre>00117 { +00118 CZoneIdent newZone; +00119 +00120 <span class="comment">// landscape must have been inited.</span> +00121 <a class="code" href="a04199.html#a6">nlassert</a>(_Landscape); +00122 <span class="keyword">const</span> CZone *zone= <a class="code" href="a02930.html#NL3D_1_1CMiniColr1">_Landscape</a>->getZone(zoneId); +00123 <span class="comment">// zone must be loaded into landscape.</span> +00124 <a class="code" href="a04199.html#a6">nlassert</a>(zone); +00125 +00126 <span class="comment">// Fill the newzone.</span> +00127 newZone.ZoneId= zoneId; +00128 newZone.Sphere.Center= zone->getZoneBB().getCenter(); +00129 newZone.Sphere.Radius= zone->getZoneBB().getRadius(); +00130 newZone.Patchs.resize(zone->getNumPatchs()); +00131 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i<zone->getNumPatchs();i++) +00132 { +00133 newZone.Patchs[i].Sphere= zone->getPatchBSphere(i); +00134 } +00135 +00136 <span class="comment">// Add it to the set (if not already done...).</span> +00137 <a class="code" href="a02930.html#NL3D_1_1CMiniColr4">_Zones</a>.insert(newZone); +00138 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniCola2" doxytag="NL3D::CMiniCol::getFaces" ></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 NL3D::CMiniCol::getFaces </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">std::vector< <a class="el" href="a03616.html">CTriangle</a> > & </td> + <td class="mdname" nowrap> <em>triresult</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02156.html">CAABBox</a> & </td> + <td class="mdname" nowrap> <em>bbox</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> +This function get the faces which intersect a bbox.. +<p> +Definition at line <a class="el" href="a06034.html#l00467">467</a> of file <a class="el" href="a06034.html">mini_col.cpp</a>. +<p> +References <a class="el" href="a06300.html#l00641">NL3D::CQuadGrid< T >::begin()</a>, <a class="el" href="a06300.html#l00646">NL3D::CQuadGrid< T >::end()</a>, <a class="el" href="a05385.html#l00087">NLMISC::CAABBox::getMax()</a>, <a class="el" href="a05385.html#l00086">NLMISC::CAABBox::getMin()</a>, <a class="el" href="a05384.html#l00107">NLMISC::CAABBox::intersect()</a>, <a class="el" href="a06300.html#l00613">NL3D::CQuadGrid< T >::select()</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V0</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V1</a>, and <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V2</a>. +<p> +<div class="fragment"><pre>00468 { +00469 triresult.clear(); +00470 +00471 <span class="comment">// Select.</span> +00472 <a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_3">select</a>(bbox.getMin(),bbox.getMax()); +00473 +00474 <span class="comment">// For each face, test if it is under pos, then test if height is correct.</span> +00475 CQuadGrid<CFace>::CIterator iFace; +00476 <span class="keywordflow">for</span>(iFace= <a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_0">begin</a>();iFace!=<a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>();iFace++) +00477 { +00478 <a class="code" href="a03616.html">CTriangle</a> &face= (*iFace).Face; +00479 +00480 <span class="keywordflow">if</span>(bbox.intersect(face.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>, face.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>, face.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a>)) +00481 { +00482 triresult.push_back(face); +00483 } +00484 } +00485 +00486 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniCola3" doxytag="NL3D::CMiniCol::getGroundNormal" ></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 NL3D::CMiniCol::getGroundNormal </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>pos</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>normal</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>hup</em> = 0.5, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>hbot</em> = 1000</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> +This function get the ground normal under a position. hbot and hup are the margin where face can be taken. +<p> +Definition at line <a class="el" href="a06034.html#l00341">341</a> of file <a class="el" href="a06034.html">mini_col.cpp</a>. +<p> +References <a class="el" href="a06300.html#l00641">NL3D::CQuadGrid< T >::begin()</a>, <a class="el" href="a06300.html#l00646">NL3D::CQuadGrid< T >::end()</a>, <a class="el" href="a05384.html#l00215">NLMISC::CAABBox::extend()</a>, <a class="el" href="a06172.html#l00035">NLMISC::CPlane::getNormal()</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a05384.html#l00081">NLMISC::CAABBox::include()</a>, <a class="el" href="a06172.html#l00051">NLMISC::CPlane::intersect()</a>, <a class="el" href="a06300.html#l00613">NL3D::CQuadGrid< T >::select()</a>, <a class="el" href="a05385.html#l00066">NLMISC::CAABBox::setCenter()</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V0</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V1</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V2</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, and <a class="el" href="a06673.html#l00051">NLMISC::CVector::z</a>. +<p> +<div class="fragment"><pre>00342 { +00343 CVector b1,b2; +00344 <span class="keywordtype">bool</span> found=<span class="keyword">false</span>; +00345 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a633">height</a>=0.0; +00346 +00347 +00348 <span class="comment">// Select quad nodes which contains pos.</span> +00349 b1=b2=pos; +00350 b1.z-= hbot; +00351 b2.z+= hup; +00352 <span class="comment">// Select.</span> +00353 <a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_3">select</a>(b1,b2); +00354 +00355 <span class="comment">// For each face, test if it is under pos, then test if height is correct.</span> +00356 CQuadGrid<CFace>::CIterator iFace; +00357 <span class="keywordflow">for</span>(iFace= <a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_0">begin</a>();iFace!=<a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>();iFace++) +00358 { +00359 <a class="code" href="a03616.html">CTriangle</a> &pFace= (*iFace).Face; +00360 CPlane &pPlane= (*iFace).Plane; +00361 <span class="comment">// Order is important.</span> +00362 CVector &p0= pFace.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>; +00363 CVector &p1= pFace.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>; +00364 CVector &p2= pFace.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a>; +00365 +00366 <span class="comment">// TOIMP: This is VERY SLOW!!! (hope that the quadtree will help, but it still very slow...).</span> +00367 +00368 <span class="comment">// Yoyo Debug, test, if the point may be IN the bbox.</span> +00369 CAABBox bbFace; +00370 bbFace.setCenter(p0); +00371 bbFace.extend(p1); +00372 bbFace.extend(p2); +00373 CVector bext=p0; +00374 bext.z= <a class="code" href="a05378.html#a378">maxof</a>(p0.z, p1.z, p2.z)+hbot; +00375 bbFace.extend(bext); +00376 bext.z= <a class="code" href="a05378.html#a375">minof</a>(p0.z, p1.z, p2.z)-hup; +00377 bbFace.extend(bext); +00378 <span class="keywordflow">if</span>(!bbFace.include(pos)) +00379 <span class="keywordflow">continue</span>; +00380 +00381 <span class="comment">// Test if the face enclose the pos in X/Y plane.</span> +00382 <span class="comment">// NB: compute and using a BBox to do a rapid test is not a very good idea, since it will </span> +00383 <span class="comment">// add an overhead which is NOT negligeable compared to the following test.</span> +00384 <span class="keywordtype">float</span> a,b,c; <span class="comment">// 2D cartesian coefficients of line in plane X/Y.</span> +00385 <span class="comment">// Line p0-p1.</span> +00386 a= -(p1.y-p0.y); +00387 b= (p1.x-p0.x); +00388 c= -(p0.x*a + p0.y*b); +00389 <span class="keywordflow">if</span>( (a*pos.x + b*pos.y + c) < 0) <span class="keywordflow">continue</span>; +00390 <span class="comment">// Line p1-p2.</span> +00391 a= -(p2.y-p1.y); +00392 b= (p2.x-p1.x); +00393 c= -(p1.x*a + p1.y*b); +00394 <span class="keywordflow">if</span>( (a*pos.x + b*pos.y + c) < 0) <span class="keywordflow">continue</span>; +00395 <span class="comment">// Line p2-p0.</span> +00396 a= -(p0.y-p2.y); +00397 b= (p0.x-p2.x); +00398 c= -(p2.x*a + p2.y*b); +00399 <span class="keywordflow">if</span>( (a*pos.x + b*pos.y + c) < 0) <span class="keywordflow">continue</span>; +00400 +00401 +00402 <span class="comment">// Compute the possible height.</span> +00403 CVector tmp; +00404 <span class="comment">// intersect the vertical line with the plane.</span> +00405 tmp= pPlane.intersect(pos, pos-CVector(0,0,100)); +00406 <span class="keywordtype">float</span> h= tmp.z; +00407 <span class="comment">// Test if it would fit in the wanted field.</span> +00408 <span class="keywordflow">if</span>(h>pos.z+hup) <span class="keywordflow">continue</span>; +00409 <span class="keywordflow">if</span>(h<pos.z-hbot) <span class="keywordflow">continue</span>; +00410 +00411 <span class="comment">// OK!!</span> +00412 <span class="keywordflow">if</span>(!found) +00413 { +00414 found=<span class="keyword">true</span>; +00415 <a class="code" href="a04223.html#a633">height</a>=h; +00416 normal= pPlane.getNormal(); +00417 } +00418 <span class="keywordflow">else</span> +00419 { +00420 <span class="keywordflow">if</span>(h><a class="code" href="a04223.html#a633">height</a>) +00421 { +00422 normal= pPlane.getNormal(); +00423 <a class="code" href="a04223.html#a633">height</a>= h; +00424 } +00425 } +00426 } +00427 +00428 <span class="keywordflow">return</span> found; +00429 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniCola4" doxytag="NL3D::CMiniCol::init" ></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 NL3D::CMiniCol::init </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02702.html">CLandscape</a> * </td> + <td class="mdname" nowrap> <em>land</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>radMin</em> = 100, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>radDelta</em> = 50</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> +Init the size of the collision system, and init it with the landscape. +<p> + +<p> +Definition at line <a class="el" href="a06034.html#l00107">107</a> of file <a class="el" href="a06034.html">mini_col.cpp</a>. +<p> +References <a class="el" href="a06035.html#l00139">_RadMax</a>, and <a class="el" href="a06035.html#l00139">_RadMin</a>. +<p> +<div class="fragment"><pre>00108 { +00109 <a class="code" href="a02930.html#NL3D_1_1CMiniColr1">_Landscape</a>= land; +00110 <a class="code" href="a02930.html#NL3D_1_1CMiniColr3">_RadMin</a>= radMin; +00111 <a class="code" href="a02930.html#NL3D_1_1CMiniColr2">_RadMax</a>= radMin+radDelta; +00112 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniCold2" doxytag="NL3D::CMiniCol::removeLandScapePart" ></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 NL3D::CMiniCol::removeLandScapePart </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>zoneId</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>patchId</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>sphere</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06034.html#l00085">85</a> of file <a class="el" href="a06034.html">mini_col.cpp</a>. +<p> +References <a class="el" href="a06300.html#l00641">NL3D::CQuadGrid< T >::begin()</a>, <a class="el" href="a05505.html#l00048">NLMISC::CBSphere::Center</a>, <a class="el" href="a06300.html#l00646">NL3D::CQuadGrid< T >::end()</a>, <a class="el" href="a06300.html#l00468">NL3D::CQuadGrid< T >::erase()</a>, <a class="el" href="a05385.html#l00087">NLMISC::CAABBox::getMax()</a>, <a class="el" href="a05385.html#l00086">NLMISC::CAABBox::getMin()</a>, <a class="el" href="a05505.html#l00049">NLMISC::CBSphere::Radius</a>, <a class="el" href="a06300.html#l00613">NL3D::CQuadGrid< T >::select()</a>, <a class="el" href="a05385.html#l00066">NLMISC::CAABBox::setCenter()</a>, <a class="el" href="a05385.html#l00067">NLMISC::CAABBox::setHalfSize()</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +Referenced by <a class="el" href="a06034.html#l00142">removeZone()</a>, and <a class="el" href="a06034.html#l00178">setCenter()</a>. +<p> +<div class="fragment"><pre>00086 { +00087 <span class="comment">// Build the AAbox which englobe the bsphere of the patch.</span> +00088 CAABBox bb; +00089 bb.setCenter(sphere.<a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>); +00090 <span class="keywordtype">float</span> <a class="code" href="a05373.html#a2">l</a>= sphere.<a class="code" href="a02291.html#NLMISC_1_1CBSphereo1">Radius</a>; +00091 bb.setHalfSize(CVector(l,l,l)); +00092 +00093 <span class="comment">// For optimisation, select only faces which are IN the bbox of the patch.</span> +00094 <a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_3">select</a>(bb.getMin(), bb.getMax()); +00095 CQuadGrid<CFace>::CIterator iFace; +00096 <span class="keywordflow">for</span>(iFace= <a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_0">begin</a>();iFace!=<a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>();) +00097 { +00098 <span class="keywordflow">if</span>((*iFace).isFromPatch(zoneId, patchId)) +00099 iFace= <a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz774_1">erase</a>(iFace); +00100 <span class="keywordflow">else</span> +00101 iFace++; +00102 } +00103 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniCola5" doxytag="NL3D::CMiniCol::removeZone" ></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 NL3D::CMiniCol::removeZone </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname1" valign="top" nowrap> <em>zoneId</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Remove a zone from the collision system. Zone do not have to be loaded into the landscape. +<p> + +<p> +Definition at line <a class="el" href="a06034.html#l00142">142</a> of file <a class="el" href="a06034.html">mini_col.cpp</a>. +<p> +References <a class="el" href="a06035.html#l00141">_Zones</a>, <a class="el" href="a06035.html#l00116">NL3D::CMiniCol::CPatchIdent::Inserted</a>, <a class="el" href="a06035.html#l00125">NL3D::CMiniCol::CZoneIdent::NPatchInserted</a>, <a class="el" href="a06035.html#l00126">NL3D::CMiniCol::CZoneIdent::Patchs</a>, <a class="el" href="a06034.html#l00085">removeLandScapePart()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06035.html#l00115">NL3D::CMiniCol::CPatchIdent::Sphere</a>, <a class="el" href="a05981.html#l00098">uint16</a>, and <a class="el" href="a06035.html#l00123">NL3D::CMiniCol::CZoneIdent::ZoneId</a>. +<p> +<div class="fragment"><pre>00143 { +00144 CZoneIdent delZone; +00145 +00146 +00147 <span class="comment">// First, delete all patch from the grid.</span> +00148 <span class="comment">//=======================================</span> +00149 <span class="comment">// Fill the key part only.</span> +00150 delZone.ZoneId= zoneId; +00151 <span class="comment">// Find the zone (or quit).</span> +00152 TZoneSet::iterator itZone; +00153 itZone= <a class="code" href="a02930.html#NL3D_1_1CMiniColr4">_Zones</a>.find(delZone); +00154 <span class="keywordflow">if</span>(itZone==<a class="code" href="a02930.html#NL3D_1_1CMiniColr4">_Zones</a>.end()) +00155 <span class="keywordflow">return</span>; +00156 +00157 CZoneIdent &zone= const_cast<CZoneIdent&>(*itZone); +00158 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)zone.Patchs.size();i++) +00159 { +00160 CPatchIdent &pa= zone.Patchs[i]; +00161 <span class="keywordflow">if</span>(pa.Inserted) +00162 { +00163 <span class="comment">// Reject the patch.</span> +00164 <a class="code" href="a02930.html#NL3D_1_1CMiniCold2">removeLandScapePart</a>(zone.ZoneId, i, pa.Sphere); +00165 pa.Inserted= <span class="keyword">false</span>; +00166 zone.NPatchInserted--; +00167 } +00168 } +00169 +00170 <span class="comment">// Then, delete it.</span> +00171 <span class="comment">//=================</span> +00172 <a class="code" href="a02930.html#NL3D_1_1CMiniColr4">_Zones</a>.erase(delZone); +00173 +00174 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniCola6" doxytag="NL3D::CMiniCol::setCenter" ></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 NL3D::CMiniCol::setCenter </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>center</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Reset the center of interset of the collision zone. +<p> + +<p> +Definition at line <a class="el" href="a06034.html#l00178">178</a> of file <a class="el" href="a06034.html">mini_col.cpp</a>. +<p> +References <a class="el" href="a06035.html#l00139">_RadMax</a>, <a class="el" href="a06035.html#l00139">_RadMin</a>, <a class="el" href="a06035.html#l00141">_Zones</a>, <a class="el" href="a06034.html#l00076">addLandscapePart()</a>, <a class="el" href="a05505.html#l00048">NLMISC::CBSphere::Center</a>, <a class="el" href="a06035.html#l00116">NL3D::CMiniCol::CPatchIdent::Inserted</a>, <a class="el" href="a05504.html#l00079">NLMISC::CBSphere::intersect()</a>, <a class="el" href="a06035.html#l00125">NL3D::CMiniCol::CZoneIdent::NPatchInserted</a>, <a class="el" href="a06035.html#l00126">NL3D::CMiniCol::CZoneIdent::Patchs</a>, <a class="el" href="a06034.html#l00085">removeLandScapePart()</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06035.html#l00115">NL3D::CMiniCol::CPatchIdent::Sphere</a>, <a class="el" href="a06035.html#l00124">NL3D::CMiniCol::CZoneIdent::Sphere</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::z</a>, and <a class="el" href="a06035.html#l00123">NL3D::CMiniCol::CZoneIdent::ZoneId</a>. +<p> +<div class="fragment"><pre>00179 { +00180 <a class="code" href="a02291.html">CBSphere</a> BMin(center, _RadMin), BMax(center, _RadMax); +00181 +00182 <span class="comment">// For all zones, test if must insert patchs..</span> +00183 TZoneSet::iterator itZone; +00184 <span class="keywordflow">for</span>(itZone= <a class="code" href="a02930.html#NL3D_1_1CMiniColr4">_Zones</a>.begin();itZone!=<a class="code" href="a02930.html#NL3D_1_1CMiniColr4">_Zones</a>.end();itZone++) +00185 { +00186 CZoneIdent &zone= const_cast<CZoneIdent&>(*itZone); +00187 +00188 <span class="comment">// Tests must be done in 2D...</span> +00189 BMin.<a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>.z= zone.Sphere.Center.z; +00190 BMax.<a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>.z= zone.Sphere.Center.z; +00191 +00192 <span class="comment">// Must test first if the zone is IN the area.</span> +00193 <span class="comment">//=============================================</span> +00194 <span class="keywordtype">bool</span> zoneIn= <span class="keyword">false</span>; +00195 <span class="keywordflow">if</span>(zone.NPatchInserted==0) +00196 { +00197 <span class="keywordflow">if</span>(BMin.<a class="code" href="a02291.html#NLMISC_1_1CBSpherea4">intersect</a>(zone.Sphere)) +00198 zoneIn= <span class="keyword">true</span>; +00199 } +00200 <span class="keywordflow">else</span> +00201 zoneIn= <span class="keyword">true</span>; +00202 +00203 <span class="comment">// Then for all patchs, must test if the patch must be inserted, or rejected.</span> +00204 <span class="comment">//=============================================</span> +00205 <span class="keywordflow">if</span>(zoneIn) +00206 { +00207 <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> i=0;i<(<a class="code" href="a04558.html#a14">sint</a>)zone.Patchs.size();i++) +00208 { +00209 CPatchIdent &pa= zone.Patchs[i]; +00210 +00211 <span class="comment">// Tests must be done in 2D...</span> +00212 BMin.<a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>.z= pa.Sphere.Center.z; +00213 BMax.<a class="code" href="a02291.html#NLMISC_1_1CBSphereo0">Center</a>.z= pa.Sphere.Center.z; +00214 +00215 <span class="keywordflow">if</span>(pa.Inserted) +00216 { +00217 <span class="comment">// Reject the patch, if entirely OUT the max radius.</span> +00218 <span class="keywordflow">if</span>(!BMax.<a class="code" href="a02291.html#NLMISC_1_1CBSpherea4">intersect</a>(pa.Sphere)) +00219 { +00220 <a class="code" href="a02930.html#NL3D_1_1CMiniCold2">removeLandScapePart</a>(zone.ZoneId, i, pa.Sphere); +00221 pa.Inserted= <span class="keyword">false</span>; +00222 zone.NPatchInserted--; +00223 } +00224 } +00225 <span class="keywordflow">else</span> +00226 { +00227 <span class="comment">// Insert the pacth, if only partially IN the min radius.</span> +00228 <span class="keywordflow">if</span>(BMin.<a class="code" href="a02291.html#NLMISC_1_1CBSpherea4">intersect</a>(pa.Sphere)) +00229 { +00230 <a class="code" href="a02930.html#NL3D_1_1CMiniCold1">addLandscapePart</a>(zone.ZoneId, i); +00231 pa.Inserted= <span class="keyword">true</span>; +00232 zone.NPatchInserted++; +00233 } +00234 } +00235 } +00236 } +00237 } +00238 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniCola7" doxytag="NL3D::CMiniCol::snapToGround" ></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 NL3D::CMiniCol::snapToGround </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>pos</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>hup</em> = 0.5, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>float </td> + <td class="mdname" nowrap> <em>hbot</em> = 1000</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> +This function snap a position on the current set of faces. hbot and hup are the margin where <a class="el" href="a04223.html#a574">pos.z</a> can't change. (the pos can't move higher than +hup and lower than -hbot) +<p> +Definition at line <a class="el" href="a06034.html#l00242">242</a> of file <a class="el" href="a06034.html">mini_col.cpp</a>. +<p> +References <a class="el" href="a06300.html#l00641">NL3D::CQuadGrid< T >::begin()</a>, <a class="el" href="a06300.html#l00646">NL3D::CQuadGrid< T >::end()</a>, <a class="el" href="a05646.html#l01013">height</a>, <a class="el" href="a06172.html#l00051">NLMISC::CPlane::intersect()</a>, <a class="el" href="a06300.html#l00613">NL3D::CQuadGrid< T >::select()</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V0</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V1</a>, <a class="el" href="a06585.html#l00051">NLMISC::CTriangle::V2</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::x</a>, <a class="el" href="a06673.html#l00051">NLMISC::CVector::y</a>, and <a class="el" href="a06673.html#l00051">NLMISC::CVector::z</a>. +<p> +Referenced by <a class="el" href="a06034.html#l00433">testMove()</a>. +<p> +<div class="fragment"><pre>00243 { +00244 CVector b1,b2; +00245 <span class="keywordtype">bool</span> found=<span class="keyword">false</span>; +00246 <span class="keywordtype">float</span> <a class="code" href="a04223.html#a633">height</a>; +00247 +00248 +00249 <span class="comment">// Select quad nodes which contains pos.</span> +00250 b1=b2=pos; +00251 b1.z-= hbot; +00252 b2.z+= hup; +00253 <span class="comment">// Select.</span> +00254 <a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_3">select</a>(b1,b2); +00255 +00256 <span class="comment">// For each face, test if it is under pos, then test if height is correct.</span> +00257 CQuadGrid<CFace>::CIterator iFace; +00258 <span class="keywordflow">for</span>(iFace= <a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_0">begin</a>();iFace!=<a class="code" href="a02930.html#NL3D_1_1CMiniColr0">_Grid</a>.<a class="code" href="a03273.html#NL3D_1_1CQuadGridz776_2">end</a>();iFace++) +00259 { +00260 <a class="code" href="a03616.html">CTriangle</a> &pFace= (*iFace).Face; +00261 CPlane &pPlane= (*iFace).Plane; +00262 <span class="comment">// Order is important.</span> +00263 CVector &p0= pFace.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo3">V0</a>; +00264 CVector &p1= pFace.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo4">V1</a>; +00265 CVector &p2= pFace.<a class="code" href="a03616.html#NLMISC_1_1CTriangleUVo5">V2</a>; +00266 +00267 <span class="comment">// TOIMP: This is VERY SLOW!!! (hope that the quadtree will help, but it still very slow...).</span> +00268 +00269 <span class="comment">// Yoyo Debug, test, if the point may be IN the bbox.</span> +00270 <span class="comment">/*CAABBox bbFace;</span> +00271 <span class="comment"> bbFace.setCenter(p0);</span> +00272 <span class="comment"> bbFace.extend(p1);</span> +00273 <span class="comment"> bbFace.extend(p2);</span> +00274 <span class="comment"> CVector bext=p0;</span> +00275 <span class="comment"> bext.z= maxof(p0.z, p1.z, p2.z)+hbot;</span> +00276 <span class="comment"> bbFace.extend(bext);</span> +00277 <span class="comment"> bext.z= minof(p0.z, p1.z, p2.z)-hup;</span> +00278 <span class="comment"> bbFace.extend(bext);</span> +00279 <span class="comment"> if(!bbFace.include(pos))</span> +00280 <span class="comment"> continue;*/</span> +00281 +00282 <span class="comment">// Test if the face enclose the pos in X/Y plane.</span> +00283 <span class="comment">// NB: compute and using a BBox to do a rapid test is not a very good idea, since it will </span> +00284 <span class="comment">// add an overhead which is NOT negligeable compared to the following test.</span> +00285 <span class="keywordtype">float</span> a,b,c; <span class="comment">// 2D cartesian coefficients of line in plane X/Y.</span> +00286 <span class="comment">// Line p0-p1.</span> +00287 a= -(p1.y-p0.y); +00288 b= (p1.x-p0.x); +00289 c= -(p0.x*a + p0.y*b); +00290 <span class="keywordflow">if</span>( (a*pos.x + b*pos.y + c) < 0) <span class="keywordflow">continue</span>; +00291 <span class="comment">// Line p1-p2.</span> +00292 a= -(p2.y-p1.y); +00293 b= (p2.x-p1.x); +00294 c= -(p1.x*a + p1.y*b); +00295 <span class="keywordflow">if</span>( (a*pos.x + b*pos.y + c) < 0) <span class="keywordflow">continue</span>; +00296 <span class="comment">// Line p2-p0.</span> +00297 a= -(p0.y-p2.y); +00298 b= (p0.x-p2.x); +00299 c= -(p2.x*a + p2.y*b); +00300 <span class="keywordflow">if</span>( (a*pos.x + b*pos.y + c) < 0) <span class="keywordflow">continue</span>; +00301 +00302 +00303 <span class="comment">// Compute the possible height.</span> +00304 CVector tmp; +00305 <span class="comment">// intersect the vertical line with the plane.</span> +00306 tmp= pPlane.intersect(pos, pos-CVector(0,0,100)); +00307 +00308 <span class="comment">/*</span> +00309 <span class="comment"> // CTriangle intersect() method.</span> +00310 <span class="comment"> CVector tmp;</span> +00311 <span class="comment"> if(pFace.intersect(b1, b2, tmp, pPlane))</span> +00312 <span class="comment"> */</span> +00313 { +00314 <span class="keywordtype">float</span> h= tmp.z; +00315 <span class="comment">// Test if it would fit in the wanted field.</span> +00316 <span class="keywordflow">if</span>(h>pos.z+hup) <span class="keywordflow">continue</span>; +00317 <span class="keywordflow">if</span>(h<pos.z-hbot) <span class="keywordflow">continue</span>; +00318 +00319 <span class="comment">// OK!!</span> +00320 <span class="keywordflow">if</span>(!found) +00321 { +00322 found=<span class="keyword">true</span>; +00323 <a class="code" href="a04223.html#a633">height</a>=h; +00324 } +00325 <span class="keywordflow">else</span> +00326 { +00327 <a class="code" href="a04223.html#a633">height</a>= max(height,h); +00328 } +00329 } +00330 } +00331 +00332 <span class="keywordflow">if</span>(found) +00333 pos.z= <a class="code" href="a04223.html#a633">height</a>; +00334 +00335 <span class="keywordflow">return</span> found; +00336 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniCola8" doxytag="NL3D::CMiniCol::testMove" ></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 NL3D::CMiniCol::testMove </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>prec</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03128.html">CVector</a> & </td> + <td class="mdname" nowrap> <em>cur</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> +This function test if a move is OK, by snaping it to ground, and test if angle is<45deg. If !OK, cur is set to prec, and false is returned. +<p> +Definition at line <a class="el" href="a06034.html#l00433">433</a> of file <a class="el" href="a06034.html">mini_col.cpp</a>. +<p> +References <a class="el" href="a06682.html#l00115">NLMISC::CVector::norm()</a>, <a class="el" href="a06682.html#l00119">NLMISC::CVector::normalize()</a>, <a class="el" href="a05587.html#l00079">NLMISC::Pi</a>, and <a class="el" href="a06034.html#l00242">snapToGround()</a>. +<p> +<div class="fragment"><pre>00434 { +00435 CVector dir= cur-prec; +00436 dir.normalize(); +00437 +00438 <span class="comment">// Angle max.</span> +00439 <span class="keywordtype">float</span> anglemax= 65; <span class="comment">// 65 degrees.</span> +00440 anglemax= (<span class="keywordtype">float</span>)tan( anglemax*Pi/180); +00441 +00442 <span class="comment">// Must not go to near of a wall.</span> +00443 CVector <a class="code" href="a05373.html#a4">test</a>= cur+dir*0.5; +00444 <span class="keywordtype">float</span> norm= (<a class="code" href="a05373.html#a4">test</a>-prec).norm(); +00445 norm*=anglemax; +00446 <span class="keywordflow">if</span>(!<a class="code" href="a02930.html#NL3D_1_1CMiniCola7">snapToGround</a>(test, norm, norm)) +00447 { +00448 cur= prec; +00449 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00450 } +00451 <span class="keywordflow">else</span> +00452 { +00453 <span class="comment">// Must test and snap the current position.</span> +00454 norm= (cur-prec).norm(); +00455 norm*=anglemax; +00456 <span class="keywordflow">if</span>(!<a class="code" href="a02930.html#NL3D_1_1CMiniCola7">snapToGround</a>(cur, norm, norm)) +00457 { +00458 cur= prec; +00459 <span class="keywordflow">return</span> <span class="keyword">false</span>; +00460 } +00461 } +00462 <span class="keywordflow">return</span> <span class="keyword">true</span>; +00463 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NL3D_1_1CMiniColr0" doxytag="NL3D::CMiniCol::_Grid" ></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="a03273.html">TGrid</a> <a class="el" href="a02930.html#NL3D_1_1CMiniColr0">NL3D::CMiniCol::_Grid</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06035.html#l00140">140</a> of file <a class="el" href="a06035.html">mini_col.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniColr1" doxytag="NL3D::CMiniCol::_Landscape" ></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="a03321.html">CRefPtr</a><<a class="el" href="a02702.html">CLandscape</a>> <a class="el" href="a02930.html#NL3D_1_1CMiniColr1">NL3D::CMiniCol::_Landscape</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06035.html#l00138">138</a> of file <a class="el" href="a06035.html">mini_col.h</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniColr2" doxytag="NL3D::CMiniCol::_RadMax" ></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="a02930.html#NL3D_1_1CMiniColr2">NL3D::CMiniCol::_RadMax</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06035.html#l00139">139</a> of file <a class="el" href="a06035.html">mini_col.h</a>. +<p> +Referenced by <a class="el" href="a06034.html#l00047">CMiniCol()</a>, <a class="el" href="a06034.html#l00107">init()</a>, and <a class="el" href="a06034.html#l00178">setCenter()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniColr3" doxytag="NL3D::CMiniCol::_RadMin" ></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="a02930.html#NL3D_1_1CMiniColr3">NL3D::CMiniCol::_RadMin</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06035.html#l00139">139</a> of file <a class="el" href="a06035.html">mini_col.h</a>. +<p> +Referenced by <a class="el" href="a06034.html#l00047">CMiniCol()</a>, <a class="el" href="a06034.html#l00107">init()</a>, and <a class="el" href="a06034.html#l00178">setCenter()</a>. </td> + </tr> +</table> +<a class="anchor" name="NL3D_1_1CMiniColr4" doxytag="NL3D::CMiniCol::_Zones" ></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="a02930.html#NL3D_1_1CMiniColy1">TZoneSet</a> <a class="el" href="a02930.html#NL3D_1_1CMiniColr4">NL3D::CMiniCol::_Zones</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06035.html#l00141">141</a> of file <a class="el" href="a06035.html">mini_col.h</a>. +<p> +Referenced by <a class="el" href="a06034.html#l00116">addZone()</a>, <a class="el" href="a06034.html#l00142">removeZone()</a>, and <a class="el" href="a06034.html#l00178">setCenter()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a06035.html">mini_col.h</a><li><a class="el" href="a06034.html">mini_col.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 06:56:22 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> |