34 void CExtractionImage::precodeL1( CDart* &last, CDart* up, CDart* behind,
const CVertex & AVertex )
36 #ifdef DEBUG_EXTRACT_IMAGE
37 cout<<
"CExtractionImage::precodeL1...";cout.flush();
40 CDart* lastc=createCubeForExtract3d(AVertex);
42 FMap->topoSew3(up,FMap->alpha012(lastc));
43 FMap->topoSew3(behind,FMap->alpha21012(lastc));
44 FMap->topoSew3(last,FMap->alpha1012101(lastc));
45 last = FMap->alpha32(behind);
47 #ifdef DEBUG_EXTRACT_IMAGE
56 CDart* CExtractionImage::newEdge()
58 CDart *V1 = FMap->addMapDart();
59 CDart *V2 = FMap->addMapDart();
60 FMap->linkAlpha0(V1, V2);
65 void CExtractionImage::closeFace( CDart* d1, CDart* d2,CDart* d3 )
69 FMap->linkAlpha1(FMap->alpha0(d1),d2);
70 FMap->linkAlpha1(FMap->alpha0(d2),d3);
71 FMap->linkAlpha1(FMap->alpha0(d3),tmp);
72 FMap->linkAlpha1(FMap->alpha0(tmp),d1);
76 void CExtractionImage::closeFace( CDart* d1, CDart* d2 )
77 { closeFace(newEdge(),d1,d2); }
80 void CExtractionImage::closeFace( CDart* d )
81 { closeFace(newEdge(),newEdge(),d); }
86 CDart* CExtractionImage::oneSameNeighboorV( CDart* d1, CDart* fo1, CDart* fo2,
const CVertex & AVertex )
92 CDart* newFace=createFaceForExtract3d( AVertex );
97 FMap->topoSew2(FMap->alpha01(d1),FMap->alpha1(d2));
98 FMap->topoSew2(FMap->alpha01(d2),FMap->alpha1(d3));
99 FMap->topoSew2(FMap->alpha01(d3),FMap->alpha1(d4));
100 FMap->topoSew2(FMap->alpha01(d4),FMap->alpha1(d1));
101 FMap->topoSew2(FMap->alpha0101(d1),FMap->alpha010(newFace));
102 FMap->topoSew2(FMap->alpha1010(d2),FMap->alpha101(newFace));
103 FMap->topoSew2(FMap->alpha0101(d3),FMap->alpha1(newFace));
104 FMap->topoSew2(FMap->alpha101(d4),newFace);
105 FMap->topoSew3(FMap->alpha0(d1),fo1);
106 FMap->topoSew3(FMap->alpha0(d2),fo2);
112 void CExtractionImage::precodeL2( CDart* &last, CDart* up, CDart* behind,
const CVertex & AVertex )
114 #ifdef DEBUG_EXTRACT_IMAGE
115 cout<<
"CExtractionImage::precodeL2...";cout.flush();
118 last = FMap->alpha101(oneSameNeighboorV( FMap->alpha010(last), FMap->alpha010(up), FMap->alpha101(behind), AVertex));
120 #ifdef DEBUG_EXTRACT_IMAGE
126 void CExtractionImage::precodeL3( CDart* &last, CDart* up, CDart* behind,
const CVertex & AVertex )
128 #ifdef DEBUG_EXTRACT_IMAGE
129 cout<<
"CExtractionImage::precodeL3...";cout.flush();
132 last = FMap->alpha201(oneSameNeighboorV( FMap->alpha101(up), FMap->alpha010(behind), FMap->alpha010(last), AVertex));
134 #ifdef DEBUG_EXTRACT_IMAGE
140 void CExtractionImage::precodeL4( CDart* &last, CDart* up, CDart* behind,
const CVertex & AVertex )
142 #ifdef DEBUG_EXTRACT_IMAGE
143 cout<<
"CExtractionImage::precodeL4...";cout.flush();
146 last = FMap->alpha12101(oneSameNeighboorV( FMap->alpha101(behind), FMap->alpha0(last), FMap->alpha101(up), AVertex));
148 #ifdef DEBUG_EXTRACT_IMAGE
157 CDart* CExtractionImage::twoSameNeighboorV( CDart* d1, CDart* d5, CDart* fo,
const CVertex & AVertex )
159 CDart *d2,*d3,*d4,*d6,*d7,*d8, *t1, *t2;
161 d2=FMap->alpha01(d1);
162 d3=FMap->alpha01(d2);
163 d4=FMap->alpha01(d3);
164 d6=FMap->alpha01(d5);
165 d7=FMap->alpha01(d6);
166 d8=FMap->alpha01(d7);
168 if (FMap->alpha2(d1) != FMap->alpha0(d5))
170 t1 = FMap->alpha2(d1);
171 t2 = FMap->alpha2(d5);
176 FMap->sew2(t1,FMap->alpha0(t2));
189 FMap->delMapDart(FMap->alpha0(d1));
190 FMap->delMapDart(FMap->alpha0(d5));
191 FMap->delMapDart(d1);
192 FMap->delMapDart(d5);
194 FMap->topoSew2(FMap->alpha01(d6),FMap->alpha1(d7));
195 FMap->topoSew2(FMap->alpha1(d4),FMap->alpha01(d3));
196 FMap->topoSew2(FMap->alpha01(d7),FMap->alpha1(d8));
197 FMap->topoSew2(FMap->alpha101(d7),FMap->alpha1010(d3));
198 FMap->topoSew2(FMap->alpha01(d2),FMap->alpha1(d3));
200 FMap->topoSew3(FMap->alpha0(fo),d4);
202 FMap->setVertex(FMap->alpha010(d7),
203 new CAttributeVertex(AVertex.getX()*
STEP3D_X,
212 void CExtractionImage::precodeL5( CDart* &last, CDart* up, CDart* behind,
const CVertex & AVertex )
215 #ifdef DEBUG_EXTRACT_IMAGE
216 cout<<
"CExtractionImage::precodeL5...";cout.flush();
219 last = FMap->alpha0(twoSameNeighboorV(FMap->alpha0(last), FMap->alpha101(behind), FMap->alpha010(up), AVertex));
221 #ifdef DEBUG_EXTRACT_IMAGE
228 void CExtractionImage::precodeL6( CDart* &last, CDart* up, CDart* behind,
const CVertex & AVertex )
230 #ifdef DEBUG_EXTRACT_IMAGE
231 cout<<
"CExtractionImage::precodeL6...";cout.flush();
234 last = FMap->alpha10121(twoSameNeighboorV(FMap->alpha010(up), FMap->alpha010(last), FMap->alpha010(behind), AVertex));
236 #ifdef DEBUG_EXTRACT_IMAGE
243 void CExtractionImage::precodeL7( CDart* &last, CDart* up, CDart* behind,
const CVertex & AVertex )
246 #ifdef DEBUG_EXTRACT_IMAGE
247 cout<<
"CExtractionImage::precodeL7...";cout.flush();
250 last = FMap->alpha0102101(twoSameNeighboorV(FMap->alpha010(behind), FMap->alpha101(up), FMap->alpha0(last), AVertex));
252 #ifdef DEBUG_EXTRACT_IMAGE
259 void CExtractionImage::precodeL8( CDart* &last, CDart* up, CDart* behind,
const CVertex & AVertex )
262 #ifdef DEBUG_EXTRACT_IMAGE
263 cout<<
"CExtractionImage::precodeL8...";cout.flush();
266 CDart *d1,*d2,*d3,*d4,*d5,*d6, *s1, *s2, *t1, *t2, *t3, *t4 ,*t5, *t6;
268 d1=FMap->alpha1(last);
269 d2=FMap->alpha01(d1);
271 d4=FMap->alpha01(d3);
272 d5=FMap->alpha0(behind);
273 d6=FMap->alpha01(d5);
276 if (FMap->alpha12(d1) != FMap->alpha01(d6))
278 s1 = FMap->alpha12(d1);
279 s2 = FMap->alpha012(d6);
281 FMap->unsew2(FMap->alpha1(d1));
282 FMap->unsew2(FMap->alpha010(d6));
286 if (FMap->alpha012(d2) != FMap->alpha1(d3))
288 s1 = FMap->alpha012(d2);
289 s2 = FMap->alpha12(d3);
291 FMap->unsew2(FMap->alpha01(d2));
292 FMap->unsew2(FMap->alpha10(d3));
296 if (FMap->alpha12(d5) != FMap->alpha01(d4))
298 s1 = FMap->alpha12(d5);
299 s2 = FMap->alpha012(d4);
301 FMap->unsew2(FMap->alpha10(d5));
302 FMap->unsew2(FMap->alpha01(d4));
306 t1 = FMap->alpha01(d2);
307 t2 = FMap->alpha01(t1);
308 t3 = FMap->alpha01(d4);
309 t4 = FMap->alpha01(t3);
310 t5 = FMap->alpha01(d6);
311 t6 = FMap->alpha01(t5);
314 FMap->unsew1(FMap->alpha0(d6));
315 FMap->unsew1(FMap->alpha0(d4));
316 FMap->unsew1(FMap->alpha0(d2));
317 FMap->unsew1(FMap->alpha10(d4));
323 FMap->topoSew2(FMap->alpha01(d1),FMap->alpha1(d2));
324 FMap->topoSew2(FMap->alpha01(d3),FMap->alpha1(d4));
325 FMap->topoSew2(FMap->alpha01(d5),FMap->alpha1(d6));
327 FMap->setVertex(FMap->alpha010(d5),
new CAttributeVertex(AVertex.getX()*
STEP3D_X,
331 FMap->delMapDart(FMap->alpha0(t2));
332 FMap->delMapDart(t2);
333 FMap->delMapDart(FMap->alpha0(t1));
334 FMap->delMapDart(t1);
335 FMap->delMapDart(FMap->alpha0(t4));
336 FMap->delMapDart(t4);
337 FMap->delMapDart(FMap->alpha0(t3));
338 FMap->delMapDart(t3);
339 FMap->delMapDart(FMap->alpha0(t6));
340 FMap->delMapDart(t6);
341 FMap->delMapDart(FMap->alpha0(t5));
342 FMap->delMapDart(t5);
344 last = FMap->alpha0(d5);
346 #ifdef DEBUG_EXTRACT_IMAGE
347 cout<<
"OK precode8\n";
355 void CExtractionImage::subcasePrecodeL1( CImage3d & image,
unsigned int x,
unsigned int y,
356 CDart* &last, CDart* up, CDart* behind,
357 int level,
const CVertex & AVertex,
int FictiveMark,
358 bool keepFictiveEdges,
bool shiftFictiveEdges )
360 precodeL1(last,up,behind,AVertex);
364 void CExtractionImage::subcasePrecodeL2( CImage3d & image,
365 unsigned int x,
unsigned int y,
366 CDart* &last, CDart* up, CDart* behind,
367 int level,
const CVertex & AVertex,
int FictiveMark,
368 bool keepFictiveEdges,
bool shiftFictiveEdges )
371 precodeL2(last,up,behind,AVertex);
374 if ( image.sameVoxelBehindLeft(x,y) )
375 if ( image.sameVoxelUpLeft(x,y) )
376 subcasePrecodeFc7(image,x,y,last,up,behind,level,AVertex,FictiveMark,
377 keepFictiveEdges, shiftFictiveEdges);
379 subcasePrecodeFc1(image,x,y,last,up,behind,level,AVertex,FictiveMark,
380 keepFictiveEdges, shiftFictiveEdges);
382 if ( image.sameVoxelUpLeft(x,y) )
383 subcasePrecodeFc4(image,x,y,last,up,behind,level,AVertex,FictiveMark,
384 keepFictiveEdges, shiftFictiveEdges);
386 precodeL2(last,up,behind,AVertex);
391 void CExtractionImage::subcasePrecodeL3( CImage3d & image,
392 unsigned int x,
unsigned int y,
393 CDart* &last, CDart* up, CDart* behind,
394 int level,
const CVertex & AVertex,
int FictiveMark,
395 bool keepFictiveEdges,
bool shiftFictiveEdges )
398 precodeL3(last,up,behind,AVertex);
401 if ( image.sameVoxelLeftUp(x,y) )
402 if ( image.sameVoxelBehindUp(x,y) )
403 subcasePrecodeFc8(image,x,y,last,up,behind,level,AVertex,FictiveMark,
404 keepFictiveEdges, shiftFictiveEdges);
406 subcasePrecodeFc2(image,x,y,last,up,behind,level,AVertex,FictiveMark,
407 keepFictiveEdges, shiftFictiveEdges);
409 if ( image.sameVoxelBehindUp(x,y) )
410 subcasePrecodeFc5(image,x,y,last,up,behind,level,AVertex,FictiveMark,
411 keepFictiveEdges, shiftFictiveEdges);
413 precodeL3(last,up,behind,AVertex);
418 void CExtractionImage::subcasePrecodeL4( CImage3d & image,
419 unsigned int x,
unsigned int y,
420 CDart* &last, CDart* up, CDart* behind,
421 int level,
const CVertex & AVertex,
int FictiveMark,
422 bool keepFictiveEdges,
bool shiftFictiveEdges )
425 precodeL4(last,up,behind,AVertex);
428 if ( image.sameVoxelUpBehind(x,y) )
429 if ( image.sameVoxelLeftBehind(x,y) )
430 subcasePrecodeFc9(image,x,y,last,up,behind,level,AVertex,FictiveMark,
431 keepFictiveEdges, shiftFictiveEdges);
433 subcasePrecodeFc3(image,x,y,last,up,behind,level,AVertex,FictiveMark,
434 keepFictiveEdges, shiftFictiveEdges);
436 if ( image.sameVoxelLeftBehind(x,y) )
437 subcasePrecodeFc6(image,x,y,last,up,behind,level,AVertex,FictiveMark,
438 keepFictiveEdges, shiftFictiveEdges);
440 precodeL4(last,up,behind,AVertex);
445 void CExtractionImage::subcasePrecodeL5( CImage3d & image,
446 unsigned int x,
unsigned int y,
447 CDart* &last, CDart* up, CDart* behind,
448 int level,
const CVertex & AVertex,
int FictiveMark,
449 bool keepFictiveEdges,
bool shiftFictiveEdges )
452 precodeL5(last,up,behind,AVertex);
455 if ( image.sameVoxelUpBehind(x,y) )
456 if ( image.sameVoxelUpLeft(x,y) )
457 subcasePrecodeFc16(image,x,y,last,up,behind,level,AVertex,FictiveMark,
458 keepFictiveEdges, shiftFictiveEdges);
460 subcasePrecodeFc10(image,x,y,last,up,behind,level,AVertex,FictiveMark,
461 keepFictiveEdges, shiftFictiveEdges);
463 if ( image.sameVoxelUpLeft(x,y) )
464 subcasePrecodeFc13(image,x,y,last,up,behind,level,AVertex,FictiveMark,
465 keepFictiveEdges, shiftFictiveEdges);
467 precodeL5(last,up,behind,AVertex);
472 void CExtractionImage::subcasePrecodeL6( CImage3d & image,
473 unsigned int x,
unsigned int y,
474 CDart* &last, CDart* up, CDart* behind,
475 int level,
const CVertex & AVertex,
int FictiveMark,
476 bool keepFictiveEdges,
bool shiftFictiveEdges )
479 precodeL6(last,up,behind,AVertex);
482 if ( image.sameVoxelBehindLeft(x,y) )
483 if ( image.sameVoxelBehindUp(x,y) )
484 subcasePrecodeFc17(image,x,y,last,up,behind,level,AVertex,FictiveMark,
485 keepFictiveEdges, shiftFictiveEdges);
487 subcasePrecodeFc11(image,x,y,last,up,behind,level,AVertex,FictiveMark,
488 keepFictiveEdges, shiftFictiveEdges);
490 if ( image.sameVoxelBehindUp(x,y) )
491 subcasePrecodeFc14(image,x,y,last,up,behind,level,AVertex,FictiveMark,
492 keepFictiveEdges, shiftFictiveEdges);
494 precodeL6(last,up,behind,AVertex);
499 void CExtractionImage::subcasePrecodeL7( CImage3d & image,
500 unsigned int x,
unsigned int y,
501 CDart* &last, CDart* up, CDart* behind,
502 int level,
const CVertex & AVertex,
int FictiveMark,
503 bool keepFictiveEdges,
bool shiftFictiveEdges )
506 precodeL7(last,up,behind,AVertex);
509 if ( image.sameVoxelLeftUp(x,y) )
510 if ( image.sameVoxelLeftBehind(x,y) )
511 subcasePrecodeFc18(image,x,y,last,up,behind,level,AVertex,FictiveMark,
512 keepFictiveEdges, shiftFictiveEdges);
514 subcasePrecodeFc12(image,x,y,last,up,behind,level,AVertex,FictiveMark,
515 keepFictiveEdges, shiftFictiveEdges);
517 if ( image.sameVoxelLeftBehind(x,y) )
518 subcasePrecodeFc15(image,x,y,last,up,behind,level,AVertex,FictiveMark,
519 keepFictiveEdges, shiftFictiveEdges);
521 precodeL7(last,up,behind,AVertex);
526 void CExtractionImage::subcasePrecodeL8( CImage3d & image,
527 unsigned int x,
unsigned int y,
528 CDart* &last, CDart* up, CDart* behind,
529 int level,
const CVertex & AVertex,
int FictiveMark,
530 bool keepFictiveEdges,
bool shiftFictiveEdges )
533 precodeL8(last,up,behind,AVertex);
536 if ( image.sameVoxelLeftUp(x,y) )
538 if ( image.sameVoxelBehindLeft(x,y) )
540 if ( image.sameVoxelUpbehindLeft(x,y) &&
541 !image.sameVoxelBehindUp(x,y) )
543 subcasePrecodeF27(image,x,y,last,up,behind,level,AVertex,
544 FictiveMark,keepFictiveEdges,shiftFictiveEdges);
547 precodeL8(last,up,behind,AVertex);
551 if ( image.sameVoxelBehindUp(x,y) &&
552 image.sameVoxelLeftbehindUp(x,y) )
554 subcasePrecodeF25(image,x,y,last,up,behind,level,AVertex,
555 FictiveMark,keepFictiveEdges, shiftFictiveEdges);
558 precodeL8(last,up,behind,AVertex);
563 if ( image.sameVoxelLeftBehind(x,y) &&
564 image.sameVoxelUpBehind(x,y) &&
565 image.sameVoxelLeftupBehind(x,y) )
567 subcasePrecodeF26(image,x,y,last,up,behind,level,AVertex,
568 FictiveMark,keepFictiveEdges, shiftFictiveEdges);
571 precodeL8(last,up,behind,AVertex);