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
|
<!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> <A CLASS=uplinks HREF=><b>Home</B></FONT></A> </TD>
<TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle> <A CLASS=uplinks HREF=><b>nevrax.com</B></FONT></A> </TD>
</TR>
</TABLE>
<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
<TR><TD BGCOLOR="#000000" BACKGROUND="/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>
<!-- 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> </td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="classes.html">Alphabetical List</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="namespacemembers.html">Namespace Members</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> </center>
<hr><h1>cube_grid.h</h1><a href="cube__grid_8h.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">#ifndef NL_CUBE_GRID_H</font>
00027 <font class="preprocessor"></font><font class="preprocessor">#define NL_CUBE_GRID_H</font>
00028 <font class="preprocessor"></font>
00029 <font class="preprocessor">#include "<a class="code" href="types__nl_8h.html">nel/misc/types_nl.h</a>"</font>
00030 <font class="preprocessor">#include "<a class="code" href="triangle_8h.html">nel/misc/triangle.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="3d_2quad__grid_8h.html">3d/quad_grid.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="static__quad__grid_8h.html">3d/static_quad_grid.h</a>"</font>
00034
00035
00036 <font class="keyword">namespace </font>NL3D {
00037
00038
00039 <font class="comment">// ***************************************************************************</font>
00051 <font class="comment"></font><font class="keyword">template</font> <<font class="keyword">class</font> TCell>
<a name="l00052"></a><a class="code" href="classNL3D_1_1CCubeGrid.html">00052</a> <font class="keyword">class </font>CCubeGrid
00053 {
00054 <font class="keyword">public</font>:
00055
00056 <a class="code" href="classNL3D_1_1CCubeGrid.html#a0">CCubeGrid</a> ();
00057 <a class="code" href="classNL3D_1_1CCubeGrid.html#a1">~CCubeGrid</a> ();
00058
00062 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CCubeGrid.html#a2">create</a> (<font class="keyword">const</font> CVector &center, <font class="keywordtype">int</font> nSize);
00063 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CCubeGrid.html#a3">insert</a> (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CTriangle.html">NLMISC::CTriangle</a> &tri, <font class="keyword">const</font> TCell &cell);
00065 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CCubeGrid.html#a4">compile</a>();
00066
00067 <font class="comment">// Selection. CubeGrid must be compilated. NB: it clear old selection.</font>
00068 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CCubeGrid.html#a5">select</a> (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &<a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>);
00069 TCell <a class="code" href="classNL3D_1_1CCubeGrid.html#a6">getSel</a> ();
00070 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CCubeGrid.html#a7">nextSel</a> ();
00071 <font class="keywordtype">bool</font> <a class="code" href="classNL3D_1_1CCubeGrid.html#a8">isEndSel</a> ();
00072
00073 <font class="comment">// ************************</font>
00074 <font class="keyword">private</font>:
00075
<a name="l00076"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#o0">00076</a> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> <a class="code" href="classNL3D_1_1CCubeGrid.html#o0">_Center</a>;
00077
<a name="l00078"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#u6">00078</a> <font class="keyword">enum</font> <a class="code" href="classNL3D_1_1CCubeGrid.html#u6">gridPos</a> { <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u0">kUp</a> = 0, <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u1">kDown</a>, <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u2">kLeft</a>, <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u3">kRight</a>, <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u4">kFront</a>, <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u5">kBack</a> };
00079 <font class="comment">// This is temp used at element insertion. freed at compile() time</font>
<a name="l00080"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#o1">00080</a> <a class="code" href="classNL3D_1_1CQuadGrid.html">NL3D::CQuadGrid<TCell></a> <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[6];
00081 <font class="comment">// For fast selection, and minimum memory overhead.</font>
<a name="l00082"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#o2">00082</a> <a class="code" href="classNL3D_1_1CStaticQuadGrid.html">NL3D::CStaticQuadGrid<TCell></a> <a class="code" href="classNL3D_1_1CCubeGrid.html#o2">_StaticGrids</a>[6];
00083
00084
<a name="l00085"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#o3">00085</a> <font class="keywordtype">bool</font> <a class="code" href="classNL3D_1_1CCubeGrid.html#o3">_Compiled</a>;
00086
00087 <font class="comment">// Selection.</font>
<a name="l00088"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#o4">00088</a> <font class="keyword">const</font> TCell *<a class="code" href="classNL3D_1_1CCubeGrid.html#o4">_Selection</a>;
<a name="l00089"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#o5">00089</a> uint <a class="code" href="classNL3D_1_1CCubeGrid.html#o5">_CurSel</a>;
<a name="l00090"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#o6">00090</a> uint <a class="code" href="classNL3D_1_1CCubeGrid.html#o6">_NumSels</a>;
00091
00092 <font class="keyword">private</font>:
00093
00094 <font class="keywordtype">void</font> <a class="code" href="classNL3D_1_1CCubeGrid.html#c0">project</a> (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CTriangle.html">NLMISC::CTriangle</a> &tri, <a class="code" href="classNLMISC_1_1CPlane.html">NLMISC::CPlane</a> pyr[4], <a class="code" href="classNLMISC_1_1CPlane.html">NLMISC::CPlane</a> &gridPlane,
00095 sint32 nGridNb, <font class="keyword">const</font> TCell &cell);
00096
00097 };
00098
00099
00100 <font class="comment">// ***************************************************************************</font>
00101 <font class="comment">// ***************************************************************************</font>
00102 <font class="comment">// Implementation</font>
00103 <font class="comment">// ***************************************************************************</font>
00104 <font class="comment">// ***************************************************************************</font>
00105
00106
00107 <font class="comment">// ***************************************************************************</font>
00108 <font class="keyword">template</font><<font class="keyword">class</font> TCell>
<a name="l00109"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#a0">00109</a> CCubeGrid<TCell>::CCubeGrid ()
00110 {
00111 <a class="code" href="classNLMISC_1_1CMatrix.html">NLMISC::CMatrix</a> tmp;
00112 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> I, J, K;
00113
00114 <font class="comment">// grids[kUp].changeBase( );</font>
00115 I = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 1, 0, 0 );
00116 J = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 0, -1, 0 );
00117 K = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 0, 0, -1 );
00118 tmp.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_0">identity</a>(); tmp.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_1">setRot</a>( I, J, K, <font class="keyword">true</font> );
00119 <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[<a class="code" href="classNL3D_1_1CCubeGrid.html#u6u1">kDown</a>].changeBase( tmp );
00120
00121 I = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 0, 0, 1 );
00122 J = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 0, 1, 0 );
00123 K = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1, 0, 0 );
00124 tmp.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_0">identity</a>(); tmp.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_1">setRot</a>( I, J, K, <font class="keyword">true</font>);
00125 <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[<a class="code" href="classNL3D_1_1CCubeGrid.html#u6u2">kLeft</a>].changeBase( tmp );
00126
00127 I = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 0, 0, -1 );
00128 J = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 0, 1, 0 );
00129 K = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 1, 0, 0 );
00130 tmp.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_0">identity</a>(); tmp.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_1">setRot</a>( I, J, K, <font class="keyword">true</font>);
00131 <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[<a class="code" href="classNL3D_1_1CCubeGrid.html#u6u3">kRight</a>].changeBase( tmp );
00132
00133 I = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 1, 0, 0 );
00134 J = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 0, 0, 1 );
00135 K = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 0, -1, 0 );
00136 tmp.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_0">identity</a>(); tmp.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_1">setRot</a>( I, J, K, <font class="keyword">true</font>);
00137 <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[<a class="code" href="classNL3D_1_1CCubeGrid.html#u6u4">kFront</a>].changeBase( tmp );
00138
00139 I = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 1, 0, 0 );
00140 J = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 0, 0, -1 );
00141 K = <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( 0, 1, 0 );
00142 tmp.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_0">identity</a>(); tmp.<a class="code" href="classNLMISC_1_1CMatrix.html#z290_1">setRot</a>( I, J, K, <font class="keyword">true</font>);
00143 <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[<a class="code" href="classNL3D_1_1CCubeGrid.html#u6u5">kBack</a>].changeBase( tmp );
00144
00145
00146 <a class="code" href="classNL3D_1_1CCubeGrid.html#o3">_Compiled</a>= <font class="keyword">false</font>;
00147 }
00148
00149 <font class="comment">// ***************************************************************************</font>
00150 <font class="keyword">template</font><<font class="keyword">class</font> TCell>
<a name="l00151"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#a1">00151</a> CCubeGrid<TCell>::~CCubeGrid ()
00152 {
00153 }
00154
00155 <font class="comment">// ***************************************************************************</font>
00156 <font class="keyword">template</font><<font class="keyword">class</font> TCell>
<a name="l00157"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#a2">00157</a> <font class="keywordtype">void</font> CCubeGrid<TCell>::create (<font class="keyword">const</font> CVector &center, <font class="keywordtype">int</font> nSize)
00158 {
00159 <a class="code" href="debug_8h.html#a6">nlassert</a>(!<a class="code" href="classNL3D_1_1CCubeGrid.html#o3">_Compiled</a>);
00160 <a class="code" href="classNL3D_1_1CCubeGrid.html#o0">_Center</a>= center;
00161
00162 <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[<a class="code" href="classNL3D_1_1CCubeGrid.html#u6u0">kUp</a>].create ( nSize, 1.0f / ((<font class="keywordtype">float</font>)nSize) );
00163 <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[<a class="code" href="classNL3D_1_1CCubeGrid.html#u6u1">kDown</a>].create ( nSize, 1.0f / ((<font class="keywordtype">float</font>)nSize) );
00164 <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[<a class="code" href="classNL3D_1_1CCubeGrid.html#u6u2">kLeft</a>].create ( nSize, 1.0f / ((<font class="keywordtype">float</font>)nSize) );
00165 <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[<a class="code" href="classNL3D_1_1CCubeGrid.html#u6u3">kRight</a>].create ( nSize, 1.0f / ((<font class="keywordtype">float</font>)nSize) );
00166 <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[<a class="code" href="classNL3D_1_1CCubeGrid.html#u6u4">kFront</a>].create ( nSize, 1.0f / ((<font class="keywordtype">float</font>)nSize) );
00167 <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[<a class="code" href="classNL3D_1_1CCubeGrid.html#u6u5">kBack</a>].create ( nSize, 1.0f / ((<font class="keywordtype">float</font>)nSize) );
00168 }
00169
00170 <font class="comment">// ***************************************************************************</font>
00171 <font class="keyword">template</font><<font class="keyword">class</font> TCell>
<a name="l00172"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#a3">00172</a> <font class="keywordtype">void</font> CCubeGrid<TCell>::insert (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CTriangle.html">NLMISC::CTriangle</a> &triIn, <font class="keyword">const</font> TCell &cell)
00173 {
00174 <a class="code" href="debug_8h.html#a6">nlassert</a>(!<a class="code" href="classNL3D_1_1CCubeGrid.html#o3">_Compiled</a>);
00175 <font class="comment">// Center triangle on _Center.</font>
00176 <a class="code" href="classNLMISC_1_1CTriangle.html">NLMISC::CTriangle</a> tri= triIn;
00177 tri.<a class="code" href="classNLMISC_1_1CTriangle.html#m0">V0</a>-= <a class="code" href="classNL3D_1_1CCubeGrid.html#o0">_Center</a>;
00178 tri.<a class="code" href="classNLMISC_1_1CTriangle.html#m1">V1</a>-= <a class="code" href="classNL3D_1_1CCubeGrid.html#o0">_Center</a>;
00179 tri.<a class="code" href="classNLMISC_1_1CTriangle.html#m2">V2</a>-= <a class="code" href="classNL3D_1_1CCubeGrid.html#o0">_Center</a>;
00180
00181 <a class="code" href="classNLMISC_1_1CPlane.html">NLMISC::CPlane</a> p[4], gp;
00182 <font class="comment">// Construct clip pyramid for grid : UP</font>
00183 p[0].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,-1,+1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,-1,+1 ) );
00184 p[1].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,-1,+1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,+1,+1 ) );
00185 p[2].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,+1,+1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,+1,+1 ) );
00186 p[3].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,+1,+1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,-1,+1 ) );
00187 gp.<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,1), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0.5) );
00188 <a class="code" href="classNL3D_1_1CCubeGrid.html#c0">project</a>( tri, p, gp, <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u0">kUp</a>, cell );
00189 <font class="comment">// Construct clip pyramid for grid : DOWN</font>
00190 p[0].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,-1,-1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,-1,-1 ) );
00191 p[1].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,-1,-1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,+1,-1 ) );
00192 p[2].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,+1,-1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,+1,-1 ) );
00193 p[3].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,+1,-1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,-1,-1 ) );
00194 gp.<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,-1), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,-0.5) );
00195 <a class="code" href="classNL3D_1_1CCubeGrid.html#c0">project</a>( tri, p, gp, <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u1">kDown</a>, cell );
00196 <font class="comment">// Construct clip pyramid for grid : LEFT</font>
00197 p[0].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,-1,-1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,-1,+1 ) );
00198 p[1].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,-1,+1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,+1,+1 ) );
00199 p[2].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,+1,+1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,+1,-1 ) );
00200 p[3].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,+1,-1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,-1,-1 ) );
00201 gp.<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(-1,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(-0.5,0,0) );
00202 <a class="code" href="classNL3D_1_1CCubeGrid.html#c0">project</a>( tri, p, gp, <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u2">kLeft</a>, cell );
00203 <font class="comment">// Construct clip pyramid for grid : RIGHT</font>
00204 p[0].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,-1,+1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,-1,-1 ) );
00205 p[1].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,-1,-1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,+1,-1 ) );
00206 p[2].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,+1,-1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,+1,+1 ) );
00207 p[3].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,+1,+1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,-1,+1 ) );
00208 gp.<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(1,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0.5,0,0) );
00209 <a class="code" href="classNL3D_1_1CCubeGrid.html#c0">project</a>( tri, p, gp, <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u3">kRight</a>, cell );
00210 <font class="comment">// Construct clip pyramid for grid : FRONT</font>
00211 p[0].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,-1,-1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,-1,-1 ) );
00212 p[1].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,-1,-1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,-1,+1 ) );
00213 p[2].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,-1,+1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,-1,+1 ) );
00214 p[3].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,-1,+1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,-1,-1 ) );
00215 gp.<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,-1,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,-0.5,0) );
00216 <a class="code" href="classNL3D_1_1CCubeGrid.html#c0">project</a>( tri, p, gp, <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u4">kFront</a>, cell );
00217 <font class="comment">// Construct clip pyramid for grid : BACK</font>
00218 p[0].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,+1,+1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,+1,-1 ) );
00219 p[1].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,+1,-1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,+1,-1 ) );
00220 p[2].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,+1,-1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,+1,+1 ) );
00221 p[3].<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( -1,+1,+1 ), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>( +1,+1,+1 ) );
00222 gp.<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,1,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0.5,0) );
00223 <a class="code" href="classNL3D_1_1CCubeGrid.html#c0">project</a>( tri, p, gp, <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u5">kBack</a>, cell );
00224 }
00225
00226
00227 <font class="comment">// ***************************************************************************</font>
00228 <font class="keyword">template</font><<font class="keyword">class</font> TCell>
<a name="l00229"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#a4">00229</a> <font class="keywordtype">void</font> CCubeGrid<TCell>::compile()
00230 {
00231 <a class="code" href="debug_8h.html#a6">nlassert</a>(!<a class="code" href="classNL3D_1_1CCubeGrid.html#o3">_Compiled</a>);
00232 <font class="comment">// For all Grids.</font>
00233 uint i;
00234 <font class="keywordflow">for</font>(i=0; i<6; i++)
00235 {
00236 <font class="comment">// build the _StaticGrid</font>
00237 <a class="code" href="classNL3D_1_1CCubeGrid.html#o2">_StaticGrids</a>[i].<a class="code" href="classNL3D_1_1CStaticQuadGrid.html#z816_0">build</a>(<a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[i]);
00238 <font class="comment">// And reset the grid. contReset is necessary to clean the CBlockMemory.</font>
00239 <a class="code" href="namespaceNLMISC.html#a222">contReset</a>(<a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[i]);
00240 }
00241
00242 <font class="comment">// done</font>
00243 <a class="code" href="classNL3D_1_1CCubeGrid.html#o3">_Compiled</a>= <font class="keyword">true</font>;
00244
00245 <font class="comment">// Clear the Selection</font>
00246 <a class="code" href="classNL3D_1_1CCubeGrid.html#o4">_Selection</a>= NULL;
00247 <a class="code" href="classNL3D_1_1CCubeGrid.html#o5">_CurSel</a>= 0;
00248 <a class="code" href="classNL3D_1_1CCubeGrid.html#o6">_NumSels</a>= 0;
00249 }
00250
00251 <font class="comment">// ***************************************************************************</font>
00252 <font class="keyword">template</font><<font class="keyword">class</font> TCell>
<a name="l00253"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#a5">00253</a> <font class="keywordtype">void</font> CCubeGrid<TCell>::select (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> &vIn)
00254 {
00255 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CCubeGrid.html#o3">_Compiled</a>);
00256 <font class="comment">// Center triangle on _Center.</font>
00257 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> <a class="code" href="driver__opengl__extension__def_8h.html#a368">v</a>= vIn-<a class="code" href="classNL3D_1_1CCubeGrid.html#o0">_Center</a>;
00258
00259
00260 sint nSelGrid= -1;
00261 <a class="code" href="classNLMISC_1_1CPlane.html">NLMISC::CPlane</a> gp;
00262 <font class="comment">// Get the plane</font>
00263 <font class="keywordflow">if</font>( ( -v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> ) && ( v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ) &&
00264 ( -v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> ) && ( v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ) &&
00265 ( 0.0f <= v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ) )
00266 {
00267 nSelGrid = <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u0">kUp</a>;
00268 gp.<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,1), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0.5) );
00269 }
00270 <font class="keywordflow">if</font>( ( v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> ) && ( v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> <= -v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ) &&
00271 ( v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> ) && ( v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> <= -v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ) &&
00272 ( v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> <= 0.0f ) )
00273 {
00274 nSelGrid = <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u1">kDown</a>;
00275 gp.<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,-1), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,-0.5) );
00276 }
00277 <font class="keywordflow">if</font>( ( v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> <= 0.0f ) &&
00278 ( v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> ) && ( v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> <= -v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> ) &&
00279 ( v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ) && ( v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> <= -v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> ) )
00280 {
00281 nSelGrid = <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u2">kLeft</a>;
00282 gp.<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(-1,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(-0.5,0,0) );
00283 }
00284 <font class="keywordflow">if</font>( ( 0.0f <= v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> ) &&
00285 ( -v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> ) && ( v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> ) &&
00286 ( -v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ) && ( v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> ) )
00287 {
00288 nSelGrid = <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u3">kRight</a>;
00289 gp.<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(1,0,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0.5,0,0) );
00290 }
00291 <font class="keywordflow">if</font>( ( v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> ) && ( v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> <= -v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> ) &&
00292 ( v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> <= 0.0f ) &&
00293 ( v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ) && ( v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> <= -v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> ) )
00294 {
00295 nSelGrid = <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u4">kFront</a>;
00296 gp.<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,-1,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,-0.5,0) );
00297 }
00298 <font class="keywordflow">if</font>( ( -v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> ) && ( v.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> ) &&
00299 ( 0.0f <= v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> ) &&
00300 ( -v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ) && ( v.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> <= v.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> ) )
00301 {
00302 nSelGrid = <a class="code" href="classNL3D_1_1CCubeGrid.html#u6u5">kBack</a>;
00303 gp.<a class="code" href="classNLMISC_1_1CPlane.html#z305_0">make</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,1,0), <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0.5,0) );
00304 }
00305 <a class="code" href="debug_8h.html#a6">nlassert</a>(nSelGrid!=-1);
00306 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> newV = gp.<a class="code" href="classNLMISC_1_1CPlane.html#z306_2">intersect</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0,0,0), v );
00307 <a class="code" href="classNL3D_1_1CCubeGrid.html#o4">_Selection</a>= <a class="code" href="classNL3D_1_1CCubeGrid.html#o2">_StaticGrids</a>[nSelGrid].<a class="code" href="classNL3D_1_1CStaticQuadGrid.html#z817_0">select</a>(newV, <a class="code" href="classNL3D_1_1CCubeGrid.html#o6">_NumSels</a>);
00308 <a class="code" href="classNL3D_1_1CCubeGrid.html#o5">_CurSel</a> = 0;
00309 }
00310
00311 <font class="comment">// ***************************************************************************</font>
00312 <font class="keyword">template</font><<font class="keyword">class</font> TCell>
<a name="l00313"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#a6">00313</a> TCell CCubeGrid<TCell>::getSel ()
00314 {
00315 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CCubeGrid.html#o3">_Compiled</a>);
00316 <font class="keywordflow">return</font> <a class="code" href="classNL3D_1_1CCubeGrid.html#o4">_Selection</a>[<a class="code" href="classNL3D_1_1CCubeGrid.html#o5">_CurSel</a>];
00317 }
00318
00319 <font class="comment">// ***************************************************************************</font>
00320 <font class="keyword">template</font><<font class="keyword">class</font> TCell>
<a name="l00321"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#a7">00321</a> <font class="keywordtype">void</font> CCubeGrid<TCell>::nextSel ()
00322 {
00323 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CCubeGrid.html#o3">_Compiled</a>);
00324 ++<a class="code" href="classNL3D_1_1CCubeGrid.html#o5">_CurSel</a>;
00325 }
00326
00327 <font class="comment">// ***************************************************************************</font>
00328 <font class="keyword">template</font><<font class="keyword">class</font> TCell>
<a name="l00329"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#a8">00329</a> <font class="keywordtype">bool</font> CCubeGrid<TCell>::isEndSel ()
00330 {
00331 <a class="code" href="debug_8h.html#a6">nlassert</a>(<a class="code" href="classNL3D_1_1CCubeGrid.html#o3">_Compiled</a>);
00332 <font class="keywordflow">return</font> (<a class="code" href="classNL3D_1_1CCubeGrid.html#o5">_CurSel</a> == <a class="code" href="classNL3D_1_1CCubeGrid.html#o6">_NumSels</a>);
00333 }
00334
00335 <font class="comment">// ***************************************************************************</font>
00336 <font class="keyword">template</font><<font class="keyword">class</font> TCell>
<a name="l00337"></a><a class="code" href="classNL3D_1_1CCubeGrid.html#c0">00337</a> <font class="keywordtype">void</font> CCubeGrid<TCell>::project (<font class="keyword">const</font> <a class="code" href="classNLMISC_1_1CTriangle.html">NLMISC::CTriangle</a> &tri, <a class="code" href="classNLMISC_1_1CPlane.html">NLMISC::CPlane</a> pyr[4], <a class="code" href="classNLMISC_1_1CPlane.html">NLMISC::CPlane</a> &gridPlane, sint32 nGridNb, <font class="keyword">const</font> TCell &cell)
00338 {
00339 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> vIn[7], vOut[7];
00340 sint32 i, nOut;
00341 vIn[0] = tri.<a class="code" href="classNLMISC_1_1CTriangle.html#m0">V0</a>; vIn[1] = tri.<a class="code" href="classNLMISC_1_1CTriangle.html#m1">V1</a>; vIn[2] = tri.<a class="code" href="classNLMISC_1_1CTriangle.html#m2">V2</a>;
00342 nOut = pyr[0].<a class="code" href="classNLMISC_1_1CPlane.html#z306_7">clipPolygonFront</a>( vIn, vOut, 3 );
00343 <font class="keywordflow">if</font>( nOut == 0 ) <font class="keywordflow">return</font>;
00344 <font class="keywordflow">for</font>( i = 0; i < nOut; ++i ) vIn[i] = vOut[i];
00345 nOut = pyr[1].<a class="code" href="classNLMISC_1_1CPlane.html#z306_7">clipPolygonFront</a>( vIn, vOut, nOut );
00346 <font class="keywordflow">if</font>( nOut == 0 ) <font class="keywordflow">return</font>;
00347 <font class="keywordflow">for</font>( i = 0; i < nOut; ++i ) vIn[i] = vOut[i];
00348 nOut = pyr[2].<a class="code" href="classNLMISC_1_1CPlane.html#z306_7">clipPolygonFront</a>( vIn, vOut, nOut );
00349 <font class="keywordflow">if</font>( nOut == 0 ) <font class="keywordflow">return</font>;
00350 <font class="keywordflow">for</font>( i = 0; i < nOut; ++i ) vIn[i] = vOut[i];
00351 nOut = pyr[3].<a class="code" href="classNLMISC_1_1CPlane.html#z306_7">clipPolygonFront</a>( vIn, vOut, nOut );
00352 <font class="keywordflow">if</font>( nOut >= 3 )
00353 {
00354 <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a> vMin(1, 1, 1), vMax(-1, -1, -1);
00355 <font class="keywordflow">for</font>( i = 0; i < nOut; ++i )
00356 {
00357 vOut[i] = gridPlane.<a class="code" href="classNLMISC_1_1CPlane.html#z306_2">intersect</a>( <a class="code" href="classNLMISC_1_1CVector.html">NLMISC::CVector</a>(0, 0, 0), vOut[i] );
00358 <font class="keywordflow">if</font>( vMin.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> > vOut[i].<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> ) vMin.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> = vOut[i].<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>;
00359 <font class="keywordflow">if</font>( vMin.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> > vOut[i].<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> ) vMin.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> = vOut[i].<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>;
00360 <font class="keywordflow">if</font>( vMin.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> > vOut[i].<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ) vMin.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> = vOut[i].<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>;
00361 <font class="keywordflow">if</font>( vMax.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> < vOut[i].<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> ) vMax.<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a> = vOut[i].<a class="code" href="classNLMISC_1_1CVector.html#m0">x</a>;
00362 <font class="keywordflow">if</font>( vMax.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> < vOut[i].<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> ) vMax.<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a> = vOut[i].<a class="code" href="classNLMISC_1_1CVector.html#m1">y</a>;
00363 <font class="keywordflow">if</font>( vMax.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> < vOut[i].<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> ) vMax.<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a> = vOut[i].<a class="code" href="classNLMISC_1_1CVector.html#m2">z</a>;
00364 }
00365 <font class="comment">// Create the bbox</font>
00366 <a class="code" href="classNL3D_1_1CCubeGrid.html#o1">_Grids</a>[nGridNb].<a class="code" href="classNL3D_1_1CQuadGrid.html#z742_2">insert</a>( vMin, vMax, cell );
00367 }
00368 }
00369
00370
00371
00372 } <font class="comment">// NL3D</font>
00373
00374
00375 <font class="preprocessor">#endif // NL_CUBE_GRID_H</font>
00376 <font class="preprocessor"></font>
00377 <font class="comment">/* End of cube_grid.h */</font>
</pre></div>
<!-- footer -->
<BR><FONT Size=+5> </FONT>
</TD>
<TD WIDTH=15><IMG SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>
|