diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/retriever__instance_8cpp-source.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to '')
-rw-r--r-- | docs/doxygen/nel/retriever__instance_8cpp-source.html | 803 |
1 files changed, 803 insertions, 0 deletions
diff --git a/docs/doxygen/nel/retriever__instance_8cpp-source.html b/docs/doxygen/nel/retriever__instance_8cpp-source.html new file mode 100644 index 00000000..b0dc2c4b --- /dev/null +++ b/docs/doxygen/nel/retriever__instance_8cpp-source.html @@ -0,0 +1,803 @@ +<!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> <A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A> </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> <A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A> </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> + + +<!-- 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> </td> +</tr></table> +<!-- Generated by Doxygen 1.2.14 --> +<center> +<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <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> </center> +<hr><h1>retriever_instance.cpp</h1><a href="retriever__instance_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="retriever__instance_8h.html">pacs/retriever_instance.h</a>"</font> +00029 <font class="preprocessor">#include "<a class="code" href="global__retriever_8h.html">pacs/global_retriever.h</a>"</font> +00030 +00031 <font class="keyword">using</font> <font class="keyword">namespace </font>std; +00032 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC; +00033 +00034 +00035 +<a name="l00036"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a0">00036</a> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a0">NLPACS::CRetrieverInstance::CRetrieverInstance</a>() +00037 { +00038 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a1">reset</a>(); +00039 } +00040 +00041 +<a name="l00042"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a3">00042</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a3">NLPACS::CRetrieverInstance::resetLinks</a>() +00043 { +00044 uint i; +00045 <font class="comment">// WARNING !!</font> +00046 <font class="comment">// this is a HARD reset !</font> +00047 <font class="comment">// only the instance i reset, no care about neighbors !!</font> +00048 <font class="keywordflow">for</font> (i=0; i<<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_0">_Neighbors</a>.size(); ++i) +00049 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_0">_Neighbors</a>[i] = -1; +00050 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>.clear(); +00051 +00052 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z954_0">_ExteriorEdgeQuad</a>.removeLinks(); +00053 } +00054 +<a name="l00055"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a2">00055</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a3">NLPACS::CRetrieverInstance::resetLinks</a>(uint32 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>) +00056 { +00057 vector<sint32>::iterator rit; +00058 <font class="keywordflow">for</font> (rit=<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_0">_Neighbors</a>.begin(); rit!=<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_0">_Neighbors</a>.end(); ) +00059 <font class="keywordflow">if</font> (*rit == (sint32)<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>) +00060 rit = <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_0">_Neighbors</a>.erase(rit); +00061 <font class="keywordflow">else</font> +00062 ++rit; +00063 +00064 uint i; +00065 <font class="keywordflow">for</font> (i=0; i<<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>.size(); ++i) +00066 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[i].Instance == (uint16)<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>) +00067 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[i].reset(); +00068 +00069 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z954_0">_ExteriorEdgeQuad</a>.removeLinks(<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>); +00070 } +00071 +<a name="l00072"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a1">00072</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a1">NLPACS::CRetrieverInstance::reset</a>() +00073 { +00074 <font class="comment">// WARNING !!</font> +00075 <font class="comment">// this is a HARD reset !</font> +00076 <font class="comment">// only the instance i reset, no care about neighbors !!</font> +00077 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n0">_NodesInformation</a>.clear(); +00078 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a> = -1; +00079 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n2">_RetrieverId</a> = -1; +00080 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_0">_Orientation</a> = 0; +00081 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a> = CVector::Null; +00082 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n3">_Type</a> = CLocalRetriever::Landscape; +00083 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>.clear(); +00084 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z954_0">_ExteriorEdgeQuad</a>.clear(); +00085 +00086 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a3">resetLinks</a>(); +00087 } +00088 +<a name="l00089"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a16">00089</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a16">NLPACS::CRetrieverInstance::init</a>(<font class="keyword">const</font> CLocalRetriever &retriever) +00090 { +00091 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n0">_NodesInformation</a>.resize(retriever.getSurfaces().size()); +00092 uint i; +00093 +00094 <font class="comment">// Resets _NodesInformation for later pathfinding graph annotation.</font> +00095 <font class="keywordflow">for</font> (i=0; i<<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n0">_NodesInformation</a>.size(); ++i) +00096 { +00097 CVector pos = <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a29">getGlobalPosition</a>(retriever.getSurfaces()[i].getCenter()); +00098 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n0">_NodesInformation</a>[i].Position = CVector2f(pos.x, pos.y); +00099 } +00100 +00101 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n3">_Type</a> = retriever.getType(); +00102 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>.resize(retriever.getBorderChains().size()); +00103 } +00104 +<a name="l00105"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a19">00105</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a19">NLPACS::CRetrieverInstance::make</a>(sint32 instanceId, sint32 retrieverId, <font class="keyword">const</font> CLocalRetriever &retriever, +00106 uint8 orientation, <font class="keyword">const</font> CVector &origin) +00107 { +00108 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a> != -1 || <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n2">_RetrieverId</a> != -1) +00109 { +00110 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"in call to NLPACS::CRetrieverInstance::make"</font>); +00111 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"_InstanceId=%d _RetrieverId=%d _Orientation=%d"</font>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n2">_RetrieverId</a>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_0">_Orientation</a>); +00112 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"instanceId=%d retrieverId=%d orientation=%d"</font>, instanceId, retrieverId, orientation); +00113 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"Retriever instance %d has already been set"</font>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>); +00114 } +00115 +00116 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a> = instanceId; +00117 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n2">_RetrieverId</a> = retrieverId; +00118 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_0">_Orientation</a> = (orientation%4); +00119 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a> = origin; +00120 +00121 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_2">_BBox</a> = retriever.getBBox(); +00122 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_2">_BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_0">setCenter</a>(<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_2">_BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z264_4">getCenter</a>()+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>); +00123 +00124 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_0">_Orientation</a> == 1 || <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_0">_Orientation</a> == 3) +00125 { +00126 CVector hs = <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_2">_BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z264_5">getHalfSize</a>(); +00127 std::swap(hs.x, hs.y); +00128 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_2">_BBox</a>.<a class="code" href="classNLMISC_1_1CAABBox.html#z263_1">setHalfSize</a>(hs); +00129 } +00130 +00131 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a16">init</a>(retriever); +00132 } +00133 +00134 <font class="comment">//</font> +<a name="l00135"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a17">00135</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a17">NLPACS::CRetrieverInstance::initEdgeQuad</a>(<a class="code" href="classNLPACS_1_1CGlobalRetriever.html">NLPACS::CGlobalRetriever</a> &gr) +00136 { +00137 <font class="keyword">const</font> CLocalRetriever &lr = gr.<a class="code" href="classNLPACS_1_1CGlobalRetriever.html#z935_5">getRetriever</a>(<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n2">_RetrieverId</a>); +00138 +00139 <font class="keywordflow">if</font> (lr.getType() != CLocalRetriever::Interior) +00140 { +00141 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"Attempt to init the edgequad of instance %d whereas local retriever %d is not interior"</font>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n2">_RetrieverId</a>); +00142 } +00143 +00144 <font class="comment">// build the edge quad</font> +00145 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z954_0">_ExteriorEdgeQuad</a>.build(lr.getExteriorMesh(), gr, gr.<a class="code" href="classNLPACS_1_1CGlobalRetriever.html#b0">getInternalCST</a>(),<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>); +00146 } +00147 +<a name="l00148"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a18">00148</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a18">NLPACS::CRetrieverInstance::linkEdgeQuad</a>(<a class="code" href="classNLPACS_1_1CGlobalRetriever.html">NLPACS::CGlobalRetriever</a> &gr) +00149 { +00150 <font class="keyword">const</font> CLocalRetriever &lr = gr.<a class="code" href="classNLPACS_1_1CGlobalRetriever.html#z935_5">getRetriever</a>(<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n2">_RetrieverId</a>); +00151 <font class="keyword">const</font> CExteriorMesh &em = lr.getExteriorMesh(); +00152 +00153 <font class="keyword">const</font> vector<CExteriorEdgeEntry> &ee = <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z954_0">_ExteriorEdgeQuad</a>.getEdgeEntries(); +00154 +00155 <font class="comment">// here we fill (partially) the _BorderChainLinks table</font> +00156 uint i; +00157 <font class="keywordflow">for</font> (i=0; i<ee.size(); ++i) +00158 { +00159 <font class="keyword">const</font> CExteriorMesh::CEdge &edge = em.getEdge(ee[i].EdgeId); +00160 <font class="keywordflow">if</font> (edge.Link != -1) +00161 { +00162 <font class="keyword">const</font> CExteriorMesh::CLink &<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a20">link</a> = em.getLink(edge.Link); +00163 +00164 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a20">link</a>.SurfaceId != 0xFFFF && <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a20">link</a>.ChainId != 0xFFFF && <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a20">link</a>.BorderChainId != 0xFFFF) +00165 { +00166 CRetrieverInstance::CLink &borderLink = <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a20">link</a>.BorderChainId]; +00167 borderLink.ChainId = 0xFFFF; <font class="comment">// no opposite chain</font> +00168 borderLink.BorderChainId = 0xFFFF; <font class="comment">// idem</font> +00169 <font class="keywordflow">if</font> ((borderLink.Instance == 0xFFFF && borderLink.SurfaceId == 0xFFFF) || +00170 (borderLink.Instance == (uint16)(ee[i].Exterior.RetrieverInstanceId) && +00171 borderLink.SurfaceId == (uint16)(ee[i].Exterior.SurfaceId) )) +00172 { +00173 borderLink.Instance = (uint16)(ee[i].Exterior.RetrieverInstanceId); +00174 borderLink.SurfaceId = (uint16)(ee[i].Exterior.SurfaceId); +00175 } +00176 <font class="keywordflow">else</font> +00177 { +00178 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"Instance %d, borderLink %d: link already set to inst=%d, surf=%d, try to set to inst=%d, surf=%d"</font>, +00179 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a20">link</a>.BorderChainId, borderLink.Instance, borderLink.SurfaceId, +00180 (uint16)(ee[i].Exterior.RetrieverInstanceId), (uint16)(ee[i].Exterior.SurfaceId)); +00181 } +00182 } +00183 } +00184 } +00185 } +00186 +00187 <font class="comment">/* Links the current retriever instance to another instance</font> +00188 <font class="comment"> * on the given edge.</font> +00189 <font class="comment"> */</font> +00190 <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a20">NLPACS::CRetrieverInstance::link</a>(CRetrieverInstance &neighbor, +00191 <font class="keyword">const</font> vector<CLocalRetriever> &retrievers) +00192 { +00193 uint i, j; +00194 <font class="keywordflow">for</font> (i=0; i<<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_0">_Neighbors</a>.size(); ++i) +00195 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_0">_Neighbors</a>[i] == neighbor._InstanceId) +00196 <font class="keywordflow">return</font>; +00197 +00198 <font class="keyword">const</font> CLocalRetriever &retriever = retrievers[<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n2">_RetrieverId</a>]; +00199 <font class="keyword">const</font> CLocalRetriever &nRetriever = retrievers[neighbor._RetrieverId]; +00200 +00201 <font class="keyword">const</font> vector<CChain> &chains = retriever.getChains(), +00202 &nChains = nRetriever.getChains(); +00203 <font class="keyword">const</font> vector<uint16> &borderChains = retriever.getBorderChains(), +00204 &nBorderChains = nRetriever.getBorderChains(); +00205 +00206 vector< pair<CVector,CVector> > chainTips, +00207 nChainTips; +00208 +00209 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>.resize(borderChains.size()); +00210 neighbor._BorderChainLinks.resize(nBorderChains.size()); +00211 +00212 <font class="keywordflow">for</font> (i=0; i<borderChains.size(); ++i) +00213 chainTips.push_back(make_pair(retriever.getTip(chains[borderChains[i]].getStartTip()).Point, +00214 retriever.getTip(chains[borderChains[i]].getStopTip()).Point)); +00215 +00217 +00218 CVector translation = neighbor._Origin - <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>; +00219 +00220 <font class="keywordflow">for</font> (i=0; i<nBorderChains.size(); ++i) +00221 nChainTips.push_back(make_pair(nRetriever.getTip(nChains[nBorderChains[i]].getStartTip()).Point+translation, +00222 nRetriever.getTip(nChains[nBorderChains[i]].getStopTip()).Point+translation)); +00223 +00224 <font class="keywordflow">for</font> (i=0; i<borderChains.size(); ++i) +00225 { +00226 <font class="comment">// if the chain is already linked, just step</font> +00227 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[i].Instance != 0xFFFF || <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[i].BorderChainId != 0xFFFF || +00228 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[i].ChainId != 0xFFFF || <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[i].SurfaceId != 0xFFFF) +00229 <font class="keywordflow">continue</font>; +00230 +00231 <font class="keywordtype">float</font> bestDist = 1.0f; +00232 sint best = -1; +00233 +00234 <font class="keywordflow">for</font> (j=0; j<nBorderChains.size(); ++j) +00235 { +00236 <font class="keywordflow">if</font> (neighbor._BorderChainLinks[j].Instance != 0xFFFF || neighbor._BorderChainLinks[j].BorderChainId != 0xFFFF || +00237 neighbor._BorderChainLinks[j].ChainId != 0xFFFF || neighbor._BorderChainLinks[j].SurfaceId != 0xFFFF) +00238 <font class="keywordflow">continue</font>; +00239 +00240 <font class="keywordtype">float</font> d = (chainTips[i].first-nChainTips[j].second).<a class="code" href="classNLMISC_1_1CVector.html#z331_2">norm</a>()+(chainTips[i].second-nChainTips[j].first).norm(); +00241 <font class="keywordflow">if</font> (d < bestDist) +00242 { +00243 bestDist = d; +00244 best = j; +00245 } +00246 } +00247 +00248 <font class="comment">// if no best match, just don't link</font> +00249 <font class="keywordflow">if</font> (bestDist > 1.0e-1f || best == -1) +00250 <font class="keywordflow">continue</font>; +00251 +00252 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[i].Instance = (uint16)neighbor._InstanceId; +00253 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[i].BorderChainId = (uint16)best; +00254 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[i].ChainId = nBorderChains[<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[i].BorderChainId]; +00255 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[i].SurfaceId = (uint16)nChains[<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>[i].ChainId].getLeft(); +00256 +00257 neighbor._BorderChainLinks[best].Instance = (uint16)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>; +00258 neighbor._BorderChainLinks[best].BorderChainId = (uint16)i; +00259 neighbor._BorderChainLinks[best].ChainId = borderChains[neighbor._BorderChainLinks[best].BorderChainId]; +00260 neighbor._BorderChainLinks[best].SurfaceId = (uint16)chains[neighbor._BorderChainLinks[best].ChainId].getLeft(); +00261 } +00262 +00263 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_0">_Neighbors</a>.push_back(neighbor._InstanceId); +00264 neighbor._Neighbors.push_back(<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>); +00265 } +00266 +00267 +<a name="l00268"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a21">00268</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a21">NLPACS::CRetrieverInstance::unlink</a>(vector<CRetrieverInstance> &instances) +00269 { +00270 uint i; +00271 +00272 <font class="keywordflow">for</font> (i=0; i<<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_0">_Neighbors</a>.size(); ++i) +00273 instances[<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_0">_Neighbors</a>[i]].resetLinks(<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>); +00274 +00275 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a3">resetLinks</a>(); +00276 } +00277 +00278 +00279 +00280 +<a name="l00281"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a22">00281</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a22">NLPACS::CRetrieverInstance::retrievePosition</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &estimated, <font class="keyword">const</font> CLocalRetriever &retriever, CCollisionSurfaceTemp &cst) <font class="keyword">const</font> +00282 <font class="comment">//NLPACS::CLocalRetriever::CLocalPosition NLPACS::CRetrieverInstance::retrievePosition(const NLMISC::CVector &estimated, const CLocalRetriever &retriever, CCollisionSurfaceTemp &cst) const</font> +00283 { +00284 <font class="comment">/*</font> +00285 <font class="comment"> CVector localEstimated;</font> +00286 <font class="comment"> CLocalRetriever::CLocalPosition retrieved;</font> +00287 <font class="comment"></font> +00288 <font class="comment"> // get local coordinates</font> +00289 <font class="comment"> localEstimated = getLocalPosition(estimated);</font> +00290 <font class="comment"> // Yoyo: must snap vector.</font> +00291 <font class="comment"> CRetrieverInstance::snapVector(localEstimated);</font> +00292 <font class="comment"></font> +00293 <font class="comment"> // fills _RetrieveTable by retrievingPosition.</font> +00294 <font class="comment"> retriever.retrievePosition(localEstimated, cst);</font> +00295 <font class="comment"></font> +00296 <font class="comment"> uint i, surf;</font> +00297 <font class="comment"> sint bestSurf = -1;</font> +00298 <font class="comment"> sint lastSurf = -1;</font> +00299 <font class="comment"> float bestDistance = 1.0e10f;</font> +00300 <font class="comment"> float bestHeight;</font> +00301 <font class="comment"> bool lfound;</font> +00302 <font class="comment"></font> +00303 <font class="comment"> // for each surface in the retriever</font> +00304 <font class="comment"> for (i=0; i<cst.PossibleSurfaces.size(); ++i)</font> +00305 <font class="comment"> {</font> +00306 <font class="comment"> surf = cst.PossibleSurfaces[i];</font> +00307 <font class="comment"> cst.SurfaceLUT[surf].first = false;</font> +00308 <font class="comment"> // if the surface contains the estimated position.</font> +00309 <font class="comment"> if (cst.SurfaceLUT[surf].second != 0)</font> +00310 <font class="comment"> {</font> +00311 <font class="comment"> // at least remembers the last seen surface...</font> +00312 <font class="comment"> cst.SurfaceLUT[surf].second = 0;</font> +00313 <font class="comment"> float meanHeight;</font> +00314 <font class="comment"> const CQuadLeaf *leaf;</font> +00315 <font class="comment"> ULocalPosition lp;</font> +00316 <font class="comment"> lfound = false;</font> +00317 <font class="comment"></font> +00318 <font class="comment"> switch (_Type)</font> +00319 <font class="comment"> {</font> +00320 <font class="comment"> case CLocalRetriever::Landscape:</font> +00321 <font class="comment"> // for landscape</font> +00322 <font class="comment"> // search in the surface's quad tree for the actual height</font> +00323 <font class="comment"> leaf = retriever.getSurfaces()[surf].getQuadTree().getLeaf(localEstimated);</font> +00324 <font class="comment"> // if there is no acceptable leaf, just give up</font> +00325 <font class="comment"> if (leaf == NULL)</font> +00326 <font class="comment"> continue;</font> +00327 <font class="comment"> meanHeight = leaf->getMaxHeight();</font> +00328 <font class="comment"> lfound = true;</font> +00329 <font class="comment"> break;</font> +00330 <font class="comment"> case CLocalRetriever::Interior:</font> +00331 <font class="comment"> // for interior</font> +00332 <font class="comment"> // get the exact position</font> +00333 <font class="comment"> lp.Surface = surf;</font> +00334 <font class="comment"> lp.Estimation = localEstimated;</font> +00335 <font class="comment"> meanHeight = localEstimated.z;</font> +00336 <font class="comment"> retriever.snapToInteriorGround(lp, lfound);</font> +00337 <font class="comment"> if (lfound)</font> +00338 <font class="comment"> meanHeight = lp.Estimation.z;</font> +00339 <font class="comment"> break;</font> +00340 <font class="comment"> default:</font> +00341 <font class="comment"> // hu?</font> +00342 <font class="comment"> continue;</font> +00343 <font class="comment"> }</font> +00344 <font class="comment"></font> +00345 <font class="comment"> // if it is closer to the estimation than the previous remembered...</font> +00346 <font class="comment"> float distance = (float)fabs(localEstimated.z-meanHeight);</font> +00347 <font class="comment"> if (distance < bestDistance && lfound)</font> +00348 <font class="comment"> {</font> +00349 <font class="comment"> bestDistance = distance;</font> +00350 <font class="comment"> bestHeight = meanHeight;</font> +00351 <font class="comment"> bestSurf = surf;</font> +00352 <font class="comment"> }</font> +00353 <font class="comment"> }</font> +00354 <font class="comment"> }</font> +00355 <font class="comment"></font> +00356 <font class="comment"> if (bestSurf != -1)</font> +00357 <font class="comment"> {</font> +00358 <font class="comment"> // if there is a best surface, returns it</font> +00359 <font class="comment"> retrieved.Surface = bestSurf;</font> +00360 <font class="comment"> retrieved.Estimation = CVector(localEstimated.x, localEstimated.y, bestHeight);</font> +00361 <font class="comment"> }</font> +00362 <font class="comment"> else</font> +00363 <font class="comment"> {</font> +00364 <font class="comment"> // else return the last remembered...</font> +00365 <font class="comment"> retrieved.Surface = lastSurf;</font> +00366 <font class="comment"> retrieved.Estimation = localEstimated;</font> +00367 <font class="comment"> }</font> +00368 <font class="comment"></font> +00369 <font class="comment"> return retrieved;</font> +00370 <font class="comment">*/</font> +00371 retrievePosition(CVectorD(estimated), retriever, cst); +00372 } +00373 +<a name="l00374"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a23">00374</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a22">NLPACS::CRetrieverInstance::retrievePosition</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVectorD.html">NLMISC::CVectorD</a> &estimated, <font class="keyword">const</font> CLocalRetriever &retriever, CCollisionSurfaceTemp &cst)<font class="keyword"> const</font> +00375 <font class="keyword"></font>{ +00376 CVector localEstimated; +00377 +00378 <font class="comment">// nldebug("PACS: retrievePosition in instance %d (retriever %d)", _InstanceId, _RetrieverId);</font> +00379 +00380 <font class="comment">// get local coordinates</font> +00381 localEstimated = <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a27">getLocalPosition</a>(estimated); +00382 <font class="comment">// Yoyo: must snap vector.</font> +00383 CRetrieverInstance::snapVector(localEstimated); +00384 +00385 <font class="comment">// fills _RetrieveTable by retrievingPosition.</font> +00386 retriever.retrievePosition(localEstimated, cst); +00387 +00388 uint i, surf; +00389 <font class="comment">/* sint bestSurf = -1;</font> +00390 <font class="comment"> sint lastSurf = -1;</font> +00391 <font class="comment"> float bestDistance = 1.0e10f;</font> +00392 <font class="comment"> float bestHeight;*/</font> +00393 <font class="keywordtype">bool</font> found = <font class="keyword">false</font>; +00394 +00395 <font class="keywordflow">switch</font> (_Type) +00396 { +00397 <font class="keywordflow">case</font> CLocalRetriever::Landscape: +00398 <font class="comment">// for landscape</font> +00399 <font class="keywordflow">for</font> (i=0; i<cst.PossibleSurfaces.size(); ++i) +00400 { +00401 surf = cst.PossibleSurfaces[i]; +00402 +00403 <font class="comment">// nldebug("PACS: surface %d: count %d", surf, cst.SurfaceLUT[surf].Counter);</font> +00404 +00405 <font class="comment">// if the surface contains the estimated position.</font> +00406 <font class="keywordflow">if</font> (cst.SurfaceLUT[surf].Counter == 2) +00407 { +00408 <font class="keywordtype">float</font> meanHeight; +00409 <font class="keyword">const</font> CQuadLeaf *leaf; +00410 +00411 <font class="comment">// search in the surface's quad tree for the actual height</font> +00412 leaf = retriever.getSurfaces()[surf].getQuadTree().getLeaf(localEstimated); +00413 <font class="comment">// if there is no acceptable leaf, just give up</font> +00414 <font class="keywordflow">if</font> (leaf != NULL) +00415 { +00416 meanHeight = leaf->getMaxHeight(); +00417 <font class="comment">//meanHeight = retriever.getSurfaces()[surf].getQuadTree().getInterpZ(localEstimated);</font> +00418 +00419 <font class="comment">// if it is closer to the estimation than the previous remembered...</font> +00420 found = <font class="keyword">true</font>; +00421 <font class="keywordtype">float</font> distance = (float)fabs(localEstimated.z-meanHeight); +00422 cst.SortedSurfaces.push_back(CCollisionSurfaceTemp::CDistanceSurface(distance, (uint16)surf, (uint16)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>, cst.SurfaceLUT[surf].FoundCloseEdge)); +00423 } +00424 } +00425 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (cst.SurfaceLUT[surf].Counter != 0) +00426 { +00427 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"PACS: unexpected surface (%d) count (%d) at instance %d (pos=(%f,%f,%f))"</font>, surf, cst.SurfaceLUT[surf].Counter, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>, estimated.<a class="code" href="classNLMISC_1_1CVectorD.html#m0">x</a>, estimated.<a class="code" href="classNLMISC_1_1CVectorD.html#m1">y</a>, estimated.<a class="code" href="classNLMISC_1_1CVectorD.html#m2">z</a>); +00428 } +00429 +00430 cst.SurfaceLUT[surf].reset(); +00431 } +00432 +00433 <font class="keywordflow">break</font>; +00434 +00435 <font class="keywordflow">case</font> CLocalRetriever::Interior: +00436 <font class="comment">// for interior</font> +00437 <font class="keywordflow">for</font> (i=0; i<cst.PossibleSurfaces.size(); ++i) +00438 { +00439 surf = cst.PossibleSurfaces[i]; +00440 <font class="comment">// if the surface contains the estimated position.</font> +00441 <font class="keywordflow">if</font> (cst.SurfaceLUT[surf].Counter == 2) +00442 { +00443 ULocalPosition lp; +00444 <font class="keywordtype">bool</font> lfound = <font class="keyword">false</font>; +00445 +00446 <font class="comment">// get the exact position</font> +00447 lp.Surface = surf; +00448 lp.Estimation = localEstimated; +00449 retriever.snapToInteriorGround(lp, lfound); +00450 <font class="keywordflow">if</font> (lfound) +00451 { +00452 <font class="comment">// if it is closer to the estimation than the previous remembered...</font> +00453 found = <font class="keyword">true</font>; +00454 <font class="keywordtype">float</font> distance = (float)fabs(localEstimated.z-lp.Estimation.z); +00455 cst.SortedSurfaces.push_back(CCollisionSurfaceTemp::CDistanceSurface(distance, (uint16)surf, (uint16)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>, cst.SurfaceLUT[surf].FoundCloseEdge)); +00456 } +00457 } +00458 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (cst.SurfaceLUT[surf].Counter != 0) +00459 { +00460 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"PACS: unexpected surface (%d) count (%d) at instance %d (pos=(%f,%f,%f))"</font>, surf, cst.SurfaceLUT[surf].Counter, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>, estimated.<a class="code" href="classNLMISC_1_1CVectorD.html#m0">x</a>, estimated.<a class="code" href="classNLMISC_1_1CVectorD.html#m1">y</a>, estimated.<a class="code" href="classNLMISC_1_1CVectorD.html#m2">z</a>); +00461 } +00462 +00463 cst.SurfaceLUT[surf].reset(); +00464 } +00465 <font class="keywordflow">break</font>; +00466 +00467 <font class="keywordflow">default</font>: +00468 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"Unknown instance type %d !!"</font>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n3">_Type</a>); +00469 <font class="keywordflow">break</font>; +00470 } +00471 +00472 cst.OutCounter = 0; +00473 } +00474 +00475 +00476 +<a name="l00477"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a24">00477</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a24">NLPACS::CRetrieverInstance::snapToInteriorGround</a>(<a class="code" href="classNLPACS_1_1ULocalPosition.html">NLPACS::ULocalPosition</a> &position, +00478 <font class="keyword">const</font> <a class="code" href="classNLPACS_1_1CLocalRetriever.html">NLPACS::CLocalRetriever</a> &retriever)<font class="keyword"> const</font> +00479 <font class="keyword"></font>{ +00480 <font class="keywordtype">bool</font> lfound; +00481 retriever.<a class="code" href="classNLPACS_1_1CLocalRetriever.html#a2">snapToInteriorGround</a>(position, lfound); +00482 } +00483 +<a name="l00484"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a25">00484</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a25">NLPACS::CRetrieverInstance::snap</a>(<a class="code" href="classNLPACS_1_1ULocalPosition.html">NLPACS::ULocalPosition</a> &position, <font class="keyword">const</font> <a class="code" href="classNLPACS_1_1CLocalRetriever.html">NLPACS::CLocalRetriever</a> &retriever)<font class="keyword"> const</font> +00485 <font class="keyword"></font>{ +00486 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n3">_Type</a> == CLocalRetriever::Landscape) +00487 { +00488 <font class="comment">// search in the surface's quad tree for the actual height</font> +00489 <font class="comment">// position.Estimation.z = retriever.getSurfaces()[position.Surface].getQuadTree().getInterpZ(position.Estimation);</font> +00490 +00491 <font class="keyword">const</font> CQuadLeaf *leaf = retriever.<a class="code" href="classNLPACS_1_1CLocalRetriever.html#z944_10">getSurfaces</a>()[position.<a class="code" href="classNLPACS_1_1ULocalPosition.html#m0">Surface</a>].getQuadTree().getLeaf(position.<a class="code" href="classNLPACS_1_1ULocalPosition.html#m1">Estimation</a>); +00492 <font class="comment">// if there is no acceptable leaf, just give up</font> +00493 <font class="keywordflow">if</font> (leaf != NULL) +00494 { +00495 position.<a class="code" href="classNLPACS_1_1ULocalPosition.html#m1">Estimation</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> = leaf->getMaxHeight(); +00496 } +00497 <font class="keywordflow">else</font> +00498 { +00499 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"PACS: couldn't snap position (%f,%f,%f) on surface %d instance %d"</font>, position.<a class="code" href="classNLPACS_1_1ULocalPosition.html#m1">Estimation</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, position.<a class="code" href="classNLPACS_1_1ULocalPosition.html#m1">Estimation</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, position.<a class="code" href="classNLPACS_1_1ULocalPosition.html#m1">Estimation</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>, position.<a class="code" href="classNLPACS_1_1ULocalPosition.html#m0">Surface</a>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>); +00500 } +00501 +00502 } +00503 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n3">_Type</a> == CLocalRetriever::Interior) +00504 { +00505 <font class="keywordtype">bool</font> lfound; +00506 retriever.<a class="code" href="classNLPACS_1_1CLocalRetriever.html#a2">snapToInteriorGround</a>(position, lfound); +00507 } +00508 <font class="keywordflow">else</font> +00509 { +00510 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"PACS: unknown instance (%d) type %d"</font>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n3">_Type</a>); +00511 } +00512 } +00513 +00514 +00515 +00516 +00517 +<a name="l00518"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a27">00518</a> CVector <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a27">NLPACS::CRetrieverInstance::getLocalPosition</a>(<font class="keyword">const</font> CVector &globalPosition)<font class="keyword"> const</font> +00519 <font class="keyword"></font>{ +00520 <font class="keywordflow">switch</font> (_Orientation) +00521 { +00522 <font class="keywordflow">default</font>: +00523 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"in NLPACS::CRetrieverInstance::getLocalPosition()"</font>); +00524 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"unexpected orientation value (%d)"</font>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_0">_Orientation</a>); +00525 <font class="keywordflow">case</font> 0: +00526 <font class="keywordflow">return</font> CVector(+globalPosition.x-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, +globalPosition.y-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, globalPosition.z-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>); +00527 <font class="keywordflow">break</font>; +00528 <font class="keywordflow">case</font> 1: +00529 <font class="keywordflow">return</font> CVector(+globalPosition.y-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, -globalPosition.x+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, globalPosition.z-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>); +00530 <font class="keywordflow">break</font>; +00531 <font class="keywordflow">case</font> 2: +00532 <font class="keywordflow">return</font> CVector(-globalPosition.x+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, -globalPosition.y+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, globalPosition.z-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>); +00533 <font class="keywordflow">break</font>; +00534 <font class="keywordflow">case</font> 3: +00535 <font class="keywordflow">return</font> CVector(-globalPosition.y+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, +globalPosition.x-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, globalPosition.z-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>); +00536 <font class="keywordflow">break</font>; +00537 } +00538 } +00539 +<a name="l00540"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a28">00540</a> CVector <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a27">NLPACS::CRetrieverInstance::getLocalPosition</a>(<font class="keyword">const</font> CVectorD &globalPosition)<font class="keyword"> const</font> +00541 <font class="keyword"></font>{ +00542 <font class="keywordflow">switch</font> (_Orientation) +00543 { +00544 <font class="keywordflow">default</font>: +00545 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"in NLPACS::CRetrieverInstance::getLocalPosition()"</font>); +00546 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"unexpected orientation value (%d)"</font>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_0">_Orientation</a>); +00547 <font class="keywordflow">case</font> 0: +00548 <font class="keywordflow">return</font> CVector((<font class="keywordtype">float</font>)(+globalPosition.x-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>), (<font class="keywordtype">float</font>)(+globalPosition.y-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>), (<font class="keywordtype">float</font>)(globalPosition.z-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>)); +00549 <font class="keywordflow">break</font>; +00550 <font class="keywordflow">case</font> 1: +00551 <font class="keywordflow">return</font> CVector((<font class="keywordtype">float</font>)(+globalPosition.y-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>), (<font class="keywordtype">float</font>)(-globalPosition.x+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>), (<font class="keywordtype">float</font>)(globalPosition.z-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>)); +00552 <font class="keywordflow">break</font>; +00553 <font class="keywordflow">case</font> 2: +00554 <font class="keywordflow">return</font> CVector((<font class="keywordtype">float</font>)(-globalPosition.x+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>), (<font class="keywordtype">float</font>)(-globalPosition.y+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>), (<font class="keywordtype">float</font>)(globalPosition.z-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>)); +00555 <font class="keywordflow">break</font>; +00556 <font class="keywordflow">case</font> 3: +00557 <font class="keywordflow">return</font> CVector((<font class="keywordtype">float</font>)(-globalPosition.y+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>), (<font class="keywordtype">float</font>)(+globalPosition.x-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>), (<font class="keywordtype">float</font>)(globalPosition.z-<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>)); +00558 <font class="keywordflow">break</font>; +00559 } +00560 } +00561 +<a name="l00562"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a29">00562</a> CVector <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a29">NLPACS::CRetrieverInstance::getGlobalPosition</a>(<font class="keyword">const</font> CVector &localPosition)<font class="keyword"> const</font> +00563 <font class="keyword"></font>{ +00564 <font class="keywordflow">switch</font> (_Orientation) +00565 { +00566 <font class="keywordflow">default</font>: +00567 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"in NLPACS::CRetrieverInstance::getLocalPosition()"</font>); +00568 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"unexpected orientation value (%d)"</font>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_0">_Orientation</a>); +00569 <font class="keywordflow">case</font> 0: +00570 <font class="keywordflow">return</font> CVector(+localPosition.x+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, +localPosition.y+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, localPosition.z+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ); +00571 <font class="keywordflow">break</font>; +00572 <font class="keywordflow">case</font> 1: +00573 <font class="keywordflow">return</font> CVector(-localPosition.y+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, +localPosition.x+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, localPosition.z+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ); +00574 <font class="keywordflow">break</font>; +00575 <font class="keywordflow">case</font> 2: +00576 <font class="keywordflow">return</font> CVector(-localPosition.x+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, -localPosition.y+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, localPosition.z+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ); +00577 <font class="keywordflow">break</font>; +00578 <font class="keywordflow">case</font> 3: +00579 <font class="keywordflow">return</font> CVector(+localPosition.y+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, -localPosition.x+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, localPosition.z+<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ); +00580 <font class="keywordflow">break</font>; +00581 } +00582 } +00583 +<a name="l00584"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a30">00584</a> CVectorD <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a30">NLPACS::CRetrieverInstance::getDoubleGlobalPosition</a>(<font class="keyword">const</font> CVector &localPosition)<font class="keyword"> const</font> +00585 <font class="keyword"></font>{ +00586 <font class="keywordflow">switch</font> (_Orientation) +00587 { +00588 <font class="keywordflow">default</font>: +00589 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"in NLPACS::CRetrieverInstance::getLocalPosition()"</font>); +00590 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"unexpected orientation value (%d)"</font>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_0">_Orientation</a>); +00591 <font class="keywordflow">case</font> 0: +00592 <font class="keywordflow">return</font> CVectorD(+(<font class="keywordtype">double</font>)localPosition.x+(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, +(<font class="keywordtype">double</font>)localPosition.y+(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, (<font class="keywordtype">double</font>)localPosition.z+(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ); +00593 <font class="keywordflow">break</font>; +00594 <font class="keywordflow">case</font> 1: +00595 <font class="keywordflow">return</font> CVectorD(-(<font class="keywordtype">double</font>)localPosition.y+(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, +(<font class="keywordtype">double</font>)localPosition.x+(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, (<font class="keywordtype">double</font>)localPosition.z+(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ); +00596 <font class="keywordflow">break</font>; +00597 <font class="keywordflow">case</font> 2: +00598 <font class="keywordflow">return</font> CVectorD(-(<font class="keywordtype">double</font>)localPosition.x+(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, -(<font class="keywordtype">double</font>)localPosition.y+(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, (<font class="keywordtype">double</font>)localPosition.z+(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ); +00599 <font class="keywordflow">break</font>; +00600 <font class="keywordflow">case</font> 3: +00601 <font class="keywordflow">return</font> CVectorD(+(<font class="keywordtype">double</font>)localPosition.y+(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>, -(<font class="keywordtype">double</font>)localPosition.x+(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>, (<font class="keywordtype">double</font>)localPosition.z+(<font class="keywordtype">double</font>)<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ); +00602 <font class="keywordflow">break</font>; +00603 } +00604 } +00605 +00606 +00607 +00608 <font class="comment">// ***************************************************************************</font> +<a name="l00609"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z956_0">00609</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z956_0">NLPACS::CRetrieverInstance::testExteriorCollision</a>(<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html">NLPACS::CCollisionSurfaceTemp</a> &cst, <font class="keyword">const</font> CAABBox &bboxMove, <font class="keyword">const</font> CVector2f &transBase, <font class="keyword">const</font> <a class="code" href="classNLPACS_1_1CLocalRetriever.html">NLPACS::CLocalRetriever</a> &retriever)<font class="keyword"> const</font> +00610 <font class="keyword"></font>{ +00611 sint i; +00612 +00613 <font class="comment">// 0. select ordered chains in the chainquad.</font> +00614 <font class="comment">//=====================================</font> +00615 sint nEei= <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z954_0">_ExteriorEdgeQuad</a>.selectEdges(bboxMove, cst); +00616 <font class="comment">// NB: cst.OChainLUT is assured to be full of 0xFFFF after this call (if was right before).</font> +00617 +00618 +00619 <font class="comment">// 1. regroup them in chains. build cst.CollisionChains</font> +00620 <font class="comment">//=====================================</font> +00621 <font class="comment">// NB: use cst.OChainLUT to look if a Chain has been inserted before.</font> +00622 uint16 *edgeLUT= cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m0">OChainLUT</a>; +00623 +00624 <font class="comment">// bkup where we begin to add chains.</font> +00625 uint firstChainAdded= cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m7">CollisionChains</a>.size(); +00626 +00627 <font class="comment">// For all exterioredge entry.</font> +00628 <font class="keywordflow">for</font>(i=0;i<nEei;i++) +00629 { +00630 <font class="comment">// get the edge entry and the edge</font> +00631 uint16 eei = cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m2">ExteriorEdgeIndexes</a>[i]; +00632 <font class="keyword">const</font> CExteriorEdgeEntry &eee = <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z954_0">_ExteriorEdgeQuad</a>.getEdgeEntry(eei); +00633 +00634 <font class="comment">// don't bother about doors</font> +00635 <font class="keywordflow">if</font> (eee.Interior.RetrieverInstanceId != -1) +00636 <font class="keywordflow">continue</font>; +00637 +00638 <font class="comment">// add/retrieve the id in cst.CollisionChains.</font> +00639 <font class="comment">//=================================</font> +00640 uint ccId; +00641 <font class="comment">// if never added.</font> +00642 <font class="keywordflow">if</font>(edgeLUT[eei]==0xFFFF) +00643 { +00644 <font class="comment">// add a new CCollisionChain.</font> +00645 ccId= cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m7">CollisionChains</a>.size(); +00646 cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m7">CollisionChains</a>.push_back(CCollisionChain()); +00647 <font class="comment">// Fill it with default.</font> +00648 cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m7">CollisionChains</a>[ccId].Tested= <font class="keyword">false</font>; +00649 cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m7">CollisionChains</a>[ccId].ExteriorEdge = <font class="keyword">true</font>; +00650 cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m7">CollisionChains</a>[ccId].FirstEdgeCollide= 0xFFFFFFFF; +00651 cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m7">CollisionChains</a>[ccId].ChainId= eei; +00652 <font class="comment">// Fill Left right info.</font> +00653 cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m7">CollisionChains</a>[ccId].LeftSurface = eee.Interior; +00654 cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m7">CollisionChains</a>[ccId].RightSurface = eee.Exterior; +00655 +00656 <font class="comment">// store this Id in the LUT of chains.</font> +00657 edgeLUT[eei]= ccId; +00658 } +00659 <font class="keywordflow">else</font> +00660 { +00661 <font class="comment">// get the id of this collision chain.</font> +00662 ccId= edgeLUT[eei]; +00663 } +00664 +00665 <font class="comment">// add edge collide to the list.</font> +00666 <font class="comment">//=================================</font> +00667 CCollisionChain &colChain= cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m7">CollisionChains</a>[ccId]; +00668 +00669 CVector2f p0 = CVector2f(retriever.<a class="code" href="classNLPACS_1_1CLocalRetriever.html#z942_0">_ExteriorMesh</a>.getEdge(eee.EdgeId).Start); +00670 CVector2f p1 = CVector2f(retriever.<a class="code" href="classNLPACS_1_1CLocalRetriever.html#z942_0">_ExteriorMesh</a>.getEdge(eee.EdgeId+1).Start); +00671 +00672 <font class="comment">// alloc a new edgeCollide.</font> +00673 uint32 ecnId= cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#z930_1">allocEdgeCollideNode</a>(); +00674 CEdgeCollideNode &ecn= cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#z930_2">getEdgeCollideNode</a>(ecnId); +00675 +00676 <font class="comment">// append to the front of the list.</font> +00677 ecn.Next= colChain.FirstEdgeCollide; +00678 colChain.FirstEdgeCollide= ecnId; +00679 +00680 <font class="comment">// build this edge.</font> +00681 p0+= transBase; +00682 p1+= transBase; +00683 ecn.make(p0, p1); +00684 } +00685 +00686 +00687 +00688 <font class="comment">// 2. Reset LUT to 0xFFFF.</font> +00689 <font class="comment">//=====================================</font> +00690 +00691 <font class="comment">// for all collisions chains inserted (starting from firstChainAdded), reset LUT.</font> +00692 <font class="keywordflow">for</font>(i=firstChainAdded; i<(sint)cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m7">CollisionChains</a>.size(); i++) +00693 { +00694 uint ccId= cst.<a class="code" href="classNLPACS_1_1CCollisionSurfaceTemp.html#m7">CollisionChains</a>[i].ChainId; +00695 edgeLUT[ccId]= 0xFFFF; +00696 } +00697 +00698 } +00699 +00700 +00701 +00702 +<a name="l00703"></a><a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a26">00703</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#a26">NLPACS::CRetrieverInstance::serial</a>(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &f) +00704 { +00705 <font class="comment">/*</font> +00706 <font class="comment"> Version 0:</font> +00707 <font class="comment"> - base version.</font> +00708 <font class="comment"> Version 1:</font> +00709 <font class="comment"> - added type and _EdgeQuad</font> +00710 <font class="comment"> */</font> +00711 sint ver= f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a>(1); +00712 +00713 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n1">_InstanceId</a>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n2">_RetrieverId</a>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_0">_Orientation</a>, <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_1">_Origin</a>); +00714 f.<a class="code" href="classNLMISC_1_1IStream.html#a7">serialCont</a>(<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_0">_Neighbors</a>); +00715 f.<a class="code" href="classNLMISC_1_1IStream.html#a7">serialCont</a>(<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z953_1">_BorderChainLinks</a>); +00716 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z952_2">_BBox</a>); +00717 +00718 <font class="comment">// serialises the number of nodes</font> +00719 uint16 totalNodes = <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n0">_NodesInformation</a>.size(); +00720 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(totalNodes); +00721 <font class="keywordflow">if</font> (f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>()) +00722 { +00723 <font class="comment">// if the stream is reading, reinits the temps table...</font> +00724 <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n0">_NodesInformation</a>.resize(totalNodes); +00725 } +00726 +00727 <font class="keywordflow">if</font> (ver >= 1) +00728 { +00729 f.<a class="code" href="classNLMISC_1_1IStream.html#a6">serialEnum</a>(<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n3">_Type</a>); +00730 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#z954_0">_ExteriorEdgeQuad</a>); +00731 +00732 <font class="comment">// a fix for old versions (with wrong _Type value)</font> +00733 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n3">_Type</a> != CLocalRetriever::Interior) <a class="code" href="classNLPACS_1_1CRetrieverInstance.html#n3">_Type</a> = CLocalRetriever::Landscape; +00734 } +00735 } +</pre></div> + +<!-- footer --> +<BR><FONT Size=+5> </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> |