aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/chain__quad_8cpp-source.html
blob: 90419d741532c001b2e1b7a0223b082ac67f646e (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
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
<!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>chain_quad.cpp</h1><a href="chain__quad_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2001 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025 
00026 <font class="preprocessor">#include "<a class="code" href="stdpacs_8h.html">stdpacs.h</a>"</font>
00027 
00028 <font class="preprocessor">#include "<a class="code" href="chain__quad_8h.html">pacs/chain_quad.h</a>"</font>
00029 
00030 <font class="keyword">using</font>   <font class="keyword">namespace </font>std;
00031 <font class="keyword">using</font>   <font class="keyword">namespace </font>NLMISC;
00032 
00033 
00034 <font class="keyword">namespace </font>NLPACS
00035 {
00036 
00037 
00038 <font class="comment">// ***************************************************************************</font>
<a name="l00039"></a><a class="code" href="classNLPACS_1_1CChainQuad.html#r0">00039</a> <font class="keyword">const</font>   <font class="keywordtype">float</font>   CChainQuad::_QuadElementSize= 4;        <font class="comment">// = 4 meters.</font>
00040 
00041 
00042 <font class="comment">// ***************************************************************************</font>
<a name="l00043"></a><a class="code" href="classNLPACS_1_1CChainQuad.html#a0">00043</a> CChainQuad::CChainQuad()
00044 {
00045         <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>= NULL;
00046         <a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>= 0;
00047 }
00048 <font class="comment">// ***************************************************************************</font>
<a name="l00049"></a><a class="code" href="classNLPACS_1_1CChainQuad.html#a2">00049</a> CChainQuad::~CChainQuad()
00050 {
00051         <font class="keyword">delete</font> [] <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>;
00052         <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>= NULL;
00053         <a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>= 0;
00054 }
00055 <font class="comment">// ***************************************************************************</font>
<a name="l00056"></a><a class="code" href="classNLPACS_1_1CChainQuad.html#a1">00056</a> CChainQuad::CChainQuad(<font class="keyword">const</font> CChainQuad &amp;o)
00057 {
00058         <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>= NULL;
00059         <a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>= 0;
00060         *<font class="keyword">this</font>= o;
00061 }
00062 <font class="comment">// ***************************************************************************</font>
<a name="l00063"></a><a class="code" href="classNLPACS_1_1CChainQuad.html#a3">00063</a> CChainQuad      &amp;CChainQuad::operator=(<font class="keyword">const</font> CChainQuad &amp;o)
00064 {
00065         <font class="comment">// Alloc good quaddata.</font>
00066         <a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>= o._QuadDataLen;
00067         <font class="keyword">delete</font> [] <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>;
00068         <font class="keywordflow">if</font>(<a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>&gt;0)
00069         {
00070                 <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>= (uint8*)<font class="keyword">new</font> uint8[<a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>];
00071                 <font class="comment">// copy contents.</font>
00072                 memcpy(<a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>, o._QuadData, <a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>);
00073         }
00074         <font class="keywordflow">else</font>
00075                 <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>= NULL;
00076 
00077         <font class="comment">// copy infos.</font>
00078         <a class="code" href="classNLPACS_1_1CChainQuad.html#o1">_Width</a>= o._Width;
00079         <a class="code" href="classNLPACS_1_1CChainQuad.html#o2">_Height</a>= o._Height;
00080         <a class="code" href="classNLPACS_1_1CChainQuad.html#o3">_X</a>= o._X;
00081         <a class="code" href="classNLPACS_1_1CChainQuad.html#o4">_Y</a>= o._Y;
00082 
00083         <font class="comment">// copy good pointers.</font>
00084         <a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>.clear();
00085         <a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>.resize(o._Quad.size(), NULL);
00086         <font class="keywordflow">for</font>(sint i=0; i&lt;(sint)<a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>.size(); i++)
00087         {
00088                 <font class="keywordflow">if</font>(o._Quad[i])
00089                 {
00090                         uint32  off= (uint32)(o._Quad[i]-o._QuadData);
00091                         <a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>[i]= <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>+off;
00092                 }
00093         }
00094 
00095 
00096         <font class="keywordflow">return</font> *<font class="keyword">this</font>;
00097 }
00098 
00099 
00100 
00101 <font class="comment">// ***************************************************************************</font>
<a name="l00102"></a><a class="code" href="classNLPACS_1_1CChainQuad.html#c1">00102</a> <font class="keywordtype">void</font>                    CChainQuad::getGridBounds(sint32 &amp;x0, sint32 &amp;y0, sint32 &amp;x1, sint32 &amp;y1, <font class="keyword">const</font> CVector &amp;minP, <font class="keyword">const</font> CVector &amp;maxP)<font class="keyword"> const</font>
00103 <font class="keyword"></font>{
00104         x0= (sint32)floor(minP.x / <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CChainQuad.html#o3">_X</a>;
00105         y0= (sint32)floor(minP.y / <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CChainQuad.html#o4">_Y</a>;
00106         x1= (sint32) ceil(maxP.x / <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CChainQuad.html#o3">_X</a>;
00107         y1= (sint32) ceil(maxP.y / <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CChainQuad.html#o4">_Y</a>;
00108         <font class="comment">// Manage selection of a point exactly on a quad bound</font>
00109         <font class="keywordflow">if</font>(x1-x0==0)
00110                 x0--, x1++;
00111         <font class="keywordflow">if</font>(y1-y0==0)
00112                 y0--, y1++;
00113         <font class="comment">// clamp</font>
00114         x0= max(x0, (sint32)0);
00115         y0= max(y0, (sint32)0);
00116         x1= <a class="code" href="bit__set_8cpp.html#a0">min</a>(x1, (sint32)<a class="code" href="classNLPACS_1_1CChainQuad.html#o1">_Width</a>);
00117         y1= <a class="code" href="bit__set_8cpp.html#a0">min</a>(y1, (sint32)<a class="code" href="classNLPACS_1_1CChainQuad.html#o2">_Height</a>);
00118 }
00119 
00120 
00121 <font class="comment">// ***************************************************************************</font>
<a name="l00122"></a><a class="code" href="classNLPACS_1_1CChainQuad.html#a4">00122</a> <font class="keywordtype">void</font>                    CChainQuad::build(<font class="keyword">const</font> std::vector&lt;COrderedChain&gt; &amp;ochains)
00123 {
00124         vector&lt; list&lt;CEdgeChainEntry&gt; &gt; tempQuad;
00125         sint    i,j;
00126 
00127         <font class="comment">// first, clear any pr-build.</font>
00128         <a class="code" href="namespaceNLMISC.html#a222">contReset</a>(<a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>);
00129         <font class="keyword">delete</font> [] <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>;
00130         <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>= NULL;
00131         <a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>= 0;
00132 
00133 
00134         <font class="comment">// 0. Find BBox of the grid. Allocate grid.</font>
00135         <font class="comment">//=========================================</font>
00136         <font class="keywordtype">bool</font>            first=<font class="keyword">true</font>;
00137         CAABBox         chainquadBBox;
00138         <font class="comment">// run all chains.</font>
00139         <font class="keywordflow">for</font>(i=0;i&lt;(sint)ochains.size();i++)
00140         {
00141                 <font class="keyword">const</font> std::vector&lt;CVector2s&gt;    &amp;vertices= ochains[i].getVertices();
00142 
00143                 <font class="comment">// run all vertices.</font>
00144                 <font class="keywordflow">for</font>(j= 0; j&lt;(sint)vertices.size();j++)
00145                 {
00146                         <font class="comment">// enlarge bbox.</font>
00147                         <font class="keywordflow">if</font>(first)
00148                                 first= <font class="keyword">false</font>, chainquadBBox.setCenter(vertices[j].unpack3f());
00149                         <font class="keywordflow">else</font>
00150                                 chainquadBBox.extend(vertices[j].unpack3f());
00151                 }
00152         }
00153 
00154         <font class="comment">// compute X,Y,Width, Height.</font>
00155         <a class="code" href="classNLPACS_1_1CChainQuad.html#o3">_X</a>= (sint32)floor(chainquadBBox.getMin().x / <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>);
00156         <a class="code" href="classNLPACS_1_1CChainQuad.html#o4">_Y</a>= (sint32)floor(chainquadBBox.getMin().y / <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>);
00157         <a class="code" href="classNLPACS_1_1CChainQuad.html#o1">_Width</a>= (sint32)ceil(chainquadBBox.getMax().x / <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CChainQuad.html#o3">_X</a>;
00158         <a class="code" href="classNLPACS_1_1CChainQuad.html#o2">_Height</a>= (sint32)ceil(chainquadBBox.getMax().y / <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CChainQuad.html#o4">_Y</a>;
00159 
00160         tempQuad.resize(<a class="code" href="classNLPACS_1_1CChainQuad.html#o1">_Width</a>*<a class="code" href="classNLPACS_1_1CChainQuad.html#o2">_Height</a>);
00161         <a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>.resize(<a class="code" href="classNLPACS_1_1CChainQuad.html#o1">_Width</a>*<a class="code" href="classNLPACS_1_1CChainQuad.html#o2">_Height</a>, NULL);
00162 
00163 
00164         <font class="comment">// 1. For each edge, add them to the quadgrid.</font>
00165         <font class="comment">//=========================================</font>
00166         <font class="comment">// run all chains.</font>
00167         <font class="keywordflow">for</font>(i=0;i&lt;(sint)ochains.size();i++)
00168         {
00169                 <font class="keyword">const</font> std::vector&lt;CVector2s&gt;    &amp;vertices= ochains[i].getVertices();
00170 
00171                 sint    numEdges= (sint)vertices.size()-1;
00172 
00173                 <font class="comment">// run all edges.</font>
00174                 <font class="keywordflow">for</font>(j= 0; j&lt;numEdges; j++)
00175                 {
00176                         <font class="keyword">const</font> CVector           p0= vertices[j].unpack3f();
00177                         <font class="keyword">const</font> CVector           p1= vertices[j+1].unpack3f();
00178                         CVector         minP,maxP;
00179                         minP.minof(p0, p1);
00180                         maxP.maxof(p0, p1);
00181                         <font class="comment">// PrecisionPb: extend a little this edge. This is important for special case like borders on zones.</font>
00182                         <font class="keywordflow">if</font>(minP.x-maxP.x==0)
00183                                 minP.x-=0.001f, maxP.x+=0.001f;
00184                         <font class="keywordflow">if</font>(minP.y-maxP.y==0)
00185                                 minP.y-=0.001f, maxP.y+=0.001f;
00186 
00187 
00188                         <font class="comment">// get bounding coordinate of this edge in the quadgrid.</font>
00189                         sint32  x0, y0, x1, y1;
00190                         <a class="code" href="classNLPACS_1_1CChainQuad.html#c1">getGridBounds</a>(x0, y0, x1, y1, minP, maxP);
00191 
00192                         <font class="comment">// add this edge to all the quadnode it touch.</font>
00193                         <font class="keywordflow">for</font>(sint <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>= y0; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;y1; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++)
00194                         {
00195                                 <font class="keywordflow">for</font>(sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>= x0; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&lt;x1; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++)
00196                                 {
00197                                         list&lt;CEdgeChainEntry&gt;   &amp;quadNode= tempQuad[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="classNLPACS_1_1CChainQuad.html#o1">_Width</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>];
00198 
00199                                         <a class="code" href="classNLPACS_1_1CChainQuad.html#c0">addEdgeToQuadNode</a>(quadNode, i, j);
00200                                 }
00201                         }
00202                 }
00203         }
00204 
00205 
00206         <font class="comment">// 2. Mem optimisation: Use only 1 block for ALL quads of the grid.</font>
00207         <font class="comment">//=========================================</font>
00208         sint    memSize= 0;
00209         <font class="comment">// run all quads.</font>
00210         <font class="keywordflow">for</font>(i=0;i&lt;(sint)tempQuad.size();i++)
00211         {
00212                 list&lt;CEdgeChainEntry&gt;   &amp;quadNode= tempQuad[i];
00213 
00214                 <font class="keywordflow">if</font>(!quadNode.empty())
00215                 {
00216                         <font class="comment">// add an entry for Len.</font>
00217                         memSize+= <font class="keyword">sizeof</font>(uint16);
00218                         <font class="comment">// add N entry of CEdgeChainEntry.</font>
00219                         memSize+= quadNode.size()*<font class="keyword">sizeof</font>(CEdgeChainEntry);
00220                 }
00221         }
00222 
00223         <font class="comment">// allocate.</font>
00224         <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>= (uint8*)<font class="keyword">new</font> uint8[memSize];
00225         <a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>= memSize;
00226 
00227 
00228         <font class="comment">// 3. Fill _QuadData with lists.</font>
00229         <font class="comment">//=========================================</font>
00230         uint8   *ptr= <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>;
00231         <font class="keywordflow">for</font>(i=0;i&lt;(sint)tempQuad.size();i++)
00232         {
00233                 list&lt;CEdgeChainEntry&gt;                   &amp;srcQuadNode= tempQuad[i];
00234                 list&lt;CEdgeChainEntry&gt;::iterator it;
00235 
00236                 <font class="keywordflow">if</font>(!srcQuadNode.empty())
00237                 {
00238                         <a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>[i]= ptr;
00239 
00240                         <font class="comment">// write len.</font>
00241                         uint16  len= srcQuadNode.size();
00242                         *((uint16*)ptr)= len;
00243                         ptr+= <font class="keyword">sizeof</font>(uint16);
00244 
00245                         <font class="comment">// add entries.</font>
00246                         it= srcQuadNode.begin();
00247                         <font class="keywordflow">for</font>(j=0; j&lt;len; j++, it++)
00248                         {
00249                                 *((CEdgeChainEntry*)ptr)= *it;
00250                                 ptr+= <font class="keyword">sizeof</font>(CEdgeChainEntry);
00251                         }
00252                 }
00253         }
00254 
00255 
00256         <font class="comment">// End.</font>
00257 }
00258 
00259 
00260 <font class="comment">// ***************************************************************************</font>
<a name="l00261"></a><a class="code" href="classNLPACS_1_1CChainQuad.html#c0">00261</a> <font class="keywordtype">void</font>                    CChainQuad::addEdgeToQuadNode(list&lt;CEdgeChainEntry&gt; &amp;quadNode, sint ochainId, sint edgeId)
00262 {
00263         <font class="comment">// 0. try to find, insert an edge in an existing CEdgeChainEntry.</font>
00264         <font class="comment">//=========================================</font>
00265         list&lt;CEdgeChainEntry&gt;::iterator         it;
00266         <font class="keywordflow">for</font>(it= quadNode.begin(); it!=quadNode.end();it++)
00267         {
00268                 <font class="keywordflow">if</font>(it-&gt;OChainId==ochainId)
00269                 {
00270                         <font class="comment">// selection is faster if we only manages a single start/end block.</font>
00271                         it-&gt;EdgeStart= <a class="code" href="bit__set_8cpp.html#a0">min</a>(it-&gt;EdgeStart, (uint16)edgeId);
00272                         it-&gt;EdgeEnd= max(it-&gt;EdgeEnd, (uint16)(edgeId+1));
00273                         <font class="keywordflow">return</font>;
00274                 }
00275         }
00276 
00277 
00278         <font class="comment">// 1. else, create new one.</font>
00279         <font class="comment">//=========================================</font>
00280         CEdgeChainEntry         entry;
00281         entry.OChainId= ochainId;
00282         entry.EdgeStart= edgeId;
00283         entry.EdgeEnd= edgeId+1;
00284         quadNode.push_back(entry);
00285 }
00286 
00287 
00288 <font class="comment">// ***************************************************************************</font>
<a name="l00289"></a><a class="code" href="classNLPACS_1_1CChainQuad.html#a5">00289</a> sint                    CChainQuad::selectEdges(<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CAABBox.html">NLMISC::CAABBox</a> &amp;bbox, CCollisionSurfaceTemp &amp;cst)<font class="keyword"> const</font>
00290 <font class="keyword"></font>{
00291         sint    nRes=0;
00292         sint    i;
00293         uint16  *ochainLUT= cst.OChainLUT;
00294 
00295         <font class="comment">// start: no edge found.</font>
00296         cst.EdgeChainEntries.clear();
00297 
00298         <font class="comment">// get bounding coordinate of this bbox in the quadgrid.</font>
00299         sint32  x0, y0, x1, y1;
00300         <a class="code" href="classNLPACS_1_1CChainQuad.html#c1">getGridBounds</a>(x0, y0, x1, y1, bbox.<a class="code" href="classNLMISC_1_1CAABBox.html#z264_0">getMin</a>(), bbox.<a class="code" href="classNLMISC_1_1CAABBox.html#z264_1">getMax</a>());
00301 
00302 
00303         <font class="comment">// run all intersected quads.</font>
00304         <font class="keywordflow">for</font>(sint <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>= y0; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;y1; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++)
00305         {
00306                 <font class="keywordflow">for</font>(sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>= x0; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>&lt;x1; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++)
00307                 {
00308                         uint8   *quadNode= <a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="classNLPACS_1_1CChainQuad.html#o1">_Width</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>];
00309 
00310                         <font class="comment">// no edgechain entry??</font>
00311                         <font class="keywordflow">if</font>(!quadNode)
00312                                 <font class="keywordflow">continue</font>;
00313 
00314                         <font class="comment">// get edgechain entries</font>
00315                         sint    numEdgeChainEntries= *((uint16*)quadNode);
00316                         quadNode+= <font class="keyword">sizeof</font>(uint16);
00317                         CEdgeChainEntry         *ptrEdgeChainEntry= (CEdgeChainEntry*)quadNode;
00318 
00319                         <font class="comment">// For each one, add it to the result list.</font>
00320                         <font class="keywordflow">for</font>(i=0;i&lt;numEdgeChainEntries;i++)
00321                         {
00322                                 uint16  ochainId= ptrEdgeChainEntry[i].OChainId;
00323 
00324                                 <font class="comment">// if ochain not yet inserted.</font>
00325                                 <font class="keywordflow">if</font>(ochainLUT[ochainId]==0xFFFF)
00326                                 {
00327                                         <font class="comment">// inc the list.</font>
00328                                         ochainLUT[ochainId]= nRes;
00329                                         cst.EdgeChainEntries.push_back(ptrEdgeChainEntry[i]);
00330                                         nRes++;
00331                                 }
00332                                 <font class="keywordflow">else</font>
00333                                 {
00334                                         <font class="comment">// extend the entry in the list.</font>
00335                                         uint16 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>= ochainLUT[ochainId];
00336                                         CEdgeChainEntry         &amp;ece= cst.EdgeChainEntries[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>];
00337                                         ece.EdgeStart= <a class="code" href="bit__set_8cpp.html#a0">min</a>(ece.EdgeStart, ptrEdgeChainEntry[i].EdgeStart);
00338                                         ece.EdgeEnd= max(ece.EdgeEnd, ptrEdgeChainEntry[i].EdgeEnd);
00339                                 }
00340                         }
00341                 }
00342         }
00343 
00344 
00345         <font class="comment">// reset LUT to 0xFFFF for all ochains selected.</font>
00346         <font class="keywordflow">for</font>(i=0;i&lt;nRes;i++)
00347         {
00348                 uint16  ochainId= cst.EdgeChainEntries[i].OChainId;
00349                 ochainLUT[ochainId]= 0xFFFF;
00350         }
00351 
00352 
00353         <font class="keywordflow">return</font> nRes;
00354 }
00355 
<a name="l00356"></a><a class="code" href="classNLPACS_1_1CChainQuad.html#a6">00356</a> sint            CChainQuad::selectEdges(CVector start, CVector end, CCollisionSurfaceTemp &amp;cst)<font class="keyword"> const</font>
00357 <font class="keyword"></font>{
00358         sint    nRes=0;
00359         sint    i;
00360         uint16  *ochainLUT= cst.OChainLUT;
00361 
00362         <font class="comment">// start: no edge found.</font>
00363         cst.EdgeChainEntries.clear();
00364 
00365         <font class="keywordflow">if</font> (end.x &lt; start.x)
00366                 swap(start, end);
00367 
00368         <font class="keywordtype">float</font>   minx = <a class="code" href="classNLPACS_1_1CChainQuad.html#o3">_X</a>*<a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>,
00369                         miny = <a class="code" href="classNLPACS_1_1CChainQuad.html#o4">_Y</a>*<a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>,
00370                         maxx = minx + <a class="code" href="classNLPACS_1_1CChainQuad.html#o1">_Width</a>*<a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>,
00371                         maxy = miny + <a class="code" href="classNLPACS_1_1CChainQuad.html#o2">_Height</a>*<a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>;
00372 
00373         <font class="keywordflow">if</font> (start.x &gt; maxx || end.x &lt; minx || start.y &gt; maxy || end.y &lt; miny)
00374                 <font class="keywordflow">return</font> nRes;
00375 
00376         <font class="keywordflow">if</font> (start.x &lt; minx)
00377         {
00378                 start.y = start.y+(end.y-start.y)*(minx-start.x)/(end.x-start.x);
00379                 start.x = minx;
00380         }
00381 
00382         <font class="keywordflow">if</font> (start.y &lt; miny)
00383         {
00384                 start.x = start.x+(end.x-start.x)*(miny-start.y)/(end.y-start.y);
00385                 start.y = miny;
00386         }
00387 
00388         <font class="keywordflow">if</font> (end.x &gt; maxx)
00389         {
00390                 end.y = start.y+(end.y-start.y)*(minx-start.x)/(end.x-start.x);
00391                 end.x = maxx;
00392         }
00393 
00394         <font class="keywordflow">if</font> (end.y &gt; maxy)
00395         {
00396                 end.x = start.x+(end.x-start.x)*(miny-start.y)/(end.y-start.y);
00397                 end.y = maxy;
00398         }
00399 
00400         sint32  x0, x1, ya, yb;
00401         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>;
00402         <font class="keywordtype">float</font>   fx, fxa, fxb, fya, fyb;
00403 
00404         x0 = (sint32)floor(start.x / <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CChainQuad.html#o3">_X</a>;
00405         x1 = (sint32)ceil(end.x / <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CChainQuad.html#o3">_X</a>;
00406         fx = (x0+<a class="code" href="classNLPACS_1_1CChainQuad.html#o3">_X</a>)*<a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>;
00407 
00408         <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>)
00409         {
00410                 fxa = (fx &lt; start.x) ? start.x : fx;
00411                 fxb = (fx+<a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a> &gt; end.x) ? end.x : fx+<a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>;
00412 
00413                 fya = start.y+(end.y-start.y)*(fxa-start.x)/(end.x-start.x);
00414                 fyb = start.y+(end.y-start.y)*(fxb-start.x)/(end.x-start.x);
00415 
00416                 <font class="keywordflow">if</font> (fya &gt; fyb)
00417                         swap (fya, fyb);
00418 
00419                 ya = (sint32)floor(fya / <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CChainQuad.html#o4">_Y</a>;
00420                 yb = (sint32)ceil(fyb / <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>) - <a class="code" href="classNLPACS_1_1CChainQuad.html#o4">_Y</a>;
00421 
00422                 fx += <a class="code" href="classNLPACS_1_1CChainQuad.html#r0">_QuadElementSize</a>;
00423 
00424                 <font class="keywordflow">for</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>=ya; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>&lt;yb; ++<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>)
00425                 {
00426                         uint8   *quadNode= <a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*<a class="code" href="classNLPACS_1_1CChainQuad.html#o1">_Width</a>+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>];
00427 
00428                         <font class="comment">// no edgechain entry??</font>
00429                         <font class="keywordflow">if</font>(!quadNode)
00430                                 <font class="keywordflow">continue</font>;
00431 
00432                         <font class="comment">// get edgechain entries</font>
00433                         sint    numEdgeChainEntries= *((uint16*)quadNode);
00434                         quadNode+= <font class="keyword">sizeof</font>(uint16);
00435                         CEdgeChainEntry         *ptrEdgeChainEntry= (CEdgeChainEntry*)quadNode;
00436 
00437                         <font class="comment">// For each one, add it to the result list.</font>
00438                         <font class="keywordflow">for</font>(i=0;i&lt;numEdgeChainEntries;i++)
00439                         {
00440                                 uint16  ochainId= ptrEdgeChainEntry[i].OChainId;
00441 
00442                                 <font class="comment">// if ochain not yet inserted.</font>
00443                                 <font class="keywordflow">if</font>(ochainLUT[ochainId]==0xFFFF)
00444                                 {
00445                                         <font class="comment">// inc the list.</font>
00446                                         ochainLUT[ochainId]= nRes;
00447                                         cst.EdgeChainEntries.push_back(ptrEdgeChainEntry[i]);
00448                                         nRes++;
00449                                 }
00450                                 <font class="keywordflow">else</font>
00451                                 {
00452                                         <font class="comment">// extend the entry in the list.</font>
00453                                         uint16 <a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>= ochainLUT[ochainId];
00454                                         CEdgeChainEntry         &amp;ece= cst.EdgeChainEntries[<a class="code" href="driver__opengl__extension__def_8h.html#a356">id</a>];
00455                                         ece.EdgeStart= <a class="code" href="bit__set_8cpp.html#a0">min</a>(ece.EdgeStart, ptrEdgeChainEntry[i].EdgeStart);
00456                                         ece.EdgeEnd= max(ece.EdgeEnd, ptrEdgeChainEntry[i].EdgeEnd);
00457                                 }
00458                         }
00459                 }
00460         }
00461 
00462         <font class="comment">// reset LUT to 0xFFFF for all ochains selected.</font>
00463         <font class="keywordflow">for</font>(i=0;i&lt;nRes;i++)
00464         {
00465                 uint16  ochainId= cst.EdgeChainEntries[i].OChainId;
00466                 ochainLUT[ochainId]= 0xFFFF;
00467         }
00468 
00469         <font class="keywordflow">return</font> nRes;
00470 }
00471 
00472 <font class="comment">// ***************************************************************************</font>
<a name="l00473"></a><a class="code" href="classNLPACS_1_1CChainQuad.html#a7">00473</a> <font class="keywordtype">void</font>            CChainQuad::serial(<a class="code" href="classNLMISC_1_1IStream.html">NLMISC::IStream</a> &amp;f)
00474 {
00475         <font class="comment">/*</font>
00476 <font class="comment">        Version 0:</font>
00477 <font class="comment">                - base version.</font>
00478 <font class="comment">        */</font>
00479         (void)f.<a class="code" href="classNLMISC_1_1IStream.html#a29">serialVersion</a>(0);
00480         uint    i;
00481 
00482         <font class="comment">// serial basics.</font>
00483         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(<a class="code" href="classNLPACS_1_1CChainQuad.html#o3">_X</a>, <a class="code" href="classNLPACS_1_1CChainQuad.html#o4">_Y</a>, <a class="code" href="classNLPACS_1_1CChainQuad.html#o1">_Width</a>, <a class="code" href="classNLPACS_1_1CChainQuad.html#o2">_Height</a>, <a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>);
00484 
00485 
00486         <font class="comment">// serial _QuadData.</font>
00487         <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>())
00488         {
00489                 <font class="keyword">delete</font> [] <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>;
00490                 <font class="keywordflow">if</font>(<a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>&gt;0)
00491                         <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>= (uint8*)<font class="keyword">new</font> uint8[<a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>];
00492                 <font class="keywordflow">else</font>
00493                         <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>= NULL;
00494         }
00495         <font class="comment">// Since we have only uint16 (see CEdgeChainEntry), serial them in a single block.</font>
00496         uint16  *ptrQData= (uint16*)<a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>;
00497         <font class="keywordflow">for</font>(i=0;i&lt;<a class="code" href="classNLPACS_1_1CChainQuad.html#o6">_QuadDataLen</a>/2; i++, ptrQData++)
00498         {
00499                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(*ptrQData);
00500         }
00501 
00502 
00503         <font class="comment">// serial _Quad.</font>
00504         std::vector&lt;uint32&gt;             offsets;
00505         uint32          len;
00506         uint32          val;
00507         <font class="keywordflow">if</font>(f.<a class="code" href="classNLMISC_1_1IStream.html#a4">isReading</a>())
00508         {
00509                 <font class="comment">// len/resize.</font>
00510                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(len);
00511                 offsets.resize(len);
00512                 <a class="code" href="namespaceNLMISC.html#a222">contReset</a>(<a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>);
00513                 <a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>.resize(len);
00514 
00515                 <font class="comment">// read offsets -&gt; ptrs.</font>
00516                 <font class="keywordflow">for</font>(i=0; i&lt;len; i++)
00517                 {
00518                         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(val);
00519                         <font class="keywordflow">if</font>(val== 0xFFFFFFFF)
00520                                 <a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>[i]= NULL;
00521                         <font class="keywordflow">else</font>
00522                                 <a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>[i]= <a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>+val;
00523                 }
00524         }
00525         <font class="keywordflow">else</font>
00526         {
00527                 <font class="comment">// len/resize.</font>
00528                 len= <a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>.size();
00529                 f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(len);
00530 
00531                 <font class="comment">// write offsets.</font>
00532                 <font class="keywordflow">for</font>(i=0; i&lt;len; i++)
00533                 {
00534                         uint8   *ptr= <a class="code" href="classNLPACS_1_1CChainQuad.html#o0">_Quad</a>[i];
00535                         <font class="keywordflow">if</font>(ptr==NULL)
00536                                 val= 0xFFFFFFFF;
00537                         <font class="keywordflow">else</font>
00538                                 val= (uint32)(ptr-<a class="code" href="classNLPACS_1_1CChainQuad.html#o5">_QuadData</a>);
00539                         f.<a class="code" href="classNLMISC_1_1IStream.html#a5">serial</a>(val);
00540                 }
00541         }
00542 
00543 }
00544 
00545 
00546 
00547 } <font class="comment">// NLPACS</font>
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
</TD>
<TD WIDTH=15><IMG  SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>