diff options
Diffstat (limited to 'docs/doxygen/nel/pacs_2quad__grid_8h-source.html')
-rw-r--r-- | docs/doxygen/nel/pacs_2quad__grid_8h-source.html | 554 |
1 files changed, 554 insertions, 0 deletions
diff --git a/docs/doxygen/nel/pacs_2quad__grid_8h-source.html b/docs/doxygen/nel/pacs_2quad__grid_8h-source.html new file mode 100644 index 00000000..fc6ffc3d --- /dev/null +++ b/docs/doxygen/nel/pacs_2quad__grid_8h-source.html @@ -0,0 +1,554 @@ +<!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>quad_grid.h</h1><a href="pacs_2quad__grid_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 +00007 <font class="comment">/* Copyright, 2000 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">#ifndef NL_QUAD_GRID_PACS_H</font> +00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_QUAD_GRID_PACS_H</font> +00028 <font class="preprocessor"></font> +00029 <font class="preprocessor">#include "<a class="code" href="debug_8h.html">nel/misc/debug.h</a>"</font> +00030 <font class="preprocessor">#include "<a class="code" href="vector_8h.html">nel/misc/vector.h</a>"</font> +00031 <font class="preprocessor">#include "<a class="code" href="plane_8h.html">nel/misc/plane.h</a>"</font> +00032 <font class="preprocessor">#include "<a class="code" href="matrix_8h.html">nel/misc/matrix.h</a>"</font> +00033 <font class="preprocessor">#include <list></font> +00034 <font class="preprocessor">#include <vector></font> +00035 +00036 +00037 <font class="keyword">namespace </font>NLPACS +00038 { +00039 +00040 +00041 <font class="keyword">using</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>; +00042 +00043 +00044 <font class="comment">// ***************************************************************************</font> +<a name="l00064"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html">00064</a> <font class="comment"></font><font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keyword">class </font>CQuadGrid +00065 { +00066 <font class="keyword">public</font>: +00068 <font class="keyword">class </font><a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a>; +<a name="l00069"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">00069</a> <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a>; +00070 +00071 <font class="keyword">public</font>: +00072 +00074 <a class="code" href="classNLPACS_1_1CQuadGrid.html#a0">CQuadGrid</a>(); +00075 +00077 <a class="code" href="classNLPACS_1_1CQuadGrid.html#a1">~CQuadGrid</a>(); +00078 +00080 +00081 +00096 <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#z948_0">changeBase</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a>& base); +00097 +00104 <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#z948_1">create</a>(uint size, <font class="keywordtype">float</font> eltSize); +00106 +00108 +00109 +00110 <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#z949_0">clear</a>(); +00111 +00118 <a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a> <a class="code" href="classNLPACS_1_1CQuadGrid.html#z949_1">erase</a>(<a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a> it); +00119 +00126 <a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a> <a class="code" href="classNLPACS_1_1CQuadGrid.html#z949_2">insert</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &bboxmin, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &bboxmax, <font class="keyword">const</font> T &val); +00128 +00129 +00131 +00132 +00134 <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_0">clearSelection</a>(); +00135 +00138 <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_1">selectAll</a>(); +00139 +00145 <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_2">select</a>(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &bboxmin, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &bboxmax); +00146 +00147 +00150 <a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a> <a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_3">begin</a>(); +00151 +00154 <a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a> <a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_4">end</a>(); +00156 +00157 +00158 <font class="comment">// =================</font> +00159 <font class="comment">// =================</font> +00160 <font class="comment">// IMPLEMENTATION.</font> +00161 <font class="comment">// =================</font> +00162 <font class="comment">// =================</font> +00163 <font class="keyword">private</font>:<font class="comment">// Classes.</font> +00164 +<a name="l00165"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CBaseNode.html">00165</a> <font class="keyword">class </font>CBaseNode +00166 { +00167 <font class="keyword">public</font>: +<a name="l00168"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CBaseNode.html#m0">00168</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CBaseNode.html#a0">CBaseNode</a> *<a class="code" href="classNLPACS_1_1CQuadGrid_1_1CBaseNode.html#m0">Prev</a>,*<a class="code" href="classNLPACS_1_1CQuadGrid_1_1CBaseNode.html#m1">Next</a>; <font class="comment">// For selection.</font> +<a name="l00169"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CBaseNode.html#a0">00169</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CBaseNode.html#a0">CBaseNode</a>() {Prev= Next= NULL;} +00170 }; +00171 +<a name="l00172"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CNode.html">00172</a> <font class="keyword">class </font>CNode : <font class="keyword">public</font> CBaseNode +00173 { +00174 <font class="keyword">public</font>: +<a name="l00175"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CNode.html#m0">00175</a> T <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CNode.html#m0">Elt</a>; +<a name="l00176"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CNode.html#m2">00176</a> uint16 <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CNode.html#m1">x0</a>,<a class="code" href="classNLPACS_1_1CQuadGrid_1_1CNode.html#m2">x1</a>; <font class="comment">// The location of the elt in the grid. Used for erase().</font> +<a name="l00177"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CNode.html#m4">00177</a> uint16 <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CNode.html#m3">y0</a>,<a class="code" href="classNLPACS_1_1CQuadGrid_1_1CNode.html#m4">y1</a>; +00178 }; +00179 +<a name="l00180"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CQuadNode.html">00180</a> <font class="keyword">class </font>CQuadNode +00181 { +00182 <font class="keyword">public</font>: +<a name="l00183"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CQuadNode.html#m0">00183</a> <a class="code" href="classstd_1_1list.html">std::list<CNode*></a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CQuadNode.html#m0">Nodes</a>; +00184 }; +00185 +00186 <font class="keyword">private</font>:<font class="comment">// Atttributes.</font> +<a name="l00187"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#o0">00187</a> std::vector<CQuadNode> <a class="code" href="classNLPACS_1_1CQuadGrid.html#o0">_Grid</a>; +<a name="l00188"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">00188</a> sint <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>; +<a name="l00189"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#o2">00189</a> sint <a class="code" href="classNLPACS_1_1CQuadGrid.html#o2">_SizePower</a>; +<a name="l00190"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#o3">00190</a> <font class="keywordtype">float</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#o3">_EltSize</a>; +<a name="l00191"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#o4">00191</a> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> <a class="code" href="classNLPACS_1_1CQuadGrid.html#o4">_ChangeBasis</a>; +00192 <font class="comment">// Selection.</font> +<a name="l00193"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#o5">00193</a> CBaseNode <a class="code" href="classNLPACS_1_1CQuadGrid.html#o5">_Selection</a>; +00194 +00195 +00196 <font class="keyword">private</font>:<font class="comment">// Methods.</font> +00197 +00198 <font class="comment">// return the coordinates on the grid of what include the bbox.</font> +<a name="l00199"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#c0">00199</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#c0">selectQuads</a>(CVector bmin, CVector bmax, sint &x0, sint &x1, sint &y0, sint &y1) +00200 { +00201 CVector bminp, bmaxp; +00202 bminp= bmin; +00203 bmaxp= bmax; +00204 bmin.minof(bminp, bmaxp); +00205 bmax.maxof(bminp, bmaxp); +00206 bmin/= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o3">_EltSize</a>; +00207 bmax/= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o3">_EltSize</a>; +00208 x0= (sint)(floor(bmin.x)); +00209 x1= (sint)(ceil(bmax.x)); +00210 y0= (sint)(floor(bmin.y)); +00211 y1= (sint)(ceil(bmax.y)); +00212 +00213 <font class="comment">// Very special case where the bbox.size==0 AND position is JUST on an edge of a case.</font> +00214 <font class="keywordflow">if</font>(x0==x1) +00215 x1++; +00216 <font class="keywordflow">if</font>(y0==y1) +00217 y1++; +00218 +00219 <font class="comment">// Manage tiling.</font> +00220 <font class="keywordflow">if</font>(x1-x0>=<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>) +00221 x0=0, x1= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>; +00222 <font class="keywordflow">else</font> +00223 { +00224 x0&= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1; +00225 x1&= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1; +00226 <font class="keywordflow">if</font>(x1<=x0) +00227 x1+=<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>; +00228 } +00229 <font class="keywordflow">if</font>(y1-y0>=<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>) +00230 y0=0, y1= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>; +00231 <font class="keywordflow">else</font> +00232 { +00233 y0&= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1; +00234 y1&= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1; +00235 <font class="keywordflow">if</font>(y1<=y0) +00236 y1+=<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>; +00237 } +00238 } +00239 +00240 <font class="comment">// If not done, add the node to the selection.</font> +<a name="l00241"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#c1">00241</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#c1">addToSelection</a>(CNode *ptr) +00242 { +00243 <font class="keywordflow">if</font>(ptr->Prev==NULL) +00244 { +00245 <font class="comment">// Append to front of the list.</font> +00246 ptr->Prev= &_Selection; +00247 ptr->Next= _Selection.Next; +00248 <font class="keywordflow">if</font>(_Selection.Next) +00249 _Selection.Next->Prev= ptr; +00250 _Selection.Next= ptr; +00251 } +00252 } +00253 +00254 <font class="comment">// Try to add each node of the quad node list.</font> +<a name="l00255"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#c2">00255</a> <font class="keywordtype">void</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#c2">addQuadNodeToSelection</a>(CQuadNode &quad) +00256 { +00257 <a class="code" href="classstd_1_1list.html">std::list<CNode*></a>::iterator itNode; +00258 <font class="keywordflow">for</font>(itNode= quad.Nodes.begin();itNode!=quad.Nodes.end();itNode++) +00259 { +00260 <a class="code" href="classNLPACS_1_1CQuadGrid.html#c1">addToSelection</a>(*itNode); +00261 } +00262 } +00263 +00264 +00265 <font class="keyword">public</font>: +00266 <font class="comment">// CLASS const_iterator.</font> +<a name="l00267"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html">00267</a> <font class="keyword">class </font>const_iterator +00268 { +00269 <font class="keyword">public</font>: +<a name="l00270"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">00270</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a>() {<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a>=NULL;} +<a name="l00271"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a1">00271</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a>(CNode *p) : <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a>(p) {} +<a name="l00272"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a2">00272</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a>(<font class="keyword">const</font> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#l1">CIterator</a>& <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>) : <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a>(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>.<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a>) {} +00273 +<a name="l00274"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a3">00274</a> <font class="keyword">const</font> T& <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a3">operator*</a>()<font class="keyword"> const</font> +00275 <font class="keyword"> </font>{<font class="keywordflow">return</font> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a>->Elt; } +00276 <font class="comment">// Doesn't work...</font> +00277 <font class="comment">/*const T* operator->() const</font> +00278 <font class="comment"> {return (&**this); }*/</font> +<a name="l00279"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a4">00279</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a>& <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a4">operator++</a>() +00280 {<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a> = (CNode*)(<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a>->Next); <font class="keywordflow">return</font> (*this); } +<a name="l00281"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a5">00281</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a4">operator++</a>(<font class="keywordtype">int</font>) +00282 {<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a> tmp = *<font class="keyword">this</font>; ++*<font class="keyword">this</font>; <font class="keywordflow">return</font> (tmp); } +<a name="l00283"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a6">00283</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a>& <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a6">operator--</a>() +00284 {<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a> = (CNode*)(<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a>->Prev); <font class="keywordflow">return</font> (*this); } +<a name="l00285"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a7">00285</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a6">operator--</a>(<font class="keywordtype">int</font>) +00286 {<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a> tmp = *<font class="keyword">this</font>; --*<font class="keyword">this</font>; <font class="keywordflow">return</font> (tmp); } +<a name="l00287"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a8">00287</a> <font class="keywordtype">bool</font> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a8">operator==</a>(<font class="keyword">const</font> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a>& <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>)<font class="keyword"> const</font> +00288 <font class="keyword"> </font>{<font class="keywordflow">return</font> (<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a> == x._Ptr); } +<a name="l00289"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a9">00289</a> <font class="keywordtype">bool</font> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a9">operator!=</a>(<font class="keyword">const</font> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a>& <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>)<font class="keyword"> const</font> +00290 <font class="keyword"> </font>{<font class="keywordflow">return</font> (!(*<font class="keyword">this</font> == x)); } +00291 <font class="keyword">protected</font>: +<a name="l00292"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">00292</a> CNode *<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a>; +<a name="l00293"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#l0">00293</a> <font class="keyword">friend</font> <font class="keyword">class </font>CQuadGrid<T>; +<a name="l00294"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#l1">00294</a> <font class="keyword">friend</font> <font class="keyword">class </font><a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#l1">CIterator</a>; +00295 }; +00296 +00297 <font class="comment">// CLASS CIterator</font> +<a name="l00298"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html">00298</a> <font class="keyword">class </font><a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a> : <font class="keyword">public</font> const_iterator +00299 { +00300 <font class="keyword">public</font>: +<a name="l00301"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a0">00301</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a0">CIterator</a>() {<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a>=NULL;} +<a name="l00302"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a1">00302</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a0">CIterator</a>(CNode *p) : <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a>(p) {} +<a name="l00303"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a2">00303</a> T& <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a2">operator*</a>()<font class="keyword"> const</font> +00304 <font class="keyword"> </font>{<font class="keywordflow">return</font> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a>->Elt; } +00305 <font class="comment">// Doesn't work...</font> +00306 <font class="comment">/*T* operator->() const</font> +00307 <font class="comment"> {return (&**this); }*/</font> +<a name="l00308"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a3">00308</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a0">CIterator</a>& <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a3">operator++</a>() +00309 {<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a> = (CNode*)(<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a>->Next); <font class="keywordflow">return</font> (*this); } +<a name="l00310"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a4">00310</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a0">CIterator</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a3">operator++</a>(<font class="keywordtype">int</font>) +00311 {<a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a0">CIterator</a> tmp = *<font class="keyword">this</font>; ++*<font class="keyword">this</font>; <font class="keywordflow">return</font> (tmp); } +<a name="l00312"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a5">00312</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a0">CIterator</a>& <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a5">operator--</a>() +00313 {<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a> = (CNode*)(<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a>->Prev); <font class="keywordflow">return</font> (*this); } +<a name="l00314"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a6">00314</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a0">CIterator</a> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a5">operator--</a>(<font class="keywordtype">int</font>) +00315 {<a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a0">CIterator</a> tmp = *<font class="keyword">this</font>; --*<font class="keyword">this</font>; <font class="keywordflow">return</font> (tmp); } +<a name="l00316"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a7">00316</a> <font class="keywordtype">bool</font> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a7">operator==</a>(<font class="keyword">const</font> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a>& <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>)<font class="keyword"> const</font> +00317 <font class="keyword"> </font>{<font class="keywordflow">return</font> (<a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#n0">_Ptr</a> == x._Ptr); } +<a name="l00318"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a8">00318</a> <font class="keywordtype">bool</font> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#a8">operator!=</a>(<font class="keyword">const</font> <a class="code" href="classNLPACS_1_1CQuadGrid_1_1const__iterator.html#a0">const_iterator</a>& <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>)<font class="keyword"> const</font> +00319 <font class="keyword"> </font>{<font class="keywordflow">return</font> (!(*<font class="keyword">this</font> == x)); } +00320 <font class="keyword">protected</font>: +<a name="l00321"></a><a class="code" href="classNLPACS_1_1CQuadGrid_1_1CIterator.html#l0">00321</a> <font class="keyword">friend</font> <font class="keyword">class </font>CQuadGrid<T>; +00322 }; +00323 +00324 +00325 }; +00326 +00327 +00328 <font class="comment">// ***************************************************************************</font> +00329 <font class="comment">// ***************************************************************************</font> +00330 <font class="comment">// ***************************************************************************</font> +00331 <font class="comment">// ***************************************************************************</font> +00332 <font class="comment">// Template CQuadGrid implementation.</font> +00333 <font class="comment">// ***************************************************************************</font> +00334 <font class="comment">// ***************************************************************************</font> +00335 <font class="comment">// ***************************************************************************</font> +00336 <font class="comment">// ***************************************************************************</font> +00337 +00338 +00339 <font class="comment">// ***************************************************************************</font> +00340 <font class="comment">// Init.</font> +00341 <font class="comment">// ***************************************************************************</font> +00342 +00343 +00344 <font class="comment">// ***************************************************************************</font> +<a name="l00345"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#a0">00345</a> <font class="keyword">template</font><<font class="keyword">class</font> T> CQuadGrid<T>::CQuadGrid() +00346 { +00347 <a class="code" href="classNLPACS_1_1CQuadGrid.html#o2">_SizePower</a>=4; +00348 <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>=1<<<a class="code" href="classNLPACS_1_1CQuadGrid.html#o2">_SizePower</a>; +00349 <a class="code" href="classNLPACS_1_1CQuadGrid.html#o3">_EltSize</a>=1; +00350 <a class="code" href="classNLPACS_1_1CQuadGrid.html#o4">_ChangeBasis</a>.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_0">identity</a>(); +00351 } +00352 <font class="comment">// ***************************************************************************</font> +<a name="l00353"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#a1">00353</a> <font class="keyword">template</font><<font class="keyword">class</font> T> CQuadGrid<T>::~CQuadGrid() +00354 { +00355 <a class="code" href="classNLPACS_1_1CQuadGrid.html#z949_0">clear</a>(); +00356 } +00357 <font class="comment">// ***************************************************************************</font> +<a name="l00358"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#z948_0">00358</a> <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keywordtype">void</font> CQuadGrid<T>::changeBase(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a>& base) +00359 { +00360 <a class="code" href="classNLPACS_1_1CQuadGrid.html#o4">_ChangeBasis</a>= base; +00361 } +00362 <font class="comment">// ***************************************************************************</font> +<a name="l00363"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#z948_1">00363</a> <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keywordtype">void</font> CQuadGrid<T>::create(uint size, <font class="keywordtype">float</font> eltSize) +00364 { +00365 <a class="code" href="classNLPACS_1_1CQuadGrid.html#z949_0">clear</a>(); +00366 +00367 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="namespaceNLMISC.html#a225">isPowerOf2</a>(size)); +00368 <a class="code" href="debug_8h.html#a6">nlassert</a>(size<=32768); +00369 <a class="code" href="classNLPACS_1_1CQuadGrid.html#o2">_SizePower</a>= <a class="code" href="namespaceNLMISC.html#a224">getPowerOf2</a>(size); +00370 <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>=1<<<a class="code" href="classNLPACS_1_1CQuadGrid.html#o2">_SizePower</a>; +00371 <a class="code" href="classNLPACS_1_1CQuadGrid.html#o0">_Grid</a>.resize(<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>*<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>); +00372 +00373 <a class="code" href="debug_8h.html#a6">nlassert</a>(eltSize>0); +00374 <a class="code" href="classNLPACS_1_1CQuadGrid.html#o3">_EltSize</a>= eltSize; +00375 } +00376 +00377 +00378 <font class="comment">// ***************************************************************************</font> +00379 <font class="comment">// insert/erase.</font> +00380 <font class="comment">// ***************************************************************************</font> +00381 +00382 +00383 <font class="comment">// ***************************************************************************</font> +<a name="l00384"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#z949_0">00384</a> <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keywordtype">void</font> CQuadGrid<T>::clear() +00385 { +00386 <a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a> it; +00387 <a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_1">selectAll</a>(); +00388 <font class="keywordflow">while</font>( (it=<a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_3">begin</a>())!=<a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_4">end</a>()) +00389 { +00390 <a class="code" href="classNLPACS_1_1CQuadGrid.html#z949_1">erase</a>(it); +00391 } +00392 +00393 <font class="comment">// Clear the selection...</font> +00394 <a class="code" href="classNLPACS_1_1CQuadGrid.html#o5">_Selection</a>.<a class="code" href="classNLPACS_1_1CQuadGrid_1_1CBaseNode.html#m1">Next</a>= NULL; +00395 } +00396 <font class="comment">// ***************************************************************************</font> +<a name="l00397"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#z949_1">00397</a> <font class="keyword">template</font><<font class="keyword">class</font> T> CQuadGrid<T>::CIterator CQuadGrid<T>::erase(CQuadGrid<T>::CIterator it) +00398 { +00399 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>; +00400 CNode *ptr= it._Ptr; +00401 +00402 <font class="keywordflow">if</font>(!ptr) +00403 <font class="keywordflow">return</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_4">end</a>(); +00404 +00405 <font class="comment">// First erase all references to it.</font> +00406 <font class="comment">//==================================</font> +00407 <font class="keywordflow">for</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>= ptr->y0;<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a><ptr->y1;<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++) +00408 { +00409 sint xe,ye; +00410 ye= <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a> &(<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1); +00411 <font class="keywordflow">for</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>= ptr->x0;<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a><ptr->x1;<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++) +00412 { +00413 xe= <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> &(<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1); +00414 CQuadNode &quad= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o0">_Grid</a>[(ye<<<a class="code" href="classNLPACS_1_1CQuadGrid.html#o2">_SizePower</a>)+xe]; +00415 <a class="code" href="classstd_1_1list.html">std::list<CNode*></a>::iterator itNode; +00416 <font class="keywordflow">for</font>(itNode= quad.Nodes.begin();itNode!=quad.Nodes.end();itNode++) +00417 { +00418 <font class="keywordflow">if</font>((*itNode)==ptr) +00419 { +00420 quad.Nodes.erase(itNode); +00421 <font class="keywordflow">break</font>; +00422 } +00423 } +00424 } +00425 } +00426 +00427 <font class="comment">// Then delete it..., and update selection linked list.</font> +00428 <font class="comment">//=====================================================</font> +00429 <font class="comment">// if selected.</font> +00430 CBaseNode *next= NULL; +00431 <font class="keywordflow">if</font>(ptr->Prev) +00432 { +00433 next= ptr->Next; +00434 <font class="keywordflow">if</font>(next) +00435 next->Prev=ptr->Prev; +00436 ptr->Prev->Next= next; +00437 } +00438 <font class="keyword">delete</font> ptr; +00439 +00440 +00441 <font class="keywordflow">return</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a>((CNode*)next); +00442 } +00443 <font class="comment">// ***************************************************************************</font> +<a name="l00444"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#z949_2">00444</a> <font class="keyword">template</font><<font class="keyword">class</font> T> CQuadGrid<T>::CIterator CQuadGrid<T>::insert(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &bboxmin, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &bboxmax, <font class="keyword">const</font> T &val) +00445 { +00446 CVector bmin,bmax; +00447 bmin= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o4">_ChangeBasis</a>*bboxmin; +00448 bmax= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o4">_ChangeBasis</a>*bboxmax; +00449 +00450 CNode *ptr= <font class="keyword">new</font> CNode; +00451 ptr->Elt= val; +00452 +00453 <font class="comment">// Find which quad include the object.</font> +00454 <font class="comment">//===================================</font> +00455 sint x0,y0; +00456 sint x1,y1; +00457 <a class="code" href="classNLPACS_1_1CQuadGrid.html#c0">selectQuads</a>(bmin, bmax, x0,x1, y0,y1); +00458 +00459 ptr->x0= x0; +00460 ptr->x1= x1; +00461 ptr->y0= y0; +00462 ptr->y1= y1; +00463 +00464 <font class="comment">// Then for all of them, insert the node in their list.</font> +00465 <font class="comment">//=====================================================</font> +00466 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>; +00467 <font class="keywordflow">for</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>= ptr->y0;<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a><ptr->y1;<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++) +00468 { +00469 sint xe,ye; +00470 ye= <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a> &(<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1); +00471 <font class="keywordflow">for</font>(<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>= ptr->x0;<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a><ptr->x1;<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++) +00472 { +00473 xe= <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> &(<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1); +00474 CQuadNode &quad= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o0">_Grid</a>[(ye<<<a class="code" href="classNLPACS_1_1CQuadGrid.html#o2">_SizePower</a>)+xe]; +00475 quad.Nodes.push_back(ptr); +00476 } +00477 } +00478 +00479 <font class="keywordflow">return</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a>(ptr); +00480 } +00481 +00482 +00483 <font class="comment">// ***************************************************************************</font> +00484 <font class="comment">// selection.</font> +00485 <font class="comment">// ***************************************************************************</font> +00486 +00487 +00488 <font class="comment">// ***************************************************************************</font> +<a name="l00489"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_0">00489</a> <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keywordtype">void</font> CQuadGrid<T>::clearSelection() +00490 { +00491 CBaseNode *ptr= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o5">_Selection</a>.<a class="code" href="classNLPACS_1_1CQuadGrid_1_1CBaseNode.html#m1">Next</a>; +00492 <font class="keywordflow">while</font>(ptr) +00493 { +00494 ptr->Prev= NULL; +00495 CBaseNode *next= ptr->Next; +00496 ptr->Next= NULL; +00497 ptr= next; +00498 } +00499 +00500 <a class="code" href="classNLPACS_1_1CQuadGrid.html#o5">_Selection</a>.<a class="code" href="classNLPACS_1_1CQuadGrid_1_1CBaseNode.html#m1">Next</a>= NULL; +00501 } +00502 <font class="comment">// ***************************************************************************</font> +<a name="l00503"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_1">00503</a> <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keywordtype">void</font> CQuadGrid<T>::selectAll() +00504 { +00505 <a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_0">clearSelection</a>(); +00506 <font class="keywordflow">for</font>(sint i=0;i<(sint)<a class="code" href="classNLPACS_1_1CQuadGrid.html#o0">_Grid</a>.size();i++) +00507 { +00508 CQuadNode &quad= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o0">_Grid</a>[i]; +00509 <a class="code" href="classNLPACS_1_1CQuadGrid.html#c2">addQuadNodeToSelection</a>(quad); +00510 } +00511 } +00512 <font class="comment">// ***************************************************************************</font> +<a name="l00513"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_2">00513</a> <font class="keyword">template</font><<font class="keyword">class</font> T> <font class="keywordtype">void</font> CQuadGrid<T>::select(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &bboxmin, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &bboxmax) +00514 { +00515 CVector bmin,bmax; +00516 bmin= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o4">_ChangeBasis</a>*bboxmin; +00517 bmax= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o4">_ChangeBasis</a>*bboxmax; +00518 +00519 <a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_0">clearSelection</a>(); +00520 +00521 <font class="comment">// What are the quads to access?</font> +00522 sint x0,y0; +00523 sint x1,y1; +00524 <a class="code" href="classNLPACS_1_1CQuadGrid.html#c0">selectQuads</a>(bmin, bmax, x0,x1, y0,y1); +00525 +00526 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>; +00527 <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><y1;<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++) +00528 { +00529 sint xe,ye; +00530 ye= <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a> &(<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1); +00531 <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><x1;<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++) +00532 { +00533 xe= <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> &(<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1); +00534 CQuadNode &quad= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o0">_Grid</a>[(ye<<<a class="code" href="classNLPACS_1_1CQuadGrid.html#o2">_SizePower</a>)+xe]; +00535 <a class="code" href="classNLPACS_1_1CQuadGrid.html#c2">addQuadNodeToSelection</a>(quad); +00536 } +00537 } +00538 +00539 } +00540 <font class="comment">// ***************************************************************************</font> +<a name="l00541"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_3">00541</a> <font class="keyword">template</font><<font class="keyword">class</font> T> CQuadGrid<T>::CIterator CQuadGrid<T>::begin() +00542 { +00543 <font class="keywordflow">return</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a>((CNode*)(<a class="code" href="classNLPACS_1_1CQuadGrid.html#o5">_Selection</a>.<a class="code" href="classNLPACS_1_1CQuadGrid_1_1CBaseNode.html#m1">Next</a>)); +00544 } +00545 <font class="comment">// ***************************************************************************</font> +<a name="l00546"></a><a class="code" href="classNLPACS_1_1CQuadGrid.html#z950_4">00546</a> <font class="keyword">template</font><<font class="keyword">class</font> T> CQuadGrid<T>::CIterator CQuadGrid<T>::end() +00547 { +00548 <font class="keywordflow">return</font> <a class="code" href="classNLPACS_1_1CQuadGrid.html#l0">CIterator</a>(NULL); +00549 } +00550 +00551 +00552 } <font class="comment">// NLPACS</font> +00553 +00554 +00555 <font class="preprocessor">#endif // NL_QUAD_GRID_H</font> +00556 <font class="preprocessor"></font> +00557 <font class="comment">/* End of quad_grid.h */</font> +</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> |