aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/move__container_8cpp-source.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/move__container_8cpp-source.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to '')
-rw-r--r--docs/doxygen/nel/move__container_8cpp-source.html2001
1 files changed, 2001 insertions, 0 deletions
diff --git a/docs/doxygen/nel/move__container_8cpp-source.html b/docs/doxygen/nel/move__container_8cpp-source.html
new file mode 100644
index 00000000..45922319
--- /dev/null
+++ b/docs/doxygen/nel/move__container_8cpp-source.html
@@ -0,0 +1,2001 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+<HEAD>
+ <TITLE>nevrax.org : docs</TITLE>
+ <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+</HEAD>
+<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<!-- uplinks -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ </TR>
+</TABLE>
+
+<!-- banner Nevrax -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
+ <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
+</TABLE>
+
+<!-- main table -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+ <!------ Begin Box ------>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
+ <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
+ <TABLE cellspacing=0 cellpadding=1 border=0>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
+ </TABLE>
+ </TD></TR></TABLE></TD></TR></TABLE>
+ <!------ End Box ------>
+
+ </TD>
+ <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+<!-- title -->
+<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
+<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
+</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
+</td></tr></table>
+&nbsp;
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Documentation</B></TD>
+ <TD ALIGN=RIGHT>&nbsp;</td>
+</tr></table>
+<!-- Generated by Doxygen 1.2.14 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
+<hr><h1>move_container.cpp</h1><a href="move__container_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
+00008 <font class="comment"> *</font>
+00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
+00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
+00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
+00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
+00013 <font class="comment"> * any later version.</font>
+00014 <font class="comment"></font>
+00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
+00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
+00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
+00018 <font class="comment"> * General Public License for more details.</font>
+00019 <font class="comment"></font>
+00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
+00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
+00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
+00023 <font class="comment"> * MA 02111-1307, USA.</font>
+00024 <font class="comment"> */</font>
+00025
+00026 <font class="preprocessor">#include "<a class="code" href="stdpacs_8h.html">stdpacs.h</a>"</font>
+00027
+00028 <font class="preprocessor">#include "<a class="code" href="move__primitive_8h.html">pacs/move_primitive.h</a>"</font>
+00029 <font class="preprocessor">#include "<a class="code" href="move__element_8h.html">pacs/move_element.h</a>"</font>
+00030 <font class="preprocessor">#include "<a class="code" href="pacs_2primitive__block_8h.html">pacs/primitive_block.h</a>"</font>
+00031
+00032 <font class="preprocessor">#include "<a class="code" href="hierarchical__timer_8h.html">nel/misc/hierarchical_timer.h</a>"</font>
+00033
+00034 <font class="preprocessor">#include "<a class="code" href="i__xml_8h.html">nel/misc/i_xml.h</a>"</font>
+00035 <font class="preprocessor">#include &lt;math.h&gt;</font>
+00036 <font class="preprocessor">#include &lt;float.h&gt;</font>
+00037
+00038 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
+00039
+<a name="l00040"></a><a class="code" href="move__container_8cpp.html#a0">00040</a> <font class="preprocessor">#define NELPACS_ALLOC_DYNAMIC_INFO 100</font>
+<a name="l00041"></a><a class="code" href="move__container_8cpp.html#a1">00041</a> <font class="preprocessor"></font><font class="preprocessor">#define NELPACS_ALLOC_STATIC_INFO 100</font>
+00042 <font class="preprocessor"></font>
+00043 <font class="keyword">namespace </font>NLPACS
+00044 {
+00045
+00046 <font class="comment">// ***************************************************************************</font>
+00047
+<a name="l00048"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a2">00048</a> CMoveContainer::~CMoveContainer ()
+00049 {
+00050 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c0">clear</a> ();
+00051 }
+00052
+00053 <font class="comment">// ***************************************************************************</font>
+00054
+<a name="l00055"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c0">00055</a> <font class="keywordtype">void</font> CMoveContainer::clear ()
+00056 {
+00057 <font class="comment">// Clear all primitives</font>
+00058 std::set&lt;CMovePrimitive*&gt;::iterator ite=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o2">_PrimitiveSet</a>.begin();
+00059 <font class="keywordflow">while</font> (ite!=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o2">_PrimitiveSet</a>.end ())
+00060 {
+00061 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c20">freePrimitive</a> (*ite);
+00062 ite++;
+00063 }
+00064
+00065 <font class="comment">// Clear primitive set</font>
+00066 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o2">_PrimitiveSet</a>.clear ();
+00067
+00068 <font class="comment">// Clear root changed</font>
+00069 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>.clear ();
+00070
+00071 <font class="comment">// Clear static world image set</font>
+00072 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.clear ();
+00073
+00074 <font class="comment">// Clear cell array</font>
+00075 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o18">_VectorCell</a>.clear ();
+00076
+00077 <font class="comment">// Clear time ot</font>
+00078 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>.clear ();
+00079 }
+00080
+00081 <font class="comment">// ***************************************************************************</font>
+00082
+<a name="l00083"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a3">00083</a> <font class="keywordtype">void</font> CMoveContainer::init (<font class="keywordtype">double</font> xmin, <font class="keywordtype">double</font> ymin, <font class="keywordtype">double</font> xmax, <font class="keywordtype">double</font> ymax, uint widthCellCount, uint heightCellCount,
+00084 <font class="keywordtype">double</font> primitiveMaxSize, uint8 numWorldImage, uint maxIteration, uint otSize)
+00085 {
+00086 <font class="comment">// Clear arrays</font>
+00087 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c0">clear</a> ();
+00088
+00089 <font class="comment">// Create world images</font>
+00090 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>.resize (numWorldImage);
+00091 <font class="keywordflow">for</font> (uint i=0; i&lt;numWorldImage; i++)
+00092 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>[i]=NULL;
+00093
+00094 <font class="comment">// Not in test mode</font>
+00095 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>=NULL;
+00096
+00097 <font class="comment">// Element size</font>
+00098 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o9">_PrimitiveMaxSize</a>=primitiveMaxSize;
+00099
+00100 <font class="comment">// BB</font>
+00101 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o10">_Xmin</a>=xmin;
+00102 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o11">_Ymin</a>=ymin;
+00103 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o12">_Xmax</a>=xmax;
+00104 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o13">_Ymax</a>=ymax;
+00105
+00106 <font class="comment">// Cells count</font>
+00107 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>=widthCellCount;
+00108 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o17">_CellCountHeight</a>=heightCellCount;
+00109
+00110 <font class="comment">// Cells size</font>
+00111 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o14">_CellWidth</a>=(<a class="code" href="classNLPACS_1_1CMoveContainer.html#o12">_Xmax</a> - <a class="code" href="classNLPACS_1_1CMoveContainer.html#o10">_Xmin</a>)/(double)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>;
+00112 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o15">_CellHeight</a>=(<a class="code" href="classNLPACS_1_1CMoveContainer.html#o13">_Ymax</a> - <a class="code" href="classNLPACS_1_1CMoveContainer.html#o11">_Ymin</a>)/(double)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o17">_CellCountHeight</a>;
+00113
+00114 <font class="comment">// Cell array</font>
+00115 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o18">_VectorCell</a>.resize (numWorldImage);
+00116 <font class="keywordflow">for</font> (uint j=0; j&lt;numWorldImage; j++)
+00117 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o18">_VectorCell</a>[j].resize (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a> * <a class="code" href="classNLPACS_1_1CMoveContainer.html#o17">_CellCountHeight</a>);
+00118
+00119 <font class="comment">// resize OT</font>
+00120 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o5">_OtSize</a>=otSize;
+00121 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>.resize (otSize);
+00122
+00123 <font class="comment">// Clear the OT</font>
+00124 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c4">clearOT</a> ();
+00125
+00126 <font class="comment">// Clear test time</font>
+00127 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o0">_TestTime</a>=0xffffffff;
+00128 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o1">_MaxTestIteration</a>=maxIteration;
+00129
+00130 <font class="comment">// Resize trigger array</font>
+00131 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o21">_Triggers</a>.resize (<a class="code" href="move__container_8h.html#a0">NELPACS_CONTAINER_TRIGGER_DEFAULT_SIZE</a>);
+00132 }
+00133
+00134 <font class="comment">// ***************************************************************************</font>
+00135
+<a name="l00136"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a4">00136</a> <font class="keywordtype">void</font> CMoveContainer::init (CGlobalRetriever* retriever, uint widthCellCount, uint heightCellCount, <font class="keywordtype">double</font> primitiveMaxSize,
+00137 uint8 numWorldImage, uint maxIteration, uint otSize)
+00138 {
+00139 <font class="comment">// Get min max of the global retriever BB</font>
+00140 CVector <a class="code" href="bit__set_8cpp.html#a0">min</a>=retriever-&gt;getBBox().getMin();
+00141 CVector max=retriever-&gt;getBBox().getMax();
+00142
+00143 <font class="comment">// Setup min max</font>
+00144 <font class="keywordtype">double</font> xmin=<a class="code" href="bit__set_8cpp.html#a0">min</a>.x;
+00145 <font class="keywordtype">double</font> ymin=<a class="code" href="bit__set_8cpp.html#a0">min</a>.y;
+00146 <font class="keywordtype">double</font> xmax=max.x;
+00147 <font class="keywordtype">double</font> ymax=max.y;
+00148
+00149 <font class="comment">// Init</font>
+00150 <a class="code" href="classNLPACS_1_1CMoveContainer.html#a3">init</a> (xmin, ymin, xmax, ymax, widthCellCount, heightCellCount, primitiveMaxSize, numWorldImage, maxIteration, otSize);
+00151
+00152 <font class="comment">// Init the retriever</font>
+00153 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>=retriever;
+00154 }
+00155
+00156 <font class="comment">// ***************************************************************************</font>
+00157
+<a name="l00158"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a12">00158</a> <font class="keywordtype">void</font> CMoveContainer::evalCollision (<font class="keywordtype">double</font> deltaTime, uint8 worldImage)
+00159 {
+00160 NL_ALLOC_CONTEXT( Pacs )
+00161
+00162 <font class="comment">// H_AUTO(PACS_MC_evalCollision);</font>
+00163
+00164 <font class="comment">// New test time</font>
+00165 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o0">_TestTime</a>++;
+00166
+00167 <font class="comment">// Delta time</font>
+00168 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>=deltaTime;
+00169
+00170 <font class="comment">// Clear triggers</font>
+00171 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o21">_Triggers</a>.clear ();
+00172
+00173 <font class="comment">// Update the bounding box and position of modified primitives</font>
+00174 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c1">updatePrimitives</a> (0.f, worldImage);
+00175
+00176 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00177 <font class="preprocessor"></font> <font class="comment">// Check list integrity</font>
+00178 <font class="comment">//checkSortedList ();</font>
+00179 <font class="preprocessor">#endif // NL_DEBUG</font>
+00180 <font class="preprocessor"></font>
+00181 <font class="comment">// Get first collision</font>
+00182 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o7">_PreviousCollisionNode</a> = &amp;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[0];
+00183
+00184 <font class="comment">// Eval all collisions</font>
+00185 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c9">evalAllCollisions</a> (0.f, worldImage);
+00186
+00187 <font class="comment">// Clear modified list</font>
+00188 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c13">clearModifiedList</a> (worldImage);
+00189
+00190 <font class="comment">// Modified list is empty at this point</font>
+00191 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>[worldImage]==NULL);
+00192
+00193 <font class="comment">// Previous node is a 'hard' OT node</font>
+00194 <a class="code" href="debug_8h.html#a6">nlassert</a> (!<a class="code" href="classNLPACS_1_1CMoveContainer.html#o7">_PreviousCollisionNode</a>-&gt;isInfo());
+00195
+00196 <font class="comment">// Get next collision</font>
+00197 CCollisionOTInfo *nextCollision=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o7">_PreviousCollisionNode</a>-&gt;getNextInfo ();
+00198
+00199 <font class="comment">// Collision ?</font>
+00200 <font class="keywordflow">while</font> (nextCollision)
+00201 {
+00202 <font class="comment">// Get new previous OT hard node</font>
+00203 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o7">_PreviousCollisionNode</a>=nextCollision-&gt;getPrevious ();
+00204
+00205 <font class="comment">// Previous node is a 'hard' OT node</font>
+00206 <a class="code" href="debug_8h.html#a6">nlassert</a> (!<a class="code" href="classNLPACS_1_1CMoveContainer.html#o7">_PreviousCollisionNode</a>-&gt;isInfo());
+00207
+00208 <font class="comment">// Keep this collision</font>
+00209 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c29">reaction</a> (*nextCollision);
+00210
+00211 <font class="comment">// Last time</font>
+00212 <font class="keywordtype">double</font> newTime=nextCollision-&gt;getCollisionTime ();
+00213
+00214 <font class="comment">// Remove modified objects from the OT</font>
+00215 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c14">removeModifiedFromOT</a> (worldImage);
+00216
+00217 <font class="comment">// Must have been removed</font>
+00218 <a class="code" href="debug_8h.html#a6">nlassert</a> (nextCollision-&gt;getPrevious ()==NULL);
+00219 <a class="code" href="debug_8h.html#a6">nlassert</a> (nextCollision-&gt;CCollisionOT::getNext ()==NULL);
+00220
+00221 <font class="comment">// Update the bounding box and position of modified primitives</font>
+00222 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c1">updatePrimitives</a> (newTime, worldImage);
+00223
+00224 <font class="comment">// Eval all collisions of modified objects for the new delta t</font>
+00225 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c9">evalAllCollisions</a> (newTime, worldImage);
+00226
+00227 <font class="comment">// Clear modified list</font>
+00228 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c13">clearModifiedList</a> (worldImage);
+00229
+00230 <font class="comment">// Get next collision</font>
+00231 nextCollision=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o7">_PreviousCollisionNode</a>-&gt;getNextInfo ();
+00232 }
+00233
+00234 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00235 <font class="preprocessor"></font> <font class="comment">// OT must be cleared</font>
+00236 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c5">checkOT</a> ();
+00237 <font class="preprocessor">#endif // NL_DEBUG</font>
+00238 <font class="preprocessor"></font>
+00239 <font class="comment">// Free ordered table info</font>
+00240 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c18">freeAllOTInfo</a> ();
+00241
+00242 <font class="comment">// Some init</font>
+00243 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o7">_PreviousCollisionNode</a>=NULL;
+00244 }
+00245
+00246 <font class="comment">// ***************************************************************************</font>
+00247
+<a name="l00248"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a14">00248</a> <font class="keywordtype">bool</font> CMoveContainer::testMove (UMovePrimitive* primitive, <font class="keyword">const</font> CVectorD&amp; speed, <font class="keywordtype">double</font> deltaTime, uint8 worldImage, CVectorD *contactNormal)
+00249 {
+00250 NL_ALLOC_CONTEXT( Pacs )
+00251
+00252 <font class="comment">// H_AUTO(PACS_MC_testMove);</font>
+00253
+00254 <font class="keywordflow">if</font> (contactNormal)
+00255 *contactNormal = CVectorD::Null;
+00256
+00257 <font class="comment">// Cast</font>
+00258 <a class="code" href="debug_8h.html#a6">nlassert</a> (dynamic_cast&lt;CMovePrimitive*&gt;(primitive));
+00259 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a>* prim=static_cast&lt;CMovePrimitive*&gt;(primitive);
+00260
+00261 <font class="comment">// New test time</font>
+00262 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o0">_TestTime</a>++;
+00263
+00264 <font class="comment">// Delta time</font>
+00265 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>=deltaTime;
+00266
+00267 <font class="comment">// Get the world image primitive</font>
+00268 uint8 primitiveWorldImage;
+00269 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI;
+00270 <font class="keywordflow">if</font> (prim-&gt;isNonCollisionable ())
+00271 {
+00272 wI=prim-&gt;getWorldImage (0);
+00273 primitiveWorldImage=worldImage;
+00274 }
+00275 <font class="keywordflow">else</font>
+00276 {
+00277 wI=prim-&gt;getWorldImage (worldImage);
+00278 primitiveWorldImage=worldImage;
+00279 }
+00280
+00281 <font class="comment">// Backup speed</font>
+00282 CVectorD oldSpeed=wI-&gt;getSpeed ();
+00283
+00284 <font class="comment">// Set speed</font>
+00285 wI-&gt;move (speed, *<font class="keyword">this</font>, *prim, primitiveWorldImage);
+00286
+00287 <font class="comment">// Update the bounding box and position of the primitive</font>
+00288 wI-&gt;update (0, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>, *prim);
+00289
+00290 <font class="comment">// Compute cells overlaped by the primitive</font>
+00291 <font class="keywordflow">if</font> (!prim-&gt;isNonCollisionable ())
+00292 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c2">updateCells</a> (prim, worldImage);
+00293
+00294 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00295 <font class="preprocessor"></font> <font class="comment">// Check list integrity</font>
+00296 <font class="comment">// checkSortedList ();</font>
+00297 <font class="preprocessor">#endif // NL_DEBUG</font>
+00298 <font class="preprocessor"></font>
+00299 <font class="comment">// Result</font>
+00300 <font class="keywordtype">bool</font> result=<font class="keyword">false</font>;
+00301 <font class="keywordtype">bool</font> testMoveValid;
+00302
+00303 <font class="comment">// Eval first each static world images</font>
+00304 result=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c6">evalOneTerrainCollision</a> (0, prim, primitiveWorldImage, <font class="keyword">true</font>, testMoveValid, NULL, contactNormal);
+00305
+00306 <font class="comment">// Eval first each static world images</font>
+00307 <font class="keywordflow">if</font> (!result)
+00308 {
+00309 std::set&lt;uint8&gt;::iterator ite=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.begin();
+00310 <font class="keywordflow">while</font> (ite!=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.end())
+00311 {
+00312
+00313 <font class="comment">// Eval in this world image</font>
+00314 result=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c7">evalOnePrimitiveCollision</a> (0, prim, *ite, primitiveWorldImage, <font class="keyword">true</font>, <font class="keyword">true</font>, testMoveValid, NULL, contactNormal);
+00315
+00316 <font class="comment">// If found, abort</font>
+00317 <font class="keywordflow">if</font> (result)
+00318 <font class="keywordflow">break</font>;
+00319
+00320 <font class="comment">// Next world image</font>
+00321 ite++;
+00322 }
+00323 }
+00324
+00325 <font class="comment">// Eval collisions if not found and not tested</font>
+00326 <font class="keywordflow">if</font> ((!result) &amp;&amp; (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.find (worldImage)==<a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.end()))
+00327 result=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c7">evalOnePrimitiveCollision</a> (0, prim, worldImage, primitiveWorldImage, <font class="keyword">true</font>, <font class="keyword">false</font>, testMoveValid, NULL, contactNormal);
+00328
+00329 <font class="comment">// Backup speed only if the primitive is inserted in the world image</font>
+00330 <font class="keywordflow">if</font> (prim-&gt;isInserted (primitiveWorldImage))
+00331 wI-&gt;move (oldSpeed, *<font class="keyword">this</font>, *prim, primitiveWorldImage);
+00332
+00333 <font class="preprocessor">#ifdef NL_DEBUG</font>
+00334 <font class="preprocessor"></font> <font class="comment">// OT must be cleared</font>
+00335 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c5">checkOT</a> ();
+00336 <font class="preprocessor">#endif // NL_DEBUG</font>
+00337 <font class="preprocessor"></font>
+00338 <font class="comment">// Free ordered table info</font>
+00339 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c18">freeAllOTInfo</a> ();
+00340
+00341 <font class="comment">// Some init</font>
+00342 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o7">_PreviousCollisionNode</a>=NULL;
+00343
+00344 <font class="comment">// Return result</font>
+00345 <font class="keywordflow">return</font> !result;
+00346 }
+00347
+00348 <font class="comment">// ***************************************************************************</font>
+00349
+<a name="l00350"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c1">00350</a> <font class="keywordtype">void</font> CMoveContainer::updatePrimitives (<font class="keywordtype">double</font> beginTime, uint8 worldImage)
+00351 {
+00352 <font class="comment">// H_AUTO(PACS_MC_updatePrimitives);</font>
+00353
+00354 <font class="comment">// For each changed primitives</font>
+00355 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> *<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>[worldImage];
+00356 <font class="keywordflow">while</font> (changed)
+00357 {
+00358 <font class="comment">// Get the primitive world image</font>
+00359 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI;
+00360 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;isNonCollisionable())
+00361 wI=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;getWorldImage (0);
+00362 <font class="keywordflow">else</font>
+00363 wI=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;getWorldImage (worldImage);
+00364
+00365 <font class="comment">// Force the build of the bounding box</font>
+00366 wI-&gt;update (beginTime, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>, *<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>);
+00367
+00368 <font class="comment">// Is inserted in this world image ?</font>
+00369 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;isInserted (worldImage))
+00370 {
+00371
+00372 <font class="comment">// Compute cells overlaped by the primitive</font>
+00373 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c2">updateCells</a> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>, worldImage);
+00374 }
+00375
+00376 <font class="comment">// Next primitive</font>
+00377 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>=wI-&gt;getNextModified ();
+00378 }
+00379 }
+00380
+00381 <font class="comment">// ***************************************************************************</font>
+00382
+<a name="l00383"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c2">00383</a> <font class="keywordtype">void</font> CMoveContainer::updateCells (CMovePrimitive *primitive, uint8 worldImage)
+00384 {
+00385 <font class="comment">// H_AUTO(PACS_MC_updateCells);</font>
+00386
+00387 <font class="comment">// Get the primitive world image</font>
+00388 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI=primitive-&gt;getWorldImage (worldImage);
+00389
+00390 <font class="comment">// Check BB width not too large</font>
+00391 <font class="keywordflow">if</font> (wI-&gt;getBBXMax() - wI-&gt;getBBXMin() &gt; <a class="code" href="classNLPACS_1_1CMoveContainer.html#o14">_CellWidth</a>)
+00392 {
+00393 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Primitives have moved more than a cell."</font>);
+00394 }
+00395
+00396 <font class="comment">// Check BB height not too large</font>
+00397 <font class="keywordflow">if</font> (wI-&gt;getBBYMax() - wI-&gt;getBBYMin() &gt; <a class="code" href="classNLPACS_1_1CMoveContainer.html#o15">_CellHeight</a>)
+00398 {
+00399 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Primitives have moved more than a cell."</font>);
+00400 }
+00401
+00402 <font class="comment">// Get coordinate in the cell array</font>
+00403 sint minx=(int)floor ((wI-&gt;getBBXMin() - <a class="code" href="classNLPACS_1_1CMoveContainer.html#o10">_Xmin</a>) / <a class="code" href="classNLPACS_1_1CMoveContainer.html#o14">_CellWidth</a>);
+00404 sint miny=(int)floor ((wI-&gt;getBBYMin() - <a class="code" href="classNLPACS_1_1CMoveContainer.html#o11">_Ymin</a>) / <a class="code" href="classNLPACS_1_1CMoveContainer.html#o15">_CellHeight</a>);
+00405 sint maxx=(int)floor ((wI-&gt;getBBXMax() - <a class="code" href="classNLPACS_1_1CMoveContainer.html#o10">_Xmin</a>) / <a class="code" href="classNLPACS_1_1CMoveContainer.html#o14">_CellWidth</a>);
+00406 sint maxy=(int)floor ((wI-&gt;getBBYMax() - <a class="code" href="classNLPACS_1_1CMoveContainer.html#o11">_Ymin</a>) / <a class="code" href="classNLPACS_1_1CMoveContainer.html#o15">_CellHeight</a>);
+00407
+00408 <font class="comment">// Born</font>
+00409 <font class="keywordflow">if</font> (minx&lt;0)
+00410 minx=0;
+00411 <font class="keywordflow">if</font> (miny&lt;0)
+00412 miny=0;
+00413 <font class="keywordflow">if</font> (maxx&gt;=(int)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>)
+00414 maxx=(int)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>-1;
+00415 <font class="keywordflow">if</font> (maxy&gt;=(int)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o17">_CellCountHeight</a>)
+00416 maxy=(int)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o17">_CellCountHeight</a>-1;
+00417
+00418 maxx=<a class="code" href="bit__set_8cpp.html#a0">std::min</a> (minx+1, maxx);
+00419 maxy=<a class="code" href="bit__set_8cpp.html#a0">std::min</a> (miny+1, maxy);
+00420
+00421 <font class="comment">// flags founded</font>
+00422 <font class="keywordtype">bool</font> found[4]={<font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>, <font class="keyword">false</font>};
+00423
+00424 <font class="comment">// For each old cells</font>
+00425 uint i;
+00426 <font class="keywordflow">for</font> (i=0; i&lt;4; i++)
+00427 {
+00428 <font class="comment">// Element</font>
+00429 CMoveElement *elm = wI-&gt;getMoveElement (i);
+00430
+00431 <font class="comment">// Old element in this cell ?</font>
+00432 <font class="keywordflow">if</font> ( elm )
+00433 {
+00434 <font class="comment">// Check</font>
+00435 <a class="code" href="debug_8h.html#a6">nlassert</a> (elm-&gt;X&lt;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>);
+00436 <a class="code" href="debug_8h.html#a6">nlassert</a> (elm-&gt;Y&lt;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o17">_CellCountHeight</a>);
+00437
+00438 <font class="comment">// Must remove it ?</font>
+00439 <font class="keywordflow">if</font> ( (elm-&gt;X &lt; minx) || (elm-&gt;X &gt; maxx) || (elm-&gt;Y &lt; miny) || (elm-&gt;Y &gt; maxy) )
+00440 {
+00441 <font class="comment">// Yes remove it</font>
+00442 wI-&gt;removeMoveElement (i, *<font class="keyword">this</font>, worldImage);
+00443 }
+00444 <font class="keywordflow">else</font>
+00445 {
+00446 <font class="comment">// Checks</font>
+00447 <a class="code" href="debug_8h.html#a6">nlassert</a> (((elm-&gt;X - minx)==0)||((elm-&gt;X - minx)==1));
+00448 <a class="code" href="debug_8h.html#a6">nlassert</a> (((elm-&gt;Y - miny)==0)||((elm-&gt;Y - miny)==1));
+00449
+00450 <font class="comment">// Update position</font>
+00451 <font class="preprocessor">#ifndef TEST_CELL</font>
+00452 <font class="preprocessor"></font> <a class="code" href="classNLPACS_1_1CMoveContainer.html#o18">_VectorCell</a>[worldImage][elm-&gt;X+elm-&gt;Y*<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>].updateSortedLists (elm, worldImage);
+00453 <font class="preprocessor">#endif</font>
+00454 <font class="preprocessor"></font>
+00455 <font class="comment">// Check found cells</font>
+00456 found[ elm-&gt;X - minx + ((elm-&gt;Y - miny) &lt;&lt; (maxx-minx)) ]=<font class="keyword">true</font>;
+00457 }
+00458 }
+00459 }
+00460
+00461 <font class="comment">// For each case selected</font>
+00462 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>;
+00463 i=0;
+00464 <font class="keywordflow">for</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>=miny; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;=(int)maxy; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++)
+00465 <font class="keywordflow">for</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>=minx; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&lt;=(int)maxx; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++)
+00466 {
+00467 <font class="comment">// Check the formula</font>
+00468 <a class="code" href="debug_8h.html#a6">nlassert</a> ((<font class="keywordtype">int</font>)i == (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> - minx + ((<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a> - miny) &lt;&lt; (maxx-minx)) ));
+00469
+00470 <font class="comment">// If the cell is not found</font>
+00471 <font class="keywordflow">if</font> (!found[i])
+00472 {
+00473 <font class="comment">// Center of the cell</font>
+00474 <font class="keywordtype">double</font> cx=((double)<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>+0.5f)*<a class="code" href="classNLPACS_1_1CMoveContainer.html#o14">_CellWidth</a>+<a class="code" href="classNLPACS_1_1CMoveContainer.html#o10">_Xmin</a>;
+00475 <font class="keywordtype">double</font> cy=((double)<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>+0.5f)*<a class="code" href="classNLPACS_1_1CMoveContainer.html#o15">_CellHeight</a>+<a class="code" href="classNLPACS_1_1CMoveContainer.html#o11">_Ymin</a>;
+00476
+00477 <font class="comment">// Add it in the list</font>
+00478 wI-&gt;addMoveElement (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o18">_VectorCell</a>[worldImage][<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>], (uint16)<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, (uint16)<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>, cx, cy, primitive, *<font class="keyword">this</font>, worldImage);
+00479 }
+00480
+00481 <font class="comment">// Next cell</font>
+00482 i++;
+00483 }
+00484 }
+00485
+00486 <font class="comment">// ***************************************************************************</font>
+00487
+<a name="l00488"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c3">00488</a> <font class="keywordtype">void</font> CMoveContainer::getCells (CMovePrimitive *primitive, uint8 worldImage, uint8 primitiveWorldImage, CMoveElement **elementArray)
+00489 {
+00490 <font class="comment">// H_AUTO(PACS_MC_getCells);</font>
+00491
+00492 <font class="comment">// Get the primitive world image</font>
+00493 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI;
+00494 <font class="keywordflow">if</font> (primitive-&gt;isNonCollisionable())
+00495 wI=primitive-&gt;getWorldImage (0);
+00496 <font class="keywordflow">else</font>
+00497 wI=primitive-&gt;getWorldImage (primitiveWorldImage);
+00498
+00499 <font class="comment">// Check BB width not too large</font>
+00500 <font class="keywordflow">if</font> (wI-&gt;getBBXMax() - wI-&gt;getBBXMin() &gt; <a class="code" href="classNLPACS_1_1CMoveContainer.html#o14">_CellWidth</a>)
+00501 {
+00502 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Primitives have moved more than a cell."</font>);
+00503 }
+00504
+00505 <font class="comment">// Check BB height not too large</font>
+00506 <font class="keywordflow">if</font> (wI-&gt;getBBYMax() - wI-&gt;getBBYMin() &gt; <a class="code" href="classNLPACS_1_1CMoveContainer.html#o15">_CellHeight</a>)
+00507 {
+00508 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Primitives have moved more than a cell."</font>);
+00509 }
+00510
+00511 <font class="comment">// Get coordinate in the cell array</font>
+00512 <font class="keywordtype">int</font> minx=(int)floor ((wI-&gt;getBBXMin() - <a class="code" href="classNLPACS_1_1CMoveContainer.html#o10">_Xmin</a>) / <a class="code" href="classNLPACS_1_1CMoveContainer.html#o14">_CellWidth</a>);
+00513 <font class="keywordtype">int</font> miny=(int)floor ((wI-&gt;getBBYMin() - <a class="code" href="classNLPACS_1_1CMoveContainer.html#o11">_Ymin</a>) / <a class="code" href="classNLPACS_1_1CMoveContainer.html#o15">_CellHeight</a>);
+00514 <font class="keywordtype">int</font> maxx=(int)floor ((wI-&gt;getBBXMax() - <a class="code" href="classNLPACS_1_1CMoveContainer.html#o10">_Xmin</a>) / <a class="code" href="classNLPACS_1_1CMoveContainer.html#o14">_CellWidth</a>);
+00515 <font class="keywordtype">int</font> maxy=(int)floor ((wI-&gt;getBBYMax() - <a class="code" href="classNLPACS_1_1CMoveContainer.html#o11">_Ymin</a>) / <a class="code" href="classNLPACS_1_1CMoveContainer.html#o15">_CellHeight</a>);
+00516
+00517 <font class="comment">// Born</font>
+00518 <font class="keywordflow">if</font> (minx&lt;0)
+00519 minx=0;
+00520 <font class="keywordflow">if</font> (miny&lt;0)
+00521 miny=0;
+00522 <font class="keywordflow">if</font> (maxx&gt;=(int)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>)
+00523 maxx=(int)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>-1;
+00524 <font class="keywordflow">if</font> (maxy&gt;=(int)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o17">_CellCountHeight</a>)
+00525 maxy=(int)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o17">_CellCountHeight</a>-1;
+00526
+00527 maxx=<a class="code" href="bit__set_8cpp.html#a0">std::min</a> (minx+1, maxx);
+00528 maxy=<a class="code" href="bit__set_8cpp.html#a0">std::min</a> (miny+1, maxy);
+00529
+00530 <font class="comment">// For each case selected</font>
+00531 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>;
+00532 <font class="keywordtype">int</font> i=0;
+00533 <font class="keywordflow">for</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>=miny; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;=(int)maxy; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++)
+00534 <font class="keywordflow">for</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>=minx; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&lt;=(int)maxx; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++)
+00535 {
+00536 <font class="comment">// Check the formula</font>
+00537 <a class="code" href="debug_8h.html#a6">nlassert</a> ((<font class="keywordtype">int</font>)i == (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> - minx + ((<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a> - miny) &lt;&lt; (maxx-minx)) ));
+00538
+00539 <font class="comment">// Center of the cell</font>
+00540 <font class="keywordtype">double</font> cx=((double)<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>+0.5f)*<a class="code" href="classNLPACS_1_1CMoveContainer.html#o14">_CellWidth</a>+<a class="code" href="classNLPACS_1_1CMoveContainer.html#o10">_Xmin</a>;
+00541
+00542 <font class="comment">// Primitive center</font>
+00543 <font class="keywordtype">double</font> pcx=(wI-&gt;getBBXMin()+wI-&gt;getBBXMax())/2.f;
+00544
+00545 elementArray[i]-&gt;Primitive=primitive;
+00546 elementArray[i]-&gt;X=<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
+00547 elementArray[i]-&gt;Y=<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>;
+00548 <font class="comment">// Insert in left or right ?</font>
+00549 <font class="keywordflow">if</font> (pcx&lt;cx)
+00550 {
+00551 <font class="comment">// In the left</font>
+00552 elementArray[i]-&gt;NextX=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o18">_VectorCell</a>[worldImage][<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>].getFirstX ();
+00553 elementArray[i]-&gt;PreviousX=NULL;
+00554 }
+00555 <font class="keywordflow">else</font>
+00556 {
+00557 <font class="comment">// In the right</font>
+00558 elementArray[i]-&gt;PreviousX=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o18">_VectorCell</a>[worldImage][<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>].getLastX ();
+00559 elementArray[i]-&gt;NextX=NULL;
+00560 }
+00561
+00562 <font class="comment">// Next cell</font>
+00563 i++;
+00564 }
+00565
+00566 <font class="comment">// Erase last array element</font>
+00567 <font class="keywordflow">for</font> (; i&lt;4; i++)
+00568 {
+00569 elementArray[i]=NULL;
+00570 }
+00571 }
+00572
+00573 <font class="comment">// ***************************************************************************</font>
+00574
+<a name="l00575"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c13">00575</a> <font class="keywordtype">void</font> CMoveContainer::clearModifiedList (uint8 worldImage)
+00576 {
+00577 <font class="comment">// For each changed primitives</font>
+00578 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> *<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>[worldImage];
+00579 <font class="keywordflow">while</font> (changed)
+00580 {
+00581 <font class="comment">// Get the world image primitive</font>
+00582 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI;
+00583 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;isNonCollisionable())
+00584 wI=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;getWorldImage (0);
+00585 <font class="keywordflow">else</font>
+00586 wI=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;getWorldImage (worldImage);
+00587
+00588 <font class="comment">// Next primitive</font>
+00589 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>=wI-&gt;getNextModified ();
+00590
+00591 <font class="comment">// Remove it from the list</font>
+00592 wI-&gt;setInModifiedListFlag (<font class="keyword">false</font>);
+00593 }
+00594
+00595 <font class="comment">// Empty list</font>
+00596 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>[worldImage]=NULL;
+00597 }
+00598
+00599 <font class="comment">// ***************************************************************************</font>
+00600
+<a name="l00601"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c15">00601</a> <font class="keywordtype">void</font> CMoveContainer::checkSortedList ()
+00602 {
+00603 <font class="comment">// Check each primitives in the set</font>
+00604 std::set&lt;CMovePrimitive*&gt;::iterator ite=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o2">_PrimitiveSet</a>.begin();
+00605 <font class="keywordflow">while</font> (ite!=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o2">_PrimitiveSet</a>.end())
+00606 {
+00607 <font class="comment">// Check</font>
+00608 (*ite)-&gt;checkSortedList ();
+00609
+00610 ite++;
+00611 }
+00612 }
+00613
+00614 <font class="comment">// ***************************************************************************</font>
+00615
+<a name="l00616"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c6">00616</a> <font class="keywordtype">bool</font> CMoveContainer::evalOneTerrainCollision (<font class="keywordtype">double</font> beginTime, CMovePrimitive *primitive, uint8 primitiveWorldImage,
+00617 <font class="keywordtype">bool</font> testMove, <font class="keywordtype">bool</font> &amp;testMoveValid, CCollisionOTStaticInfo *staticColInfo, CVectorD *contactNormal)
+00618 {
+00619 <font class="comment">// H_AUTO(PACS_MC_evalOneCollision);</font>
+00620
+00621 <font class="comment">// Find its collisions</font>
+00622 <font class="keywordtype">bool</font> found=<font class="keyword">false</font>;
+00623
+00624 <font class="comment">// Get the primitive world image</font>
+00625 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI;
+00626 <font class="keywordflow">if</font> (primitive-&gt;isNonCollisionable())
+00627 wI=primitive-&gt;getWorldImage (0);
+00628 <font class="keywordflow">else</font>
+00629 wI=primitive-&gt;getWorldImage (primitiveWorldImage);
+00630
+00631 <font class="comment">// Begin time must be the same as beginTime</font>
+00632 <a class="code" href="debug_8h.html#a6">nlassert</a> (wI-&gt;getInitTime()==beginTime);
+00633
+00634 <font class="comment">// Test its static collision</font>
+00635 <font class="keywordflow">if</font> (_Retriever)
+00636 {
+00637 <font class="comment">// Delta pos..</font>
+00638 <font class="comment">// Test retriever with the primitive</font>
+00639 <font class="keyword">const</font> <a class="code" href="namespaceNLPACS.html#a0">TCollisionSurfaceDescVector</a> *result=wI-&gt;evalCollision (*<a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o20">_SurfaceTemp</a>, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o0">_TestTime</a>, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o1">_MaxTestIteration</a>, *primitive);
+00640 <font class="keywordflow">if</font> (result)
+00641 {
+00642 <font class="comment">// TEST MOVE MUST BE OK !!</font>
+00643 testMoveValid=<font class="keyword">true</font>;
+00644
+00645 <font class="comment">// Size of the array</font>
+00646 uint size=result-&gt;size();
+00647
+00648 <font class="comment">// For each detected collisions</font>
+00649 <font class="keywordflow">for</font> (uint c=0; c&lt;size; c++)
+00650 {
+00651 <font class="comment">// Ref on the collision</font>
+00652 CCollisionSurfaceDesc desc=(*result)[c];
+00653 <font class="keywordtype">double</font> contactTime = (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>-beginTime)*desc.ContactTime+beginTime;
+00654
+00655 <font class="comment">/*</font>
+00656 <font class="comment"> * If beginTime is 0.999999999 and desc.ContactTime&lt;1.0, contactTime will be 1.0.</font>
+00657 <font class="comment"> * In this case, we force contactTime to be beginTime to avoid collision at time == 1.0.</font>
+00658 <font class="comment"> **/</font>
+00659 <font class="keywordflow">if</font> ((contactTime &gt;= 1.0) &amp;&amp; (beginTime &lt; 1.0) &amp;&amp; (desc.ContactTime &lt; 1.0))
+00660 contactTime = beginTime;
+00661
+00662 <font class="comment">// Set the container's time space contact time</font>
+00663 desc.ContactTime = contactTime;
+00664
+00665 <font class="comment">// ptr on the surface</font>
+00666 <font class="keyword">const</font> CRetrievableSurface *surf= <a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>-&gt;getSurfaceById (desc.ContactSurface);
+00667
+00668 <font class="comment">// TODO: check surface flags against primitive flags HERE:</font>
+00669 <font class="comment">// Is a wall ?</font>
+00670 <font class="keywordtype">bool</font> isWall;
+00671 <font class="keywordflow">if</font>(!surf)
+00672 isWall= <font class="keyword">true</font>;
+00673 <font class="keywordflow">else</font>
+00674 isWall= !(surf-&gt;isFloor() || surf-&gt;isCeiling());
+00675
+00676 <font class="comment">// stop on a wall.</font>
+00677 <font class="keywordflow">if</font>(isWall)
+00678 {
+00679 <font class="comment">// Test move ?</font>
+00680 <font class="keywordflow">if</font> (testMove)
+00681 {
+00682 <font class="comment">// return contact normal only when testmove and vector provided</font>
+00683 <font class="keywordflow">if</font> (contactNormal)
+00684 *contactNormal = desc.ContactNormal;
+00685 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00686 }
+00687 <font class="keywordflow">else</font>
+00688 {
+00689 <font class="comment">// OK, collision if we are a collisionable primitive</font>
+00690 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c10">newCollision</a> (primitive, desc, primitiveWorldImage, beginTime, staticColInfo);
+00691
+00692 <font class="comment">// One collision found</font>
+00693 found=<font class="keyword">true</font>;
+00694 <font class="keywordflow">break</font>;
+00695 }
+00696 }
+00697 }
+00698 }
+00699 <font class="keywordflow">else</font>
+00700 <font class="comment">// More than maxtest made, exit</font>
+00701 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00702 }
+00703 <font class="keywordflow">return</font> found;
+00704 }
+00705
+00706 <font class="comment">// ***************************************************************************</font>
+00707
+<a name="l00708"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c7">00708</a> <font class="keywordtype">bool</font> CMoveContainer::evalOnePrimitiveCollision (<font class="keywordtype">double</font> beginTime, CMovePrimitive *primitive, uint8 worldImage, uint8 primitiveWorldImage,
+00709 <font class="keywordtype">bool</font> testMove, <font class="keywordtype">bool</font> secondIsStatic, <font class="keywordtype">bool</font> &amp;testMoveValid, CCollisionOTDynamicInfo *dynamicColInfo,
+00710 CVectorD *contactNormal)
+00711 {
+00712 <font class="comment">// H_AUTO(PACS_MC_evalOneCollision);</font>
+00713
+00714 <font class="comment">// Find its collisions</font>
+00715 <font class="keywordtype">bool</font> found=<font class="keyword">false</font>;
+00716
+00717 <font class="comment">// Get the primitive world image</font>
+00718 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI;
+00719 <font class="keywordflow">if</font> (primitive-&gt;isNonCollisionable())
+00720 wI=primitive-&gt;getWorldImage (0);
+00721 <font class="keywordflow">else</font>
+00722 wI=primitive-&gt;getWorldImage (primitiveWorldImage);
+00723
+00724 <font class="comment">// Begin time must be the same as beginTime</font>
+00725 <a class="code" href="debug_8h.html#a6">nlassert</a> (wI-&gt;getInitTime()==beginTime);
+00726
+00727 <font class="comment">// Element table</font>
+00728 CMoveElement tableNotInserted[4];
+00729 CMoveElement *table[4];
+00730
+00731 <font class="comment">// Single test ?</font>
+00732 <font class="keywordtype">bool</font> singleTest=<a class="code" href="classNLPACS_1_1CMoveContainer.html#a14">testMove</a>;
+00733
+00734 <font class="comment">// Is in world image</font>
+00735 <font class="keywordflow">if</font> ((worldImage==primitiveWorldImage) &amp;&amp; wI-&gt;isInWorldImageFlag())
+00736 {
+00737 <font class="comment">// Get move element table from the primitive</font>
+00738 table[0]=wI-&gt;getMoveElement (0);
+00739 table[1]=wI-&gt;getMoveElement (1);
+00740 table[2]=wI-&gt;getMoveElement (2);
+00741 table[3]=wI-&gt;getMoveElement (3);
+00742 }
+00743 <font class="keywordflow">else</font>
+00744 {
+00745 <font class="comment">// Set table pointers</font>
+00746 table[0]=tableNotInserted+0;
+00747 table[1]=tableNotInserted+1;
+00748 table[2]=tableNotInserted+2;
+00749 table[3]=tableNotInserted+3;
+00750
+00751 <font class="comment">// Get cells</font>
+00752 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c3">getCells</a> (primitive, worldImage, primitiveWorldImage, table);
+00753
+00754 <font class="comment">// Force the test</font>
+00755 singleTest=<font class="keyword">true</font>;
+00756 }
+00757
+00758 <font class="comment">// For each move element</font>
+00759 <font class="keywordflow">for</font> (uint i=0; i&lt;4; i++)
+00760 {
+00761 <font class="comment">// Get the element</font>
+00762 CMoveElement *elm=table[i];
+00763
+00764 <font class="comment">// Element valid ?</font>
+00765 <font class="keywordflow">if</font> (elm)
+00766 {
+00767 <font class="comment">// Check</font>
+00768 <a class="code" href="debug_8h.html#a6">nlassert</a> (elm-&gt;Primitive==primitive);
+00769 <font class="comment">// Primitive to the left</font>
+00770
+00771 <font class="comment">// Lookup in X sorted list on the left</font>
+00772 CMoveElement *other=elm-&gt;PreviousX;
+00773 <a class="code" href="debug_8h.html#a6">nlassert</a> (other!=elm);
+00774
+00775 <font class="keywordflow">while</font> (other &amp;&amp; (wI-&gt;getBBXMin() - other-&gt;Primitive-&gt;getWorldImage(worldImage)-&gt;getBBXMin() &lt; <a class="code" href="classNLPACS_1_1CMoveContainer.html#o9">_PrimitiveMaxSize</a>) )
+00776 {
+00777 <font class="comment">// Other primitive</font>
+00778 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> *otherPrimitive=other-&gt;Primitive;
+00779 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *otherWI=otherPrimitive-&gt;getWorldImage (worldImage);
+00780 <a class="code" href="debug_8h.html#a6">nlassert</a> (otherPrimitive!=primitive);
+00781
+00782 <font class="comment">// Continue the check if the other primitive is not int the modified list or if its pointer is higher than primitive</font>
+00783 <font class="keywordflow">if</font> ( singleTest || ( (!otherWI-&gt;isInModifiedListFlag ()) || (primitive&lt;otherPrimitive) ) )
+00784 {
+00785 <font class="comment">// Look if valid in X</font>
+00786 <font class="keywordflow">if</font> (wI-&gt;getBBXMin() &lt; otherWI-&gt;getBBXMax())
+00787 {
+00788 <font class="comment">// Look if valid in Y</font>
+00789 <font class="keywordflow">if</font> ( (wI-&gt;getBBYMin() &lt; otherWI-&gt;getBBYMax()) &amp;&amp; (otherWI-&gt;getBBYMin() &lt; wI-&gt;getBBYMax()) )
+00790 {
+00791 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c8">evalPrimAgainstPrimCollision</a> (beginTime, primitive, otherPrimitive, wI, otherWI, <a class="code" href="classNLPACS_1_1CMoveContainer.html#a14">testMove</a>,
+00792 primitiveWorldImage, worldImage, secondIsStatic, dynamicColInfo, contactNormal))
+00793 {
+00794 <font class="keywordflow">if</font> (testMove)
+00795 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00796 found=<font class="keyword">true</font>;
+00797 }
+00798 }
+00799 }
+00800 }
+00801
+00802 <font class="comment">// Next primitive to the left</font>
+00803 other = other-&gt;PreviousX;
+00804 }
+00805
+00806 <font class="comment">// Lookup in X sorted list on the right</font>
+00807 other=elm-&gt;NextX;
+00808
+00809 <font class="comment">// Primitive to the right</font>
+00810 <font class="keywordflow">while</font> (other &amp;&amp; (other-&gt;Primitive-&gt;getWorldImage(worldImage)-&gt;getBBXMin() &lt; wI-&gt;getBBXMax()) )
+00811 {
+00812 <font class="comment">// Other primitive</font>
+00813 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> *otherPrimitive=other-&gt;Primitive;
+00814 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *otherWI=otherPrimitive-&gt;getWorldImage (worldImage);
+00815 <a class="code" href="debug_8h.html#a6">nlassert</a> (otherPrimitive!=primitive);
+00816
+00817 <font class="comment">// Continue the check if the other primitive is not in the modified list or if its pointer is higher than primitive</font>
+00818 <font class="keywordflow">if</font> ( singleTest || ( (!otherWI-&gt;isInModifiedListFlag ()) || (primitive&lt;otherPrimitive) ) )
+00819 {
+00820 <font class="comment">// Look if valid in Y</font>
+00821 <font class="keywordflow">if</font> ( (wI-&gt;getBBYMin() &lt; otherWI-&gt;getBBYMax()) &amp;&amp; (otherWI-&gt;getBBYMin() &lt; wI-&gt;getBBYMax()) )
+00822 {
+00823 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c8">evalPrimAgainstPrimCollision</a> (beginTime, primitive, otherPrimitive, wI, otherWI, <a class="code" href="classNLPACS_1_1CMoveContainer.html#a14">testMove</a>,
+00824 primitiveWorldImage, worldImage, secondIsStatic, dynamicColInfo, contactNormal))
+00825 {
+00826 <font class="keywordflow">if</font> (testMove)
+00827 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00828 found=<font class="keyword">true</font>;
+00829 }
+00830 }
+00831 }
+00832
+00833 <font class="comment">// Next primitive to the left</font>
+00834 other = other-&gt;NextX;
+00835 }
+00836 }
+00837 }
+00838
+00839 <font class="keywordflow">return</font> found;
+00840 }
+00841
+00842 <font class="comment">// ***************************************************************************</font>
+00843
+<a name="l00844"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c8">00844</a> <font class="keywordtype">bool</font> CMoveContainer::evalPrimAgainstPrimCollision (<font class="keywordtype">double</font> beginTime, CMovePrimitive *primitive, CMovePrimitive *otherPrimitive,
+00845 CPrimitiveWorldImage *wI, CPrimitiveWorldImage *otherWI, <font class="keywordtype">bool</font> testMove,
+00846 uint8 firstWorldImage, uint8 secondWorldImage, <font class="keywordtype">bool</font> secondIsStatic, CCollisionOTDynamicInfo *dynamicColInfo,
+00847 CVectorD *contactNormal)
+00848 {
+00849 <font class="comment">// H_AUTO(PACS_MC_evalPrimAgainstPrimCollision);</font>
+00850
+00851 <font class="comment">// Test the primitive</font>
+00852 <font class="keywordtype">double</font> firstTime, lastTime;
+00853
+00854 <font class="comment">// Collision</font>
+00855 CCollisionDesc desc;
+00856 <font class="keywordflow">if</font> (wI-&gt;evalCollision (*otherWI, desc, beginTime, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o0">_TestTime</a>, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o1">_MaxTestIteration</a>,
+00857 firstTime, lastTime, *primitive, *otherPrimitive))
+00858 {
+00859 <font class="comment">// Enter or exit</font>
+00860 <font class="keywordtype">bool</font> enter = (beginTime&lt;=firstTime) &amp;&amp; (firstTime&lt;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>);
+00861 <font class="keywordtype">bool</font> exit = (beginTime&lt;=lastTime) &amp;&amp; (lastTime&lt;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>);
+00862 <font class="keywordtype">bool</font> overlap = (firstTime&lt;=beginTime) &amp;&amp; (lastTime&gt;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>);
+00863 <font class="keywordtype">bool</font> collision = ( beginTime&lt;=((firstTime+lastTime)/2) ) &amp;&amp; (firstTime&lt;=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>);
+00864
+00865 <font class="comment">// Return collision time</font>
+00866
+00867 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#a14">testMove</a> &amp;&amp; collision)
+00868 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+00869 <font class="keywordflow">else</font>
+00870 {
+00871 <font class="comment">// TODO: make new collision when collision==false to raise triggers</font>
+00872
+00881 <font class="keywordflow">if</font> (primitive-&gt;isNonCollisionable () &amp;&amp; (enter || exit || overlap))
+00882 {
+00883 <font class="keywordflow">if</font> (primitive-&gt;isTriggered (*otherPrimitive, enter, exit))
+00884 {
+00885 <font class="comment">// Add a trigger</font>
+00886 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c12">newTrigger</a> (primitive, otherPrimitive, desc, enter ? UTriggerInfo::In : exit ? UTriggerInfo::Out : UTriggerInfo::Inside);
+00887 }
+00888
+00889 <font class="comment">// If the other primitive is not an obstacle, skip it because it will re-generate collisions.</font>
+00890 <font class="keywordflow">if</font> (!otherPrimitive-&gt;isObstacle ())
+00891 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00892 }
+00893
+00894 <font class="comment">// OK, collision</font>
+00895 <font class="keywordflow">if</font> (collision)
+00896 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c10">newCollision</a> (primitive, otherPrimitive, desc, collision, enter, exit, firstWorldImage, secondWorldImage, secondIsStatic,
+00897 dynamicColInfo);
+00898
+00899 <font class="comment">// Collision</font>
+00900 <font class="keywordflow">return</font> collision;
+00901 }
+00902 }
+00903 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+00904 }
+00905
+00906 <font class="comment">// ***************************************************************************</font>
+00907
+<a name="l00908"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c9">00908</a> <font class="keywordtype">void</font> CMoveContainer::evalAllCollisions (<font class="keywordtype">double</font> beginTime, uint8 worldImage)
+00909 {
+00910 <font class="comment">// H_AUTO(PACS_MC_evalAllCollisions);</font>
+00911
+00912 <font class="comment">// First primitive</font>
+00913 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> *primitive=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>[worldImage];
+00914
+00915 <font class="comment">// For each modified primitive</font>
+00916 <font class="keywordflow">while</font> (primitive)
+00917 {
+00918 <font class="comment">// Get the primitive world image</font>
+00919 uint8 primitiveWorldImage;
+00920 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI;
+00921 <font class="keywordflow">if</font> (primitive-&gt;isNonCollisionable ())
+00922 {
+00923 wI=primitive-&gt;getWorldImage (0);
+00924 primitiveWorldImage=worldImage;
+00925 }
+00926 <font class="keywordflow">else</font>
+00927 {
+00928 wI=primitive-&gt;getWorldImage (worldImage);
+00929 primitiveWorldImage=worldImage;
+00930 }
+00931
+00932 CVectorD d0=wI-&gt;getDeltaPosition();
+00933
+00934 <font class="comment">// Find a collision</font>
+00935 <font class="keywordtype">bool</font> found=<font class="keyword">false</font>;
+00936 <font class="keywordtype">bool</font> testMoveValid=<font class="keyword">false</font>;
+00937
+00938 <font class="comment">// Eval collision on the terrain</font>
+00939 found|=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c6">evalOneTerrainCollision</a> (beginTime, primitive, primitiveWorldImage, <font class="keyword">false</font>, testMoveValid, NULL, NULL);
+00940
+00941 <font class="comment">// Eval collision in each static world image</font>
+00942 std::set&lt;uint8&gt;::iterator ite=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.begin();
+00943 <font class="keywordflow">while</font> (ite!=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.end())
+00944 {
+00945 <font class="comment">// Eval in this world image</font>
+00946 found|=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c7">evalOnePrimitiveCollision</a> (beginTime, primitive, *ite, primitiveWorldImage, <font class="keyword">false</font>, <font class="keyword">true</font>, testMoveValid, NULL, NULL);
+00947
+00948 <font class="comment">// Next world image</font>
+00949 ite++;
+00950 }
+00951
+00952 CVectorD d1=wI-&gt;getDeltaPosition();
+00953
+00954 <font class="comment">// Eval collision in the world image if not already tested</font>
+00955 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.find (worldImage)==<a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.end())
+00956 found|=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c7">evalOnePrimitiveCollision</a> (beginTime, primitive, worldImage, primitiveWorldImage, <font class="keyword">false</font>, <font class="keyword">false</font>, testMoveValid, NULL, NULL);
+00957
+00958 CVectorD d2=wI-&gt;getDeltaPosition();
+00959
+00960 <font class="comment">// No collision ?</font>
+00961 <font class="keywordflow">if</font> (!found)
+00962 {
+00963 <a class="code" href="debug_8h.html#a6">nlassert</a> ((d0==d1)&amp;&amp;(d0==d2));
+00964 <font class="comment">// nlassert (f1==f2);</font>
+00965 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>&amp;&amp;testMoveValid)
+00966 {
+00967 <font class="comment">// Do move</font>
+00968 wI-&gt;doMove (*<a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o20">_SurfaceTemp</a>, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>, primitive-&gt;getDontSnapToGround());
+00969 }
+00970 <font class="keywordflow">else</font>
+00971 {
+00972 <font class="comment">// Do move</font>
+00973 wI-&gt;doMove (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>);
+00974 }
+00975 }
+00976
+00977 <font class="comment">// Next primitive</font>
+00978 primitive=wI-&gt;getNextModified ();
+00979 }
+00980 }
+00981
+00982 <font class="comment">// ***************************************************************************</font>
+00983
+<a name="l00984"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c10">00984</a> <font class="keywordtype">void</font> CMoveContainer::newCollision (CMovePrimitive* first, CMovePrimitive* second, <font class="keyword">const</font> CCollisionDesc&amp; desc, <font class="keywordtype">bool</font> collision, <font class="keywordtype">bool</font> enter, <font class="keywordtype">bool</font> exit,
+00985 uint firstWorldImage, uint secondWorldImage, <font class="keywordtype">bool</font> secondIsStatic, CCollisionOTDynamicInfo *dynamicColInfo)
+00986 {
+00987 <font class="comment">// H_AUTO(PACS_MC_newCollision_short);</font>
+00988
+00989 <a class="code" href="debug_8h.html#a6">nlassert</a> ((dynamicColInfo &amp;&amp; first-&gt;isNonCollisionable ()) || (!dynamicColInfo &amp;&amp; first-&gt;isCollisionable ()));
+00990
+00991 <font class="keywordflow">if</font> (dynamicColInfo)
+00992 {
+00993 dynamicColInfo-&gt;init (first, second, desc, collision, enter, exit, firstWorldImage, secondWorldImage, secondIsStatic);
+00994 }
+00995 <font class="keywordflow">else</font>
+00996 {
+00997 <font class="comment">// Get an ordered time index. Always round to the future.</font>
+00998 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=(int)(ceil (desc.ContactTime*(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o5">_OtSize</a>/<a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>) );
+00999
+01000 <font class="comment">// Clamp left.</font>
+01001 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>&lt;0)
+01002 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=0;
+01003
+01004 <font class="comment">// If in time</font>
+01005 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>&lt;(int)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o5">_OtSize</a>)
+01006 {
+01007 <font class="comment">// Build info</font>
+01008 CCollisionOTDynamicInfo *info = <a class="code" href="classNLPACS_1_1CMoveContainer.html#c16">allocateOTDynamicInfo</a> ();
+01009 info-&gt;init (first, second, desc, collision, enter, exit, firstWorldImage, secondWorldImage, secondIsStatic);
+01010
+01011 <font class="comment">// Add in the primitive list</font>
+01012 first-&gt;addCollisionOTInfo (info);
+01013 second-&gt;addCollisionOTInfo (info);
+01014
+01015 <font class="comment">// Insert in the time ordered table</font>
+01016 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>&lt;(<font class="keywordtype">int</font>)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>.size());
+01017 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].link (info);
+01018
+01019 <font class="comment">// Check it is after the last hard collision</font>
+01020 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o7">_PreviousCollisionNode</a>&lt;=&amp;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]);
+01021 }
+01022 }
+01023 }
+01024
+01025 <font class="comment">// ***************************************************************************</font>
+01026
+<a name="l01027"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c11">01027</a> <font class="keywordtype">void</font> CMoveContainer::newCollision (CMovePrimitive* first, <font class="keyword">const</font> CCollisionSurfaceDesc&amp; desc, uint8 worldImage, <font class="keywordtype">double</font> beginTime, CCollisionOTStaticInfo *staticColInfo)
+01028 {
+01029 <font class="comment">// H_AUTO(PACS_MC_newCollision_long);</font>
+01030
+01031 <font class="comment">// Check</font>
+01032 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>);
+01033 <a class="code" href="debug_8h.html#a6">nlassert</a> ((staticColInfo &amp;&amp; first-&gt;isNonCollisionable ()) || (!staticColInfo &amp;&amp; first-&gt;isCollisionable ()));
+01034
+01035 <font class="comment">// Get the world image</font>
+01036 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI;
+01037 <font class="keywordflow">if</font> (first-&gt;isNonCollisionable())
+01038 wI=first-&gt;getWorldImage (0);
+01039 <font class="keywordflow">else</font>
+01040 wI=first-&gt;getWorldImage (worldImage);
+01041
+01042 <font class="comment">// Time</font>
+01043 <font class="keywordtype">double</font> time=desc.ContactTime;
+01044 <font class="comment">/*</font>
+01045 <font class="comment"> if (time == _DeltaTime)</font>
+01046 <font class="comment"> time -= _DeltaTime*FLT_EPSILON;</font>
+01047 <font class="comment">*/</font>
+01048
+01049 <font class="comment">// Check time interval</font>
+01050 <a class="code" href="debug_8h.html#a8">nlassertex</a> (beginTime&lt;=time, (<font class="stringliteral">"beginTime=%f, time=%f"</font>, beginTime, time));
+01051 <a class="code" href="debug_8h.html#a8">nlassertex</a> (time&lt;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>, (<font class="stringliteral">"time=%f, _DeltaTime=%f"</font>, time, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>));
+01052
+01053 <font class="comment">// Time of the collision.</font>
+01054 time-=<a class="code" href="move__primitive_8h.html#a0">NELPACS_DIST_BACK</a>/wI-&gt;getSpeed().norm();
+01055 time=std::max(time, beginTime);
+01056 <font class="keywordtype">double</font> ratio=(time-beginTime)/(<a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>-beginTime);
+01057 <a class="code" href="debug_8h.html#a6">nlassert</a> (ratio&gt;=0);
+01058 <a class="code" href="debug_8h.html#a6">nlassert</a> (ratio&lt;=1);
+01059
+01060 <font class="keywordflow">if</font> (staticColInfo)
+01061 {
+01062 <font class="comment">// Make a new globalposition</font>
+01063 UGlobalPosition endPosition=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>-&gt;doMove (wI-&gt;getGlobalPosition(), wI-&gt;getDeltaPosition(),
+01064 (float)ratio, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o20">_SurfaceTemp</a>, <font class="keyword">false</font>);
+01065
+01066 <font class="comment">// Init the info descriptor</font>
+01067 staticColInfo-&gt;init (first, desc, endPosition, ratio, worldImage);
+01068 }
+01069 <font class="keywordflow">else</font>
+01070 {
+01071 <font class="comment">// Get an ordered time index. Always round to the future.</font>
+01072 <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=(int)(ceil (time*(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o5">_OtSize</a>/<a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>) );
+01073
+01074 <font class="comment">// Clamp left.</font>
+01075 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>&lt;0)
+01076 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=0;
+01077
+01078 <font class="comment">// If in time</font>
+01079 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>&lt;(int)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o5">_OtSize</a>)
+01080 {
+01081 <font class="comment">// Build info</font>
+01082 CCollisionOTStaticInfo *info = <a class="code" href="classNLPACS_1_1CMoveContainer.html#c17">allocateOTStaticInfo</a> ();
+01083
+01084 <font class="comment">// Make a new globalposition</font>
+01085 UGlobalPosition endPosition=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>-&gt;doMove (wI-&gt;getGlobalPosition(), wI-&gt;getDeltaPosition(),
+01086 (float)ratio, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o20">_SurfaceTemp</a>, <font class="keyword">false</font>);
+01087
+01088 <font class="comment">// Init the info descriptor</font>
+01089 info-&gt;init (first, desc, endPosition, ratio, worldImage);
+01090
+01091 <font class="comment">// Add in the primitive list</font>
+01092 first-&gt;addCollisionOTInfo (info);
+01093
+01094 <font class="comment">// Insert in the time ordered table</font>
+01095 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>&lt;(<font class="keywordtype">int</font>)<a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>.size());
+01096 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].link (info);
+01097
+01098 <font class="comment">// Check it is after the last hard collision</font>
+01099 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o7">_PreviousCollisionNode</a>&lt;=&amp;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]);
+01100 }
+01101 }
+01102 }
+01103
+01104 <font class="comment">// ***************************************************************************</font>
+01105
+<a name="l01106"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c12">01106</a> <font class="keywordtype">void</font> CMoveContainer::newTrigger (CMovePrimitive* first, CMovePrimitive* second, <font class="keyword">const</font> CCollisionDesc&amp; desc, uint triggerType)
+01107 {
+01108 <font class="comment">// Element index</font>
+01109 uint <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o21">_Triggers</a>.size();
+01110
+01111 <font class="comment">// Add one element</font>
+01112 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o21">_Triggers</a>.resize (<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>+1);
+01113
+01114 <font class="comment">// Fill info</font>
+01115 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o21">_Triggers</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].Object0=first-&gt;UserData;
+01116 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o21">_Triggers</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].Object1=second-&gt;UserData;
+01117 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o21">_Triggers</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].CollisionDesc=desc;
+01118 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o21">_Triggers</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>].CollisionType = triggerType;
+01119 }
+01120
+01121 <font class="comment">// ***************************************************************************</font>
+01122
+<a name="l01123"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c5">01123</a> <font class="keywordtype">void</font> CMoveContainer::checkOT ()
+01124 {
+01125 <font class="comment">// Check</font>
+01126 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o5">_OtSize</a>==<a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>.size());
+01127
+01128 <font class="comment">// Check linked list</font>
+01129 <font class="keywordflow">for</font> (uint i=0; i&lt;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o5">_OtSize</a>-1; i++)
+01130 {
+01131 <font class="comment">// Check link</font>
+01132 <a class="code" href="debug_8h.html#a6">nlassert</a> ( <a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[i].getNext() == (&amp;(<a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[i+1])) );
+01133 <a class="code" href="debug_8h.html#a6">nlassert</a> ( <a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[i+1].getPrevious() == (&amp;(<a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[i])) );
+01134 }
+01135
+01136 <font class="comment">// Check first and last</font>
+01137 <a class="code" href="debug_8h.html#a6">nlassert</a> ( <a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[0].getPrevious() == NULL );
+01138 <a class="code" href="debug_8h.html#a6">nlassert</a> ( <a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[<a class="code" href="classNLPACS_1_1CMoveContainer.html#o5">_OtSize</a>-1].getNext() == NULL );
+01139 }
+01140
+01141 <font class="comment">// ***************************************************************************</font>
+01142
+<a name="l01143"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c4">01143</a> <font class="keywordtype">void</font> CMoveContainer::clearOT ()
+01144 {
+01145 <font class="comment">// Check</font>
+01146 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o5">_OtSize</a>==<a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>.size());
+01147
+01148 <font class="comment">// clear the list</font>
+01149 uint i;
+01150 <font class="keywordflow">for</font> (i=0; i&lt;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o5">_OtSize</a>; i++)
+01151 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[i].clear ();
+01152
+01153 <font class="comment">// Relink the list</font>
+01154 <font class="keywordflow">for</font> (i=0; i&lt;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o5">_OtSize</a>-1; i++)
+01155 <font class="comment">// Link the two cells</font>
+01156 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[i].link (&amp;(<a class="code" href="classNLPACS_1_1CMoveContainer.html#o6">_TimeOT</a>[i+1]));
+01157 }
+01158
+01159 <font class="comment">// ***************************************************************************</font>
+01160
+<a name="l01161"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c14">01161</a> <font class="keywordtype">void</font> CMoveContainer::removeModifiedFromOT (uint8 worldImage)
+01162 {
+01163 <font class="comment">// For each changed primitives</font>
+01164 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> *<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>[worldImage];
+01165 <font class="keywordflow">while</font> (changed)
+01166 {
+01167 <font class="comment">// Remove from ot list</font>
+01168 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;removeCollisionOTInfo ();
+01169
+01170 <font class="comment">// Get the primitive world image</font>
+01171 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI;
+01172 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;isNonCollisionable())
+01173 wI=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;getWorldImage (0);
+01174 <font class="keywordflow">else</font>
+01175 wI=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;getWorldImage (worldImage);
+01176
+01177 <font class="comment">// Next primitive</font>
+01178 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>=wI-&gt;getNextModified ();
+01179 }
+01180 }
+01181
+01182 <font class="comment">// ***************************************************************************</font>
+01183
+<a name="l01184"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c16">01184</a> CCollisionOTDynamicInfo *CMoveContainer::allocateOTDynamicInfo ()
+01185 {
+01186 <font class="keywordflow">return</font> <a class="code" href="classNLPACS_1_1CMoveContainer.html#o22">_AllocOTDynamicInfo</a>.<a class="code" href="classNLMISC_1_1CPoolMemory.html#a1">allocate</a> ();
+01187 }
+01188
+01189 <font class="comment">// ***************************************************************************</font>
+01190
+<a name="l01191"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c17">01191</a> CCollisionOTStaticInfo *CMoveContainer::allocateOTStaticInfo ()
+01192 {
+01193 <font class="keywordflow">return</font> <a class="code" href="classNLPACS_1_1CMoveContainer.html#o23">_AllocOTStaticInfo</a>.<a class="code" href="classNLMISC_1_1CPoolMemory.html#a1">allocate</a> ();
+01194 }
+01195
+01196 <font class="comment">// ***************************************************************************</font>
+01197
+01198 <font class="comment">// Free all ordered table info</font>
+<a name="l01199"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c18">01199</a> <font class="keywordtype">void</font> CMoveContainer::freeAllOTInfo ()
+01200 {
+01201 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o22">_AllocOTDynamicInfo</a>.<a class="code" href="classNLMISC_1_1CPoolMemory.html#a2">free</a> ();
+01202 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o23">_AllocOTStaticInfo</a>.<a class="code" href="classNLMISC_1_1CPoolMemory.html#a2">free</a> ();
+01203 }
+01204
+01205 <font class="comment">// ***************************************************************************</font>
+01206
+<a name="l01207"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c19">01207</a> CMovePrimitive *CMoveContainer::allocatePrimitive (uint8 firstWorldImage, uint8 numWorldImage)
+01208 {
+01209 <font class="comment">// Simply allocate</font>
+01210 <font class="keywordflow">return</font> <font class="keyword">new</font> <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> (<font class="keyword">this</font>, firstWorldImage, numWorldImage);
+01211 }
+01212
+01213 <font class="comment">// ***************************************************************************</font>
+01214
+<a name="l01215"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c20">01215</a> <font class="keywordtype">void</font> CMoveContainer::freePrimitive (CMovePrimitive *primitive)
+01216 {
+01217 <font class="comment">// Simply deallocate</font>
+01218 <font class="keyword">delete</font> primitive;
+01219 }
+01220
+01221 <font class="comment">// ***************************************************************************</font>
+01222
+<a name="l01223"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c21">01223</a> CPrimitiveWorldImage **CMoveContainer::allocateWorldImagesPtrs (uint numPtrs)
+01224 {
+01225 <font class="keywordflow">return</font> <font class="keyword">new</font> <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a>*[numPtrs];
+01226 }
+01227
+01228 <font class="comment">// ***************************************************************************</font>
+01229
+<a name="l01230"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c22">01230</a> <font class="keywordtype">void</font> CMoveContainer::freeWorldImagesPtrs (CPrimitiveWorldImage **ptrs)
+01231 {
+01232 <font class="keyword">delete</font> [] ptrs;
+01233 }
+01234
+01235 <font class="comment">// ***************************************************************************</font>
+01236
+<a name="l01237"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c23">01237</a> CPrimitiveWorldImage *CMoveContainer::allocateWorldImage ()
+01238 {
+01239 <font class="keywordflow">return</font> <font class="keyword">new</font> <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a>;
+01240 }
+01241
+01242 <font class="comment">// ***************************************************************************</font>
+01243
+<a name="l01244"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c24">01244</a> <font class="keywordtype">void</font> CMoveContainer::freeWorldImage (CPrimitiveWorldImage *worldImage)
+01245 {
+01246 <font class="keyword">delete</font> worldImage;
+01247 }
+01248
+01249 <font class="comment">// ***************************************************************************</font>
+01250
+<a name="l01251"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a15">01251</a> CMoveElement *CMoveContainer::allocateMoveElement ()
+01252 {
+01253 <font class="comment">// Simply allocate</font>
+01254 <font class="keywordflow">return</font> <font class="keyword">new</font> CMoveElement;
+01255 }
+01256
+01257 <font class="comment">// ***************************************************************************</font>
+01258
+<a name="l01259"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a16">01259</a> <font class="keywordtype">void</font> CMoveContainer::freeMoveElement (CMoveElement *element)
+01260 {
+01261 <font class="comment">// Simply deallocate</font>
+01262 <font class="keyword">delete</font> element;
+01263 }
+01264
+01265 <font class="comment">// ***************************************************************************</font>
+01266
+<a name="l01267"></a><a class="code" href="classNLPACS_1_1UMoveContainer.html#d2">01267</a> <font class="keywordtype">void</font> UMoveContainer::deleteMoveContainer (UMoveContainer *container)
+01268 {
+01269 <font class="keyword">delete</font> (CMoveContainer*)container;
+01270 }
+01271
+01272 <font class="comment">// ***************************************************************************</font>
+01273
+<a name="l01274"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a5">01274</a> UMovePrimitive *CMoveContainer::addCollisionablePrimitive (uint8 firstWorldImage, uint8 numWorldImage, <font class="keyword">const</font> UMovePrimitive *copyFrom)
+01275 {
+01276 NL_ALLOC_CONTEXT( Pacs )
+01277
+01278 <font class="comment">// Allocate primitive</font>
+01279 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> *primitive=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c19">allocatePrimitive</a> (firstWorldImage, numWorldImage);
+01280
+01281 <font class="comment">// Add into the set</font>
+01282 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o2">_PrimitiveSet</a>.insert (primitive);
+01283
+01284 <font class="comment">// if copy from primitive is not null, copy attributes</font>
+01285 <font class="keywordflow">if</font> (copyFrom != NULL)
+01286 {
+01287 primitive-&gt;setPrimitiveType(copyFrom-&gt;getPrimitiveType());
+01288 primitive-&gt;setReactionType(copyFrom-&gt;getReactionType());
+01289 primitive-&gt;setTriggerType(copyFrom-&gt;getTriggerType());
+01290 primitive-&gt;setCollisionMask(copyFrom-&gt;getCollisionMask());
+01291 primitive-&gt;setOcclusionMask(copyFrom-&gt;getOcclusionMask());
+01292 primitive-&gt;setObstacle(copyFrom-&gt;getObstacle());
+01293 primitive-&gt;setAbsorbtion(copyFrom-&gt;getAbsorbtion());
+01294 primitive-&gt;setHeight(copyFrom-&gt;getHeight());
+01295 <font class="keywordflow">if</font> (primitive-&gt;getPrimitiveType() == UMovePrimitive::_2DOrientedBox)
+01296 {
+01297 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>=0.0f, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>=0.0f;
+01298 copyFrom-&gt;getSize(<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>);
+01299 primitive-&gt;setSize(<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>);
+01300 }
+01301 <font class="keywordflow">else</font>
+01302 {
+01303 primitive-&gt;setRadius(copyFrom-&gt;getRadius());
+01304 }
+01305 }
+01306
+01307 <font class="comment">// Return it</font>
+01308 <font class="keywordflow">return</font> primitive;
+01309 }
+01310
+01311 <font class="comment">// ***************************************************************************</font>
+01312
+<a name="l01313"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a6">01313</a> UMovePrimitive *CMoveContainer::addNonCollisionablePrimitive (<font class="keyword">const</font> UMovePrimitive *copyFrom)
+01314 {
+01315 NL_ALLOC_CONTEXT( Pacs )
+01316
+01317 <font class="comment">// Allocate primitive</font>
+01318 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> *primitive=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c19">allocatePrimitive</a> (0, 1);
+01319
+01320 <font class="comment">// Set as noncollisionable</font>
+01321 primitive-&gt;setNonCollisionable (<font class="keyword">true</font>);
+01322
+01323 <font class="comment">// Add into the set</font>
+01324 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o2">_PrimitiveSet</a>.insert (primitive);
+01325
+01326 <font class="comment">// if copy from primitive is not null, copy attributes</font>
+01327 <font class="keywordflow">if</font> (copyFrom != NULL)
+01328 {
+01329 primitive-&gt;setPrimitiveType(copyFrom-&gt;getPrimitiveType());
+01330 primitive-&gt;setReactionType(copyFrom-&gt;getReactionType());
+01331 primitive-&gt;setTriggerType(copyFrom-&gt;getTriggerType());
+01332 primitive-&gt;setCollisionMask(copyFrom-&gt;getCollisionMask());
+01333 primitive-&gt;setOcclusionMask(copyFrom-&gt;getOcclusionMask());
+01334 primitive-&gt;setObstacle(copyFrom-&gt;getObstacle());
+01335 primitive-&gt;setAbsorbtion(copyFrom-&gt;getAbsorbtion());
+01336 primitive-&gt;setHeight(copyFrom-&gt;getHeight());
+01337 <font class="keywordflow">if</font> (primitive-&gt;getPrimitiveType() == UMovePrimitive::_2DOrientedBox)
+01338 {
+01339 <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>=0.0f, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>=0.0f;
+01340 copyFrom-&gt;getSize(<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>);
+01341 primitive-&gt;setSize(<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>);
+01342 }
+01343 <font class="keywordflow">else</font>
+01344 {
+01345 primitive-&gt;setRadius(copyFrom-&gt;getRadius());
+01346 }
+01347 }
+01348
+01349 <font class="comment">// Return it</font>
+01350 <font class="keywordflow">return</font> primitive;
+01351 }
+01352
+01353 <font class="comment">// ***************************************************************************</font>
+01354
+<a name="l01355"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a11">01355</a> <font class="keywordtype">void</font> CMoveContainer::removePrimitive (UMovePrimitive* primitive)
+01356 {
+01357 NL_ALLOC_CONTEXT( Pacs )
+01358
+01359 <font class="comment">// CMovePrimitive pointer</font>
+01360 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> *prim=(<a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a>*)primitive;
+01361
+01362 <font class="comment">// Get the primitive world image</font>
+01363 <font class="keywordflow">for</font> (uint8 i=0; i&lt;prim-&gt;getNumWorldImage (); i++)
+01364 {
+01365 <font class="comment">// World image</font>
+01366 uint8 worldImage=prim-&gt;getFirstWorldImage ()+i;
+01367
+01368 <font class="comment">// Get primitive world image</font>
+01369 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI=prim-&gt;getWorldImage (worldImage);
+01370
+01371 <font class="comment">// In modified list ?</font>
+01372 <font class="keywordflow">if</font> (wI-&gt;isInModifiedListFlag ())
+01373 {
+01374 <font class="comment">// Non collisionable primitive ?</font>
+01375 <font class="keywordflow">if</font> (prim-&gt;isNonCollisionable())
+01376 {
+01377 <font class="comment">// Remove from all world image</font>
+01378 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c27">removeNCFromModifiedList</a> (prim, worldImage);
+01379 }
+01380 <font class="keywordflow">else</font>
+01381 {
+01382 <font class="comment">// Remove from modified list</font>
+01383 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c26">removeFromModifiedList</a> (prim, worldImage);
+01384 }
+01385 }
+01386 }
+01387
+01388 <font class="comment">// Remove from the set</font>
+01389 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o2">_PrimitiveSet</a>.erase (prim);
+01390
+01391 <font class="comment">// Erase it</font>
+01392 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c20">freePrimitive</a> (prim);
+01393 }
+01394
+01395 <font class="comment">// ***************************************************************************</font>
+01396
+<a name="l01397"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c27">01397</a> <font class="keywordtype">void</font> CMoveContainer::removeNCFromModifiedList (CMovePrimitive* primitive, uint8 worldImage)
+01398 {
+01399 <font class="comment">// For each world image</font>
+01400 uint i;
+01401 uint worldImageCount = <a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>.size();
+01402 <font class="keywordflow">for</font> (i=0; i&lt;worldImageCount; i++)
+01403 {
+01404 <font class="comment">// For each changed primitives</font>
+01405 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> *<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>[i];
+01406 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *previous=NULL;
+01407 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI=primitive-&gt;getWorldImage (worldImage);
+01408
+01409 <font class="keywordflow">while</font> (changed)
+01410 {
+01411 <font class="comment">// Get the primitive world image</font>
+01412 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *changedWI=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;getWorldImage (worldImage);
+01413
+01414 <font class="comment">// Remove from ot list</font>
+01415 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>==primitive)
+01416 {
+01417 <font class="comment">// There is a previous primitive ?</font>
+01418 <font class="keywordflow">if</font> (previous)
+01419 previous-&gt;linkInModifiedList (wI-&gt;getNextModified ());
+01420 <font class="keywordflow">else</font>
+01421 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>[i]=wI-&gt;getNextModified ();
+01422
+01423 <font class="comment">// Unlink</font>
+01424 wI-&gt;linkInModifiedList (NULL);
+01425 wI-&gt;setInModifiedListFlag (<font class="keyword">false</font>);
+01426 <font class="keywordflow">break</font>;
+01427 }
+01428
+01429 <font class="comment">// Next primitive</font>
+01430 previous=changedWI;
+01431 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>=changedWI-&gt;getNextModified ();
+01432 }
+01433
+01434 <font class="comment">// Breaked ?</font>
+01435 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>==primitive)
+01436 <font class="keywordflow">break</font>;
+01437 }
+01438 }
+01439
+01440 <font class="comment">// ***************************************************************************</font>
+01441
+<a name="l01442"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c26">01442</a> <font class="keywordtype">void</font> CMoveContainer::removeFromModifiedList (CMovePrimitive* primitive, uint8 worldImage)
+01443 {
+01444 <font class="comment">// For each changed primitives</font>
+01445 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> *<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>[worldImage];
+01446 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *previous=NULL;
+01447 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI=primitive-&gt;getWorldImage (worldImage);
+01448
+01449 <font class="keywordflow">while</font> (changed)
+01450 {
+01451 <font class="comment">// Get the primitive world image</font>
+01452 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *changedWI=<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>-&gt;getWorldImage (worldImage);
+01453
+01454 <font class="comment">// Remove from ot list</font>
+01455 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>==primitive)
+01456 {
+01457 <font class="comment">// There is a previous primitive ?</font>
+01458 <font class="keywordflow">if</font> (previous)
+01459 previous-&gt;linkInModifiedList (wI-&gt;getNextModified ());
+01460 <font class="keywordflow">else</font>
+01461 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>[worldImage]=wI-&gt;getNextModified ();
+01462
+01463 <font class="comment">// Unlink</font>
+01464 wI-&gt;linkInModifiedList (NULL);
+01465 wI-&gt;setInModifiedListFlag (<font class="keyword">false</font>);
+01466 <font class="keywordflow">break</font>;
+01467 }
+01468
+01469 <font class="comment">// Next primitive</font>
+01470 previous=changedWI;
+01471 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c25">changed</a>=changedWI-&gt;getNextModified ();
+01472 }
+01473 }
+01474
+01475 <font class="comment">// ***************************************************************************</font>
+01476
+<a name="l01477"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c28">01477</a> <font class="keywordtype">void</font> CMoveContainer::unlinkMoveElement (CMoveElement *element, uint8 worldImage)
+01478 {
+01479 <font class="comment">// Some checks</font>
+01480 <a class="code" href="debug_8h.html#a6">nlassert</a> (element-&gt;X&lt;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>);
+01481 <a class="code" href="debug_8h.html#a6">nlassert</a> (element-&gt;Y&lt;<a class="code" href="classNLPACS_1_1CMoveContainer.html#o17">_CellCountHeight</a>);
+01482
+01483 <font class="comment">// Unlink it</font>
+01484 CMoveCell &amp;cell=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o18">_VectorCell</a>[worldImage][element-&gt;X+element-&gt;Y*<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>];
+01485 cell.unlinkX (element);
+01486 <font class="comment">//cell.unlinkY (element);</font>
+01487 }
+01488
+01489 <font class="comment">// ***************************************************************************</font>
+01490
+<a name="l01491"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#c29">01491</a> <font class="keywordtype">void</font> CMoveContainer::reaction (<font class="keyword">const</font> CCollisionOTInfo&amp; first)
+01492 {
+01493 <font class="comment">// H_AUTO(PACS_MC_reaction);</font>
+01494
+01495 <font class="comment">// Static collision ?</font>
+01496 <font class="keywordflow">if</font> (first.isCollisionAgainstStatic())
+01497 {
+01498 <font class="comment">// Check mode</font>
+01499 <a class="code" href="debug_8h.html#a6">nlassert</a> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>);
+01500
+01501 <font class="comment">// Cast</font>
+01502 <font class="keyword">const</font> CCollisionOTStaticInfo *staticInfo=safe_cast&lt;const CCollisionOTStaticInfo*&gt; (&amp;first);
+01503
+01504 <font class="comment">// Get the primitive world image</font>
+01505 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a> *movePrimitive=staticInfo-&gt;getPrimitive ();
+01506 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI;
+01507 <font class="keywordflow">if</font> (movePrimitive-&gt;isNonCollisionable ())
+01508 wI=movePrimitive-&gt;getWorldImage (0);
+01509 <font class="keywordflow">else</font>
+01510 wI=movePrimitive-&gt;getWorldImage (staticInfo-&gt;getWorldImage());
+01511
+01512 <font class="comment">// Dynamic collision</font>
+01513 wI-&gt;reaction ( staticInfo-&gt;getCollisionDesc (), staticInfo-&gt;getGlobalPosition (),
+01514 *<a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>, staticInfo-&gt;getDeltaTime(), <a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>, *staticInfo-&gt;getPrimitive (), *<font class="keyword">this</font>, staticInfo-&gt;getWorldImage());
+01515 }
+01516 <font class="keywordflow">else</font>
+01517 {
+01518 <font class="comment">// Cast</font>
+01519 <font class="keyword">const</font> CCollisionOTDynamicInfo *dynInfo=safe_cast&lt;const CCollisionOTDynamicInfo*&gt; (&amp;first);
+01520
+01521 <font class="comment">// Get the primitives world image</font>
+01522 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *firstWI;
+01523 <font class="keywordflow">if</font> (dynInfo-&gt;getFirstPrimitive ()-&gt;isNonCollisionable ())
+01524 firstWI=dynInfo-&gt;getFirstPrimitive ()-&gt;getWorldImage (0);
+01525 <font class="keywordflow">else</font>
+01526 firstWI=dynInfo-&gt;getFirstPrimitive ()-&gt;getWorldImage (dynInfo-&gt;getFirstWorldImage());
+01527
+01528 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *secondWI;
+01529 <font class="keywordflow">if</font> (dynInfo-&gt;getSecondPrimitive ()-&gt;isNonCollisionable ())
+01530 secondWI=dynInfo-&gt;getSecondPrimitive ()-&gt;getWorldImage (0);
+01531 <font class="keywordflow">else</font>
+01532 secondWI=dynInfo-&gt;getSecondPrimitive ()-&gt;getWorldImage (dynInfo-&gt;getSecondWorldImage());
+01533
+01534 <font class="comment">// Dynamic collision</font>
+01535 firstWI-&gt;reaction ( *secondWI, dynInfo-&gt;getCollisionDesc (), <a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o20">_SurfaceTemp</a>, dynInfo-&gt;isCollision(),
+01536 *dynInfo-&gt;getFirstPrimitive (), *dynInfo-&gt;getSecondPrimitive (), <font class="keyword">this</font>, dynInfo-&gt;getFirstWorldImage(),
+01537 dynInfo-&gt;getSecondWorldImage(), dynInfo-&gt;isSecondStatic());
+01538
+01547 <font class="keywordflow">if</font> (dynInfo-&gt;getFirstPrimitive ()-&gt;isCollisionable ())
+01548 {
+01549 <font class="keywordflow">if</font> (dynInfo-&gt;getFirstPrimitive ()-&gt;isTriggered (*dynInfo-&gt;getSecondPrimitive (), dynInfo-&gt;isEnter(), dynInfo-&gt;isExit()))
+01550 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c12">newTrigger</a> (dynInfo-&gt;getFirstPrimitive (), dynInfo-&gt;getSecondPrimitive (), dynInfo-&gt;getCollisionDesc (),
+01551 dynInfo-&gt;isEnter() ? UTriggerInfo::In : dynInfo-&gt;isExit() ? UTriggerInfo::Out : UTriggerInfo::Inside);
+01552 }
+01553 }
+01554 }
+01555
+01556 <font class="comment">// ***************************************************************************</font>
+01557
+<a name="l01558"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a9">01558</a> <font class="keywordtype">void</font> CMoveContainer::setAsStatic (uint8 worldImage)
+01559 {
+01560 NL_ALLOC_CONTEXT( Pacs )
+01561
+01562 <font class="comment">// Add this world image in the static set of world image</font>
+01563 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.insert (worldImage);
+01564 }
+01565
+01566 <font class="comment">// ***************************************************************************</font>
+01567
+<a name="l01568"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a10">01568</a> <font class="keywordtype">void</font> CMoveContainer::duplicateWorldImage (uint8 source, uint8 dest)
+01569 {
+01570 NL_ALLOC_CONTEXT( Pacs )
+01571
+01572 <font class="comment">// Cell count</font>
+01573 uint cellCount=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o16">_CellCountWidth</a>*<a class="code" href="classNLPACS_1_1CMoveContainer.html#o17">_CellCountHeight</a>;
+01574
+01575 <font class="comment">// Clear dest modified list</font>
+01576 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c13">clearModifiedList</a> (dest);
+01577
+01578 <font class="comment">// Clear destination cells</font>
+01579 uint i;
+01580 <font class="keywordflow">for</font> (i=0; i&lt;cellCount; i++)
+01581 {
+01582 <font class="comment">// Get first X</font>
+01583 CMoveElement *elm;
+01584 <font class="keywordflow">while</font> ((elm=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o18">_VectorCell</a>[dest][i].getFirstX ()))
+01585 {
+01586 <font class="comment">// Get primitive world image</font>
+01587 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI=elm-&gt;Primitive-&gt;getWorldImage (dest);
+01588
+01589 <font class="comment">// Remove the primitive</font>
+01590 <font class="keywordtype">int</font> i;
+01591 <font class="keywordflow">for</font> (i=0; i&lt;4; i++)
+01592 {
+01593 <font class="keywordflow">if</font> (wI-&gt;getMoveElement(i))
+01594 wI-&gt;removeMoveElement (i, *<font class="keyword">this</font>, dest);
+01595 }
+01596 }
+01597 }
+01598
+01599 <font class="comment">// Duplicate destination cells</font>
+01600 <font class="keywordflow">for</font> (i=0; i&lt;cellCount; i++)
+01601 {
+01602 <font class="comment">// Get first X</font>
+01603 CMoveElement *elm=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o18">_VectorCell</a>[source][i].getFirstX ();
+01604 <font class="keywordflow">while</font> (elm)
+01605 {
+01606 <font class="comment">// Get primitive world image</font>
+01607 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wISource=elm-&gt;Primitive-&gt;getWorldImage (source);
+01608 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wIDest=elm-&gt;Primitive-&gt;getWorldImage (dest);
+01609
+01610 <font class="comment">// First time the primitive is visited ?</font>
+01611 <font class="keywordflow">if</font> (wIDest-&gt;getMoveElement (0)==NULL)
+01612 {
+01613 wIDest-&gt;copy (*wISource);
+01614 }
+01615
+01616 <font class="comment">// Add at the end of the list</font>
+01617 wIDest-&gt;addMoveElementendOfList (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o18">_VectorCell</a>[dest][i], elm-&gt;X, elm-&gt;Y, elm-&gt;Primitive, *<font class="keyword">this</font>);
+01618
+01619 <font class="comment">// Added ?</font>
+01620 <a class="code" href="debug_8h.html#a6">nlassert</a> (wIDest-&gt;getMoveElement (0)!=NULL);
+01621
+01622 <font class="comment">// Next primitive</font>
+01623 elm=elm-&gt;NextX;
+01624 }
+01625 }
+01626 }
+01627
+01628 <font class="comment">// ***************************************************************************</font>
+01629
+<a name="l01630"></a><a class="code" href="classNLPACS_1_1UMoveContainer.html#d0">01630</a> UMoveContainer *UMoveContainer::createMoveContainer (<font class="keywordtype">double</font> xmin, <font class="keywordtype">double</font> ymin, <font class="keywordtype">double</font> xmax, <font class="keywordtype">double</font> ymax,
+01631 uint widthCellCount, uint heightCellCount, <font class="keywordtype">double</font> primitiveMaxSize, uint8 numWorldImage,
+01632 uint maxIteration, uint otSize)
+01633 {
+01634 NL_ALLOC_CONTEXT( Pacs )
+01635
+01636 <font class="comment">// Create a CMoveContainer</font>
+01637 <font class="keywordflow">return</font> <font class="keyword">new</font> CMoveContainer (xmin, ymin, xmax, ymax, widthCellCount, heightCellCount, primitiveMaxSize, numWorldImage, maxIteration, otSize);
+01638 }
+01639
+01640 <font class="comment">// ***************************************************************************</font>
+01641
+<a name="l01642"></a><a class="code" href="classNLPACS_1_1UMoveContainer.html#d1">01642</a> UMoveContainer *UMoveContainer::createMoveContainer (UGlobalRetriever* retriever, uint widthCellCount,
+01643 uint heightCellCount, <font class="keywordtype">double</font> primitiveMaxSize, uint8 numWorldImage, uint maxIteration, uint otSize)
+01644 {
+01645 NL_ALLOC_CONTEXT( Pacs )
+01646
+01647 <font class="comment">// Cast</font>
+01648 <a class="code" href="debug_8h.html#a6">nlassert</a> (dynamic_cast&lt;CGlobalRetriever*&gt;(retriever));
+01649 CGlobalRetriever* <a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>=static_cast&lt;CGlobalRetriever*&gt;(retriever);
+01650
+01651 <font class="comment">// Create a CMoveContainer</font>
+01652 <font class="keywordflow">return</font> <font class="keyword">new</font> CMoveContainer (<a class="code" href="driver__opengl__extension__def_8h.html#a385">r</a>, widthCellCount, heightCellCount, primitiveMaxSize, numWorldImage, maxIteration, otSize);
+01653 }
+01654
+01655 <font class="comment">// ***************************************************************************</font>
+01656
+<a name="l01657"></a><a class="code" href="classNLPACS_1_1UCollisionDesc.html#a0">01657</a> <font class="keywordtype">void</font> UCollisionDesc::serial (<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a>&amp; stream)
+01658 {
+01659 stream.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNLPACS_1_1UCollisionDesc.html#m0">ContactPosition</a>);
+01660 stream.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNLPACS_1_1UCollisionDesc.html#m1">ContactNormal0</a>);
+01661 stream.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNLPACS_1_1UCollisionDesc.html#m2">ContactNormal1</a>);
+01662 stream.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNLPACS_1_1UCollisionDesc.html#m3">ContactTime</a>);
+01663 };
+01664
+01665 <font class="comment">// ***************************************************************************</font>
+01666
+<a name="l01667"></a><a class="code" href="classNLPACS_1_1UTriggerInfo.html#a0">01667</a> <font class="keywordtype">void</font> UTriggerInfo::serial (<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a>&amp; stream)
+01668 {
+01669 stream.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNLPACS_1_1UTriggerInfo.html#m0">Object0</a>);
+01670 stream.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNLPACS_1_1UTriggerInfo.html#m1">Object1</a>);
+01671 stream.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a> (<a class="code" href="classNLPACS_1_1UTriggerInfo.html#m2">CollisionDesc</a>);
+01672 }
+01673
+01674
+01675
+01676 <font class="comment">// ***************************************************************************</font>
+<a name="l01677"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a8">01677</a> <font class="keywordtype">void</font> CMoveContainer::addCollisionnablePrimitiveBlock(UPrimitiveBlock *pb,uint8 firstWorldImage,uint8 numWorldImage,std::vector&lt;UMovePrimitive*&gt; *primitives,<font class="keywordtype">float</font> orientation,<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;position, <font class="keywordtype">bool</font> dontSnapToGround <font class="comment">/* = false*/</font>)
+01678 {
+01679 NL_ALLOC_CONTEXT( Pacs )
+01680
+01681 CPrimitiveBlock *block = NLMISC::safe_cast&lt;CPrimitiveBlock *&gt;(pb);
+01682 <font class="comment">// Reserve the pointer array</font>
+01683 <font class="keywordflow">if</font> (primitives)
+01684 primitives-&gt;reserve (block-&gt;Primitives.size());
+01685
+01686 <font class="comment">// For each primitive</font>
+01687 uint prim;
+01688 <font class="keywordflow">for</font> (prim=0; prim&lt;block-&gt;Primitives.size(); prim++)
+01689 {
+01690 <font class="comment">// Create a collisionable primitive</font>
+01691 UMovePrimitive *primitive = <a class="code" href="classNLPACS_1_1CMoveContainer.html#a5">addCollisionablePrimitive</a> (firstWorldImage, numWorldImage);
+01692
+01693 <font class="comment">// Ref on the block descriptor</font>
+01694 CPrimitiveDesc &amp;desc = block-&gt;Primitives[prim];
+01695
+01696 <font class="comment">// Set its properties</font>
+01697 primitive-&gt;setPrimitiveType (desc.Type);
+01698 primitive-&gt;setReactionType (desc.Reaction);
+01699 primitive-&gt;setTriggerType (desc.Trigger);
+01700 primitive-&gt;setCollisionMask (desc.CollisionMask);
+01701 primitive-&gt;setOcclusionMask (desc.OcclusionMask);
+01702 primitive-&gt;setObstacle (desc.Obstacle);
+01703 primitive-&gt;setAbsorbtion (desc.Attenuation);
+01704 primitive-&gt;setDontSnapToGround(dontSnapToGround);
+01705 <font class="keywordflow">if</font> (desc.Type == UMovePrimitive::_2DOrientedBox)
+01706 {
+01707 primitive-&gt;setSize (desc.Length[0], desc.Length[1]);
+01708 }
+01709 <font class="keywordflow">else</font>
+01710 {
+01711 <a class="code" href="debug_8h.html#a6">nlassert</a> (desc.Type == UMovePrimitive::_2DOrientedCylinder);
+01712 primitive-&gt;setRadius (desc.Length[0]);
+01713 }
+01714 primitive-&gt;setHeight (desc.Height);
+01715
+01716 <font class="comment">// Insert the primitives</font>
+01717
+01718 <font class="comment">// For each world image</font>
+01719 uint wI;
+01720 <font class="keywordflow">for</font> (wI=firstWorldImage; wI&lt;(uint)(firstWorldImage+numWorldImage); wI++)
+01721 {
+01722 <font class="comment">// Insert the primitive</font>
+01723 primitive-&gt;insertInWorldImage (wI);
+01724
+01725 <font class="comment">// Final position</font>
+01726 <font class="keywordtype">float</font> cosa = (float) cos (orientation);
+01727 <font class="keywordtype">float</font> sina = (float) sin (orientation);
+01728 CVector finalPos;
+01729 finalPos.x = cosa * desc.Position.x - sina * desc.Position.y + position.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>;
+01730 finalPos.y = sina * desc.Position.y + cosa * desc.Position.y + position.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>;
+01731 finalPos.z = desc.Position.z + position.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>;
+01732
+01733 <font class="comment">// Set the primtive orientation</font>
+01734 <font class="keywordflow">if</font> (desc.Type == UMovePrimitive::_2DOrientedBox)
+01735 primitive-&gt;setOrientation ((<font class="keywordtype">float</font>)fmod (desc.Orientation + orientation, 2*<a class="code" href="namespaceNLMISC.html#a7">Pi</a>), wI);
+01736
+01737 <font class="comment">// Set the primitive global position</font>
+01738 primitive-&gt;setGlobalPosition (finalPos, wI);
+01739 }
+01740
+01741 <font class="comment">// Feedback asked ?</font>
+01742 <font class="keywordflow">if</font> (primitives)
+01743 {
+01744 <font class="comment">// Add the pointer</font>
+01745 primitives-&gt;push_back (primitive);
+01746 }
+01747 }
+01748 }
+01749
+01750
+01751 <font class="comment">// ***************************************************************************</font>
+01752
+<a name="l01753"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a7">01753</a> <font class="keywordtype">bool</font> CMoveContainer::loadCollisionablePrimitiveBlock (<font class="keyword">const</font> <font class="keywordtype">char</font> *filename, uint8 firstWorldImage, uint8 numWorldImage, std::vector&lt;UMovePrimitive*&gt; *primitives, <font class="keywordtype">float</font> orientation, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;position, <font class="keywordtype">bool</font> dontSnapToGround <font class="comment">/*= false*/</font>)
+01754 {
+01755 NL_ALLOC_CONTEXT( Pacs )
+01756
+01757 <font class="comment">// Check world image</font>
+01758 <font class="keywordflow">if</font> ( (uint)(firstWorldImage+numWorldImage) &gt; <a class="code" href="classNLPACS_1_1CMoveContainer.html#o3">_ChangedRoot</a>.size() )
+01759 {
+01760 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Invalid world image number."</font>);
+01761 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01762 }
+01763
+01764 <font class="comment">// Try to load the file</font>
+01765 CIFile <a class="code" href="cf__lexical_8cpp.html#a95">file</a>;
+01766 <font class="keywordflow">if</font> (<a class="code" href="cf__lexical_8cpp.html#a95">file</a>.open (filename))
+01767 {
+01768 <font class="comment">// Create the XML stream</font>
+01769 CIXml input;
+01770
+01771 <font class="comment">// Init</font>
+01772 <font class="keywordflow">if</font> (input.init (<a class="code" href="cf__lexical_8cpp.html#a95">file</a>))
+01773 {
+01774 <font class="comment">// The primitive block</font>
+01775 CPrimitiveBlock block;
+01776
+01777 <font class="comment">// Serial it</font>
+01778 <a class="code" href="cf__lexical_8cpp.html#a95">file</a>.serial (block);
+01779
+01780 <font class="comment">// add primitives</font>
+01781 <a class="code" href="classNLPACS_1_1CMoveContainer.html#a8">addCollisionnablePrimitiveBlock</a>(&amp;block, firstWorldImage, numWorldImage, primitives, orientation, position, dontSnapToGround);
+01782
+01783 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01784 }
+01785 <font class="keywordflow">else</font>
+01786 {
+01787 <font class="comment">// Warning</font>
+01788 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Can't init XML stream with file %s."</font>, filename);
+01789
+01790 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01791 }
+01792 }
+01793 <font class="keywordflow">else</font>
+01794 {
+01795 <font class="comment">// Warning</font>
+01796 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"Can't load primitive block %s."</font>, filename);
+01797
+01798 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01799 }
+01800 }
+01801
+01802
+01803 <font class="comment">// ***************************************************************************</font>
+<a name="l01804"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a20">01804</a> <font class="keywordtype">void</font> CMoveContainer::getPrimitives(std::vector&lt;const UMovePrimitive *&gt; &amp;dest)<font class="keyword"> const</font>
+01805 <font class="keyword"></font>{
+01806 NL_ALLOC_CONTEXT( Pacs )
+01807
+01808 dest.resize(<a class="code" href="classNLPACS_1_1CMoveContainer.html#o2">_PrimitiveSet</a>.size());
+01809 std::copy(<a class="code" href="classNLPACS_1_1CMoveContainer.html#o2">_PrimitiveSet</a>.begin(), <a class="code" href="classNLPACS_1_1CMoveContainer.html#o2">_PrimitiveSet</a>.end(), dest.begin());
+01810 }
+01811
+01812
+01813 <font class="comment">// ***************************************************************************</font>
+<a name="l01814"></a><a class="code" href="classNLPACS_1_1UMoveContainer.html#d3">01814</a> <font class="keywordtype">void</font> UMoveContainer::getPACSCoordsFromMatrix(<a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;pos,<font class="keywordtype">float</font> &amp;angle,<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> &amp;mat)
+01815 {
+01816 pos = mat.<a class="code" href="classNLMISC_1_1CMatrix.html#z291_4">getPos</a>();
+01817 CVector orient = mat.<a class="code" href="classNLMISC_1_1CMatrix.html#z294_0">mulVector</a>(<a class="code" href="classNLMISC_1_1CVector.html#p1">NLMISC::CVector::I</a>);
+01818 orient.z = 0.f;
+01819 orient.normalize();
+01820 angle = orient.y &gt;= 0.f ? ::acosf(orient.x)
+01821 : 2.f * (float) NLMISC::Pi - ::acosf(orient.x);
+01822
+01823 }
+01824
+01825 <font class="comment">// ***************************************************************************</font>
+<a name="l01826"></a><a class="code" href="classNLPACS_1_1CMoveContainer.html#a13">01826</a> <font class="keywordtype">bool</font> CMoveContainer::evalNCPrimitiveCollision (<font class="keywordtype">double</font> deltaTime, UMovePrimitive *primitive, uint8 worldImage)
+01827 {
+01828 NL_ALLOC_CONTEXT( Pacs )
+01829
+01830 <font class="comment">// New test time</font>
+01831 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o0">_TestTime</a>++;
+01832
+01833 <font class="comment">// Clear triggers</font>
+01834 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o21">_Triggers</a>.clear ();
+01835
+01836 <font class="comment">// Only non-collisionable primitives</font>
+01837 <font class="keywordflow">if</font> (!primitive-&gt;isCollisionable())
+01838 {
+01839 <font class="comment">// Delta time</font>
+01840 <a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>=deltaTime;
+01841
+01842 <font class="comment">// Begin of the time slice to compute</font>
+01843 <font class="keywordtype">double</font> beginTime = 0;
+01844 <font class="keywordtype">double</font> collisionTime = deltaTime;
+01845
+01846 <font class="comment">// Get the world image</font>
+01847 <a class="code" href="classNLPACS_1_1CMoveContainer.html#l1">CPrimitiveWorldImage</a> *wI = ((<a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a>*)primitive)-&gt;getWorldImage (0);
+01848
+01849 CCollisionOTInfo *firstCollision = NULL;
+01850 <font class="keywordflow">do</font>
+01851 {
+01852
+01853 <a class="code" href="debug_8h.html#a6">nlassert</a> (beginTime &lt; 1.0);
+01854
+01855 <font class="comment">// Update the primitive</font>
+01856 wI-&gt;update (beginTime, deltaTime, *(<a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a>*)primitive);
+01857
+01858 CVectorD d0=wI-&gt;getDeltaPosition();
+01859
+01860 <font class="comment">// Eval collision again the terrain</font>
+01861 <font class="keywordtype">bool</font> testMoveValid = <font class="keyword">false</font>;
+01862 CCollisionOTStaticInfo staticColInfo;
+01863 CCollisionOTDynamicInfo dynamicColInfoWI0;
+01864 CCollisionOTDynamicInfo dynamicColInfoWI;
+01865
+01866 firstCollision = NULL;
+01867
+01868 <font class="comment">// If collision found, note it is on the landscape</font>
+01869 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c6">evalOneTerrainCollision</a> (beginTime, (<a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a>*)primitive, worldImage, <font class="keyword">false</font>, testMoveValid, &amp;staticColInfo, NULL))
+01870 {
+01871 firstCollision = &amp;staticColInfo;
+01872 }
+01873
+01874 <font class="comment">// Eval collision again the static primitives</font>
+01875 std::set&lt;uint8&gt;::iterator ite=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.begin();
+01876 <font class="keywordflow">while</font> (ite!=<a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.end())
+01877 {
+01878 <font class="comment">// Eval in this world image</font>
+01879 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c7">evalOnePrimitiveCollision</a> (beginTime, (<a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a>*)primitive, *ite, worldImage, <font class="keyword">false</font>, <font class="keyword">true</font>, testMoveValid, &amp;dynamicColInfoWI0, NULL))
+01880 {
+01881 <font class="comment">// First collision..</font>
+01882 <font class="keywordflow">if</font> (!firstCollision || (firstCollision-&gt;getCollisionTime () &gt; dynamicColInfoWI0.getCollisionTime ()))
+01883 {
+01884 firstCollision = &amp;dynamicColInfoWI0;
+01885 }
+01886 }
+01887
+01888 <font class="comment">// Next world image</font>
+01889 ite++;
+01890 }
+01891
+01892 <font class="comment">// Checks</font>
+01893 CVectorD d1=wI-&gt;getDeltaPosition();
+01894
+01895 <font class="comment">// Eval collision again the world image</font>
+01896 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.find (worldImage)==<a class="code" href="classNLPACS_1_1CMoveContainer.html#o4">_StaticWorldImage</a>.end())
+01897 {
+01898 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#c7">evalOnePrimitiveCollision</a> (beginTime, (<a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a>*)primitive, worldImage, worldImage, <font class="keyword">false</font>, <font class="keyword">false</font>, testMoveValid, &amp;dynamicColInfoWI, NULL))
+01899 {
+01900 <font class="comment">// First collision..</font>
+01901 <font class="keywordflow">if</font> (!firstCollision || (firstCollision-&gt;getCollisionTime () &gt; dynamicColInfoWI.getCollisionTime ()))
+01902 {
+01903 firstCollision = &amp;dynamicColInfoWI;
+01904 }
+01905 }
+01906 }
+01907
+01908 <font class="comment">// Checks</font>
+01909 CVectorD d2=wI-&gt;getDeltaPosition();
+01910 <a class="code" href="debug_8h.html#a6">nlassert</a> ((d0==d1)&amp;&amp;(d0==d2));
+01911
+01912 <font class="comment">// if (found)</font>
+01913 <font class="comment">// nlstop;</font>
+01914
+01915 <font class="comment">// Reaction</font>
+01916 <font class="keywordflow">if</font> (firstCollision)
+01917 {
+01918 collisionTime = firstCollision-&gt;getCollisionTime ();
+01919 <a class="code" href="classNLPACS_1_1CMoveContainer.html#c29">reaction</a> (*firstCollision);
+01920 <a class="code" href="debug_8h.html#a6">nlassert</a> (collisionTime != 1);
+01921 }
+01922 <font class="keywordflow">else</font>
+01923 {
+01924 <font class="comment">// Retriever mode ?</font>
+01925 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>&amp;&amp;testMoveValid)
+01926 {
+01927 <font class="comment">// Do move</font>
+01928 wI-&gt;doMove (*<a class="code" href="classNLPACS_1_1CMoveContainer.html#o19">_Retriever</a>, <a class="code" href="classNLPACS_1_1CMoveContainer.html#o20">_SurfaceTemp</a>, deltaTime, collisionTime, ((<a class="code" href="classNLPACS_1_1CMoveContainer.html#l0">CMovePrimitive</a>*)primitive)-&gt;getDontSnapToGround());
+01929 }
+01930 <font class="keywordflow">else</font>
+01931 {
+01932 <font class="comment">// Do move</font>
+01933 wI-&gt;doMove (<a class="code" href="classNLPACS_1_1CMoveContainer.html#o8">_DeltaTime</a>);
+01934 }
+01935 }
+01936
+01937 beginTime = collisionTime;
+01938 }
+01939 <font class="keywordflow">while</font> (firstCollision);
+01940 }
+01941 <font class="keywordflow">else</font>
+01942 <font class="keywordflow">return</font> <font class="keyword">false</font>;
+01943
+01944 <font class="keywordflow">return</font> <font class="keyword">true</font>;
+01945 }
+01946
+01947
+01948 } <font class="comment">// NLPACS</font>
+</pre></div>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
+</TD>
+<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>