aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/pacs_2quad__grid_8h-source.html
blob: 4e665cb53c3050fb7b02eca37073c35b2aaf75b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
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="/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="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/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="/inc/img/black_banner.jpg"><A HREF=""><IMG  SRC="/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="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="/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="/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

	</TD>
	<TD WIDTH=15><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
	<TD ALIGN=left valign=top><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

<!-- title -->
<TABLE  background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="/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="/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:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </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 &lt;list&gt;</font>
00034 <font class="preprocessor">#include &lt;vector&gt;</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>&lt;<font class="keyword">class</font> T&gt;       <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>&amp; 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> &amp;bboxmin, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;bboxmax, <font class="keyword">const</font> T &amp;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> &amp;bboxmin, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;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&lt;CNode*&gt;</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&lt;CQuadNode&gt;  <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 &amp;x0, sint &amp;x1, sint &amp;y0, sint &amp;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&gt;=<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&amp;= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1;
00225                         x1&amp;= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1;
00226                         <font class="keywordflow">if</font>(x1&lt;=x0)
00227                                 x1+=<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>;
00228                 }
00229                 <font class="keywordflow">if</font>(y1-y0&gt;=<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&amp;= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1;
00234                         y1&amp;= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1;
00235                         <font class="keywordflow">if</font>(y1&lt;=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-&gt;Prev==NULL)
00244                 {
00245                         <font class="comment">// Append to front of the list.</font>
00246                         ptr-&gt;Prev= &amp;_Selection;
00247                         ptr-&gt;Next= _Selection.Next;
00248                         <font class="keywordflow">if</font>(_Selection.Next)
00249                                 _Selection.Next-&gt;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        &amp;quad)
00256         {
00257                 <a class="code" href="classstd_1_1list.html">std::list&lt;CNode*&gt;</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>&amp; <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&amp;        <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>-&gt;Elt; }
00276                 <font class="comment">// Doesn't work...</font>
00277                 <font class="comment">/*const T*      operator-&gt;() const</font>
00278 <font class="comment">                        {return (&amp;**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>&amp; <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>-&gt;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>&amp; <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>-&gt;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>&amp; <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>&amp; <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&lt;T&gt;;
<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&amp;      <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>-&gt;Elt; }
00305                 <font class="comment">// Doesn't work...</font>
00306                 <font class="comment">/*T*    operator-&gt;() const</font>
00307 <font class="comment">                        {return (&amp;**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>&amp; <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>-&gt;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>&amp; <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>-&gt;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>&amp; <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>&amp; <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&lt;T&gt;;
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>&lt;<font class="keyword">class</font> T&gt;       CQuadGrid&lt;T&gt;::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&lt;&lt;<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>&lt;<font class="keyword">class</font> T&gt;       CQuadGrid&lt;T&gt;::~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>&lt;<font class="keyword">class</font> T&gt;       <font class="keywordtype">void</font>            CQuadGrid&lt;T&gt;::changeBase(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a>&amp; 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>&lt;<font class="keyword">class</font> T&gt;       <font class="keywordtype">void</font>            CQuadGrid&lt;T&gt;::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&lt;=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&lt;&lt;<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&gt;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>&lt;<font class="keyword">class</font> T&gt;       <font class="keywordtype">void</font>            CQuadGrid&lt;T&gt;::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>&lt;<font class="keyword">class</font> T&gt;       CQuadGrid&lt;T&gt;::CIterator CQuadGrid&lt;T&gt;::erase(CQuadGrid&lt;T&gt;::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-&gt;y0;<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;ptr-&gt;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> &amp;(<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-&gt;x0;<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&lt;ptr-&gt;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> &amp;(<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1);
00414                         CQuadNode       &amp;quad= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o0">_Grid</a>[(ye&lt;&lt;<a class="code" href="classNLPACS_1_1CQuadGrid.html#o2">_SizePower</a>)+xe];
00415                         <a class="code" href="classstd_1_1list.html">std::list&lt;CNode*&gt;</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-&gt;Prev)
00432         {
00433                 next= ptr-&gt;Next;
00434                 <font class="keywordflow">if</font>(next)
00435                         next-&gt;Prev=ptr-&gt;Prev;
00436                 ptr-&gt;Prev-&gt;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>&lt;<font class="keyword">class</font> T&gt;       CQuadGrid&lt;T&gt;::CIterator CQuadGrid&lt;T&gt;::insert(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;bboxmin, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;bboxmax, <font class="keyword">const</font> T &amp;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-&gt;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-&gt;x0= x0;
00460         ptr-&gt;x1= x1;
00461         ptr-&gt;y0= y0;
00462         ptr-&gt;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-&gt;y0;<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;ptr-&gt;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> &amp;(<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-&gt;x0;<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&lt;ptr-&gt;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> &amp;(<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1);
00474                         CQuadNode       &amp;quad= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o0">_Grid</a>[(ye&lt;&lt;<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>&lt;<font class="keyword">class</font> T&gt;       <font class="keywordtype">void</font>                    CQuadGrid&lt;T&gt;::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-&gt;Prev= NULL;
00495                 CBaseNode       *next= ptr-&gt;Next;
00496                 ptr-&gt;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>&lt;<font class="keyword">class</font> T&gt;       <font class="keywordtype">void</font>                    CQuadGrid&lt;T&gt;::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&lt;(sint)<a class="code" href="classNLPACS_1_1CQuadGrid.html#o0">_Grid</a>.size();i++)
00507         {
00508                 CQuadNode       &amp;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>&lt;<font class="keyword">class</font> T&gt;       <font class="keywordtype">void</font>                    CQuadGrid&lt;T&gt;::select(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;bboxmin, <font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &amp;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>&lt;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> &amp;(<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>&lt;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> &amp;(<a class="code" href="classNLPACS_1_1CQuadGrid.html#o1">_Size</a>-1);
00534                         CQuadNode       &amp;quad= <a class="code" href="classNLPACS_1_1CQuadGrid.html#o0">_Grid</a>[(ye&lt;&lt;<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>&lt;<font class="keyword">class</font> T&gt;       CQuadGrid&lt;T&gt;::CIterator         CQuadGrid&lt;T&gt;::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>&lt;<font class="keyword">class</font> T&gt;       CQuadGrid&lt;T&gt;::CIterator         CQuadGrid&lt;T&gt;::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>&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=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>