356
356
Dart_handle d3 = make_iso_cuboid(Point_3(nbcube, nbcube + 1, nbcube), 1);
357
357
Dart_handle d4 = make_iso_cuboid(Point_3(nbcube + 1, nbcube + 1, nbcube), 1);
359
scene.lcc->sew<3>(d1->beta(1)->beta(1)->beta(2), d2->beta (2));
360
scene.lcc->sew<3>(d1->beta(2)->beta(1)->beta(1)->beta (2), d3);
359
scene.lcc->sew<3>(scene.lcc->beta(d1,1,1,2), scene.lcc->beta(d2,2));
360
scene.lcc->sew<3>(scene.lcc->beta(d1,2,1,1,2), d3);
362
scene.lcc->sew<3>(d3->beta(1)->beta(1)->beta(2), d4->beta (2));
363
scene.lcc->sew<3>(d2->beta(2)->beta(1)->beta(1)->beta (2), d4);
362
scene.lcc->sew<3>(scene.lcc->beta(d3,1,1,2), scene.lcc->beta(d4,2));
363
scene.lcc->sew<3>(scene.lcc->beta(d2,2,1,1,2), d4);
365
365
CGAL::remove_cell<LCC,2>(*scene.lcc, d3);
366
CGAL::remove_cell<LCC,2>(*scene.lcc, d2->beta (2));
366
CGAL::remove_cell<LCC,2>(*scene.lcc, scene.lcc->beta(d2,2));
368
368
on_new_volume(d1);
369
369
on_new_volume(d4);
752
Dart_handle prev = NULL;
754
Dart_handle prev = scene.lcc->null_handle;
753
755
for (LCC::Dart_range::iterator it(scene.lcc->darts().begin()),
754
756
itend=scene.lcc->darts().end(); it!=itend; )
756
if ( !it->is_free(3) &&
757
it->attribute<3>()->info().is_filled_and_visible() &&
758
it->beta(3)->attribute<3>()->info().is_filled_and_visible() )
758
if ( !scene.lcc->is_free(it,3) &&
759
scene.lcc->info<3>(it).is_filled_and_visible() &&
760
scene.lcc->info<3>(scene.lcc->beta(it,3))
761
.is_filled_and_visible())
760
763
CGAL::remove_cell<LCC,2>(*scene.lcc,it);
761
764
itend=scene.lcc->darts().end();
762
if ( prev==NULL ) it=scene.lcc->darts().begin();
765
if ( prev==scene.lcc->null_handle ) it=scene.lcc->darts().begin();
763
766
else { it=prev; if ( it!=itend ) ++it; }
803
806
volumeList->setRowCount(newRow+1);
805
808
QTableWidgetItem* volumeLabel = new QTableWidgetItem
806
(QString(ah->info().color_name().c_str()));
809
(QString((scene.lcc->get_attribute<3>(ah).info().color_name().c_str())));
807
810
volumeLabel->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
808
811
volumeLabel->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
809
812
volumeList->setItem(newRow,0,volumeLabel);
811
814
QTableWidgetItem* fillCB = new QTableWidgetItem;
812
815
fillCB->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
813
if ( ah->info().is_filled() ) fillCB->setCheckState(Qt::Checked);
814
else fillCB->setCheckState(Qt::Unchecked);
816
if ( scene.lcc->get_attribute<3>(ah).info().is_filled() )
817
fillCB->setCheckState(Qt::Checked);
819
fillCB->setCheckState(Qt::Unchecked);
815
820
volumeList->setItem(newRow,1, fillCB);
817
822
QTableWidgetItem* hiddenCB = new QTableWidgetItem();
818
823
hiddenCB->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
819
if ( ah->info().is_visible() ) hiddenCB->setCheckState(Qt::Unchecked);
820
else hiddenCB->setCheckState(Qt::Checked);
824
if ( scene.lcc->get_attribute<3>(ah).info().is_visible() )
825
hiddenCB->setCheckState(Qt::Unchecked);
827
hiddenCB->setCheckState(Qt::Checked);
821
828
volumeList->setItem(newRow,2,hiddenCB);
823
830
QTableWidgetItem* attribHandle = new QTableWidgetItem;
824
831
attribHandle->setData
825
(Qt::UserRole, reinterpret_cast<quintptr>(&*(ah)));
832
(Qt::UserRole, reinterpret_cast<quintptr>(&scene.lcc->get_attribute<3>(ah)));
827
834
volumeList->setItem(newRow,3,attribHandle);
1244
1255
void MainWindow::split_face_in_three(Dart_handle dh)
1246
CGAL::insert_cell_1_in_cell_2(*(scene.lcc),dh->beta(1)->beta(1)->beta(1),
1247
dh->beta(0)->beta(0));
1248
CGAL::insert_cell_1_in_cell_2(*(scene.lcc),dh->beta(1)->beta(1),dh->beta(0));
1257
CGAL::insert_cell_1_in_cell_2(*(scene.lcc),scene.lcc->beta(dh,1,1,1),
1258
scene.lcc->beta(dh,0,0));
1259
CGAL::insert_cell_1_in_cell_2(*(scene.lcc),scene.lcc->beta(dh,1,1),
1260
scene.lcc->beta(dh,0));
1251
1263
void MainWindow::split_face_in_nine(Dart_handle dh)
1253
Dart_handle d2 = dh->beta(1)->beta(1)->beta(1)->beta(1)
1254
->beta(1)->beta(1)->beta(1);
1265
Dart_handle d2 = scene.lcc->beta(dh,1,1,1,1,1,1,1);
1256
1267
Dart_handle e2= CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
1257
dh->beta(1)->beta(1),d2);
1268
scene.lcc->beta(dh,1,1),d2);
1258
1269
Dart_handle e1= CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
1259
dh->beta(1),d2->beta(1));
1270
scene.lcc->beta(dh,1),
1271
scene.lcc->beta(d2,1));
1261
1273
split_edge_in_three(e1);
1262
1274
split_edge_in_three(e2);
1264
1276
split_face_in_three(dh);
1265
1277
split_face_in_three(d2);
1266
split_face_in_three(e2->beta(0));
1278
split_face_in_three(scene.lcc->beta(e2,0));
1269
1281
void MainWindow::split_vol_in_three(Dart_handle dh, bool removecenter)
1271
1283
std::vector<Dart_handle> edges1;
1272
1284
std::vector<Dart_handle> edges2;
1274
Dart_handle curd = dh->beta(2)->beta(1)->beta(1)->beta(2);
1286
Dart_handle curd = scene.lcc->beta(dh,2,1,1,2);
1275
1287
for (unsigned int i=0;i<4;++i)
1277
1289
edges1.push_back(curd);
1278
curd=curd->beta(1)->beta(2)->beta(1);
1290
curd=scene.lcc->beta(curd,1,2,1);
1280
CGAL_assertion( curd==dh->beta(2)->beta(1)->beta(1)->beta(2) );
1292
CGAL_assertion( curd==scene.lcc->beta(dh,2,1,1,2) );
1282
curd = curd->beta(1)->beta(1)->beta(2);
1294
curd = scene.lcc->beta(curd,1,1,2);
1283
1295
for (unsigned int i=0;i<4;++i)
1285
1297
edges2.push_back(curd);
1286
curd=curd->beta(1)->beta(2)->beta(1);
1298
curd=scene.lcc->beta(curd,1,2,1);
1288
1300
CGAL_assertion( curd==
1289
dh->beta(2)->beta(1)->beta(1)->beta(2)->beta(1)->beta(1)->beta(2) );
1301
scene.lcc->beta(dh,2,1,1,2,1,1,2) );
1291
1303
Dart_handle f1=
1292
1304
insert_cell_2_in_cell_3(*(scene.lcc),edges1.begin(),edges1.end());
1294
1306
Dart_handle f2=
1295
1307
insert_cell_2_in_cell_3(*(scene.lcc),edges2.begin(),edges2.end());
1297
f1->attribute<3>()->info().color()=
1309
scene.lcc->info<3>(f1).color()=
1298
1310
(CGAL::Color(myrandom.get_int(0,256),
1299
1311
myrandom.get_int(0,256),
1300
1312
myrandom.get_int(0,256)));
1301
f2->attribute<3>()->info().color()=
1313
scene.lcc->info<3>(f2).color()=
1302
1314
(CGAL::Color(myrandom.get_int(0,256),
1303
1315
myrandom.get_int(0,256),
1304
1316
myrandom.get_int(0,256)));
1306
update_volume_list_add(dh->attribute<3>());
1318
update_volume_list_add(scene.lcc->attribute<3>(dh));
1308
1320
if ( removecenter )
1309
1321
CGAL::remove_cell<LCC,3>(*scene.lcc,f1);
1312
1324
mengerVolumes.push_back(f1);
1313
update_volume_list_add(f1->attribute<3>());
1325
update_volume_list_add(scene.lcc->attribute<3>(f1));
1316
1328
mengerVolumes.push_back(f2);
1321
1333
std::vector<Dart_handle> edges1;
1322
1334
std::vector<Dart_handle> edges2;
1324
Dart_handle curd = dh->beta(1)->beta(2);
1336
Dart_handle curd = scene.lcc->beta(dh,1,2);
1325
1337
for (unsigned int i=0;i<8;++i)
1327
1339
edges1.push_back(curd);
1328
curd=curd->beta(1)->beta(2)->beta(1);
1340
curd=scene.lcc->beta(curd,1,2,1);
1330
CGAL_assertion( curd==dh->beta(1)->beta(2) );
1342
CGAL_assertion( curd==scene.lcc->beta(dh,1,2) );
1332
curd = curd->beta(1)->beta(1)->beta(2);
1344
curd = scene.lcc->beta(curd,1,1,2);
1333
1345
for (unsigned int i=0;i<8;++i)
1335
1347
edges2.push_back(curd);
1336
curd=curd->beta(1)->beta(2)->beta(1);
1348
curd=scene.lcc->beta(curd,1,2,1);
1338
CGAL_assertion( curd==dh->beta(1)->beta(2)->beta(1)->beta(1)->beta(2) );
1350
CGAL_assertion( curd==scene.lcc->beta(dh,1,2,1,1,2) );
1340
1352
Dart_handle f1=
1341
1353
insert_cell_2_in_cell_3(*(scene.lcc),edges1.begin(),edges1.end());
1343
1355
Dart_handle f2=
1344
1356
insert_cell_2_in_cell_3(*(scene.lcc),edges2.begin(),edges2.end());
1346
f1->attribute<3>()->info().color()=
1358
scene.lcc->info<3>(f1).color()=
1347
1359
(CGAL::Color(myrandom.get_int(0,256),
1348
1360
myrandom.get_int(0,256),
1349
1361
myrandom.get_int(0,256)));
1350
f2->attribute<3>()->info().color()=
1362
scene.lcc->info<3>(f2).color()=
1351
1363
(CGAL::Color(myrandom.get_int(0,256),
1352
1364
myrandom.get_int(0,256),
1353
1365
myrandom.get_int(0,256)));
1355
update_volume_list_add(dh->attribute<3>());
1367
update_volume_list_add(scene.lcc->attribute<3>(dh));
1356
1368
if ( !removecenter)
1357
update_volume_list_add(f1->attribute<3>());
1369
update_volume_list_add(scene.lcc->attribute<3>(f1));
1359
1371
split_face_in_three(f1);
1360
1372
split_face_in_three(f2);
1362
1374
split_vol_in_three(dh,removecenter);
1364
mengerVolumes.push_back(f2->beta(2)->beta(1));
1365
split_vol_in_three(f2->beta(2)->beta(1),removecenter);
1376
mengerVolumes.push_back(scene.lcc->beta(f2,2,1));
1377
split_vol_in_three(scene.lcc->beta(f2,2,1),removecenter);
1367
1379
if ( removecenter )
1368
1380
CGAL::remove_cell<LCC,3>(*scene.lcc,f1);
1371
mengerVolumes.push_back(f1->beta(2)->beta(1));
1372
split_vol_in_three(f1->beta(2)->beta(1),true);
1383
mengerVolumes.push_back(scene.lcc->beta(f1,2,1));
1384
split_vol_in_three(scene.lcc->beta(f1,2,1),true);
1378
1390
std::vector<Dart_handle> edges1;
1379
1391
std::vector<Dart_handle> edges2;
1381
Dart_handle curd = dh->beta(1)->beta(1)->beta(2);
1393
Dart_handle curd = scene.lcc->beta(dh,1,1,2);
1382
1394
for (unsigned int i=0;i<12;++i)
1384
1396
edges1.push_back(curd);
1385
curd=curd->beta(1)->beta(2)->beta(1);
1397
curd=scene.lcc->beta(curd,1,2,1);
1387
CGAL_assertion( curd==dh->beta(1)->beta(1)->beta(2) );
1399
CGAL_assertion( curd==scene.lcc->beta(dh,1,1,2) );
1389
curd = curd->beta(1)->beta(1)->beta(2);
1401
curd = scene.lcc->beta(curd,1,1,2);
1390
1402
for (unsigned int i=0;i<12;++i)
1392
1404
edges2.push_back(curd);
1393
curd=curd->beta(1)->beta(2)->beta(1);
1405
curd=scene.lcc->beta(curd,1,2,1);
1395
CGAL_assertion( curd==dh->beta(1)->beta(1)->beta(2)->beta(1)->beta(1)->beta(2) );
1407
CGAL_assertion( curd==scene.lcc->beta(dh,1,1,2,1,1,2) );
1397
1409
Dart_handle f1=
1398
1410
insert_cell_2_in_cell_3(*(scene.lcc),edges1.begin(),edges1.end());
1400
1412
Dart_handle f2=
1401
1413
insert_cell_2_in_cell_3(*(scene.lcc),edges2.begin(),edges2.end());
1403
f1->attribute<3>()->info().color()=
1404
(CGAL::Color(myrandom.get_int(0,256),
1405
myrandom.get_int(0,256),
1406
myrandom.get_int(0,256)));
1407
f2->attribute<3>()->info().color()=
1408
(CGAL::Color(myrandom.get_int(0,256),
1409
myrandom.get_int(0,256),
1410
myrandom.get_int(0,256)));
1412
update_volume_list_add(dh->attribute<3>());
1413
update_volume_list_add(f1->attribute<3>());
1415
mengerVolumes.push_back(f1->beta(2));
1416
mengerVolumes.push_back(f2->beta(2));
1418
split_face_in_nine(f1->beta(1));
1419
split_face_in_nine(f2->beta(1));
1415
scene.lcc->info<3>(f1).color()=
1416
(CGAL::Color(myrandom.get_int(0,256),
1417
myrandom.get_int(0,256),
1418
myrandom.get_int(0,256)));
1419
scene.lcc->info<3>(f2).color()=
1420
(CGAL::Color(myrandom.get_int(0,256),
1421
myrandom.get_int(0,256),
1422
myrandom.get_int(0,256)));
1424
update_volume_list_add(scene.lcc->attribute<3>(dh));
1425
update_volume_list_add(scene.lcc->attribute<3>(f1));
1427
mengerVolumes.push_back(scene.lcc->beta(f1,2));
1428
mengerVolumes.push_back(scene.lcc->beta(f2,2));
1430
split_face_in_nine(scene.lcc->beta(f1,1));
1431
split_face_in_nine(scene.lcc->beta(f2,1));
1421
1433
split_vol_in_nine(dh,false);
1422
split_vol_in_nine(f1->beta(2),true);
1423
split_vol_in_nine(f2->beta(2),false);
1434
split_vol_in_nine(scene.lcc->beta(f1,2),true);
1435
split_vol_in_nine(scene.lcc->beta(f2,2),false);
1426
1438
void MainWindow::process_full_slice(Dart_handle init,
1430
1442
Dart_handle d[12];
1431
d[0]=init->beta(1)->beta(2);
1432
d[1]=d[0]->beta(3)->beta(1)->beta(2)->beta(1);
1433
d[2]=d[1]->beta(1)->beta(2)->beta(1);
1434
d[3]=d[2]->beta(3)->beta(1)->beta(2)->beta(1);
1436
d[4]=init->beta(1)->beta(1)->beta(2);
1437
d[5]=d[4]->beta(3)->beta(0)->beta(2)->beta(0);
1438
d[6]=d[5]->beta(0)->beta(2)->beta(0);
1440
d[7]=d[6]->beta(3)->beta(0)->beta(2)->beta(0);
1441
d[8]=d[7]->beta(3)->beta(0)->beta(2)->beta(0);
1442
d[9]=d[8]->beta(0)->beta(2)->beta(0);
1444
d[10]=d[9]->beta(3)->beta(0)->beta(2)->beta(0);
1445
d[11]=d[10]->beta(3)->beta(0)->beta(2)->beta(0);
1443
d[0]=scene.lcc->beta(init,1,2);
1444
d[1]=scene.lcc->beta(d[0],3,1,2,1);
1445
d[2]=scene.lcc->beta(d[1],1,2,1);
1446
d[3]=scene.lcc->beta(d[2],3,1,2,1);
1448
d[4]=scene.lcc->beta(init,1,1,2);
1449
d[5]=scene.lcc->beta(d[4],3,0,2,0);
1450
d[6]=scene.lcc->beta(d[5],0,2,0);
1452
d[7]=scene.lcc->beta(d[6],3,0,2,0);
1453
d[8]=scene.lcc->beta(d[7],3,0,2,0);
1454
d[9]=scene.lcc->beta(d[8],0,2,0);
1456
d[10]=scene.lcc->beta(d[9],3,0,2,0);
1457
d[11]=scene.lcc->beta(d[10],3,0,2,0);
1447
1459
for (unsigned int j=0; j<12; ++j)
1461
1473
Dart_handle d[24];
1463
d[1]=d[0]->beta(0)->beta(2)->beta(3)->beta(2)->beta(0);
1464
d[2]=d[1]->beta(0)->beta(2)->beta(3)->beta(2)->beta(0);
1465
d[3]=d[2]->beta(1)->beta(1)->beta(2)->beta(3)->beta(2);
1466
d[4]=d[3]->beta(1)->beta(1)->beta(2)->beta(3)->beta(2);
1467
d[5]=d[0]->beta(1)->beta(1)->beta(2)->beta(3)->beta(2);
1468
d[6]=d[5]->beta(1)->beta(1)->beta(2)->beta(3)->beta(2);
1469
d[7]=d[6]->beta(0)->beta(2)->beta(3)->beta(2)->beta(0);
1475
d[1]=scene.lcc->beta(d[0],0,2,3,2,0);
1476
d[2]=scene.lcc->beta(d[1],0,2,3,2,0);
1477
d[3]=scene.lcc->beta(d[2],1,1,2,3,2);
1478
d[4]=scene.lcc->beta(d[3],1,1,2,3,2);
1479
d[5]=scene.lcc->beta(d[0],1,1,2,3,2);
1480
d[6]=scene.lcc->beta(d[5],1,1,2,3,2);
1481
d[7]=scene.lcc->beta(d[6],0,2,3,2,0);
1471
init = init->beta(3)->beta(2)->beta(1)->beta(1)->beta(2);
1483
init = scene.lcc->beta(init,3,2,1,1,2);
1473
d[9]=d[8]->beta(3)->beta(1)->beta(2)->beta(3)->beta(2)->beta(1);
1474
d[10]=d[9]->beta(1)->beta(2)->beta(3)->beta(2)->beta(1)->beta(3);
1475
d[11]=d[10]->beta(3)->beta(0)->beta(0)->beta(2)->beta(3)->beta(2);
1476
d[12]=d[11]->beta(0)->beta(0)->beta(2)->beta(3)->beta(2)->beta(3);
1477
d[13]=d[8]->beta(3)->beta(0)->beta(0)->beta(2)->beta(3)->beta(2);
1478
d[14]=d[13]->beta(0)->beta(0)->beta(2)->beta(3)->beta(2)->beta(3);
1479
d[15]=d[14]->beta(3)->beta(1)->beta(2)->beta(3)->beta(2)->beta(1);
1481
d[16]=d[0]->beta(3)->beta(1)->beta(2);
1482
d[17]=d[0]->beta(3)->beta(1)->beta(1)->beta(2);
1484
d[18]=d[4]->beta(3)->beta(2);
1485
d[19]=d[4]->beta(3)->beta(0)->beta(2);
1487
d[20]=d[2]->beta(3)->beta(0)->beta(2);
1488
d[21]=d[2]->beta(3)->beta(1)->beta(1)->beta(2);
1490
d[22]=d[6]->beta(3)->beta(2);
1491
d[23]=d[6]->beta(3)->beta(1)->beta(2);
1485
d[9]=scene.lcc->beta(d[8],3,1,2,3,2,1);
1486
d[10]=scene.lcc->beta(d[9],1,2,3,2,1,3);
1487
d[11]=scene.lcc->beta(d[10],3,0,0,2,3,2);
1488
d[12]=scene.lcc->beta(d[11],0,0,2,3,2,3);
1489
d[13]=scene.lcc->beta(d[8],3,0,0,2,3,2);
1490
d[14]=scene.lcc->beta(d[13],0,0,2,3,2,3);
1491
d[15]=scene.lcc->beta(d[14],3,1,2,3,2,1);
1493
d[16]=scene.lcc->beta(d[0],3,1,2);
1494
d[17]=scene.lcc->beta(d[0],3,1,1,2);
1496
d[18]=scene.lcc->beta(d[4],3,2);
1497
d[19]=scene.lcc->beta(d[4],3,0,2);
1499
d[20]=scene.lcc->beta(d[2],3,0,2);
1500
d[21]=scene.lcc->beta(d[2],3,1,1,2);
1502
d[22]=scene.lcc->beta(d[6],3,2);
1503
d[23]=scene.lcc->beta(d[6],3,1,2);
1493
1505
for (unsigned int j=0; j<24; ++j)
1495
CGAL_assertion( d[j]!=LCC::null_dart_handle );
1507
CGAL_assertion( d[j]!=(scene.lcc)->null_dart_handle );
1496
1508
if ( !(scene.lcc)->is_marked(d[j], markVols) )
1498
1510
CGAL::mark_cell<LCC,3>(*(scene.lcc), d[j], markVols);