aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/a03765.html
blob: 2f5c2617f143f737403f22e7670b4eb82206fcb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>NeL: NL3D::CZoneTgtSmoother class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.6 -->
<div class="qindex">  <form class="search" action="search.php" method="get">
<a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="namespacemembers.html">Namespace&nbsp;Members</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a>  | <span class="search"><u>S</u>earch&nbsp;for&nbsp;<input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div>
<h1>NL3D::CZoneTgtSmoother Class Reference</h1><code>#include &lt;<a class="el" href="a06783.html">zone_tgt_smoother.h</a>&gt;</code>
<p>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A class used to make Vertices coplanar IN or/and across zones. <dl compact><dt><b>Author:</b></dt><dd>Lionel Berenguier <p>
Nevrax France </dd></dl>
<dl compact><dt><b>Date:</b></dt><dd>2000 </dd></dl>

<p>

<p>
Definition at line <a class="el" href="a06783.html#l00048">48</a> of file <a class="el" href="a06783.html">zone_tgt_smoother.h</a>.<table border=0 cellpadding=0 cellspacing=0>
<tr><td></td></tr>
<tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03765.html#NL3D_1_1CZoneTgtSmoothera0">CZoneTgtSmoother</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Constructor.  <a href="#NL3D_1_1CZoneTgtSmoothera0"></a><br><br></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>void&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03765.html#NL3D_1_1CZoneTgtSmoothera1">makeVerticesCoplanar</a> (std::vector&lt; <a class="el" href="a03738.html">CZoneInfo</a> &gt; &amp;zones)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Doit method. zones are modified. zones[0] is the center zones. Other are border zones.  <a href="#NL3D_1_1CZoneTgtSmoothera1"></a><br><br></td></tr>
<tr><td colspan=2><br><h2>Private Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top>typedef TVertexMap::iterator&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03765.html#NL3D_1_1CZoneTgtSmoothery0">ItVertexMap</a></td></tr>

<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map&lt; <a class="el" href="a04558.html#a14">sint</a>, <a class="el" href="a03768.html">CVertexInfo</a> &gt;&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03765.html#NL3D_1_1CZoneTgtSmoothery1">TVertexMap</a></td></tr>

<tr><td colspan=2><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03765.html#NL3D_1_1CZoneTgtSmoothery1">TVertexMap</a>&nbsp;</td><td class="memItemRight" valign=bottom><a class="el" href="a03765.html#NL3D_1_1CZoneTgtSmootherr0">VertexMap</a></td></tr>

</table>
<hr><h2>Member Typedef Documentation</h2>
<a class="anchor" name="NL3D_1_1CZoneTgtSmoothery0" doxytag="NL3D::CZoneTgtSmoother::ItVertexMap" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> typedef TVertexMap::iterator <a class="el" href="a03765.html#NL3D_1_1CZoneTgtSmoothery0">NL3D::CZoneTgtSmoother::ItVertexMap</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a06783.html#l00109">109</a> of file <a class="el" href="a06783.html">zone_tgt_smoother.h</a>.    </td>
  </tr>
</table>
<a class="anchor" name="NL3D_1_1CZoneTgtSmoothery1" doxytag="NL3D::CZoneTgtSmoother::TVertexMap" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> typedef std::map&lt;<a class="el" href="a04558.html#a14">sint</a>, <a class="el" href="a03768.html">CVertexInfo</a>&gt; <a class="el" href="a03765.html#NL3D_1_1CZoneTgtSmoothery1">NL3D::CZoneTgtSmoother::TVertexMap</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a06783.html#l00108">108</a> of file <a class="el" href="a06783.html">zone_tgt_smoother.h</a>.    </td>
  </tr>
</table>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="NL3D_1_1CZoneTgtSmoothera0" doxytag="NL3D::CZoneTgtSmoother::CZoneTgtSmoother" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> NL3D::CZoneTgtSmoother::CZoneTgtSmoother </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Constructor. 
<p>

<p>
Definition at line <a class="el" href="a06783.html#l00053">53</a> of file <a class="el" href="a06783.html">zone_tgt_smoother.h</a>.
<p>
<div class="fragment"><pre>00053 {}
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="NL3D_1_1CZoneTgtSmoothera1" doxytag="NL3D::CZoneTgtSmoother::makeVerticesCoplanar" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> void NL3D::CZoneTgtSmoother::makeVerticesCoplanar </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">std::vector&lt; <a class="el" href="a03738.html">CZoneInfo</a> &gt; &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>zones</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Doit method. zones are modified. zones[0] is the center zones. Other are border zones. 
<p>

<p>
Definition at line <a class="el" href="a06782.html#l00039">39</a> of file <a class="el" href="a06782.html">zone_tgt_smoother.cpp</a>.
<p>
References <a class="el" href="a06760.html#l00126">NL3D::CPatchInfo::BaseVertices</a>, <a class="el" href="a06760.html#l00236">NL3D::CPatchInfo::BindEdges</a>, <a class="el" href="a06760.html#l00068">NL3D::CBorderVertex::CurrentVertex</a>, <a class="el" href="a06783.html#l00078">NL3D::CZoneTgtSmoother::CTangentId::EdgeId</a>, <a class="el" href="a06760.html#l00192">NL3D::CPatchInfo::getSmoothFlag()</a>, <a class="el" href="a06783.html#l00069">NL3D::CZoneTgtSmoother::CPatchId::IdVert</a>, <a class="el" href="a05479.html#l00081">NL3D::CBezierPatch::Interiors</a>, <a class="el" href="a06760.html#l00072">NL3D::CBorderVertex::NeighborVertex</a>, <a class="el" href="a06760.html#l00070">NL3D::CBorderVertex::NeighborZoneId</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a06682.html#l00115">NLMISC::CVector::norm()</a>, <a class="el" href="a06783.html#l00100">NL3D::CZoneTgtSmoother::CVertexInfo::OnBorder</a>, <a class="el" href="a06760.html#l00120">NL3D::CPatchInfo::Patch</a>, <a class="el" href="a06783.html#l00067">NL3D::CZoneTgtSmoother::CPatchId::Patch</a>, <a class="el" href="a06783.html#l00077">NL3D::CZoneTgtSmoother::CTangentId::PatchId</a>, <a class="el" href="a06783.html#l00065">NL3D::CZoneTgtSmoother::CPatchId::PatchId</a>, <a class="el" href="a06783.html#l00080">NL3D::CZoneTgtSmoother::CTangentId::Patchs</a>, <a class="el" href="a06783.html#l00099">NL3D::CZoneTgtSmoother::CVertexInfo::Patchs</a>, <a class="el" href="a05981.html#l00104">sint</a>, <a class="el" href="a06783.html#l00082">NL3D::CZoneTgtSmoother::CTangentId::Tangent</a>, <a class="el" href="a05479.html#l00079">NL3D::CBezierPatch::Tangents</a>, <a class="el" href="a06783.html#l00076">NL3D::CZoneTgtSmoother::CTangentId::ZoneId</a>, and <a class="el" href="a06783.html#l00064">NL3D::CZoneTgtSmoother::CPatchId::ZoneId</a>.
<p>
<div class="fragment"><pre>00040 {
00041         <a class="code" href="a04558.html#a14">sint</a>    i,j, numZone;
00042         <a class="code" href="a04558.html#a14">sint</a>    centerZoneId;
00043 
00044         <a class="code" href="a04199.html#a6">nlassert</a>(zones.size()&gt;=1);
00045         centerZoneId= zones[0].ZoneId;
00046 
00047         <span class="comment">// 0. CenterZone.</span>
00048         <span class="comment">//===============</span>
00049         <span class="comment">// First, make connectivity patch/vertex</span>
00050         <span class="keywordflow">for</span>(i=0;i&lt;(<a class="code" href="a04558.html#a14">sint</a>)zones[0].Patchs.size();i++)
00051         {
00052                 CPatchInfo              &amp;pa= zones[0].Patchs[i];
00053 
00054                 <span class="keywordflow">for</span>(j=0;j&lt;4;j++)
00055                 {
00056                         <a class="code" href="a04558.html#a14">sint</a>    vtx= pa.BaseVertices[j];
00057                         CPatchId        pid;
00058                         pid.ZoneId= centerZoneId;
00059                         pid.PatchId= i;
00060                         pid.Patch= &amp;pa;
00061                         pid.IdVert= j;
00062                         <a class="code" href="a03765.html#NL3D_1_1CZoneTgtSmootherr0">VertexMap</a>[vtx].Patchs.push_back(pid);
00063                 }
00064         }
00065         <span class="comment">// Second, what vertices of this zone are one border?</span>
00066         <span class="keywordflow">for</span>(i=0;i&lt;(<a class="code" href="a04558.html#a14">sint</a>)zones[0].BorderVertices.size();i++)
00067         {
00068                 CBorderVertex   &amp;bv= zones[0].BorderVertices[i];
00069                 <a class="code" href="a04558.html#a14">sint</a>    vtx= bv.CurrentVertex;
00070                 <a class="code" href="a03765.html#NL3D_1_1CZoneTgtSmootherr0">VertexMap</a>[vtx].OnBorder= <span class="keyword">true</span>;
00071         }
00072 
00073         <span class="comment">// 1. Neighbor zones.</span>
00074         <span class="comment">//===================</span>
00075         map&lt;sint, sint&gt;         tempMap;
00076         <span class="keywordflow">for</span>(numZone= 1; numZone&lt;(<a class="code" href="a04558.html#a14">sint</a>)zones.size(); numZone++)
00077         {
00078                 <a class="code" href="a04558.html#a14">sint</a>    adjZoneId= zones[numZone].ZoneId;
00079 
00080                 tempMap.clear();
00081                 <span class="comment">// Tests which vertices points on the center zone.</span>
00082                 <span class="keywordflow">for</span>(i=0;i&lt;(<a class="code" href="a04558.html#a14">sint</a>)zones[numZone].BorderVertices.size();i++)
00083                 {
00084                         CBorderVertex   &amp;bv= zones[numZone].BorderVertices[i];
00085 
00086                         <span class="keywordflow">if</span>(bv.NeighborZoneId== centerZoneId)
00087                         {
00088                                 tempMap[bv.CurrentVertex]= bv.NeighborVertex;
00089                         }
00090                 }
00091                 <span class="comment">// Tests patchs which points on center zone.</span>
00092                 <span class="keywordflow">for</span>(i=0;i&lt;(<a class="code" href="a04558.html#a14">sint</a>)zones[numZone].Patchs.size();i++)
00093                 {
00094                         CPatchInfo              &amp;pa= zones[numZone].Patchs[i];
00095 
00096                         <span class="keywordflow">for</span>(j=0;j&lt;4;j++)
00097                         {
00098                                 <a class="code" href="a04558.html#a14">sint</a>    vtx= pa.BaseVertices[j];
00099                                 <span class="keywordflow">if</span>(tempMap.find(vtx)!=tempMap.end())
00100                                 {
00101                                         CPatchId        pid;
00102                                         pid.ZoneId= adjZoneId;
00103                                         pid.PatchId= i;
00104                                         pid.Patch= &amp;pa;
00105                                         pid.IdVert= j;
00106                                         <span class="comment">// Fill the vertex of the center zone.</span>
00107                                         <a class="code" href="a03765.html#NL3D_1_1CZoneTgtSmootherr0">VertexMap</a>[tempMap[vtx]].Patchs.push_back(pid);
00108                                 }
00109                         }
00110                 }
00111 
00112         }
00113 
00114         <span class="comment">// 2. Process each vertex.</span>
00115         <span class="comment">//========================</span>
00116         <a class="code" href="a03765.html#NL3D_1_1CZoneTgtSmoothery0">ItVertexMap</a>             itVert;
00117         <span class="keywordflow">for</span>(itVert= <a class="code" href="a03765.html#NL3D_1_1CZoneTgtSmootherr0">VertexMap</a>.begin(); itVert!=<a class="code" href="a03765.html#NL3D_1_1CZoneTgtSmootherr0">VertexMap</a>.end(); itVert++)
00118         {
00119                 CVertexInfo             &amp;vert= itVert-&gt;second;
00120 
00121                 <span class="comment">// a. verify if coplanar is possible.</span>
00122                 <span class="comment">//===================================</span>
00123 
00124                 <span class="comment">// \todo yoyo: later: do it too on non border vertices if wanted (with a normal threshold...).</span>
00125                 <span class="keywordflow">if</span>(!vert.OnBorder)
00126                         <span class="keywordflow">continue</span>;
00127                 <span class="comment">// \todo yoyo: later: formula with 3, 5 ... patchs around the vertex.</span>
00128                 <span class="keywordflow">if</span>(vert.Patchs.size()!=4)
00129                         <span class="keywordflow">continue</span>;
00130 
00131                 <span class="comment">// Test if there is no bind 1/x on this patch, around this vertex.</span>
00132                 <span class="comment">// \todo yoyo: later: binds should works...</span>
00133                 std::list&lt;CPatchId&gt;::iterator   itPatch;
00134                 <span class="keywordtype">bool</span>    bindFound= <span class="keyword">false</span>;
00135                 <span class="keywordflow">for</span>(itPatch= vert.Patchs.begin(); itPatch!= vert.Patchs.end(); itPatch++)
00136                 {
00137                         <span class="comment">// Tests the two edges around the vertex (before: e0, and after: e1).</span>
00138                         <a class="code" href="a04558.html#a14">sint</a>    e0= (itPatch-&gt;IdVert+4-1)%4;
00139                         <a class="code" href="a04558.html#a14">sint</a>    e1= itPatch-&gt;IdVert;
00140 
00141                         <span class="keywordflow">if</span>(itPatch-&gt;Patch-&gt;BindEdges[e0].NPatchs!= 1 || itPatch-&gt;Patch-&gt;BindEdges[e1].NPatchs!= 1)
00142                         {
00143                                 bindFound= <span class="keyword">true</span>;
00144                                 <span class="keywordflow">break</span>;
00145                         }
00146                 }
00147                 <span class="keywordflow">if</span>(bindFound)
00148                         <span class="keywordflow">continue</span>;
00149 
00150 
00151 
00152                 <span class="comment">// b. maps patchs on tangents.</span>
00153                 <span class="comment">//=========================</span>
00154                 vector&lt;CTangentId&gt;      tangents;
00155                 <span class="keywordflow">for</span>(itPatch= vert.Patchs.begin(); itPatch!= vert.Patchs.end(); itPatch++)
00156                 {
00157                         CPatchInfo              &amp;pa= *(itPatch-&gt;Patch);
00158                         <span class="comment">// The edges, before and after the veterx.</span>
00159                         <a class="code" href="a04558.html#a14">sint</a>    edgeNum[2]= {(itPatch-&gt;IdVert+4-1)%4, itPatch-&gt;IdVert };
00160                         <span class="comment">// The tangents, before and after the veterx.</span>
00161                         <a class="code" href="a04558.html#a14">sint</a>    tgtNum[2]=  {(itPatch-&gt;IdVert*2+8-1)%8, itPatch-&gt;IdVert*2 };
00162 
00163                         <span class="comment">// For the 2 edges around this vertex.</span>
00164                         <span class="keywordflow">for</span>(<a class="code" href="a04558.html#a14">sint</a> ed= 0; ed&lt;2;ed++)
00165                         {
00166                                 <a class="code" href="a04558.html#a14">sint</a>    patchId, zoneId, edgeId;
00167                                 <a class="code" href="a04558.html#a14">sint</a>    tgt;
00168 
00169                                 <span class="comment">// get neighbor edge id.</span>
00170                                 zoneId= pa.BindEdges[ edgeNum[ed] ].ZoneId;
00171                                 patchId= pa.BindEdges[ edgeNum[ed] ].Next[0];
00172                                 edgeId= pa.BindEdges[ edgeNum[ed] ].Edge[0];
00173                                 <span class="comment">// Search if tangent already inserted, mapped to this "neighbor edge".</span>
00174                                 <span class="keywordflow">for</span>(tgt= 0; tgt&lt;(<a class="code" href="a04558.html#a14">sint</a>)tangents.size();tgt++)
00175                                 {
00176                                         <span class="keywordflow">if</span>(tangents[tgt].ZoneId==zoneId &amp;&amp; tangents[tgt].PatchId==patchId &amp;&amp; tangents[tgt].EdgeId==edgeId)
00177                                                 <span class="keywordflow">break</span>;
00178                                 }
00179                                 <span class="comment">// If not found, add the tangent, and map ME to it.</span>
00180                                 <span class="keywordflow">if</span>(tgt==(<a class="code" href="a04558.html#a14">sint</a>)tangents.size())
00181                                 {
00182                                         CTangentId      tangent;
00183                                         <span class="comment">// Set OUR edge Id.</span>
00184                                         tangent.ZoneId= itPatch-&gt;ZoneId;
00185                                         tangent.PatchId= itPatch-&gt;PatchId;
00186                                         tangent.EdgeId= edgeNum[ed];
00187                                         <span class="comment">// Get the tangent, before or after the vertex.</span>
00188                                         tangent.Tangent= pa.Patch.Tangents[ tgtNum[ed] ];
00189                                         <span class="comment">// Which patchs this edge share. (0 is those which insert this tgt)</span>
00190                                         tangent.Patchs[0]= &amp;pa;
00191                                         tangents.push_back(tangent);
00192                                 }
00193                                 <span class="keywordflow">else</span>
00194                                 {
00195                                         <span class="comment">// Which patchs this edge share. (0 is those which access this tgt)</span>
00196                                         tangents[tgt].Patchs[1]= &amp;pa;
00197                                 }
00198                                 <span class="comment">// Map the patch to this tangent.</span>
00199                                 itPatch-&gt;Tangents[ed]= tgt;
00200 
00201                         }
00202                 }
00203 
00204                 <span class="comment">// There should be 4 tangents.</span>
00205                 <span class="keywordflow">if</span> (tangents.size()!=4)
00206                 {
00207                         <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"ERROR: vertex %d should have 4 tangents. It got %d. (MAXINDICES +1!!)"</span>, itVert-&gt;first, tangents.size());
00208                         <span class="keywordflow">continue</span>;
00209                 }
00210 
00211 
00212                 <span class="comment">// c. get the vertex.</span>
00213                 <span class="comment">//===================</span>
00214                 CVector         vertexValue;
00215                 itPatch= vert.Patchs.begin();
00216                 vertexValue= itPatch-&gt;Patch-&gt;Patch.Vertices[itPatch-&gt;IdVert];
00217 
00218 
00219                 <span class="comment">// d. project the tangents.</span>
00220                 <span class="comment">//=========================</span>
00221                 <span class="comment">// better coplanar than Max... (with orthogonal angles: use p0/p1).</span>
00222                 <span class="keywordflow">for</span>(i=0;i&lt;(<a class="code" href="a04558.html#a14">sint</a>)tangents.size();i++)
00223                 {
00224                         <span class="comment">// For following tangents, search the opposite.</span>
00225                         <span class="comment">// Begin at i+1 so we are sure to do this only one time.</span>
00226                         <span class="keywordflow">for</span>(j=i+1;j&lt;(<a class="code" href="a04558.html#a14">sint</a>)tangents.size();j++)
00227                         {
00228                                 <span class="keywordflow">if</span>(tangents[i].isOppositeOf(tangents[j]))
00229                                 {
00230                                         CVector         &amp;tgt0= tangents[i].Tangent;
00231                                         CVector         &amp;tgt1= tangents[j].Tangent;
00232                                         <span class="comment">// Colinear the tangents. Must keep the length of vectors.</span>
00233                                         <span class="keywordtype">float</span>           l0= (tgt0-vertexValue).norm();
00234                                         <span class="keywordtype">float</span>           l1= (tgt1-vertexValue).norm();
00235                                         <span class="comment">// Average the tangents. Normalize them before, to keep much as possible the orientation.</span>
00236                                         CVector         d0= (vertexValue-tgt0).normed();
00237                                         CVector         d1= (tgt1-vertexValue).normed();
00238                                         CVector         dir= (d0+d1).normed();
00239 
00240                                         <span class="comment">// Copy to tangents.</span>
00241                                         tgt0= vertexValue-dir*l0;
00242                                         tgt1= vertexValue+dir*l1;
00243                                 }
00244                         }
00245                 }
00246 
00247 
00248                 <span class="comment">// e. assign tangents to patchs, rebuild interior.</span>
00249                 <span class="comment">//==============================</span>
00250                 <span class="keywordflow">for</span>(itPatch= vert.Patchs.begin(); itPatch!= vert.Patchs.end(); itPatch++)
00251                 {
00252                         CPatchInfo              &amp;pa= *(itPatch-&gt;Patch);
00253                         <span class="comment">// The tangents, before and after the vertex.</span>
00254                         <a class="code" href="a04558.html#a14">sint</a>    tgtNum[2]=  {(itPatch-&gt;IdVert*2+8-1)%8, itPatch-&gt;IdVert*2 };
00255                         <a class="code" href="a04558.html#a14">sint</a>    t0= tgtNum[0];
00256                         <a class="code" href="a04558.html#a14">sint</a>    t1= tgtNum[1];
00257                         <a class="code" href="a04558.html#a14">sint</a>    smoothEdge0= pa.getSmoothFlag (t0/2);
00258                         <a class="code" href="a04558.html#a14">sint</a>    smoothEdge1= pa.getSmoothFlag (t1/2);
00259 
00260                         <span class="comment">// Smooth this edge ?</span>
00261                         <span class="keywordflow">if</span> (smoothEdge0)
00262                                 pa.Patch.Tangents[t0]= tangents[itPatch-&gt;Tangents[0]].Tangent;
00263                         <span class="keywordflow">if</span> (smoothEdge1)
00264                                 pa.Patch.Tangents[t1]= tangents[itPatch-&gt;Tangents[1]].Tangent;
00265 
00266                         <span class="comment">// Setup the coplanared interior. just the sum of 2 vector tangents.</span>
00267                         <span class="keywordflow">if</span> (smoothEdge0&amp;&amp;smoothEdge1)
00268                                 pa.Patch.Interiors[itPatch-&gt;IdVert]= pa.Patch.Tangents[t0] + pa.Patch.Tangents[t1] - vertexValue;
00269                 }
00270         }
00271 }
</pre></div>    </td>
  </tr>
</table>
<hr><h2>Field Documentation</h2>
<a class="anchor" name="NL3D_1_1CZoneTgtSmootherr0" doxytag="NL3D::CZoneTgtSmoother::VertexMap" ></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> <a class="el" href="a03765.html#NL3D_1_1CZoneTgtSmoothery1">TVertexMap</a> <a class="el" href="a03765.html#NL3D_1_1CZoneTgtSmootherr0">NL3D::CZoneTgtSmoother::VertexMap</a><code> [private]</code>
      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>

<p>
Definition at line <a class="el" href="a06783.html#l00112">112</a> of file <a class="el" href="a06783.html">zone_tgt_smoother.h</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a06783.html">zone_tgt_smoother.h</a><li><a class="el" href="a06782.html">zone_tgt_smoother.cpp</a></ul>
<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 08:36:40 2004 for NeL by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0 > 
</a>1.3.6 </small></address>
</body>
</html>