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
|
<!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>bezier_patch.cpp</h1><a href="bezier__patch_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025
00026 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
00027
00028 <font class="preprocessor">#include "<a class="code" href="bezier__patch_8h.html">3d/bezier_patch.h</a>"</font>
00029 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00030
00031
00032 <font class="keyword">namespace </font>NL3D {
00033
00034
00035 <font class="comment">// ***************************************************************************</font>
<a name="l00036"></a><a class="code" href="classNL3D_1_1CBezierPatch.html#a1">00036</a> <font class="keywordtype">void</font> CBezierPatch::make(CVector vertices[4], CVector normals[4])
00037 {
00038 sint i;
00039 <font class="keyword">static</font> sint starts[8]= {0,1, 1,2, 2,3, 3,0};
00040 <font class="keyword">static</font> sint ends[8]= {1,0, 2,1, 3,2, 0,3};
00041
00042 <font class="keywordflow">for</font>(i=0;i<4;i++)
00043 <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[i]= vertices[i];
00044
00045 <font class="comment">// For all tangents.</font>
00046 <font class="keywordflow">for</font>(i=0;i<8;i++)
00047 {
00048 CVector tgt= <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[ends[i]] - <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[starts[i]];
00049 CVector I,J,K;
00050 J= normals[starts[i]];
00051 I= J^tgt;
00052 K= I^J;
00053 K.normalize();
00054 <font class="comment">// Yes, we store tangents as position, not vectors...</font>
00055 <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[i]= <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[starts[i]] + K*tgt.norm()/3;
00056 }
00057
00058 <a class="code" href="classNL3D_1_1CBezierPatch.html#a2">makeInteriors</a>();
00059 }
00060 <font class="comment">// ***************************************************************************</font>
<a name="l00061"></a><a class="code" href="classNL3D_1_1CBezierPatch.html#a2">00061</a> <font class="keywordtype">void</font> CBezierPatch::makeInteriors()
00062 {
00063 CVector &a = <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[0];
00064 CVector &b = <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[1];
00065 CVector &c = <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[2];
00066 CVector &d = <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[3];
00067 <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[0] = <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[7] + <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[0] - a;
00068 <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[1] = <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[1] + <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[2] - b;
00069 <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[2] = <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[3] + <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[4] - c;
00070 <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[3] = <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[5] + <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[6] - d;
00071 }
00072 <font class="comment">// ***************************************************************************</font>
<a name="l00073"></a><a class="code" href="classNL3D_1_1CBezierPatch.html#a3">00073</a> <font class="keywordtype">void</font> CBezierPatch::applyMatrix(<font class="keyword">const</font> CMatrix &m)
00074 {
00075 sint i;
00076
00077 <font class="keywordflow">for</font>(i=0;i<4;i++)
00078 <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[i]= m*<a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[i];
00079 <font class="keywordflow">for</font>(i=0;i<8;i++)
00080 <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[i]= m*<a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[i];
00081 <font class="keywordflow">for</font>(i=0;i<4;i++)
00082 <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[i]= m*<a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[i];
00083 }
00084
00085
00086 <font class="comment">// ***************************************************************************</font>
00087 <font class="keyword">static</font> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(CVector &tgt, <font class="keyword">const</font> CVector &<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>, <font class="keywordtype">float</font> f)
00088 {
00089 tgt.x+= <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>.x*f;
00090 tgt.y+= <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>.y*f;
00091 tgt.z+= <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>.z*f;
00092 }
00093
00094
00095 <font class="comment">// ***************************************************************************</font>
00096 <font class="keyword">static</font> <font class="keyword">inline</font> <font class="keywordtype">void</font> <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(CVectorD &tgt, <font class="keyword">const</font> CVector &<a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>, <font class="keywordtype">double</font> f)
00097 {
00098 tgt.x+= <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>.x*f;
00099 tgt.y+= <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>.y*f;
00100 tgt.z+= <a class="code" href="driver__opengl__extension__def_8h.html#a409">src</a>.z*f;
00101 }
00102
00103
00104 <font class="comment">// ***************************************************************************</font>
<a name="l00105"></a><a class="code" href="classNL3D_1_1CBezierPatch.html#a4">00105</a> CVector CBezierPatch::eval(<font class="keywordtype">float</font> ps, <font class="keywordtype">float</font> pt)<font class="keyword"> const</font>
00106 <font class="keyword"></font>{
00107 CVector p;
00108
00109 <font class="keywordtype">float</font> ps2 = ps * ps;
00110 <font class="keywordtype">float</font> ps1 = 1.0f - ps;
00111 <font class="keywordtype">float</font> ps12 = ps1 * ps1;
00112 <font class="keywordtype">float</font> s0 = ps12 * ps1;
00113 <font class="keywordtype">float</font> s1 = 3.0f * ps * ps12;
00114 <font class="keywordtype">float</font> s2 = 3.0f * ps2 * ps1;
00115 <font class="keywordtype">float</font> s3 = ps2 * ps;
00116 <font class="keywordtype">float</font> pt2 = pt * pt;
00117 <font class="keywordtype">float</font> pt1 = 1.0f - pt;
00118 <font class="keywordtype">float</font> pt12 = pt1 * pt1;
00119 <font class="keywordtype">float</font> t0 = pt12 * pt1;
00120 <font class="keywordtype">float</font> t1 = 3.0f * pt * pt12;
00121 <font class="keywordtype">float</font> t2 = 3.0f * pt2 * pt1;
00122 <font class="keywordtype">float</font> t3 = pt2 * pt;
00123
00124 p.set(0,0,0);
00125 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[0] , s0 * t0);
00126 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[7] , s1 * t0);
00127 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[6] , s2 * t0);
00128 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[3] , s3 * t0);
00129 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[0] , s0 * t1);
00130 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[0], s1 * t1);
00131 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[3], s2 * t1);
00132 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[5] , s3 * t1);
00133 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[1] , s0 * t2);
00134 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[1], s1 * t2);
00135 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[2], s2 * t2);
00136 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[4] , s3 * t2);
00137 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[1] , s0 * t3);
00138 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[2] , s1 * t3);
00139 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[3] , s2 * t3);
00140 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[2] , s3 * t3);
00141
00142 <font class="keywordflow">return</font> p;
00143 }
00144 <font class="comment">// ***************************************************************************</font>
<a name="l00145"></a><a class="code" href="classNL3D_1_1CBezierPatch.html#a5">00145</a> CVectorD CBezierPatch::evalDouble(<font class="keywordtype">double</font> ps, <font class="keywordtype">double</font> pt)<font class="keyword"> const</font>
00146 <font class="keyword"></font>{
00147 CVectorD p;
00148
00149 <font class="keywordtype">double</font> ps2 = ps * ps;
00150 <font class="keywordtype">double</font> ps1 = 1.0f - ps;
00151 <font class="keywordtype">double</font> ps12 = ps1 * ps1;
00152 <font class="keywordtype">double</font> s0 = ps12 * ps1;
00153 <font class="keywordtype">double</font> s1 = 3.0f * ps * ps12;
00154 <font class="keywordtype">double</font> s2 = 3.0f * ps2 * ps1;
00155 <font class="keywordtype">double</font> s3 = ps2 * ps;
00156 <font class="keywordtype">double</font> pt2 = pt * pt;
00157 <font class="keywordtype">double</font> pt1 = 1.0f - pt;
00158 <font class="keywordtype">double</font> pt12 = pt1 * pt1;
00159 <font class="keywordtype">double</font> t0 = pt12 * pt1;
00160 <font class="keywordtype">double</font> t1 = 3.0f * pt * pt12;
00161 <font class="keywordtype">double</font> t2 = 3.0f * pt2 * pt1;
00162 <font class="keywordtype">double</font> t3 = pt2 * pt;
00163
00164 p.set(0,0,0);
00165 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[0] , s0 * t0);
00166 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[7] , s1 * t0);
00167 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[6] , s2 * t0);
00168 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[3] , s3 * t0);
00169 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[0] , s0 * t1);
00170 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[0], s1 * t1);
00171 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[3], s2 * t1);
00172 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[5] , s3 * t1);
00173 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[1] , s0 * t2);
00174 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[1], s1 * t2);
00175 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[2], s2 * t2);
00176 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[4] , s3 * t2);
00177 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[1] , s0 * t3);
00178 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[2] , s1 * t3);
00179 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[3] , s2 * t3);
00180 <a class="code" href="namespaceNL3D.html#a318">mulAddD</a>(p, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[2] , s3 * t3);
00181
00182 <font class="keywordflow">return</font> p;
00183 }
00184
00185
00186 <font class="comment">// ***************************************************************************</font>
<a name="l00187"></a><a class="code" href="classNL3D_1_1CBezierPatch.html#a6">00187</a> CVector CBezierPatch::evalNormal(<font class="keywordtype">float</font> ps, <font class="keywordtype">float</font> pt)<font class="keyword"> const</font>
00188 <font class="keyword"></font>{
00189 CVector tgtS, tgtT;
00190
00191 <font class="keywordtype">float</font> s0,s1,s2,s3;
00192 <font class="keywordtype">float</font> t0,t1,t2,t3;
00193 <font class="keywordtype">float</font> ps2 = ps * ps;
00194 <font class="keywordtype">float</font> ps1 = 1.0f - ps;
00195 <font class="keywordtype">float</font> ps12 = ps1 * ps1;
00196 <font class="keywordtype">float</font> pt2 = pt * pt;
00197 <font class="keywordtype">float</font> pt1 = 1.0f - pt;
00198 <font class="keywordtype">float</font> pt12 = pt1 * pt1;
00199
00200 <font class="comment">// Compute tangentS</font>
00201 <font class="comment">//=================</font>
00202 <font class="comment">// s/ds.</font>
00203 s0 = -3* ps12;
00204 s1 = 9*ps2 + 3 -12*ps;
00205 s2 =-9*ps2 + 6*ps ;
00206 s3 = 3* ps2;
00207 <font class="comment">// t/dt.</font>
00208 t0 = pt12 * pt1;
00209 t1 = 3.0f * pt * pt12;
00210 t2 = 3.0f * pt2 * pt1;
00211 t3 = pt2 * pt;
00212
00213 tgtS.set(0,0,0);
00214 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[0] , s0 * t0);
00215 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[7] , s1 * t0);
00216 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[6] , s2 * t0);
00217 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[3] , s3 * t0);
00218 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[0] , s0 * t1);
00219 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[0], s1 * t1);
00220 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[3], s2 * t1);
00221 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[5] , s3 * t1);
00222 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[1] , s0 * t2);
00223 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[1], s1 * t2);
00224 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[2], s2 * t2);
00225 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[4] , s3 * t2);
00226 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[1] , s0 * t3);
00227 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[2] , s1 * t3);
00228 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[3] , s2 * t3);
00229 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[2] , s3 * t3);
00230
00231 <font class="comment">// Compute tangentT</font>
00232 <font class="comment">//=================</font>
00233 <font class="comment">// s/ds.</font>
00234 s0 = ps12 * ps1;
00235 s1 = 3.0f * ps * ps12;
00236 s2 = 3.0f * ps2 * ps1;
00237 s3 = ps2 * ps;
00238 <font class="comment">// t/dt.</font>
00239 t0 = -3* pt12;
00240 t1 = 9*pt2 + 3 -12*pt;
00241 t2 =-9*pt2 + 6*pt ;
00242 t3 = 3* pt2;
00243
00244 tgtT.set(0,0,0);
00245 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[0] , s0 * t0);
00246 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[7] , s1 * t0);
00247 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[6] , s2 * t0);
00248 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[3] , s3 * t0);
00249 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[0] , s0 * t1);
00250 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[0], s1 * t1);
00251 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[3], s2 * t1);
00252 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[5] , s3 * t1);
00253 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[1] , s0 * t2);
00254 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[1], s1 * t2);
00255 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[2], s2 * t2);
00256 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[4] , s3 * t2);
00257 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[1] , s0 * t3);
00258 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[2] , s1 * t3);
00259 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[3] , s2 * t3);
00260 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[2] , s3 * t3);
00261
00262
00263 <font class="comment">// Return the normal.</font>
00264 CVector norm= tgtT^tgtS;
00265 norm.normalize();
00266 <font class="keywordflow">return</font> norm;
00267 }
00268
00269
00270 <font class="comment">// ***************************************************************************</font>
<a name="l00271"></a><a class="code" href="classNL3D_1_1CBezierPatch.html#a7">00271</a> CVector CBezierPatch::evalTangentS(<font class="keywordtype">float</font> ps, <font class="keywordtype">float</font> pt)<font class="keyword"> const</font>
00272 <font class="keyword"></font>{
00273 CVector tgtS;
00274
00275 <font class="keywordtype">float</font> s0,s1,s2,s3;
00276 <font class="keywordtype">float</font> t0,t1,t2,t3;
00277 <font class="keywordtype">float</font> ps2 = ps * ps;
00278 <font class="keywordtype">float</font> ps1 = 1.0f - ps;
00279 <font class="keywordtype">float</font> ps12 = ps1 * ps1;
00280 <font class="keywordtype">float</font> pt2 = pt * pt;
00281 <font class="keywordtype">float</font> pt1 = 1.0f - pt;
00282 <font class="keywordtype">float</font> pt12 = pt1 * pt1;
00283
00284 <font class="comment">// Compute tangentS</font>
00285 <font class="comment">//=================</font>
00286 <font class="comment">// s/ds.</font>
00287 s0 = -3* ps12;
00288 s1 = 9*ps2 + 3 -12*ps;
00289 s2 =-9*ps2 + 6*ps ;
00290 s3 = 3* ps2;
00291 <font class="comment">// t/dt.</font>
00292 t0 = pt12 * pt1;
00293 t1 = 3.0f * pt * pt12;
00294 t2 = 3.0f * pt2 * pt1;
00295 t3 = pt2 * pt;
00296
00297 tgtS.set(0,0,0);
00298 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[0] , s0 * t0);
00299 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[7] , s1 * t0);
00300 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[6] , s2 * t0);
00301 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[3] , s3 * t0);
00302 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[0] , s0 * t1);
00303 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[0], s1 * t1);
00304 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[3], s2 * t1);
00305 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[5] , s3 * t1);
00306 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[1] , s0 * t2);
00307 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[1], s1 * t2);
00308 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[2], s2 * t2);
00309 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[4] , s3 * t2);
00310 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[1] , s0 * t3);
00311 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[2] , s1 * t3);
00312 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[3] , s2 * t3);
00313 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtS, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[2] , s3 * t3);
00314
00315 <font class="comment">// Return the tgt normalized</font>
00316 <font class="keywordflow">return</font> tgtS.normed();
00317 }
00318
00319
00320 <font class="comment">// ***************************************************************************</font>
<a name="l00321"></a><a class="code" href="classNL3D_1_1CBezierPatch.html#a8">00321</a> CVector CBezierPatch::evalTangentT(<font class="keywordtype">float</font> ps, <font class="keywordtype">float</font> pt)<font class="keyword"> const</font>
00322 <font class="keyword"></font>{
00323 CVector tgtT;
00324
00325 <font class="keywordtype">float</font> s0,s1,s2,s3;
00326 <font class="keywordtype">float</font> t0,t1,t2,t3;
00327 <font class="keywordtype">float</font> ps2 = ps * ps;
00328 <font class="keywordtype">float</font> ps1 = 1.0f - ps;
00329 <font class="keywordtype">float</font> ps12 = ps1 * ps1;
00330 <font class="keywordtype">float</font> pt2 = pt * pt;
00331 <font class="keywordtype">float</font> pt1 = 1.0f - pt;
00332 <font class="keywordtype">float</font> pt12 = pt1 * pt1;
00333
00334 <font class="comment">// Compute tangentT</font>
00335 <font class="comment">//=================</font>
00336 <font class="comment">// s/ds.</font>
00337 s0 = ps12 * ps1;
00338 s1 = 3.0f * ps * ps12;
00339 s2 = 3.0f * ps2 * ps1;
00340 s3 = ps2 * ps;
00341 <font class="comment">// t/dt.</font>
00342 t0 = -3* pt12;
00343 t1 = 9*pt2 + 3 -12*pt;
00344 t2 =-9*pt2 + 6*pt ;
00345 t3 = 3* pt2;
00346
00347 tgtT.set(0,0,0);
00348 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[0] , s0 * t0);
00349 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[7] , s1 * t0);
00350 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[6] , s2 * t0);
00351 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[3] , s3 * t0);
00352 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[0] , s0 * t1);
00353 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[0], s1 * t1);
00354 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[3], s2 * t1);
00355 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[5] , s3 * t1);
00356 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[1] , s0 * t2);
00357 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[1], s1 * t2);
00358 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[2], s2 * t2);
00359 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[4] , s3 * t2);
00360 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[1] , s0 * t3);
00361 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[2] , s1 * t3);
00362 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[3] , s2 * t3);
00363 <a class="code" href="namespaceNL3D.html#a317">mulAdd</a>(tgtT, <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[2] , s3 * t3);
00364
00365 <font class="comment">// Return the tgt normalized</font>
00366 <font class="keywordflow">return</font> tgtT.normed();
00367 }
00368
00369
00370 <font class="comment">// ***************************************************************************</font>
<a name="l00371"></a><a class="code" href="structNL3D_1_1CBezierPatch_1_1CBezierCurve.html#a0">00371</a> <font class="keywordtype">void</font> CBezierPatch::CBezierCurve::subdivide(CBezierCurve &left, CBezierCurve &right, <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>)
00372 {
00373 <font class="keywordtype">float</font> t1= 1-<a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>;
00374
00375 <font class="comment">// Subdivide the 2 curves.</font>
00376 left.P0= <a class="code" href="structNL3D_1_1CBezierPatch_1_1CBezierCurve.html#m0">P0</a>;
00377 right.P3= <a class="code" href="structNL3D_1_1CBezierPatch_1_1CBezierCurve.html#m3">P3</a>;
00378
00379 left.P1= t1*<a class="code" href="structNL3D_1_1CBezierPatch_1_1CBezierCurve.html#m0">P0</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>*<a class="code" href="structNL3D_1_1CBezierPatch_1_1CBezierCurve.html#m1">P1</a>;
00380 right.P2= t1*<a class="code" href="structNL3D_1_1CBezierPatch_1_1CBezierCurve.html#m2">P2</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>*<a class="code" href="structNL3D_1_1CBezierPatch_1_1CBezierCurve.html#m3">P3</a>;
00381 CVector middle12= t1*<a class="code" href="structNL3D_1_1CBezierPatch_1_1CBezierCurve.html#m1">P1</a> + <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>*<a class="code" href="structNL3D_1_1CBezierPatch_1_1CBezierCurve.html#m2">P2</a>;
00382
00383 left.P2= t1*left.P1 + <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>*middle12;
00384 right.P1= t1*middle12 + <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>*right.P2;
00385
00386 left.P3= right.P0= t1*left.P2 + <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>*right.P1;
00387 }
00388
00389
00390 <font class="comment">// ***************************************************************************</font>
<a name="l00391"></a><a class="code" href="classNL3D_1_1CBezierPatch.html#z386_0">00391</a> <font class="keywordtype">void</font> CBezierPatch::subdivideS(<a class="code" href="classNL3D_1_1CBezierPatch.html#a0">CBezierPatch</a> &left, <a class="code" href="classNL3D_1_1CBezierPatch.html#a0">CBezierPatch</a> &right, <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>)<font class="keyword"> const</font>
00392 <font class="keyword"></font>{
00393 CBezierCurve curveT[4];
00394 CBezierCurve curveTLeft[4];
00395 CBezierCurve curveTRight[4];
00396
00397 <font class="comment">// Setup horizontal curves.</font>
00398 curveT[0].set(<a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[0], <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[7] , <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[6] , <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[3]);
00399 curveT[1].set(<a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[0], <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[0], <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[3], <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[5]);
00400 curveT[2].set(<a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[1], <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[1], <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[2], <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[4]);
00401 curveT[3].set(<a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[1], <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[2] , <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[3] , <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[2]);
00402
00403 <font class="comment">// Subdivide curves.</font>
00404 <font class="keywordflow">for</font>(sint i=0;i<4;i++)
00405 curveT[i].subdivide(curveTLeft[i], curveTRight[i], <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>);
00406
00407 <font class="comment">// Setup bezier patchs.</font>
00408 <font class="comment">// left.</font>
00409 curveTLeft[0].get(left.Vertices[0], left.Tangents[7] , left.Tangents[6] , left.Vertices[3]);
00410 curveTLeft[1].get(left.Tangents[0], left.Interiors[0], left.Interiors[3], left.Tangents[5]);
00411 curveTLeft[2].get(left.Tangents[1], left.Interiors[1], left.Interiors[2], left.Tangents[4]);
00412 curveTLeft[3].get(left.Vertices[1], left.Tangents[2] , left.Tangents[3] , left.Vertices[2]);
00413 <font class="comment">// right.</font>
00414 curveTRight[0].get(right.Vertices[0], right.Tangents[7] , right.Tangents[6] , right.Vertices[3]);
00415 curveTRight[1].get(right.Tangents[0], right.Interiors[0], right.Interiors[3], right.Tangents[5]);
00416 curveTRight[2].get(right.Tangents[1], right.Interiors[1], right.Interiors[2], right.Tangents[4]);
00417 curveTRight[3].get(right.Vertices[1], right.Tangents[2] , right.Tangents[3] , right.Vertices[2]);
00418 }
00419
00420
00421 <font class="comment">// ***************************************************************************</font>
<a name="l00422"></a><a class="code" href="classNL3D_1_1CBezierPatch.html#z386_1">00422</a> <font class="keywordtype">void</font> CBezierPatch::subdivideT(CBezierPatch &top, CBezierPatch &bottom, <font class="keywordtype">float</font> <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>)<font class="keyword"> const</font>
00423 <font class="keyword"></font>{
00424 CBezierCurve curveS[4];
00425 CBezierCurve curveSTop[4];
00426 CBezierCurve curveSBottom[4];
00427
00428 <font class="comment">// Setup vertical curves.</font>
00429 curveS[0].set(<a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[0], <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[0] , <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[1] , <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[1]);
00430 curveS[1].set(<a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[7], <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[0], <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[1], <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[2]);
00431 curveS[2].set(<a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[6], <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[3], <a class="code" href="classNL3D_1_1CBezierPatch.html#m2">Interiors</a>[2], <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[3]);
00432 curveS[3].set(<a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[3], <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[5] , <a class="code" href="classNL3D_1_1CBezierPatch.html#m1">Tangents</a>[4] , <a class="code" href="classNL3D_1_1CBezierPatch.html#m0">Vertices</a>[2]);
00433
00434 <font class="comment">// Subdivide curves.</font>
00435 <font class="keywordflow">for</font>(sint i=0;i<4;i++)
00436 curveS[i].subdivide(curveSTop[i], curveSBottom[i], <a class="code" href="driver__opengl__extension__def_8h.html#a384">t</a>);
00437
00438 <font class="comment">// Setup bezier patchs.</font>
00439 <font class="comment">// top.</font>
00440 curveSTop[0].get(top.Vertices[0], top.Tangents[0] , top.Tangents[1] , top.Vertices[1]);
00441 curveSTop[1].get(top.Tangents[7], top.Interiors[0], top.Interiors[1], top.Tangents[2]);
00442 curveSTop[2].get(top.Tangents[6], top.Interiors[3], top.Interiors[2], top.Tangents[3]);
00443 curveSTop[3].get(top.Vertices[3], top.Tangents[5] , top.Tangents[4] , top.Vertices[2]);
00444 <font class="comment">// bottom.</font>
00445 curveSBottom[0].get(bottom.Vertices[0], bottom.Tangents[0] , bottom.Tangents[1] , bottom.Vertices[1]);
00446 curveSBottom[1].get(bottom.Tangents[7], bottom.Interiors[0], bottom.Interiors[1], bottom.Tangents[2]);
00447 curveSBottom[2].get(bottom.Tangents[6], bottom.Interiors[3], bottom.Interiors[2], bottom.Tangents[3]);
00448 curveSBottom[3].get(bottom.Vertices[3], bottom.Tangents[5] , bottom.Tangents[4] , bottom.Vertices[2]);
00449 }
00450
00451
00452
00453 } <font class="comment">// NL3D</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>
|