aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/edge__quad_8cpp-source.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/doxygen/nel/edge__quad_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/edge__quad_8cpp-source.html711
1 files changed, 711 insertions, 0 deletions
diff --git a/docs/doxygen/nel/edge__quad_8cpp-source.html b/docs/doxygen/nel/edge__quad_8cpp-source.html
new file mode 100644
index 00000000..597eea0a
--- /dev/null
+++ b/docs/doxygen/nel/edge__quad_8cpp-source.html
@@ -0,0 +1,711 @@
+<!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>edge_quad.cpp</h1><a href="edge__quad_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="edge__quad_8h.html">pacs/edge_quad.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 <font class="keyword">namespace </font>NLPACS
+00036 {
+00037
+00038
+00039 <font class="comment">// ***************************************************************************</font>
+<a name="l00040"></a><a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">00040</a> <font class="keyword">const</font> <font class="keywordtype">float</font> CEdgeQuad::_QuadElementSize= 4; <font class="comment">// = 4 meters.</font>
+00041
+00042
+00043 <font class="comment">// ***************************************************************************</font>
+<a name="l00044"></a><a class="code" href="classNLPACS_1_1CEdgeQuad.html#a0">00044</a> CEdgeQuad::CEdgeQuad()
+00045 {
+00046 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>= NULL;
+00047 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>= 0;
+00048 }
+00049 <font class="comment">// ***************************************************************************</font>
+<a name="l00050"></a><a class="code" href="classNLPACS_1_1CEdgeQuad.html#a2">00050</a> CEdgeQuad::~CEdgeQuad()
+00051 {
+00052 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#a4">clear</a>();
+00053 }
+00054 <font class="comment">// ***************************************************************************</font>
+<a name="l00055"></a><a class="code" href="classNLPACS_1_1CEdgeQuad.html#a1">00055</a> CEdgeQuad::CEdgeQuad(<font class="keyword">const</font> CEdgeQuad &amp;o)
+00056 {
+00057 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>= NULL;
+00058 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>= 0;
+00059 *<font class="keyword">this</font>= o;
+00060 }
+00061 <font class="comment">// ***************************************************************************</font>
+<a name="l00062"></a><a class="code" href="classNLPACS_1_1CEdgeQuad.html#a3">00062</a> CEdgeQuad &amp;CEdgeQuad::operator=(<font class="keyword">const</font> CEdgeQuad &amp;o)
+00063 {
+00064 <font class="comment">// Alloc good quaddata.</font>
+00065 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>= o._QuadDataLen;
+00066 <font class="keyword">delete</font> [] <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>;
+00067 <font class="keywordflow">if</font>(<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>&gt;0)
+00068 {
+00069 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>= (uint8*)<font class="keyword">new</font> uint8[<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>];
+00070 <font class="comment">// copy contents.</font>
+00071 memcpy(<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>, o._QuadData, <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>);
+00072 }
+00073 <font class="keywordflow">else</font>
+00074 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>= NULL;
+00075
+00076 <font class="comment">// copy infos.</font>
+00077 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>= o._Width;
+00078 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o3">_Height</a>= o._Height;
+00079 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o4">_X</a>= o._X;
+00080 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o5">_Y</a>= o._Y;
+00081 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a> = o._EdgeEntries;
+00082
+00083 <font class="comment">// copy good pointers.</font>
+00084 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>.clear();
+00085 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>.resize(o._Quad.size(), NULL);
+00086 <font class="keywordflow">for</font>(sint i=0; i&lt;(sint)<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>.size(); i++)
+00087 {
+00088 <font class="keywordflow">if</font>(o._Quad[i])
+00089 {
+00090 uint32 off= (uint32)(o._Quad[i]-o._QuadData);
+00091 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>[i]= <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>+off;
+00092 }
+00093 }
+00094
+00095
+00096 <font class="keywordflow">return</font> *<font class="keyword">this</font>;
+00097 }
+00098
+00099 <font class="comment">// ***************************************************************************</font>
+<a name="l00100"></a><a class="code" href="classNLPACS_1_1CEdgeQuad.html#a4">00100</a> <font class="keywordtype">void</font> CEdgeQuad::clear()
+00101 {
+00102 <font class="keyword">delete</font> [] <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>;
+00103 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>= NULL;
+00104 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>= 0;
+00105
+00106 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>.clear();
+00107 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>.clear();
+00108 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a> = 0;
+00109 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o3">_Height</a> = 0;
+00110 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o4">_X</a> = 0;
+00111 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o5">_Y</a> = 0;
+00112 }
+00113
+00114 <font class="comment">// ***************************************************************************</font>
+<a name="l00115"></a><a class="code" href="classNLPACS_1_1CEdgeQuad.html#c0">00115</a> <font class="keywordtype">void</font> CEdgeQuad::getGridBounds(sint32 &amp;x0, sint32 &amp;y0, sint32 &amp;x1, sint32 &amp;y1, <font class="keyword">const</font> CVector &amp;minP, <font class="keyword">const</font> CVector &amp;maxP)<font class="keyword"> const</font>
+00116 <font class="keyword"></font>{
+00117 x0= (sint32)floor(minP.x / <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o4">_X</a>;
+00118 y0= (sint32)floor(minP.y / <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o5">_Y</a>;
+00119 x1= (sint32) ceil(maxP.x / <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o4">_X</a>;
+00120 y1= (sint32) ceil(maxP.y / <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o5">_Y</a>;
+00121 x0= max(x0, (sint32)0);
+00122 y0= max(y0, (sint32)0);
+00123 x1= <a class="code" href="bit__set_8cpp.html#a0">min</a>(x1, (sint32)<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>);
+00124 y1= <a class="code" href="bit__set_8cpp.html#a0">min</a>(y1, (sint32)<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o3">_Height</a>);
+00125 }
+00126
+00127
+00128
+00129 <font class="comment">// ***************************************************************************</font>
+<a name="l00130"></a><a class="code" href="classNLPACS_1_1CEdgeQuad.html#a5">00130</a> <font class="keywordtype">void</font> CEdgeQuad::build(<font class="keyword">const</font> CExteriorMesh &amp;em,
+00131 <font class="keyword">const</font> CGlobalRetriever &amp;global,
+00132 CCollisionSurfaceTemp &amp;cst,
+00133 uint32 thisInstance)
+00134 {
+00135 <font class="keyword">const</font> std::vector&lt;CExteriorMesh::CEdge&gt; &amp;edges = em.getEdges();
+00136
+00137 vector&lt; list&lt;uint16&gt; &gt; tempQuad;
+00138 sint i, j;
+00139
+00140 <font class="comment">// first, clear any pr-build.</font>
+00141 <a class="code" href="namespaceNLMISC.html#a222">contReset</a>(<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>);
+00142 <font class="keyword">delete</font> [] <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>;
+00143 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>= NULL;
+00144 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>= 0;
+00145
+00146 <font class="comment">// don't care about the origin of the instance</font>
+00147 CVector origin = global.getInstance(thisInstance).getOrigin();
+00148
+00149 <font class="comment">// 0. Find BBox of the grid. Allocate grid.</font>
+00150 <font class="comment">//=========================================</font>
+00151 <font class="keywordtype">bool</font> first=<font class="keyword">true</font>;
+00152 CAABBox chainquadBBox;
+00153 <font class="comment">// run all chains.</font>
+00154 <font class="keywordflow">for</font> (i=0; i&lt;(sint)edges.size()-1; i++)
+00155 {
+00156 <font class="comment">// enlarge bbox.</font>
+00157 <font class="keywordflow">if</font> (first)
+00158 first= <font class="keyword">false</font>, chainquadBBox.setCenter(edges[i].Start);
+00159 <font class="keywordflow">else</font>
+00160 chainquadBBox.extend(edges[i].Start);
+00161 }
+00162
+00163 <font class="comment">// compute X,Y,Width, Height.</font>
+00164 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o4">_X</a>= (sint32)floor(chainquadBBox.getMin().x / <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>);
+00165 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o5">_Y</a>= (sint32)floor(chainquadBBox.getMin().y / <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>);
+00166 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>= (sint32)ceil(chainquadBBox.getMax().x / <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o4">_X</a>;
+00167 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o3">_Height</a>= (sint32)ceil(chainquadBBox.getMax().y / <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o5">_Y</a>;
+00168
+00169 tempQuad.resize(<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o3">_Height</a>);
+00170 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>.resize(<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o3">_Height</a>, NULL);
+00171
+00172
+00173 <font class="comment">// 1. For each edge, add them to the quadgrid.</font>
+00174 <font class="comment">//=========================================</font>
+00175 <font class="comment">// run all chains.</font>
+00176 <font class="keywordflow">for</font> (i=0; i&lt;(sint)edges.size()-1; i++)
+00177 {
+00178 <font class="keywordtype">float</font> dnorm = (edges[i+1].Start-edges[i].Start).norm();
+00179 uint numStep = (uint)(dnorm/0.1f)+1;
+00180 uint step;
+00181
+00182 CVector pbegin = edges[i].Start+origin,
+00183 pend = edges[i+1].Start+origin;
+00184
+00185 CVector opbegin = edges[i].Start,
+00186 opend = edges[i+1].Start;
+00187
+00188 <font class="keywordflow">for</font> (step=0; step&lt;numStep; ++step)
+00189 {
+00190 <font class="keywordtype">float</font> lambda0 = (float)(step)/(float)(numStep);
+00191 <font class="keywordtype">float</font> lambda1 = (float)(step+1)/(float)(numStep);
+00192 CVector p0 = pbegin*(1.0f-lambda0)+pend*(lambda0),
+00193 p1 = pbegin*(1.0f-lambda1)+pend*(lambda1);
+00194 CVector op0 = opbegin*(1.0f-lambda0)+opend*(lambda0),
+00195 op1 = opbegin*(1.0f-lambda1)+opend*(lambda1);
+00196 CVector s0, s1,
+00197 mins, maxs;
+00198
+00199 uint prevEdge = (i-1)%(edges.size()-1);
+00200 <font class="keywordtype">bool</font> prio0 = (edges[i].Link!=-1) || (edges[prevEdge].Link!=-1);
+00201
+00202 UGlobalPosition gp0 = global.retrievePosition(p0);
+00203 global.updateHeight(gp0);
+00204 UGlobalPosition gp1 = global.retrievePosition(p1);
+00205 global.updateHeight(gp1);
+00206
+00207 <font class="keywordflow">if</font> (!prio0)
+00208 {
+00209 swap(p0, p1);
+00210 swap(op0, op1);
+00211 swap(gp0, gp1);
+00212 }
+00213
+00214 <font class="keywordflow">if</font> (gp0.InstanceId == -1)
+00215 {
+00216 swap(p0, p1);
+00217 swap(op0, op1);
+00218 swap(gp0, gp1);
+00219 }
+00220
+00221 <font class="keyword">const</font> <a class="code" href="namespaceNLPACS.html#a0">TCollisionSurfaceDescVector</a> *pcd = global.testCylinderMove(gp0, p1-p0, 0.01f, cst);
+00222
+00223 <font class="keywordflow">if</font> (pcd == NULL)
+00224 {
+00225 <font class="comment">// nlwarning("in CEdgeQuad::build(): testCylinderMove() returned NULL");</font>
+00226 <font class="keywordflow">continue</font>;
+00227 }
+00228
+00229 <a class="code" href="namespaceNLPACS.html#a0">TCollisionSurfaceDescVector</a> cd = (*pcd);
+00230
+00231 <font class="keywordflow">if</font> (edges[i].Link != -1 &amp;&amp; cd.size() &gt; 0)
+00232 {
+00233 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"In NLPACS::CEdgeQuad::build()"</font>);
+00234 <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"ERROR: exterior edge %d with interior link crosses some surfaces"</font>, i);
+00235 cd.clear ();
+00236 }
+00237
+00238 <font class="comment">// add start surface to the collision description</font>
+00239 CCollisionSurfaceDesc stcd;
+00240 stcd.ContactTime = 0.0f;
+00241 stcd.ContactSurface.RetrieverInstanceId = gp0.InstanceId;
+00242 stcd.ContactSurface.SurfaceId = gp0.LocalPosition.Surface;
+00243 cd.insert(cd.begin(), stcd);
+00244
+00245 <font class="comment">// get the surface, chain ...</font>
+00246 sint edgeId = i;
+00247 uint16 chainId;
+00248
+00249 CSurfaceIdent interior;
+00250 <font class="keywordflow">if</font> (edges[i].Link == -1)
+00251 {
+00252 interior.RetrieverInstanceId = -1;
+00253 interior.SurfaceId = -1;
+00254 chainId = 0xFFFF;
+00255 }
+00256 <font class="keywordflow">else</font>
+00257 {
+00258 interior.RetrieverInstanceId = thisInstance;
+00259 interior.SurfaceId = em.getLink(edges[i].Link).SurfaceId;
+00260 chainId = em.getLink(edges[i].Link).ChainId;
+00261 }
+00262
+00263
+00264 <font class="comment">// add end point to the collision description</font>
+00265 stcd = cd.back();
+00266 stcd.ContactTime = 1.0f;
+00267 cd.push_back(stcd);
+00268
+00269 <font class="keywordflow">for</font> (j=0; j&lt;(sint)cd.size()-1; ++j)
+00270 {
+00271 s0 = op0*(float)(1.0-cd[j].ContactTime) + op1*(float)(cd[j].ContactTime);
+00272 s1 = op0*(float)(1.0-cd[j+1].ContactTime) + op1*(float)(cd[j+1].ContactTime);
+00273
+00274 mins.minof(s0, s1);
+00275 maxs.maxof(s0, s1);
+00276
+00277 <font class="comment">// PrecisionPb: extend a little this edge. This is important for special case like borders on zones.</font>
+00278 <font class="keywordflow">if</font>(mins.x-maxs.x==0)
+00279 mins.x-=0.001f, maxs.x+=0.001f;
+00280 <font class="keywordflow">if</font>(mins.y-maxs.y==0)
+00281 mins.y-=0.001f, maxs.y+=0.001f;
+00282
+00283 <font class="comment">// get bounding coordinate of this edge in the quadgrid.</font>
+00284 sint32 x0, y0, x1, y1;
+00285 sint <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>;
+00286 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#c0">getGridBounds</a>(x0, y0, x1, y1, mins, maxs);
+00287
+00288 CSurfaceIdent exterior = cd[j].ContactSurface;
+00289
+00290 uint entry;
+00291 <font class="keywordflow">for</font> (entry=0; entry&lt;<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>.size(); ++entry)
+00292 {
+00293 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[entry].EdgeId == edgeId &amp;&amp;
+00294 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[entry].Exterior == exterior)
+00295 {
+00296 <font class="keywordflow">if</font> (<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[entry].ChainId != chainId ||
+00297 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[entry].Interior != interior)
+00298 {
+00299 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"In NLPACS::CEdgeQuad::build()"</font>);
+00300 <a class="code" href="debug_8h.html#a3">nlerror</a>(<font class="stringliteral">"exterior edge %d has different interior linkage"</font>, edgeId);
+00301 }
+00302
+00303 <font class="keywordflow">break</font>;
+00304 }
+00305 }
+00306
+00307 <font class="comment">// if this entry didn't exist before create a new one...</font>
+00308 <font class="keywordflow">if</font> (entry == <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>.size())
+00309 {
+00310 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>.push_back(CExteriorEdgeEntry());
+00311 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>.back().EdgeId = edgeId;
+00312 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>.back().ChainId = chainId;
+00313 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>.back().Interior = interior;
+00314 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>.back().Exterior = exterior;
+00315 }
+00316
+00317 <font class="comment">// add this edge to all the quadnode it touches.</font>
+00318 <font class="keywordflow">for</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>=y0; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;y1; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++)
+00319 {
+00320 <font class="keywordflow">for</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>=x0; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&lt;x1; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++)
+00321 {
+00322 <font class="comment">// check we don't push this entry twice</font>
+00323 list&lt;uint16&gt;::iterator it;
+00324 <font class="keywordflow">for</font> (it=tempQuad[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>].begin(); it!=tempQuad[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>].end(); ++it)
+00325 <font class="keywordflow">if</font> (entry == *it)
+00326 <font class="keywordflow">break</font>;
+00327 <font class="keywordflow">if</font> (it == tempQuad[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>].end())
+00328 tempQuad[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>].push_back(entry);
+00329 }
+00330 }
+00331 }
+00332 }
+00333
+00334 }
+00335
+00336 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"Built ExteriorEdgeQuad, linked following doors:"</font>);
+00337 <font class="keywordflow">for</font> (i=0; i&lt;(sint)<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>.size(); ++i)
+00338 {
+00339 <font class="keywordflow">if</font> (edges[<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[i].EdgeId].Link != -1 &amp;&amp;
+00340 (<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[i].Interior.RetrieverInstanceId == -1 || <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[i].Interior.SurfaceId == -1 ||
+00341 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[i].Exterior.RetrieverInstanceId == -1 || <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[i].Exterior.SurfaceId == -1))
+00342 {
+00343 <a class="code" href="debug_8h.html#a2">nlwarning</a>(<font class="stringliteral">"In NLPACS::CEdgeQuad::build(): exterior door %d has corrupted link"</font>, i);
+00344 }
+00345 <font class="keywordflow">else</font> <font class="keywordflow">if</font> (edges[<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[i].EdgeId].Link != -1)
+00346 {
+00347 <a class="code" href="debug_8h.html#a1">nlinfo</a>(<font class="stringliteral">"Inst=%d ExtEdge=%d IntInst=%d IntSurf=%d IntChain=%d ExtInst=%d ExtSurf=%d"</font>, thisInstance, <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[i].EdgeId,
+00348 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[i].Interior.RetrieverInstanceId, <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[i].Interior.SurfaceId, <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[i].ChainId,
+00349 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[i].Exterior.RetrieverInstanceId, <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>[i].Exterior.SurfaceId);
+00350 }
+00351 }
+00352
+00353 <font class="comment">// 2. Mem optimisation: Use only 1 block for ALL quads of the grid.</font>
+00354 <font class="comment">//=========================================</font>
+00355 sint memSize= 0;
+00356 <font class="comment">// run all quads.</font>
+00357 <font class="keywordflow">for</font>(i=0;i&lt;(sint)tempQuad.size();i++)
+00358 {
+00359 list&lt;uint16&gt; &amp;quadNode= tempQuad[i];
+00360
+00361 <font class="keywordflow">if</font>(!quadNode.empty())
+00362 {
+00363 <font class="comment">// add an entry for Len.</font>
+00364 memSize+= <font class="keyword">sizeof</font>(uint16);
+00365 <font class="comment">// add N entry of CEdgeChainEntry.</font>
+00366 memSize+= quadNode.size()*<font class="keyword">sizeof</font>(uint16);
+00367 }
+00368 }
+00369
+00370 <font class="comment">// allocate.</font>
+00371 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>= (uint8*)<font class="keyword">new</font> uint8[memSize];
+00372 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>= memSize;
+00373
+00374
+00375 <font class="comment">// 3. Fill _QuadData with lists.</font>
+00376 <font class="comment">//=========================================</font>
+00377 uint8 *ptr= <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>;
+00378 <font class="keywordflow">for</font>(i=0;i&lt;(sint)tempQuad.size();i++)
+00379 {
+00380 list&lt;uint16&gt; &amp;srcQuadNode= tempQuad[i];
+00381 list&lt;uint16&gt;::iterator it;
+00382
+00383 <font class="keywordflow">if</font>(!srcQuadNode.empty())
+00384 {
+00385 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>[i]= ptr;
+00386
+00387 <font class="comment">// write len.</font>
+00388 uint16 len= srcQuadNode.size();
+00389 *((uint16*)ptr)= len;
+00390 ptr+= <font class="keyword">sizeof</font>(uint16);
+00391
+00392 <font class="comment">// add entries.</font>
+00393 it= srcQuadNode.begin();
+00394 <font class="keywordflow">for</font>(j=0; j&lt;len; j++, it++)
+00395 {
+00396 *((uint16 *)ptr)= *it;
+00397 ptr+= <font class="keyword">sizeof</font>(uint16);
+00398 }
+00399 }
+00400 }
+00401
+00402 <font class="comment">// End.</font>
+00403 }
+00404
+00405
+00406 <font class="comment">// ***************************************************************************</font>
+<a name="l00407"></a><a class="code" href="classNLPACS_1_1CEdgeQuad.html#a6">00407</a> sint CEdgeQuad::selectEdges(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CAABBox.html">NLMISC::CAABBox</a> &amp;bbox, CCollisionSurfaceTemp &amp;cst)<font class="keyword"> const</font>
+00408 <font class="keyword"></font>{
+00409 sint nRes=0;
+00410 sint i;
+00411 uint16 *indexLUT = cst.OChainLUT;
+00412
+00413 <font class="comment">// start: no edge found.</font>
+00414 cst.ExteriorEdgeIndexes.clear();
+00415
+00416 <font class="comment">// get bounding coordinate of this bbox in the quadgrid.</font>
+00417 sint32 x0, y0, x1, y1;
+00418 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#c0">getGridBounds</a>(x0, y0, x1, y1, bbox.<a class="code" href="classNLMISC_1_1CAABBox.html#z264_0">getMin</a>(), bbox.<a class="code" href="classNLMISC_1_1CAABBox.html#z264_1">getMax</a>());
+00419
+00420
+00421 <font class="comment">// run all intersected quads.</font>
+00422 <font class="keywordflow">for</font> (sint <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>= y0; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;y1; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++)
+00423 {
+00424 <font class="keywordflow">for</font> (sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>= x0; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&lt;x1; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++)
+00425 {
+00426 uint8 *quadNode= <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>];
+00427
+00428 <font class="comment">// no edgechain entry??</font>
+00429 <font class="keywordflow">if</font>(!quadNode)
+00430 <font class="keywordflow">continue</font>;
+00431
+00432 <font class="comment">// get edgechain entries</font>
+00433 sint numExteriorEdgeIndexes= *((uint16*)quadNode);
+00434 quadNode+= <font class="keyword">sizeof</font>(uint16);
+00435 uint16 *ptrExteriorEdgeIndex= (uint16*)quadNode;
+00436
+00437 <font class="comment">// For each one, add it to the result list.</font>
+00438 <font class="keywordflow">for</font> (i=0;i&lt;numExteriorEdgeIndexes;i++)
+00439 {
+00440 uint16 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> = ptrExteriorEdgeIndex[i];
+00441
+00442 <font class="comment">// if ochain not yet inserted.</font>
+00443 <font class="keywordflow">if</font> (indexLUT[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]==0xFFFF)
+00444 {
+00445 <font class="comment">// inc the list.</font>
+00446 indexLUT[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]= nRes;
+00447 cst.ExteriorEdgeIndexes.push_back(<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>);
+00448 nRes++;
+00449 }
+00450 }
+00451 }
+00452 }
+00453
+00454
+00455 <font class="comment">// reset LUT to 0xFFFF for all ochains selected.</font>
+00456 <font class="keywordflow">for</font>(i=0;i&lt;nRes;i++)
+00457 indexLUT[cst.ExteriorEdgeIndexes[i]]= 0xFFFF;
+00458
+00459 <font class="keywordflow">return</font> nRes;
+00460 }
+00461
+<a name="l00462"></a><a class="code" href="classNLPACS_1_1CEdgeQuad.html#a7">00462</a> sint CEdgeQuad::selectEdges(CVector start, CVector end, CCollisionSurfaceTemp &amp;cst)<font class="keyword"> const</font>
+00463 <font class="keyword"></font>{
+00464 sint nRes=0;
+00465 sint i;
+00466 uint16 *indexLUT= cst.OChainLUT;
+00467
+00468 <font class="comment">// start: no edge found.</font>
+00469 cst.ExteriorEdgeIndexes.clear();
+00470
+00471 <font class="keywordflow">if</font> (end.x &lt; start.x)
+00472 swap(start, end);
+00473
+00474 <font class="keywordtype">float</font> minx = <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o4">_X</a>*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>,
+00475 miny = <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o5">_Y</a>*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>,
+00476 maxx = minx + <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>,
+00477 maxy = miny + <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o3">_Height</a>*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>;
+00478
+00479 <font class="keywordflow">if</font> (start.x &gt; maxx || end.x &lt; minx || start.y &gt; maxy || end.y &lt; miny)
+00480 <font class="keywordflow">return</font> nRes;
+00481
+00482 <font class="keywordflow">if</font> (start.x &lt; minx)
+00483 {
+00484 start.y = start.y+(end.y-start.y)*(minx-start.x)/(end.x-start.x);
+00485 start.x = minx;
+00486 }
+00487
+00488 <font class="keywordflow">if</font> (start.y &lt; miny)
+00489 {
+00490 start.x = start.x+(end.x-start.x)*(miny-start.y)/(end.y-start.y);
+00491 start.y = miny;
+00492 }
+00493
+00494 <font class="keywordflow">if</font> (end.x &gt; maxx)
+00495 {
+00496 end.y = start.y+(end.y-start.y)*(minx-start.x)/(end.x-start.x);
+00497 end.x = maxx;
+00498 }
+00499
+00500 <font class="keywordflow">if</font> (end.y &gt; maxy)
+00501 {
+00502 end.x = start.x+(end.x-start.x)*(miny-start.y)/(end.y-start.y);
+00503 end.y = maxy;
+00504 }
+00505
+00506 sint32 x0, x1, ya, yb;
+00507 sint <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>;
+00508 <font class="keywordtype">float</font> fx, fxa, fxb, fya, fyb;
+00509
+00510 x0 = (sint32)floor(start.x / <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o4">_X</a>;
+00511 x1 = (sint32)ceil(end.x / <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o4">_X</a>;
+00512 fx = (x0+<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o4">_X</a>)*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>;
+00513
+00514 <font class="keywordflow">for</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>=x0; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&lt;x1; ++<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>)
+00515 {
+00516 fxa = (fx &lt; start.x) ? start.x : fx;
+00517 fxb = (fx+<a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a> &gt; end.x) ? end.x : fx+<a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>;
+00518
+00519 fya = start.y+(end.y-start.y)*(fxa-start.x)/(end.x-start.x);
+00520 fyb = start.y+(end.y-start.y)*(fxb-start.x)/(end.x-start.x);
+00521
+00522 <font class="keywordflow">if</font> (fya &gt; fyb)
+00523 swap (fya, fyb);
+00524
+00525 ya = (sint32)floor(fya / <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o5">_Y</a>;
+00526 yb = (sint32)ceil(fyb / <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o5">_Y</a>;
+00527
+00528 fx += <a class="code" href="classNLPACS_1_1CEdgeQuad.html#r0">_QuadElementSize</a>;
+00529
+00530 <font class="keywordflow">for</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>=ya; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;yb; ++<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>)
+00531 {
+00532 uint8 *quadNode= <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>];
+00533
+00534 <font class="comment">// no edgechain entry??</font>
+00535 <font class="keywordflow">if</font>(!quadNode)
+00536 <font class="keywordflow">continue</font>;
+00537
+00538 <font class="comment">// get edgechain entries</font>
+00539 sint numExteriorEdgeIndexes= *((uint16 *)quadNode);
+00540 quadNode+= <font class="keyword">sizeof</font>(uint16);
+00541 uint16 *ptrExteriorEdgeIndex = (uint16 *)quadNode;
+00542
+00543 <font class="comment">// For each one, add it to the result list.</font>
+00544 <font class="keywordflow">for</font>(i=0;i&lt;numExteriorEdgeIndexes;i++)
+00545 {
+00546 uint16 <a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a> = ptrExteriorEdgeIndex[i];
+00547
+00548 <font class="comment">// if ochain not yet inserted.</font>
+00549 <font class="keywordflow">if</font>(indexLUT[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]==0xFFFF)
+00550 {
+00551 <font class="comment">// inc the list.</font>
+00552 indexLUT[<a class="code" href="driver__opengl__extension__def_8h.html#a358">index</a>]= nRes;
+00553 cst.ExteriorEdgeIndexes.push_back(ptrExteriorEdgeIndex[i]);
+00554 nRes++;
+00555 }
+00556 }
+00557 }
+00558 }
+00559
+00560 <font class="comment">// reset LUT to 0xFFFF for all ochains selected.</font>
+00561 <font class="keywordflow">for</font>(i=0;i&lt;nRes;i++)
+00562 indexLUT[cst.ExteriorEdgeIndexes[i]]= 0xFFFF;
+00563
+00564 <font class="keywordflow">return</font> nRes;
+00565 }
+00566
+00567 <font class="comment">// ***************************************************************************</font>
+<a name="l00568"></a><a class="code" href="classNLPACS_1_1CEdgeQuad.html#a10">00568</a> <font class="keywordtype">void</font> CEdgeQuad::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f)
+00569 {
+00570 <font class="comment">/*</font>
+00571 <font class="comment"> Version 0:</font>
+00572 <font class="comment"> - base version.</font>
+00573 <font class="comment"> */</font>
+00574 (void)f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a>(0);
+00575 uint i;
+00576
+00577 <font class="comment">// serial basics.</font>
+00578 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o4">_X</a>, <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o5">_Y</a>, <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o2">_Width</a>, <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o3">_Height</a>, <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>);
+00579 f.<a class="code" href="classNLMISC_1_1IStream.html#a7">serialCont</a>(<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o1">_EdgeEntries</a>);
+00580
+00581 <font class="comment">// serial _QuadData.</font>
+00582 <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>())
+00583 {
+00584 <font class="keyword">delete</font> [] <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>;
+00585 <font class="keywordflow">if</font>(<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>&gt;0)
+00586 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>= (uint8*)<font class="keyword">new</font> uint8[<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>];
+00587 <font class="keywordflow">else</font>
+00588 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>= NULL;
+00589 }
+00590 <font class="comment">// Since we have only uint16 (see CEdgeChainEntry), serial them in a single block.</font>
+00591 uint16 *ptrQData= (uint16*)<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>;
+00592 <font class="keywordflow">for</font>(i=0;i&lt;<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o7">_QuadDataLen</a>/2; i++, ptrQData++)
+00593 {
+00594 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(*ptrQData);
+00595 }
+00596
+00597
+00598 <font class="comment">// serial _Quad.</font>
+00599 std::vector&lt;uint32&gt; offsets;
+00600 uint32 len;
+00601 uint32 val;
+00602 <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>())
+00603 {
+00604 <font class="comment">// len/resize.</font>
+00605 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(len);
+00606 offsets.resize(len);
+00607 <a class="code" href="namespaceNLMISC.html#a222">contReset</a>(<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>);
+00608 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>.resize(len);
+00609
+00610 <font class="comment">// read offsets -&gt; ptrs.</font>
+00611 <font class="keywordflow">for</font>(i=0; i&lt;len; i++)
+00612 {
+00613 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(val);
+00614 <font class="keywordflow">if</font>(val== 0xFFFFFFFF)
+00615 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>[i]= NULL;
+00616 <font class="keywordflow">else</font>
+00617 <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>[i]= <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>+val;
+00618 }
+00619 }
+00620 <font class="keywordflow">else</font>
+00621 {
+00622 <font class="comment">// len/resize.</font>
+00623 len= <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>.size();
+00624 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(len);
+00625
+00626 <font class="comment">// write offsets.</font>
+00627 <font class="keywordflow">for</font>(i=0; i&lt;len; i++)
+00628 {
+00629 uint8 *ptr= <a class="code" href="classNLPACS_1_1CEdgeQuad.html#o0">_Quad</a>[i];
+00630 <font class="keywordflow">if</font>(ptr==NULL)
+00631 val= 0xFFFFFFFF;
+00632 <font class="keywordflow">else</font>
+00633 val= (uint32)(ptr-<a class="code" href="classNLPACS_1_1CEdgeQuad.html#o6">_QuadData</a>);
+00634 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(val);
+00635 }
+00636 }
+00637
+00638 }
+00639
+00640
+00641
+00642 } <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>