Moka libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
precodes-fc.icc
Go to the documentation of this file.
1 /*
2  * lib-extraction-images : Extraction de cartes à partir d'images 2D et 3D.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of lib-extraction-images
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
25 // Les précodes "faces coplanaires" utilisés pour extraire la carte de niveau 2
26 // Precodes fc1=>fc18
27 //******************************************************************************
28 
29 #include "image-3d.hh"
30 #include "pixel-step.hh"
31 
32 namespace GMap3d
33 {
34 //******************************************************************************
35 // Méthode générique utilisée pour les précodes fc1 -> fc9
36 INLINE
37 CDart* CExtractionImage::oneSameNeighboorFc( const CVertex & AVertex,
38  CDart* d1, CDart* fo1, CDart* fo2, int fusionCase )
39 // fusionCase = 1 : pour fusionner les faces incidentes à fo1
40 // 2 : pour fusionner les faces incidentes à fo2
41 // 3 : pour fusionner les deux couples de faces
42 {
43  CDart *d2,*d3,*d4, *t1, *t2, *t3, *t4, *t5, *t6;
44  CDart *g1,*g2,*g3, *c1,*c2,*c3;
45  CDart *tmp2;
46  CDart *tmp3;
47 
48  d2=(FMap->alpha01(d1));
49  d3=(FMap->alpha01(d2));
50  d4=(FMap->alpha01(d3));
51  CDart* newF=createFaceForExtract3d(AVertex);
52  FMap->unsew1(FMap->alpha0(d2));
53  FMap->unsew1(d2);
54 
55  if ( fusionCase & 1 ) // On va fusionner les 2 faces incidentes à fo1
56  {
57  t1=FMap->alpha1(fo1);
58  t2=FMap->alpha21(fo1);
59  t3=FMap->alpha021(fo1);
60  t4=FMap->alpha01(fo1);
61  t5=FMap->alpha2(d1);
62  t6=FMap->alpha2(fo1);
63 
64  FMap->unsew1(t1);
65  FMap->unsew1(t2);
66  FMap->unsew1(t3);
67  FMap->unsew1(t4);
68 
69  g3=newEdge();
70  g2=newEdge();
71  g1=newEdge();
72 
73  FMap->linkAlpha1(FMap->alpha0(g1),g2);
74  FMap->linkAlpha1(FMap->alpha0(g2),g3);
75 
76  FMap->topoSew3(t1,g1);
77 
78  FMap->unsew2(d1);
79 
80  FMap->unsew2(fo1);
81 
82  FMap->sew1(t1,t2);
83  FMap->sew1(t3,t4);
84 
85  FMap->delMapDart(FMap->alpha0(t6));
86  FMap->delMapDart(t6);
87 
88  FMap->delMapDart(FMap->alpha0(fo1));
89  FMap->delMapDart(fo1);
90 
91  FMap->delMapDart(FMap->alpha0(t5));
92  FMap->delMapDart(t5);
93  }
94  else // On ne fusionne pas les 2 faces incidentes à fo1
95  {
96  tmp2=createFaceForExtract3d();
97  t1=FMap->alpha2(d1);
98  FMap->unsew2(d1);
99  FMap->sew2(t1,tmp2);
100  FMap->sew3(tmp2,FMap->alpha0(fo1));
101 
102  g1=FMap->alpha01(tmp2);
103  g2=FMap->alpha01(g1);
104  g3=FMap->alpha01(g2);
105  }
106 //******************************************************************************
107 
108  if ( fusionCase & 2 ) // On va fusionner les 2 faces incidentes à fo2
109  {
110  t1=FMap->alpha1(fo2);
111  t2=FMap->alpha21(fo2);
112  t3=FMap->alpha021(fo2);
113  t4=FMap->alpha01(fo2);
114  t5=FMap->alpha2(d2);
115  t6=FMap->alpha2(fo2);
116 
117  FMap->unsew1(t1);
118  FMap->unsew1(t2);
119  FMap->unsew1(t3);
120  FMap->unsew1(t4);
121 
122  c3=newEdge();
123  c2=newEdge();
124  c1=newEdge();
125 
126  FMap->linkAlpha1(FMap->alpha0(c1),c2);
127  FMap->linkAlpha1(FMap->alpha0(c2),c3);
128 
129  FMap->topoSew3(c1,t1);
130 
131  FMap->unsew2(d2);
132  FMap->unsew2(fo2);
133 
134  FMap->sew1(t1,t2);
135  FMap->sew1(t3,t4);
136 
137  FMap->delMapDart(FMap->alpha0(t6));
138  FMap->delMapDart(t6);
139 
140  FMap->delMapDart(FMap->alpha0(fo2));
141  FMap->delMapDart(fo2);
142 
143  FMap->delMapDart(FMap->alpha0(t5));
144  FMap->delMapDart(t5);
145 
146  }
147  else // On ne fusionne pas les 2 faces incidentes à fo2
148  {
149  tmp3=createFaceForExtract3d();
150 
151  t2=FMap->alpha2(d2);
152 
153  FMap->unsew2(d2);
154  FMap->sew2(tmp3,t2);
155  FMap->sew3(FMap->alpha0(tmp3),fo2);
156  c1=FMap->alpha01(tmp3);
157  c2=FMap->alpha01(c1);
158  c3=FMap->alpha01(c2);
159  }
160 
161  closeFace(d3);
162  closeFace(d4,d1);
163  FMap->topoSew2(FMap->alpha0(g1),c3);
164  FMap->topoSew2(c1,FMap->alpha1(d3));
165  FMap->topoSew2(FMap->alpha01(d3),FMap->alpha1(d4));
166  FMap->sew2(FMap->alpha0(d1),g3);
167 
168  FMap->topoSew2(g2,FMap->alpha010(newF));
169  FMap->topoSew2(c2,FMap->alpha101(newF));
170  FMap->topoSew2(FMap->alpha0101(d3),FMap->alpha1(newF));
171  FMap->topoSew2(FMap->alpha101(d4),newF);
172 
173  FMap->delMapDart(FMap->alpha0(d2));
174  FMap->delMapDart(d2);
175 
176  return newF;
177 }
178 
179 
180 //******************************************************************************
182 INLINE
183 void CExtractionImage::precodeFc1( CDart* &last, CDart* up, CDart* behind, const CVertex & AVertex )
184 {
185 #ifdef DEBUG_EXTRACT_IMAGE
186  cout<<"CExtractionImage::precodeFc1...";cout.flush();
187 #endif
188 
189  last = FMap->alpha101(oneSameNeighboorFc( AVertex, FMap->alpha010(last), FMap->alpha010(up), FMap->alpha101(behind), 2 ));
190 
191 #ifdef DEBUG_EXTRACT_IMAGE
192  cout<<"OK\n";
193 #endif
194 }
195 
196 INLINE
197 void CExtractionImage::precodeFc4( CDart* &last, CDart* up, CDart* behind, const CVertex & AVertex )
198 {
199 #ifdef DEBUG_EXTRACT_IMAGE
200  cout<<"CExtractionImage::precodeFc4...";cout.flush();
201 #endif
202 
203  last = FMap->alpha101(oneSameNeighboorFc( AVertex, FMap->alpha010(last), FMap->alpha010(up), FMap->alpha101(behind), 1 ));
204 
205 #ifdef DEBUG_EXTRACT_IMAGE
206  cout<<"OK\n";
207 #endif
208 }
209 
210 INLINE
211 void CExtractionImage::precodeFc7( CDart* &last, CDart* up, CDart* behind, const CVertex & AVertex )
212 {
213 #ifdef DEBUG_EXTRACT_IMAGE
214  cout<<"CExtractionImage::precodeFc7...";cout.flush();
215 #endif
216 
217  last= FMap->alpha101(oneSameNeighboorFc( AVertex, FMap->alpha010(last), FMap->alpha010(up), FMap->alpha101(behind), 3 ));
218 
219 #ifdef DEBUG_EXTRACT_IMAGE
220  cout<<"OK\n";
221 #endif
222 }
223 
224 //******************************************************************************
226 INLINE
227 void CExtractionImage::precodeFc2( CDart* &last, CDart* up, CDart* behind, const CVertex & AVertex)
228 {
229 #ifdef DEBUG_EXTRACT_IMAGE
230  cout<<"CExtractionImage::precodeFc2...";cout.flush();
231 #endif
232 
233  last = FMap->alpha201(oneSameNeighboorFc( AVertex, FMap->alpha101(up), FMap->alpha010(behind), FMap->alpha010(last), 2 ));
234 
235 #ifdef DEBUG_EXTRACT_IMAGE
236  cout<<"OK\n";
237 #endif
238 }
239 
240 INLINE
241 void CExtractionImage::precodeFc5( CDart* &last, CDart* up, CDart* behind, const CVertex & AVertex )
242 {
243 #ifdef DEBUG_EXTRACT_IMAGE
244  cout<<"CExtractionImage::precodeFc5...";cout.flush();
245 #endif
246 
247  last = FMap->alpha201(oneSameNeighboorFc( AVertex, FMap->alpha101(up), FMap->alpha010(behind), FMap->alpha010(last), 1));
248 
249 #ifdef DEBUG_EXTRACT_IMAGE
250  cout<<"OK\n";
251 #endif
252 }
253 
254 INLINE
255 void CExtractionImage::precodeFc8( CDart* &last, CDart* up, CDart* behind, const CVertex & AVertex )
256 {
257 #ifdef DEBUG_EXTRACT_IMAGE
258  cout<<"CExtractionImage::precodeFc8...";cout.flush();
259 #endif
260 
261  last = FMap->alpha201(oneSameNeighboorFc( AVertex, FMap->alpha101(up), FMap->alpha010(behind), FMap->alpha010(last), 3));
262 
263 #ifdef DEBUG_EXTRACT_IMAGE
264  cout<<"OK\n";
265 #endif
266 }
267 
268 //******************************************************************************
270 INLINE
271 void CExtractionImage::precodeFc3( CDart* &last, CDart* up, CDart* behind, const CVertex & AVertex )
272 {
273 #ifdef DEBUG_EXTRACT_IMAGE
274  cout<<"CExtractionImage::precodeFc3...";cout.flush();
275 #endif
276 
277  last = FMap->alpha12101(oneSameNeighboorFc( AVertex, FMap->alpha101(behind), FMap->alpha0(last), FMap->alpha101(up), 2 ));
278 
279 #ifdef DEBUG_EXTRACT_IMAGE
280  cout<<"OK\n";
281 #endif
282 }
283 
284 INLINE
285 void CExtractionImage::precodeFc6( CDart* &last, CDart* up, CDart* behind, const CVertex & AVertex )
286 {
287 #ifdef DEBUG_EXTRACT_IMAGE
288  cout<<"CExtractionImage::precodeFc6...";cout.flush();
289 #endif
290 
291  last = FMap->alpha12101(oneSameNeighboorFc( AVertex, FMap->alpha101(behind), FMap->alpha0(last), FMap->alpha101(up), 1 ));
292 
293 #ifdef DEBUG_EXTRACT_IMAGE
294  cout<<"OK\n";
295 #endif
296 }
297 
298 INLINE
299 void CExtractionImage::precodeFc9( CDart* &last, CDart* up, CDart* behind, const CVertex & AVertex)
300 {
301 #ifdef DEBUG_EXTRACT_IMAGE
302  cout<<"CExtractionImage::precodeFc9...";cout.flush();
303 #endif
304 
305  last = FMap->alpha12101(oneSameNeighboorFc( AVertex, FMap->alpha101(behind), FMap->alpha0(last), FMap->alpha101(up), 3 ));
306 
307 #ifdef DEBUG_EXTRACT_IMAGE
308  cout<<"OK\n";
309 #endif
310 }
311 
312 //******************************************************************************
313 // Méthode générique utilisée pour les précodes fc10 -> fc18
314 INLINE
315 CDart* CExtractionImage::twoSameNeighboorFc1( const CVertex & AVertex, CDart* d1, CDart* d5, CDart* fo )
316 // On va fusionner les deux faces incidentes au brin frontOf
317 {
318  CDart *d2,*d3,*d4,*d6,*d7,*d8, *t1, *t2, *t3, *t4, *t5, *t6;
319  CDart *g1,*g2,*g3;
320  CDart *tmp3;
321  CDart *s1, *s2;
322 
323  d2=FMap->alpha01(d1);
324  d3=FMap->alpha01(d2);
325  d4=FMap->alpha01(d3);
326  d6=FMap->alpha01(d5);
327  d7=FMap->alpha01(d6);
328  d8=FMap->alpha01(d7);
329 
330  tmp3=FMap->alpha2(d6);
331 
332  if (FMap->alpha2(d1) != FMap->alpha0(d5))
333  {
334  s1 = FMap->alpha2(d1);
335  s2 = FMap->alpha02(d5);
336  FMap->unsew2(d1);
337  FMap->unsew2(d5);
338  FMap->sew2(s1,s2);
339  }
340 
341  t1=FMap->alpha1(fo);
342  t2=FMap->alpha21(fo);
343  t3=FMap->alpha021(fo);
344  t4=FMap->alpha01(fo);
345  t5=FMap->alpha2(d4);
346  t6=FMap->alpha2(fo);
347 
348  FMap->unsew1(t1);
349  FMap->unsew1(t2);
350  FMap->unsew1(t3);
351  FMap->unsew1(t4);
352 
353  g3=newEdge();
354  g2=newEdge();
355  g1=newEdge();
356 
357  FMap->linkAlpha1(FMap->alpha0(g1),g2);
358  FMap->linkAlpha1(FMap->alpha0(g2),g3);
359 
360  FMap->topoSew3(t1,g1);
361 
362  FMap->unsew1(FMap->alpha0(d1));
363  FMap->unsew1(d1);
364  FMap->unsew1(FMap->alpha0(d5));
365  FMap->unsew1(d5);
366  FMap->unsew1(d7);
367 
368  FMap->unsew2(d6);
369 
370  FMap->unsew2(d4);
371 
372  FMap->sew1(t1,t2);
373  FMap->sew1(t3,t4);
374 
375  FMap->delMapDart(FMap->alpha0(t6));
376  FMap->delMapDart((t6));
377 
378  FMap->delMapDart(FMap->alpha0(fo));
379  FMap->delMapDart(fo);
380 
381  FMap->delMapDart(FMap->alpha0(t5));
382  FMap->delMapDart(t5);
383 
384  closeFace(d3,d4);
385  closeFace(d7);
386  closeFace(d8,d2);
387 
388  FMap->delMapDart(FMap->alpha0(d1));
389  FMap->delMapDart(d1);
390 
391  FMap->delMapDart(FMap->alpha0(d5));
392  FMap->delMapDart(d5);
393 
394  FMap->delMapDart(FMap->alpha0(d6));
395  FMap->delMapDart(d6);
396 
397  FMap->topoSew2(g2,FMap->alpha1(d7));
398  FMap->sew2(FMap->alpha0(d4),g3);
399  FMap->topoSew2(FMap->alpha01(d7),FMap->alpha1(d8));
400  FMap->topoSew2(FMap->alpha01(d4),FMap->alpha101(d7));
401  FMap->topoSew2(FMap->alpha1(d3),FMap->alpha0101(d8));
402 
403  FMap->topoSew2(tmp3,g1);
404 
405  FMap->setVertex(FMap->alpha010(d7), new CAttributeVertex(AVertex.getX()*STEP3D_X,
406  AVertex.getY()*STEP3D_Y,
407  AVertex.getZ()*STEP3D_Z));
408 
409  return d7;
410 }
411 
412 
413 INLINE
414 CDart* CExtractionImage::twoSameNeighboorFc2( const CVertex & AVertex, CDart* d1, CDart* d5, CDart* fo )
415 {
416  CDart *d2,*d3,*d4,*d6,*d7,*d8, *t1, *t2, *t3, *t4, *t5, *t6;
417  CDart *c1,*c2,*c3;
418  CDart *tmp3;
419  CDart *s1, *s2, *fob;
420 
421  d2 = FMap->alpha01(d1);
422  d3 = FMap->alpha01(d2);
423  d4 = FMap->alpha01(d3);
424  d6 = FMap->alpha01(d5);
425  d7 = FMap->alpha01(d6);
426  d8 = FMap->alpha01(d7);
427 
428  tmp3=FMap->alpha2(d4);
429 
430  if (FMap->alpha2(d1) != FMap->alpha0(d5))
431  {
432  s1 = FMap->alpha2(d1);
433  s2 = FMap->alpha02(d5);
434  FMap->unsew2(d1);
435  FMap->unsew2(d5);
436  FMap->sew2(s1,s2);
437  }
438 
439  t1 = fo;
440  t2 = FMap->alpha121(fo);
441  t3 = FMap->alpha1021(fo);
442  t4 = FMap->alpha101(fo);
443  t5 = FMap->alpha2(d6);
444  t6 = FMap->alpha12(fo);
445  fob = FMap->alpha1(fo);
446 
447  FMap->unsew1(t1);
448  FMap->unsew1(t2);
449  FMap->unsew1(t3);
450  FMap->unsew1(t4);
451 
452  c3=newEdge();
453  c2=newEdge();
454  c1=newEdge();
455 
456  FMap->linkAlpha1(FMap->alpha0(c1),c2);
457  FMap->linkAlpha1(FMap->alpha0(c2),c3);
458 
459  FMap->sew3(t1,c1);
460 
461  FMap->unsew1(FMap->alpha0(d1));
462  FMap->unsew1(d1);
463  FMap->unsew1(FMap->alpha0(d5));
464  FMap->unsew1(d5);
465  FMap->unsew1(d7);
466 
467  FMap->unsew1(d8);
468  FMap->unsew1(d3);
469  FMap->unsew2(d6);
470  FMap->unsew2(d4);
471 
472  FMap->sew1(t1,t2);
473  FMap->sew1(t3,t4);
474 
475  FMap->delMapDart(FMap->alpha0(t6));
476  FMap->delMapDart(t6);
477  FMap->delMapDart(FMap->alpha0(fob));
478  FMap->delMapDart(fob);
479  FMap->delMapDart(FMap->alpha0(t5));
480  FMap->delMapDart(t5);
481 
482  closeFace(d3,d4);//
483  closeFace(d7);
484  closeFace(d8,d2);
485 
486  FMap->delMapDart(FMap->alpha0(d1));
487  FMap->delMapDart(d1);
488  FMap->delMapDart(FMap->alpha0(d5));
489  FMap->delMapDart(d5);
490  FMap->delMapDart(FMap->alpha0(d6));
491  FMap->delMapDart(d6);
492 
493  FMap->topoSew2(c3,FMap->alpha10(d7));
494  FMap->sew2(d4,c2);
495  FMap->topoSew2(FMap->alpha01(d7),FMap->alpha1(d8));
496  FMap->topoSew2(FMap->alpha01(d4),FMap->alpha101(d7));
497  FMap->topoSew2(FMap->alpha1(d3),FMap->alpha01(d2));
498  FMap->topoSew2(tmp3,FMap->alpha0(c1));
499 
500  FMap->setVertex(FMap->alpha010(d7), new CAttributeVertex(AVertex.getX()*STEP3D_X,
501  AVertex.getY()*STEP3D_Y,
502  AVertex.getZ()*STEP3D_Z));
503 
504  return d7;
505 }
506 
507 INLINE
508 CDart* CExtractionImage::twoSameNeighboorFc3( const CVertex & AVertex, CDart* d1, CDart* d5, CDart* fo )
509 {
510  CDart *d2,*d3,*d4,*d6,*d7,*d8, *t1, *t2, *t3, *t4, *t5, *t6;
511  CDart *g1,*g2;
512  CDart *tmp3, *tmp4, *fob, *fot, *fo1, *fo0;
513  CDart *s1, *s2;
514 
515  d2 = FMap->alpha01(d1);
516  d3 = FMap->alpha01(d2);
517  d4 = FMap->alpha01(d3);
518  d6 = FMap->alpha01(d5);
519  d7 = FMap->alpha01(d6);
520  d8 = FMap->alpha01(d7);
521 
522  tmp3=FMap->alpha2(d6);
523  tmp4=FMap->alpha2(d4);
524 
525  fob=FMap->alpha2(fo);
526  fot=FMap->alpha12(fo);
527  fo1=FMap->alpha1(fo);
528  fo0=(fo);
529 
530  if (FMap->alpha2(d1) != FMap->alpha0(d5))
531  {
532  s1 = FMap->alpha2(d1);
533  s2 = FMap->alpha02(d5);
534  FMap->unsew2(d1);
535  FMap->unsew2(d5);
536  FMap->sew2(s1,s2);
537  }
538 
539  t3=FMap->alpha021(fo);
540  t4=FMap->alpha01(fo);
541  t5=FMap->alpha101(fo);
542  t6=FMap->alpha1021(fo);
543  t1=FMap->alpha121(fo);
544 
545  if (t1!=fob)
546  {
547  t1=FMap->alpha121(fo);
548  t2=FMap->alpha21(fo);
549  FMap->unsew1(t1);
550  FMap->unsew1(t2);
551  FMap->sew1(t1,t2);
552  }
553 
554  FMap->unsew1(t3);
555  FMap->unsew1(t4);
556  FMap->unsew1(t5);
557  FMap->unsew1(t6);
558  FMap->unsew1(fo0);
559 
560  g2=newEdge();
561  g1=newEdge();
562 
563  FMap->linkAlpha1(FMap->alpha0(g1),g2);
564 
565  FMap->topoSew3(t4,g1);
566 
567  FMap->unsew1(FMap->alpha0(d1));
568  FMap->unsew1(d1);
569  FMap->unsew1(FMap->alpha0(d5));
570  FMap->unsew1(d5);
571  FMap->unsew1(d7);
572 
573  FMap->unsew2(d6);
574  FMap->unsew2(fob);
575  FMap->unsew2(fot);
576  FMap->unsew2(d4);
577 
578  FMap->sew1(t3,t4);
579  FMap->sew1(t5,t6);
580 
581  FMap->delMapDart(FMap->alpha0(fo0));
582  FMap->delMapDart(fo0);
583 
584  FMap->delMapDart(FMap->alpha0(fo1));
585  FMap->delMapDart(fo1);
586 
587  FMap->delMapDart(FMap->alpha0(tmp4));
588  FMap->delMapDart(tmp4);
589 
590  FMap->delMapDart(FMap->alpha0(tmp3));
591  FMap->delMapDart(tmp3);
592 
593  closeFace(d3,d4);
594  closeFace(d7);
595  closeFace(d8,d2);
596 
597  FMap->delMapDart(FMap->alpha0(d1));
598  FMap->delMapDart(d1);
599 
600  FMap->delMapDart(FMap->alpha0(d5));
601  FMap->delMapDart(d5);
602 
603  FMap->delMapDart(FMap->alpha0(d6));
604  FMap->delMapDart(d6);
605 
606  FMap->delMapDart(FMap->alpha0(fob));
607  FMap->delMapDart(fob);
608 
609  FMap->delMapDart(FMap->alpha0(fot));
610  FMap->delMapDart(fot);
611 
612  FMap->topoSew2(g2,FMap->alpha10(d7));
613  FMap->sew2(d4,g1);
614  FMap->topoSew2(FMap->alpha01(d7),FMap->alpha1(d8));
615  FMap->topoSew2(FMap->alpha01(d4),FMap->alpha101(d7));
616  FMap->topoSew2(FMap->alpha1(d3),FMap->alpha0101(d8));
617 
618  FMap->setVertex(FMap->alpha010(d7), new CAttributeVertex(AVertex.getX()*STEP3D_X,
619  AVertex.getY()*STEP3D_Y,
620  AVertex.getZ()*STEP3D_Z));
621  return d7;
622 }
623 
624 //******************************************************************************
626 INLINE
627 void CExtractionImage::precodeFc10( CDart* &last, CDart* up, CDart* behind, const CVertex & AVertex )
628 {
629 #ifdef DEBUG_EXTRACT_IMAGE
630  cout<<"CExtractionImage::precodeFc10...";cout.flush();
631 #endif
632 
633  last = FMap->alpha0(twoSameNeighboorFc2( AVertex, FMap->alpha0(last), FMap->alpha101(behind), FMap->alpha010(up) ));
634 
635 #ifdef DEBUG_EXTRACT_IMAGE
636  cout<<"OK\n";
637 #endif
638 }
639 
640 INLINE
641 void CExtractionImage::precodeFc13( CDart* &last, CDart* up, CDart* behind, const CVertex & AVertex )
642 {
643 #ifdef DEBUG_EXTRACT_IMAGE
644  cout<<"CExtractionImage::precodeFc13...";cout.flush();
645 #endif
646 
647  last = FMap->alpha0(twoSameNeighboorFc1( AVertex, FMap->alpha0(last), FMap->alpha101(behind), FMap->alpha010(up) ));
648 
649 #ifdef DEBUG_EXTRACT_IMAGE
650  cout<<"OK\n";
651 #endif
652 }
653 
654 INLINE
655 void CExtractionImage::precodeFc16( CDart* &last, CDart* up, CDart* behind, const CVertex &AVertex )
656 {
657 #ifdef DEBUG_EXTRACT_IMAGE
658  cout<<"CExtractionImage::precodeFc16...";cout.flush();
659 #endif
660 
661  last = FMap->alpha0(twoSameNeighboorFc3( AVertex, FMap->alpha0(last), FMap->alpha101(behind), FMap->alpha010(up) ));
662 
663 #ifdef DEBUG_EXTRACT_IMAGE
664  cout<<"OK\n";
665 #endif
666 }
667 
668 //******************************************************************************
670 INLINE
671 void CExtractionImage::precodeFc11( CDart* &last, CDart* up, CDart* behind, const CVertex &AVertex )
672 {
673 #ifdef DEBUG_EXTRACT_IMAGE
674  cout<<"CExtractionImage::precodeFc11...";cout.flush();
675 #endif
676 
677  last = FMap->alpha10121(twoSameNeighboorFc2( AVertex, FMap->alpha010(up), FMap->alpha010(last), FMap->alpha010(behind) ));
678 
679 #ifdef DEBUG_EXTRACT_IMAGE
680  cout<<"OK\n";
681 #endif
682 }
683 
684 INLINE
685 void CExtractionImage::precodeFc14( CDart* &last, CDart* up, CDart* behind, const CVertex &AVertex )
686 {
687 #ifdef DEBUG_EXTRACT_IMAGE
688  cout<<"CExtractionImage::precodeFc14...";cout.flush();
689 #endif
690 
691  last = FMap->alpha10121(twoSameNeighboorFc1( AVertex, FMap->alpha010(up), FMap->alpha010(last), FMap->alpha010(behind) ));
692 
693 #ifdef DEBUG_EXTRACT_IMAGE
694  cout<<"OK\n";
695 #endif
696 }
697 
698 INLINE
699 void CExtractionImage::precodeFc17( CDart* &last, CDart* up, CDart* behind, const CVertex &AVertex )
700 {
701 #ifdef DEBUG_EXTRACT_IMAGE
702  cout<<"CExtractionImage::precodeFc17...";cout.flush();
703 #endif
704 
705  last = FMap->alpha10121(twoSameNeighboorFc3( AVertex, FMap->alpha010(up), FMap->alpha010(last), FMap->alpha010(behind) ));
706 
707 #ifdef DEBUG_EXTRACT_IMAGE
708  cout<<"OK\n";
709 #endif
710 }
711 
712 //******************************************************************************
714 INLINE
715 void CExtractionImage::precodeFc12( CDart* &last, CDart* up, CDart* behind, const CVertex &AVertex )
716 {
717 #ifdef DEBUG_EXTRACT_IMAGE
718  cout<<"CExtractionImage::precodeFc12...";cout.flush();
719 #endif
720 
721  last = FMap->alpha0102101(twoSameNeighboorFc2( AVertex, FMap->alpha010(behind), FMap->alpha101(up), FMap->alpha0(last) ));
722 
723 #ifdef DEBUG_EXTRACT_IMAGE
724  cout<<"OK\n";
725 #endif
726 }
727 
728 
729 INLINE
730 void CExtractionImage::precodeFc15( CDart* &last, CDart* up, CDart* behind, const CVertex &AVertex )
731 {
732 #ifdef DEBUG_EXTRACT_IMAGE
733  cout<<"CExtractionImage::precodeFc15...";cout.flush();
734 #endif
735 
736  last = FMap->alpha0102101(twoSameNeighboorFc1( AVertex, FMap->alpha010(behind), FMap->alpha101(up), FMap->alpha0(last) ));
737 
738 #ifdef DEBUG_EXTRACT_IMAGE
739  cout<<"OK\n";
740 #endif
741 }
742 
743 INLINE
744 void CExtractionImage::precodeFc18( CDart* &last, CDart* up, CDart* behind, const CVertex &AVertex )
745 {
746 #ifdef DEBUG_EXTRACT_IMAGE
747  cout<<"CExtractionImage::precodeFc18...";cout.flush();
748 #endif
749 
750  last = FMap->alpha0102101(twoSameNeighboorFc3( AVertex, FMap->alpha010(behind), FMap->alpha101(up), FMap->alpha0(last) ));
751 
752 #ifdef DEBUG_EXTRACT_IMAGE
753  cout<<"OK\n";
754 #endif
755 }
756 
757 //******************************************************************************
758 INLINE
759 void CExtractionImage::subcasePrecodeFc1 ( CImage3d & image,
760  unsigned int x, unsigned int y,
761  CDart* &last, CDart* up, CDart* behind,
762  int level, const CVertex & AVertex, int FictiveMark,
763  bool keepFictiveEdges, bool shiftFictiveEdges )
764 {
765  precodeFc1(last,up,behind,AVertex);
766 }
767 
768 INLINE
769 void CExtractionImage::subcasePrecodeFc2 ( CImage3d & image,
770  unsigned int x, unsigned int y,
771  CDart* &last, CDart* up, CDart* behind,
772  int level, const CVertex & AVertex, int FictiveMark,
773  bool keepFictiveEdges, bool shiftFictiveEdges )
774 {
775  precodeFc2(last,up,behind,AVertex);
776 }
777 
778 INLINE
779 void CExtractionImage::subcasePrecodeFc3 ( CImage3d & image,
780  unsigned int x, unsigned int y,
781  CDart* &last, CDart* up, CDart* behind,
782  int level, const CVertex & AVertex, int FictiveMark,
783  bool keepFictiveEdges, bool shiftFictiveEdges )
784 {
785  precodeFc3(last,up,behind,AVertex);
786 }
787 
788 INLINE
789 void CExtractionImage::subcasePrecodeFc4 ( CImage3d & image,
790  unsigned int x, unsigned int y,
791  CDart* &last, CDart* up, CDart* behind,
792  int level, const CVertex & AVertex, int FictiveMark,
793  bool keepFictiveEdges, bool shiftFictiveEdges )
794 {
795  precodeFc4(last,up,behind,AVertex);
796 }
797 
798 INLINE
799 void CExtractionImage::subcasePrecodeFc5 ( CImage3d & image,
800  unsigned int x, unsigned int y,
801  CDart* &last, CDart* up, CDart* behind,
802  int level, const CVertex & AVertex, int FictiveMark,
803  bool keepFictiveEdges, bool shiftFictiveEdges )
804 {
805  precodeFc5(last,up,behind,AVertex);
806 }
807 
808 INLINE
809 void CExtractionImage::subcasePrecodeFc6 ( CImage3d & image,
810  unsigned int x, unsigned int y,
811  CDart* &last, CDart* up, CDart* behind,
812  int level, const CVertex & AVertex, int FictiveMark,
813  bool keepFictiveEdges, bool shiftFictiveEdges )
814 {
815  precodeFc6(last,up,behind,AVertex);
816 }
817 
818 INLINE
819 void CExtractionImage::subcasePrecodeFc7 ( CImage3d & image,
820  unsigned int x, unsigned int y,
821  CDart* &last, CDart* up, CDart* behind,
822  int level, const CVertex & AVertex, int FictiveMark,
823  bool keepFictiveEdges, bool shiftFictiveEdges )
824 {
825  if (level==2)
826  precodeFc7(last,up,behind,AVertex);
827  else
828  {
829  if ( image.sameVoxelUpbehindLeft(x,y) )
830  subcasePrecodesF1F4F7F10(image,x,y,last,up,behind,level,AVertex,
831  FictiveMark,keepFictiveEdges, shiftFictiveEdges);
832  else
833  precodeFc7(last,up,behind,AVertex);
834  }
835 }
836 
837 INLINE
838 void CExtractionImage::subcasePrecodeFc8 ( CImage3d & image,
839  unsigned int x, unsigned int y,
840  CDart* &last, CDart* up, CDart* behind,
841  int level, const CVertex & AVertex, int FictiveMark,
842  bool keepFictiveEdges, bool shiftFictiveEdges )
843 {
844  if (level==2)
845  precodeFc8(last,up,behind,AVertex);
846  else
847  {
848  if ( image.sameVoxelLeftbehindUp(x,y) )
849  subcasePrecodesF2F5F8F11(image,x,y,last,up,behind,level,AVertex,
850  FictiveMark,keepFictiveEdges, shiftFictiveEdges);
851  else
852  precodeFc8(last,up,behind,AVertex);
853  }
854 }
855 
856 INLINE
857 void CExtractionImage::subcasePrecodeFc9 ( CImage3d & image,
858  unsigned int x, unsigned int y,
859  CDart* &last, CDart* up, CDart* behind,
860  int level, const CVertex & AVertex, int FictiveMark,
861  bool keepFictiveEdges, bool shiftFictiveEdges )
862 {
863  if (level==2)
864  precodeFc9(last,up,behind,AVertex);
865  else
866  {
867  if ( image.sameVoxelLeftupBehind(x,y) )
868  subcasePrecodesF3F6F9F12(image,x,y,last,up,behind,level,AVertex,
869  FictiveMark,keepFictiveEdges, shiftFictiveEdges);
870  else
871  precodeFc9(last,up,behind,AVertex);
872  }
873 }
874 
875 INLINE
876 void CExtractionImage::subcasePrecodeFc10( CImage3d & image,
877  unsigned int x, unsigned int y,
878  CDart* &last, CDart* up, CDart* behind,
879  int level, const CVertex & AVertex, int FictiveMark,
880  bool keepFictiveEdges, bool shiftFictiveEdges )
881 {
882  if (level==2)
883  precodeFc10(last,up,behind,AVertex);
884  else
885  {
886  if ( image.sameVoxelLeftBehind(x,y) &&
887  image.sameVoxelLeftupBehind(x,y) )
888  subcasePrecodesF16F22(image,x,y,last,up,behind,level,AVertex,
889  FictiveMark,keepFictiveEdges, shiftFictiveEdges);
890  else
891  precodeFc10(last,up,behind,AVertex);
892  }
893 }
894 
895 INLINE
896 void CExtractionImage::subcasePrecodeFc11( CImage3d & image,
897  unsigned int x, unsigned int y,
898  CDart* &last, CDart* up, CDart* behind,
899  int level, const CVertex & AVertex, int FictiveMark,
900  bool keepFictiveEdges, bool shiftFictiveEdges )
901 {
902  if (level==2)
903  precodeFc11(last,up,behind,AVertex);
904  else
905  {
906  if ( image.sameVoxelUpLeft(x,y) &&
907  image.sameVoxelUpbehindLeft(x,y) )
908  subcasePrecodesF17F23(image,x,y,last,up,behind,level,AVertex,
909  FictiveMark,keepFictiveEdges, shiftFictiveEdges);
910  else
911  precodeFc11(last,up,behind,AVertex);
912  }
913 }
914 
915 INLINE
916 void CExtractionImage::subcasePrecodeFc12( CImage3d & image,
917  unsigned int x, unsigned int y,
918  CDart* &last, CDart* up, CDart* behind,
919  int level, const CVertex & AVertex, int FictiveMark,
920  bool keepFictiveEdges, bool shiftFictiveEdges )
921 {
922  if (level==2)
923  precodeFc12(last,up,behind,AVertex);
924  else
925  {
926  if ( image.sameVoxelBehindUp(x,y) &&
927  image.sameVoxelLeftbehindUp(x,y) )
928  subcasePrecodesF18F24(image,x,y,last,up,behind,level,AVertex,
929  FictiveMark,keepFictiveEdges, shiftFictiveEdges);
930  else
931  precodeFc12(last,up,behind,AVertex);
932  }
933 }
934 
935 INLINE
936 void CExtractionImage::subcasePrecodeFc13( CImage3d & image,
937  unsigned int x, unsigned int y,
938  CDart* &last, CDart* up, CDart* behind,
939  int level, const CVertex & AVertex, int FictiveMark,
940  bool keepFictiveEdges, bool shiftFictiveEdges )
941 {
942  if (level==2)
943  precodeFc13(last,up,behind,AVertex);
944  else
945  {
946  if ( image.sameVoxelBehindLeft(x,y) &&
947  image.sameVoxelUpbehindLeft(x,y) )
948  subcasePrecodesF13F19(image,x,y,last,up,behind,level,AVertex,
949  FictiveMark,keepFictiveEdges, shiftFictiveEdges);
950  else
951  precodeFc13(last,up,behind,AVertex);
952  }
953 }
954 
955 INLINE
956 void CExtractionImage::subcasePrecodeFc14( CImage3d & image,
957  unsigned int x, unsigned int y,
958  CDart* &last, CDart* up, CDart* behind,
959  int level, const CVertex & AVertex, int FictiveMark,
960  bool keepFictiveEdges, bool shiftFictiveEdges )
961 {
962  if (level==2)
963  precodeFc14(last,up,behind,AVertex);
964  else
965  {
966  if ( image.sameVoxelLeftUp(x,y) &&
967  image.sameVoxelLeftbehindUp(x,y) )
968  subcasePrecodesF14F20(image,x,y,last,up,behind,level,AVertex,
969  FictiveMark,keepFictiveEdges, shiftFictiveEdges);
970  else
971  precodeFc14(last,up,behind,AVertex);
972  }
973 }
974 
975 INLINE
976 void CExtractionImage::subcasePrecodeFc15( CImage3d & image,
977  unsigned int x, unsigned int y,
978  CDart* &last, CDart* up, CDart* behind,
979  int level, const CVertex & AVertex, int FictiveMark,
980  bool keepFictiveEdges, bool shiftFictiveEdges )
981 {
982  if (level==2)
983  precodeFc15(last,up,behind,AVertex);
984  else
985  {
986  if ( image.sameVoxelUpBehind(x,y) &&
987  image.sameVoxelLeftupBehind(x,y) )
988  subcasePrecodesF15F21(image,x,y,last,up,behind,level,AVertex,
989  FictiveMark,keepFictiveEdges, shiftFictiveEdges);
990  else
991  precodeFc15(last,up,behind,AVertex);
992  }
993 }
994 
995 INLINE
996 void CExtractionImage::subcasePrecodeFc16( CImage3d & image,
997  unsigned int x, unsigned int y,
998  CDart* &last, CDart* up, CDart* behind,
999  int level, const CVertex & AVertex, int FictiveMark,
1000  bool keepFictiveEdges, bool shiftFictiveEdges )
1001 {
1002  if (keepFictiveEdges)
1003  {
1004  CDart * dart1 = FMap->alpha0121(last);
1005  CDart * dart2 = FMap->alpha012(behind);
1006 
1007  if (FMap->isMarked(dart1,FictiveMark))
1008  {
1009  FMap->shiftAllAdjacentFictiveEdges(FMap->alpha0(dart2),FictiveMark);
1010  precodeFc16(last,up,behind,AVertex);
1011  }
1012  else if (dart1!=FMap->alpha0(dart2) &&
1013  FMap->isSameOrbit(dart1,dart2,ORBIT_01))
1014  {
1015  precodeFc13(last,up,behind,AVertex);
1016  FMap->markOrbit(FMap->alpha0121(last),ORBIT_023,FictiveMark); // Attention, c'est le "nouveau last"
1017  }
1018  else
1019  precodeFc16(last,up,behind,AVertex);
1020  }
1021  else
1022  precodeFc16(last,up,behind,AVertex);
1023 }
1024 
1025 INLINE
1026 void CExtractionImage::subcasePrecodeFc17( CImage3d & image,
1027  unsigned int x, unsigned int y,
1028  CDart* &last, CDart* up, CDart* behind,
1029  int level, const CVertex & AVertex, int FictiveMark,
1030  bool keepFictiveEdges, bool shiftFictiveEdges )
1031 {
1032  if (keepFictiveEdges)
1033  {
1034  CDart * dart1 = FMap->alpha021(last);
1035  CDart * dart2 = FMap->alpha0123(behind);
1036 
1037  if (FMap->isMarked(dart1,FictiveMark))
1038  {
1039  FMap->shiftAllAdjacentFictiveEdges(FMap->alpha1(dart1),FictiveMark);
1040  precodeFc17(last,up,behind,AVertex);
1041  }
1042  else if (dart1!=FMap->alpha0(dart2) &&
1043  FMap->isSameOrbit(dart1,dart2,ORBIT_01))
1044  {
1045  CDart *tmp = FMap->alpha2(last);
1046  precodeFc14(last,up,behind,AVertex);
1047  FMap->markOrbit(tmp,ORBIT_023,FictiveMark);
1048  }
1049  else
1050  precodeFc17(last,up,behind,AVertex);
1051  }
1052  else
1053  precodeFc17(last,up,behind,AVertex);
1054 }
1055 
1056 INLINE
1057 void CExtractionImage::subcasePrecodeFc18( CImage3d & image,
1058  unsigned int x, unsigned int y,
1059  CDart* &last, CDart* up, CDart* behind,
1060  int level, const CVertex & AVertex, int FictiveMark,
1061  bool keepFictiveEdges, bool shiftFictiveEdges )
1062 {
1063  if (keepFictiveEdges)
1064  {
1065  CDart * dart1 = FMap->alpha012(last);
1066 
1067  if (FMap->isMarked(FMap->alpha1(dart1),FictiveMark))
1068  {
1069  FMap->shiftAllAdjacentFictiveEdges(dart1,FictiveMark);
1070  precodeFc18(last,up,behind,AVertex);
1071  }
1072  else if (FMap->alpha1(dart1)!=FMap->alpha20(last) &&
1073  FMap->isSameOrbit(dart1,FMap->alpha2(last),ORBIT_01))
1074  {
1075  precodeFc15(last,up,behind,AVertex);
1076  FMap->markOrbit(dart1,ORBIT_023,FictiveMark); // Attention : on peut faire çFMap->alpha car on
1077  }
1078  else
1079  precodeFc18(last,up,behind,AVertex);
1080  }
1081  else
1082  precodeFc18(last,up,behind,AVertex);
1083 }
1084 
1085 } // namespace GMap3d