Update demo for Menger, Sierpinski Carpet and Sierpinski Triangle.

This commit is contained in:
Guillaume Damiand 2014-12-28 17:15:02 +01:00
parent 237c4b87fb
commit 32464de4a5
6 changed files with 253 additions and 221 deletions

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>264</width> <width>288</width>
<height>106</height> <height>106</height>
</rect> </rect>
</property> </property>
@ -32,7 +32,7 @@
<widget class="QSpinBox" name="mengerLevel"> <widget class="QSpinBox" name="mengerLevel">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>150</x> <x>170</x>
<y>10</y> <y>10</y>
<width>51</width> <width>51</width>
<height>27</height> <height>27</height>
@ -59,7 +59,7 @@
<rect> <rect>
<x>23</x> <x>23</x>
<y>15</y> <y>15</y>
<width>121</width> <width>141</width>
<height>17</height> <height>17</height>
</rect> </rect>
</property> </property>
@ -70,9 +70,9 @@
<widget class="QCheckBox" name="updateAttributes"> <widget class="QCheckBox" name="updateAttributes">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>0</x>
<y>40</y> <y>40</y>
<width>241</width> <width>291</width>
<height>18</height> <height>18</height>
</rect> </rect>
</property> </property>
@ -80,7 +80,7 @@
<string>Update attributes during construction</string> <string>Update attributes during construction</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</widget> </widget>

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>325</width> <width>325</width>
<height>151</height> <height>119</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -16,8 +16,8 @@
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>150</x> <x>80</x>
<y>120</y> <y>80</y>
<width>171</width> <width>171</width>
<height>32</height> <height>32</height>
</rect> </rect>
@ -34,7 +34,7 @@
<rect> <rect>
<x>20</x> <x>20</x>
<y>13</y> <y>13</y>
<width>181</width> <width>201</width>
<height>16</height> <height>16</height>
</rect> </rect>
</property> </property>
@ -45,131 +45,31 @@
<widget class="QSpinBox" name="level"> <widget class="QSpinBox" name="level">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>200</x> <x>230</x>
<y>10</y> <y>10</y>
<width>47</width> <width>47</width>
<height>24</height> <height>24</height>
</rect> </rect>
</property> </property>
</widget> </widget>
<widget class="QGroupBox" name="groupBox1"> <widget class="QCheckBox" name="updateAttributes">
<property name="geometry"> <property name="enabled">
<rect>
<x>10</x>
<y>30</y>
<width>161</width>
<height>81</height>
</rect>
</property>
<property name="title">
<string>Update Attributes</string>
</property>
<widget class="QRadioButton" name="never">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>97</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>Never</string>
</property>
</widget>
<widget class="QRadioButton" name="during">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>141</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>During construction</string>
</property>
<property name="checked">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget>
<widget class="QRadioButton" name="after">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>20</x>
<y>60</y> <y>50</y>
<width>141</width> <width>291</width>
<height>18</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>After construction</string> <string>Update attributes during construction</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>180</x>
<y>30</y>
<width>91</width>
<height>61</height>
</rect>
</property>
<property name="title">
<string>Method</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<widget class="QRadioButton" name="stdmap">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>81</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>std map</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QRadioButton" name="traversal">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>81</width>
<height>18</height>
</rect>
</property>
<property name="text">
<string>traversal</string>
</property>
</widget>
</widget>
<widget class="QPushButton" name="computeGeometry">
<property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="geometry">
<rect>
<x>0</x>
<y>120</y>
<width>151</width>
<height>32</height>
</rect>
</property>
<property name="text">
<string>Compute geometry</string>
</property>
</widget> </widget>
</widget> </widget>
<resources/> <resources/>

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>265</width> <width>303</width>
<height>112</height> <height>112</height>
</rect> </rect>
</property> </property>
@ -32,9 +32,9 @@
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>10</x>
<y>13</y> <y>13</y>
<width>181</width> <width>211</width>
<height>16</height> <height>16</height>
</rect> </rect>
</property> </property>
@ -45,7 +45,7 @@
<widget class="QSpinBox" name="level"> <widget class="QSpinBox" name="level">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>200</x> <x>220</x>
<y>10</y> <y>10</y>
<width>53</width> <width>53</width>
<height>24</height> <height>24</height>
@ -55,17 +55,17 @@
<widget class="QCheckBox" name="updateAttributes"> <widget class="QCheckBox" name="updateAttributes">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>10</x>
<y>40</y> <y>40</y>
<width>241</width> <width>291</width>
<height>18</height> <height>20</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Update attributes during construction</string> <string>Update attributes during construction</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</widget> </widget>

View File

@ -111,7 +111,9 @@ void MainWindow::connect_actions ()
QObject::connect(dialogsierpinskicarpet.level, SIGNAL(valueChanged(int)), QObject::connect(dialogsierpinskicarpet.level, SIGNAL(valueChanged(int)),
this, SLOT(onSierpinskiCarpetChangeLevel(int))); this, SLOT(onSierpinskiCarpetChangeLevel(int)));
QObject::connect(dialogsierpinskicarpet.never, SIGNAL(clicked(bool)), QObject::connect(dialogsierpinskicarpet.updateAttributes, SIGNAL(clicked(bool)),
this, SLOT(onSierpinskiCarpetUpdateAttributes(bool)));
/* QObject::connect(dialogsierpinskicarpet.never, SIGNAL(clicked(bool)),
this, SLOT(onSierpinskiCarpetNeverUpdateAttributes(bool))); this, SLOT(onSierpinskiCarpetNeverUpdateAttributes(bool)));
QObject::connect(dialogsierpinskicarpet.during, SIGNAL(clicked(bool)), QObject::connect(dialogsierpinskicarpet.during, SIGNAL(clicked(bool)),
this, SLOT(onSierpinskiCarpetDuringConstructionUpdateAttributes(bool))); this, SLOT(onSierpinskiCarpetDuringConstructionUpdateAttributes(bool)));
@ -122,7 +124,7 @@ void MainWindow::connect_actions ()
QObject::connect(dialogsierpinskicarpet.traversal, SIGNAL(clicked(bool)), QObject::connect(dialogsierpinskicarpet.traversal, SIGNAL(clicked(bool)),
this, SLOT(onSierpinskiCarpetUpdateAttributesMethodTraversal(bool))); this, SLOT(onSierpinskiCarpetUpdateAttributesMethodTraversal(bool)));
QObject::connect(dialogsierpinskicarpet.computeGeometry, SIGNAL(clicked(bool)), QObject::connect(dialogsierpinskicarpet.computeGeometry, SIGNAL(clicked(bool)),
this, SLOT(onSierpinskiCarpetComputeGeometry(bool))); this, SLOT(onSierpinskiCarpetComputeGeometry(bool)));*/
QObject::connect(&dialogsierpinskicarpet, SIGNAL(accepted()), QObject::connect(&dialogsierpinskicarpet, SIGNAL(accepted()),
this, SLOT(onSierpinskiCarpetOk())); this, SLOT(onSierpinskiCarpetOk()));
QObject::connect(&dialogsierpinskicarpet, SIGNAL(rejected()), QObject::connect(&dialogsierpinskicarpet, SIGNAL(rejected()),
@ -157,6 +159,8 @@ void MainWindow::update_operations_entries(bool show)
void MainWindow::onSceneChanged () void MainWindow::onSceneChanged ()
{ {
QApplication::setOverrideCursor( Qt::WaitCursor );
int mark = scene.lcc->get_new_mark (); int mark = scene.lcc->get_new_mark ();
scene.lcc->negate_mark (mark); scene.lcc->negate_mark (mark);
@ -183,9 +187,12 @@ void MainWindow::onSceneChanged ()
scene.lcc->negate_mark (mark); scene.lcc->negate_mark (mark);
scene.lcc->free_mark (mark); scene.lcc->free_mark (mark);
// statusBar()->showMessage (QString ("Update OpenGL lists"), DELAY_STATUSMSG);
viewer->sceneChanged (); viewer->sceneChanged ();
statusMessage->setText (os.str().c_str ()); statusMessage->setText (os.str().c_str ());
QApplication::restoreOverrideCursor();
} }
void MainWindow::clear_all() void MainWindow::clear_all()
@ -414,6 +421,8 @@ void MainWindow::on_actionCreate_mesh_triggered ()
void MainWindow::onCreateMeshOk() void MainWindow::onCreateMeshOk()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -436,13 +445,16 @@ void MainWindow::onCreateMeshOk()
<<timer.time()<<" seconds."<<std::endl; <<timer.time()<<" seconds."<<std::endl;
#endif #endif
statusBar ()->showMessage (QString ("mesh created"),DELAY_STATUSMSG); statusBar ()->showMessage (QString ("Mesh created"),DELAY_STATUSMSG);
QApplication::restoreOverrideCursor ();
emit (sceneChanged ()); emit (sceneChanged ());
} }
void MainWindow::on_actionSubdivide_triggered () void MainWindow::on_actionSubdivide_triggered ()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -456,6 +468,7 @@ void MainWindow::on_actionSubdivide_triggered ()
<<timer.time()<<" seconds."<<std::endl; <<timer.time()<<" seconds."<<std::endl;
#endif #endif
QApplication::restoreOverrideCursor ();
emit (sceneChanged ()); emit (sceneChanged ());
statusBar ()->showMessage (QString ("Objects were subdivided"), statusBar ()->showMessage (QString ("Objects were subdivided"),
DELAY_STATUSMSG); DELAY_STATUSMSG);
@ -463,6 +476,8 @@ void MainWindow::on_actionSubdivide_triggered ()
void MainWindow::on_actionSubdivide_pqq_triggered () void MainWindow::on_actionSubdivide_pqq_triggered ()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -476,6 +491,7 @@ void MainWindow::on_actionSubdivide_pqq_triggered ()
<<timer.time()<<" seconds."<<std::endl; <<timer.time()<<" seconds."<<std::endl;
#endif #endif
QApplication::restoreOverrideCursor ();
emit (sceneChanged ()); emit (sceneChanged ());
statusBar ()->showMessage (QString ("Objects were subdivided"), statusBar ()->showMessage (QString ("Objects were subdivided"),
DELAY_STATUSMSG); DELAY_STATUSMSG);
@ -498,6 +514,8 @@ void MainWindow::on_actionCompute_Voronoi_3D_triggered ()
if (fileName.isEmpty ()) return; if (fileName.isEmpty ()) return;
QApplication::setOverrideCursor (Qt::WaitCursor);
this->clear_all(); this->clear_all();
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
@ -582,6 +600,7 @@ void MainWindow::on_actionCompute_Voronoi_3D_triggered ()
#endif #endif
init_all_new_volumes(); init_all_new_volumes();
QApplication::restoreOverrideCursor ();
emit (sceneChanged ()); emit (sceneChanged ());
statusBar ()->showMessage (QString ("Voronoi 3D of points in ") + fileName, statusBar ()->showMessage (QString ("Voronoi 3D of points in ") + fileName,
DELAY_STATUSMSG); DELAY_STATUSMSG);
@ -597,6 +616,8 @@ void MainWindow::on_actionDual_3_triggered ()
return; return;
} }
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -618,11 +639,14 @@ void MainWindow::on_actionDual_3_triggered ()
init_all_new_volumes(); init_all_new_volumes();
statusBar ()->showMessage (QString ("Dual_3 computed"), DELAY_STATUSMSG); statusBar ()->showMessage (QString ("Dual_3 computed"), DELAY_STATUSMSG);
QApplication::restoreOverrideCursor ();
emit (sceneChanged ()); emit (sceneChanged ());
} }
void MainWindow::on_actionClose_volume_triggered() void MainWindow::on_actionClose_volume_triggered()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -639,6 +663,8 @@ void MainWindow::on_actionClose_volume_triggered()
statusBar ()->showMessage statusBar ()->showMessage
(QString ("LCC already 3-closed"), DELAY_STATUSMSG); (QString ("LCC already 3-closed"), DELAY_STATUSMSG);
QApplication::restoreOverrideCursor ();
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
timer.stop(); timer.stop();
std::cout<<"Time to 3-close the current lcc: " std::cout<<"Time to 3-close the current lcc: "
@ -652,6 +678,8 @@ void MainWindow::on_actionSew3_same_facets_triggered()
int mymark = scene.lcc->get_new_mark(); int mymark = scene.lcc->get_new_mark();
mark_all_filled_and_visible_volumes(mymark); mark_all_filled_and_visible_volumes(mymark);
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -669,6 +697,8 @@ void MainWindow::on_actionSew3_same_facets_triggered()
scene.lcc->free_mark(mymark); scene.lcc->free_mark(mymark);
QApplication::restoreOverrideCursor ();
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
timer.stop(); timer.stop();
std::cout<<"Time to sew3 all same facets: " std::cout<<"Time to sew3 all same facets: "
@ -679,6 +709,7 @@ void MainWindow::on_actionSew3_same_facets_triggered()
void MainWindow::on_actionUnsew3_all_triggered() void MainWindow::on_actionUnsew3_all_triggered()
{ {
unsigned int nb=0; unsigned int nb=0;
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
@ -700,6 +731,7 @@ void MainWindow::on_actionUnsew3_all_triggered()
std::cout<<"Time to unsew3 all filled volumes: " std::cout<<"Time to unsew3 all filled volumes: "
<<timer.time()<<" seconds."<<std::endl; <<timer.time()<<" seconds."<<std::endl;
#endif #endif
QApplication::restoreOverrideCursor ();
if ( nb > 0 ) if ( nb > 0 )
{ {
@ -714,6 +746,8 @@ void MainWindow::on_actionUnsew3_all_triggered()
void MainWindow::on_actionRemove_filled_volumes_triggered() void MainWindow::on_actionRemove_filled_volumes_triggered()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -739,6 +773,7 @@ void MainWindow::on_actionRemove_filled_volumes_triggered()
#endif #endif
recreate_whole_volume_list(); recreate_whole_volume_list();
QApplication::restoreOverrideCursor ();
emit(sceneChanged()); emit(sceneChanged());
statusBar()->showMessage statusBar()->showMessage
@ -748,6 +783,8 @@ void MainWindow::on_actionRemove_filled_volumes_triggered()
void MainWindow::on_actionTriangulate_all_facets_triggered() void MainWindow::on_actionTriangulate_all_facets_triggered()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -770,6 +807,7 @@ void MainWindow::on_actionTriangulate_all_facets_triggered()
<<timer.time()<<" seconds."<<std::endl; <<timer.time()<<" seconds."<<std::endl;
#endif #endif
QApplication::restoreOverrideCursor ();
emit (sceneChanged ()); emit (sceneChanged ());
statusBar()->showMessage statusBar()->showMessage
(QString ("Facets of visible and filled volume(s) triangulated"), (QString ("Facets of visible and filled volume(s) triangulated"),
@ -778,6 +816,8 @@ void MainWindow::on_actionTriangulate_all_facets_triggered()
void MainWindow::on_actionMerge_all_volumes_triggered() void MainWindow::on_actionMerge_all_volumes_triggered()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -813,9 +853,10 @@ void MainWindow::on_actionMerge_all_volumes_triggered()
recreate_whole_volume_list(); recreate_whole_volume_list();
QApplication::restoreOverrideCursor ();
emit (sceneChanged ()); emit (sceneChanged ());
statusBar()->showMessage statusBar()->showMessage
(QString ("All volume(s) merged"), DELAY_STATUSMSG); (QString ("Visible and filled volume(s) merged"), DELAY_STATUSMSG);
} }
bool MainWindow::is_volume_in_list(LCC::Attribute_handle<3>::type ah) bool MainWindow::is_volume_in_list(LCC::Attribute_handle<3>::type ah)
@ -865,7 +906,8 @@ void MainWindow::update_volume_list_add(LCC::Attribute_handle<3>::type ah)
QTableWidgetItem* attribHandle = new QTableWidgetItem; QTableWidgetItem* attribHandle = new QTableWidgetItem;
attribHandle->setData attribHandle->setData
(Qt::UserRole, reinterpret_cast<quintptr>(&scene.lcc->get_attribute<3>(ah))); (Qt::UserRole,
reinterpret_cast<quintptr>(&scene.lcc->get_attribute<3>(ah)));
volumeList->setItem(newRow,3,attribHandle); volumeList->setItem(newRow,3,attribHandle);
@ -1169,6 +1211,8 @@ void MainWindow::onMengerCancel()
recreate_whole_volume_list(); recreate_whole_volume_list();
mengerVolumes.clear(); mengerVolumes.clear();
update_operations_entries(true); update_operations_entries(true);
statusBar()->showMessage (QString ("Menger sponge creation canceled"),
DELAY_STATUSMSG);
emit(sceneChanged()); emit(sceneChanged());
} }
@ -1191,6 +1235,8 @@ void MainWindow::onMengerUpdateAttributes(bool newValue)
void MainWindow::onMengerInc() void MainWindow::onMengerInc()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -1292,13 +1338,21 @@ void MainWindow::onMengerInc()
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
timer.stop(); timer.stop();
std::cout<<"Time to increase the level of menger sponge (" std::cout<<"Menger sponge "
<<this->mengerLevel-1<<" -> "<<this->mengerLevel<<"): " <<this->mengerLevel-1<<" -> "<<this->mengerLevel<<", "
<<"attributes updated "
<<(mengerUpdateAttributes ? "DURING" : "AFTER")
<< " construction: "
<<timer.time()<<" seconds."<<std::endl; <<timer.time()<<" seconds."<<std::endl;
#endif #endif
CGAL_assertion( (scene.lcc)->is_valid() ); CGAL_assertion( (scene.lcc)->is_valid() );
QApplication::restoreOverrideCursor ();
statusBar()->showMessage(QString ("Menger sponge creation %1 -> %2").
arg(this->mengerLevel-1).arg(this->mengerLevel),
DELAY_STATUSMSG);
emit(sceneChanged()); emit(sceneChanged());
} }
@ -1592,6 +1646,8 @@ void MainWindow::process_inter_slice(Dart_handle init,
void MainWindow::onMengerDec() void MainWindow::onMengerDec()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -1714,14 +1770,21 @@ void MainWindow::onMengerDec()
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
timer.stop(); timer.stop();
std::cout<<"Time to decrease the level of menger sponge (" std::cout<<"Menger sponge "
<<this->mengerLevel+1<<" -> "<<this->mengerLevel<<"): " <<this->mengerLevel+1<<" -> "<<this->mengerLevel<<", "
<<"attributes updated "
<<(mengerUpdateAttributes ? "DURING" : "AFTER")
<< " construction: "
<<timer.time()<<" seconds."<<std::endl; <<timer.time()<<" seconds."<<std::endl;
#endif #endif
recreate_whole_volume_list(); recreate_whole_volume_list();
statusBar ()->showMessage (QString ("Menger Dec"),DELAY_STATUSMSG); statusBar()->showMessage(QString ("Menger sponge creation %1 -> %2").
arg(this->mengerLevel+1).arg(this->mengerLevel),
DELAY_STATUSMSG);
QApplication::restoreOverrideCursor ();
emit(sceneChanged()); emit(sceneChanged());
} }
@ -1731,14 +1794,18 @@ void MainWindow::onMengerDec()
void MainWindow::on_actionCreate_Sierpinski_Carpet_triggered () void MainWindow::on_actionCreate_Sierpinski_Carpet_triggered ()
{ {
neverUpdateAttributes = dialogsierpinskicarpet.never->isChecked(); /*neverUpdateAttributes = dialogsierpinskicarpet.never->isChecked();
duringConstructionUpdateAttributes = dialogsierpinskicarpet.during->isChecked(); duringConstructionUpdateAttributes = dialogsierpinskicarpet.during->isChecked();
afterConstructionUpdateAttributes = dialogsierpinskicarpet.after->isChecked(); afterConstructionUpdateAttributes = dialogsierpinskicarpet.after->isChecked();
updateAttributesMethodStdMap = dialogsierpinskicarpet.stdmap->isChecked(); updateAttributesMethodStdMap = dialogsierpinskicarpet.stdmap->isChecked();
updateAttributesMethodTraversal = dialogsierpinskicarpet.traversal->isChecked(); updateAttributesMethodTraversal = dialogsierpinskicarpet.traversal->isChecked();
computeGeometry = false;
// By default, the geometry will be computed after the construction // By default, the geometry will be computed after the construction
isComputableGeometry = true; isComputableGeometry = true;*/
computeGeometry = false;
sierpinskiCarpetUpdateAttributes
= dialogsierpinskicarpet.updateAttributes->isChecked();
dialogsierpinskicarpet.level->disconnect(this); dialogsierpinskicarpet.level->disconnect(this);
@ -1775,6 +1842,7 @@ void MainWindow::on_actionCreate_Sierpinski_Carpet_triggered ()
void MainWindow::onSierpinskiCarpetCancel() void MainWindow::onSierpinskiCarpetCancel()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
for(std::vector<Dart_handle>::iterator it=sierpinskiCarpetSurfaces.begin(); for(std::vector<Dart_handle>::iterator it=sierpinskiCarpetSurfaces.begin();
it!=sierpinskiCarpetSurfaces.end(); ++it) it!=sierpinskiCarpetSurfaces.end(); ++it)
{ {
@ -1784,6 +1852,7 @@ void MainWindow::onSierpinskiCarpetCancel()
recreate_whole_volume_list(); recreate_whole_volume_list();
sierpinskiCarpetSurfaces.clear(); sierpinskiCarpetSurfaces.clear();
update_operations_entries(true); update_operations_entries(true);
QApplication::restoreOverrideCursor ();
emit(sceneChanged()); emit(sceneChanged());
} }
@ -1799,7 +1868,12 @@ void MainWindow::onSierpinskiCarpetChangeLevel(int newLevel)
while ( newLevel < sierpinskiCarpetLevel ) onSierpinskiCarpetDec(); while ( newLevel < sierpinskiCarpetLevel ) onSierpinskiCarpetDec();
} }
void MainWindow::onSierpinskiCarpetNeverUpdateAttributes(bool /*newValue*/) void MainWindow::onSierpinskiCarpetUpdateAttributes(bool newValue)
{
sierpinskiCarpetUpdateAttributes = newValue;
}
/*void MainWindow::onSierpinskiCarpetNeverUpdateAttributes(bool newValue)
{ {
if (afterConstructionUpdateAttributes) if (afterConstructionUpdateAttributes)
{ {
@ -1811,7 +1885,7 @@ void MainWindow::onSierpinskiCarpetNeverUpdateAttributes(bool /*newValue*/)
afterConstructionUpdateAttributes = false; afterConstructionUpdateAttributes = false;
} }
void MainWindow::onSierpinskiCarpetDuringConstructionUpdateAttributes(bool /*newValue*/) void MainWindow::onSierpinskiCarpetDuringConstructionUpdateAttributes(bool newValue)
{ {
if (afterConstructionUpdateAttributes) if (afterConstructionUpdateAttributes)
{ {
@ -1823,7 +1897,7 @@ void MainWindow::onSierpinskiCarpetDuringConstructionUpdateAttributes(bool /*new
afterConstructionUpdateAttributes = false; afterConstructionUpdateAttributes = false;
} }
void MainWindow::onSierpinskiCarpetAfterConstructionUpdateAttributes(bool /*newValue*/) void MainWindow::onSierpinskiCarpetAfterConstructionUpdateAttributes(bool newValue)
{ {
if (!afterConstructionUpdateAttributes) if (!afterConstructionUpdateAttributes)
{ {
@ -1835,19 +1909,19 @@ void MainWindow::onSierpinskiCarpetAfterConstructionUpdateAttributes(bool /*newV
afterConstructionUpdateAttributes = true; afterConstructionUpdateAttributes = true;
} }
void MainWindow::onSierpinskiCarpetUpdateAttributesMethodStdMap(bool /*newValue*/) void MainWindow::onSierpinskiCarpetUpdateAttributesMethodStdMap(bool newValue)
{ {
updateAttributesMethodStdMap = true; updateAttributesMethodStdMap = true;
updateAttributesMethodTraversal = false; updateAttributesMethodTraversal = false;
} }
void MainWindow::onSierpinskiCarpetUpdateAttributesMethodTraversal(bool /*newValue*/) void MainWindow::onSierpinskiCarpetUpdateAttributesMethodTraversal(bool newValue)
{ {
updateAttributesMethodStdMap = false; updateAttributesMethodStdMap = false;
updateAttributesMethodTraversal = true; updateAttributesMethodTraversal = true;
} }
void MainWindow::onSierpinskiCarpetComputeGeometry(bool /*newValue*/) void MainWindow::onSierpinskiCarpetComputeGeometry(bool newValue)
{ {
sierpinski_carpet_compute_geometry(); sierpinski_carpet_compute_geometry();
@ -1855,10 +1929,12 @@ void MainWindow::onSierpinskiCarpetComputeGeometry(bool /*newValue*/)
dialogsierpinskicarpet.computeGeometry->setEnabled(false); dialogsierpinskicarpet.computeGeometry->setEnabled(false);
emit(sceneChanged()); emit(sceneChanged());
} }*/
void MainWindow::onSierpinskiCarpetInc() void MainWindow::onSierpinskiCarpetInc()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -1866,14 +1942,14 @@ void MainWindow::onSierpinskiCarpetInc()
this->sierpinskiCarpetLevel++; this->sierpinskiCarpetLevel++;
if (computeGeometry) /* if (computeGeometry)
{ {
// Here case where the geometry could be computed after the construction, but it was not updated. // Here case where the geometry could be computed after the construction, but it was not updated.
computeGeometry = false; computeGeometry = false;
dialogsierpinskicarpet.computeGeometry->setEnabled(false); dialogsierpinskicarpet.computeGeometry->setEnabled(false);
// => geometry will not be computed later. // => geometry will not be computed later.
isComputableGeometry = false; isComputableGeometry = false;
} }*/
std::vector<Dart_handle> edges; std::vector<Dart_handle> edges;
nbfacesinit = sierpinskiCarpetSurfaces.size(); nbfacesinit = sierpinskiCarpetSurfaces.size();
@ -1918,7 +1994,7 @@ void MainWindow::onSierpinskiCarpetInc()
(scene.lcc)->free_mark(markEdges); (scene.lcc)->free_mark(markEdges);
(scene.lcc)->free_mark(markFaces); (scene.lcc)->free_mark(markFaces);
if (afterConstructionUpdateAttributes) /* if (afterConstructionUpdateAttributes)
{ {
if (updateAttributesMethodStdMap) if (updateAttributesMethodStdMap)
{ {
@ -1935,7 +2011,7 @@ void MainWindow::onSierpinskiCarpetInc()
} }
} }
} }
} }*/
for(std::size_t i = 0; i < edges.size(); i++) for(std::size_t i = 0; i < edges.size(); i++)
{ {
@ -1948,12 +2024,12 @@ void MainWindow::onSierpinskiCarpetInc()
sierpinski_carpet_split_face_in_nine(sierpinskiCarpetSurfaces[i]); sierpinski_carpet_split_face_in_nine(sierpinskiCarpetSurfaces[i]);
} }
if (afterConstructionUpdateAttributes) if (!sierpinskiCarpetUpdateAttributes)
{ {
sierpinski_carpet_update_geometry(); sierpinski_carpet_update_geometry();
} }
if (neverUpdateAttributes) /* if (neverUpdateAttributes)
{ {
scene.lcc->correct_invalid_attributes(); scene.lcc->correct_invalid_attributes();
@ -1963,24 +2039,33 @@ void MainWindow::onSierpinskiCarpetInc()
computeGeometry = true; computeGeometry = true;
dialogsierpinskicarpet.computeGeometry->setEnabled(true); dialogsierpinskicarpet.computeGeometry->setEnabled(true);
} }
} }*/
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
timer.stop(); timer.stop();
std::cout<<"Time to increase the level of sierpinski carpet (" std::cout<<"Sierpinski carpet "
<<this->sierpinskiCarpetLevel-1<<" -> "<<this->sierpinskiCarpetLevel<<") " <<this->sierpinskiCarpetLevel-1<<" -> "
<<(duringConstructionUpdateAttributes ? "DURING" : "AFTER") << " construction update attributes: " <<this->sierpinskiCarpetLevel<<", "
<<"attributes updated "
<<(sierpinskiCarpetUpdateAttributes ? "DURING" : "AFTER")
<< " construction: "
<<timer.time()<<" seconds."<<std::endl; <<timer.time()<<" seconds."<<std::endl;
#endif #endif
CGAL_assertion( (scene.lcc)->is_valid() ); CGAL_assertion( (scene.lcc)->is_valid() );
statusBar()->showMessage(QString ("Sierpinski carpet creation %1 -> %2").
arg(this->sierpinskiCarpetLevel-1).
arg(this->sierpinskiCarpetLevel),
DELAY_STATUSMSG);
QApplication::restoreOverrideCursor ();
emit(sceneChanged()); emit(sceneChanged());
} }
void MainWindow::sierpinski_carpet_update_geometry() void MainWindow::sierpinski_carpet_update_geometry()
{ {
if (updateAttributesMethodStdMap) /* if (updateAttributesMethodStdMap)
{ {
for(std::size_t i = 0; i < new_darts.size(); i++) for(std::size_t i = 0; i < new_darts.size(); i++)
{ {
@ -1991,7 +2076,7 @@ void MainWindow::sierpinski_carpet_update_geometry()
new_darts.clear(); new_darts.clear();
} }
if (updateAttributesMethodTraversal) if (updateAttributesMethodTraversal)*/
{ {
int markVertices = (scene.lcc)->get_new_mark(); int markVertices = (scene.lcc)->get_new_mark();
@ -2257,7 +2342,7 @@ void MainWindow::sierpinski_carpet_copy_attributes_and_embed_vertex
void MainWindow::sierpinski_carpet_split_edge_in_three(Dart_handle dh) void MainWindow::sierpinski_carpet_split_edge_in_three(Dart_handle dh)
{ {
if (duringConstructionUpdateAttributes) if (sierpinskiCarpetUpdateAttributes)
{ {
LCC::Point p1 = scene.lcc->point(dh); LCC::Point p1 = scene.lcc->point(dh);
LCC::Point p2 = scene.lcc->point(scene.lcc->other_extremity(dh)); LCC::Point p2 = scene.lcc->point(scene.lcc->other_extremity(dh));
@ -2276,7 +2361,7 @@ void MainWindow::sierpinski_carpet_split_edge_in_three(Dart_handle dh)
{ {
LCC::Point p3, p4; LCC::Point p3, p4;
if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap) /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
{ {
LCC::Point p1 = dart_map[dh]; LCC::Point p1 = dart_map[dh];
LCC::Point p2 = dart_map[scene.lcc->other_extremity(dh)]; LCC::Point p2 = dart_map[scene.lcc->other_extremity(dh)];
@ -2286,7 +2371,7 @@ void MainWindow::sierpinski_carpet_split_edge_in_three(Dart_handle dh)
p3 = LCC::Traits::Construct_translated_point() (p1,v2); p3 = LCC::Traits::Construct_translated_point() (p1,v2);
p4 = LCC::Traits::Construct_translated_point() (p1,v3); p4 = LCC::Traits::Construct_translated_point() (p1,v3);
} }*/
Dart_handle d1= Dart_handle d1=
CGAL::insert_cell_0_in_cell_1(*(scene.lcc), CGAL::insert_cell_0_in_cell_1(*(scene.lcc),
@ -2294,7 +2379,7 @@ void MainWindow::sierpinski_carpet_split_edge_in_three(Dart_handle dh)
LCC::null_handle, LCC::null_handle,
false); false);
if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap) /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
{ {
dart_map.insert(std::pair<Dart_handle, LCC::Point>(d1, p4)); dart_map.insert(std::pair<Dart_handle, LCC::Point>(d1, p4));
if (!(scene.lcc)->is_free(d1,2)) if (!(scene.lcc)->is_free(d1,2))
@ -2302,7 +2387,7 @@ void MainWindow::sierpinski_carpet_split_edge_in_three(Dart_handle dh)
dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(d1,2,1), p4)); dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(d1,2,1), p4));
} }
new_darts.push_back((scene.lcc)->beta(dh,1)); new_darts.push_back((scene.lcc)->beta(dh,1));
} }*/
Dart_handle d2= Dart_handle d2=
CGAL::insert_cell_0_in_cell_1(*(scene.lcc), CGAL::insert_cell_0_in_cell_1(*(scene.lcc),
@ -2310,7 +2395,7 @@ void MainWindow::sierpinski_carpet_split_edge_in_three(Dart_handle dh)
LCC::null_handle, LCC::null_handle,
false); false);
if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap) /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
{ {
dart_map.insert(std::pair<Dart_handle, LCC::Point>(d2, p3)); dart_map.insert(std::pair<Dart_handle, LCC::Point>(d2, p3));
if (!(scene.lcc)->is_free(d2,2)) if (!(scene.lcc)->is_free(d2,2))
@ -2318,7 +2403,7 @@ void MainWindow::sierpinski_carpet_split_edge_in_three(Dart_handle dh)
dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(d2,2,1), p3)); dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(d2,2,1), p3));
} }
new_darts.push_back((scene.lcc)->beta(dh,1)); new_darts.push_back((scene.lcc)->beta(dh,1));
} }*/
} }
} }
@ -2329,16 +2414,16 @@ void MainWindow::sierpinski_carpet_split_face_in_three(Dart_handle dh,
CGAL::insert_cell_1_in_cell_2(*(scene.lcc), CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
scene.lcc->beta(dh,1,1,1), scene.lcc->beta(dh,1,1,1),
scene.lcc->beta(dh,0,0), scene.lcc->beta(dh,0,0),
duringConstructionUpdateAttributes); sierpinskiCarpetUpdateAttributes);
Dart_handle d2= Dart_handle d2=
CGAL::insert_cell_1_in_cell_2(*(scene.lcc), CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
scene.lcc->beta(dh,1,1), scene.lcc->beta(dh,1,1),
scene.lcc->beta(dh,0), scene.lcc->beta(dh,0),
duringConstructionUpdateAttributes); sierpinskiCarpetUpdateAttributes);
if ( removecenter ) if ( removecenter )
{ {
CGAL::remove_cell<LCC,2>(*scene.lcc,d2,duringConstructionUpdateAttributes); CGAL::remove_cell<LCC,2>(*scene.lcc,d2,sierpinskiCarpetUpdateAttributes);
} }
else else
{ {
@ -2359,25 +2444,25 @@ void MainWindow::sierpinski_carpet_split_face_in_nine(Dart_handle dh)
CGAL::insert_cell_1_in_cell_2(*(scene.lcc), CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
d1, d1,
d2, d2,
duringConstructionUpdateAttributes); sierpinskiCarpetUpdateAttributes);
if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap) /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
{ {
dart_map.insert(std::pair<Dart_handle, LCC::Point>(e2, dart_map[d2])); dart_map.insert(std::pair<Dart_handle, LCC::Point>(e2, dart_map[d2]));
dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(e2,2), dart_map[d1])); dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(e2,2), dart_map[d1]));
} }*/
Dart_handle e1= Dart_handle e1=
CGAL::insert_cell_1_in_cell_2(*(scene.lcc), CGAL::insert_cell_1_in_cell_2(*(scene.lcc),
d3, d3,
d4, d4,
duringConstructionUpdateAttributes); sierpinskiCarpetUpdateAttributes);
if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap) /*if (afterConstructionUpdateAttributes && updateAttributesMethodStdMap)
{ {
dart_map.insert(std::pair<Dart_handle, LCC::Point>(e1, dart_map[d4])); dart_map.insert(std::pair<Dart_handle, LCC::Point>(e1, dart_map[d4]));
dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(e1,2), dart_map[d3])); dart_map.insert(std::pair<Dart_handle, LCC::Point>((scene.lcc)->beta(e1,2), dart_map[d3]));
} }*/
sierpinskiCarpetSurfaces.push_back(e2); sierpinskiCarpetSurfaces.push_back(e2);
sierpinskiCarpetSurfaces.push_back(e1); sierpinskiCarpetSurfaces.push_back(e1);
@ -2394,6 +2479,8 @@ void MainWindow::sierpinski_carpet_split_face_in_nine(Dart_handle dh)
void MainWindow::onSierpinskiCarpetDec() void MainWindow::onSierpinskiCarpetDec()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -2412,7 +2499,8 @@ void MainWindow::onSierpinskiCarpetDec()
std::vector<Dart_handle> vertices; std::vector<Dart_handle> vertices;
// First we remove edges. // First we remove edges.
for ( std::vector<Dart_handle>::iterator itsurfaces=sierpinskiCarpetSurfaces.begin(); for ( std::vector<Dart_handle>::iterator
itsurfaces=sierpinskiCarpetSurfaces.begin();
itsurfaces!=sierpinskiCarpetSurfaces.end(); ++itsurfaces) itsurfaces!=sierpinskiCarpetSurfaces.end(); ++itsurfaces)
{ {
Dart_handle dh = *itsurfaces; Dart_handle dh = *itsurfaces;
@ -2429,16 +2517,17 @@ void MainWindow::onSierpinskiCarpetDec()
for(std::size_t i = 0; i < edges.size(); i++) for(std::size_t i = 0; i < edges.size(); i++)
{ {
CGAL::remove_cell<LCC,1>(*scene.lcc, scene.lcc->beta(edges[i],0), CGAL::remove_cell<LCC,1>(*scene.lcc, scene.lcc->beta(edges[i],0),
duringConstructionUpdateAttributes); sierpinskiCarpetUpdateAttributes);
CGAL::remove_cell<LCC,1>(*scene.lcc, scene.lcc->beta(edges[i],1), CGAL::remove_cell<LCC,1>(*scene.lcc, scene.lcc->beta(edges[i],1),
duringConstructionUpdateAttributes); sierpinskiCarpetUpdateAttributes);
CGAL::remove_cell<LCC,1>(*scene.lcc, edges[i], CGAL::remove_cell<LCC,1>(*scene.lcc, edges[i],
duringConstructionUpdateAttributes); sierpinskiCarpetUpdateAttributes);
} }
edges.clear(); edges.clear();
// Lastly we remove vertices. // Lastly we remove vertices.
for ( std::vector<Dart_handle>::iterator itsurfaces=sierpinskiCarpetSurfaces.begin(); for ( std::vector<Dart_handle>::iterator
itsurfaces=sierpinskiCarpetSurfaces.begin();
itsurfaces!=sierpinskiCarpetSurfaces.end(); ++itsurfaces) itsurfaces!=sierpinskiCarpetSurfaces.end(); ++itsurfaces)
{ {
Dart_handle dh = scene.lcc->beta(*itsurfaces,1); Dart_handle dh = scene.lcc->beta(*itsurfaces,1);
@ -2461,7 +2550,8 @@ void MainWindow::onSierpinskiCarpetDec()
} }
(scene.lcc)->negate_mark(markSurfaces); (scene.lcc)->negate_mark(markSurfaces);
for ( std::vector<Dart_handle>::iterator itsurfaces=sierpinskiCarpetSurfaces.begin(); for ( std::vector<Dart_handle>::iterator
itsurfaces=sierpinskiCarpetSurfaces.begin();
itsurfaces!=sierpinskiCarpetSurfaces.end(); ++itsurfaces) itsurfaces!=sierpinskiCarpetSurfaces.end(); ++itsurfaces)
{ {
Dart_handle dh = scene.lcc->beta(*itsurfaces,1); Dart_handle dh = scene.lcc->beta(*itsurfaces,1);
@ -2482,28 +2572,37 @@ void MainWindow::onSierpinskiCarpetDec()
for(std::size_t i = 0; i < vertices.size(); i++) for(std::size_t i = 0; i < vertices.size(); i++)
{ {
CGAL::remove_cell<LCC,0>(*scene.lcc, vertices[i], duringConstructionUpdateAttributes); CGAL::remove_cell<LCC,0>(*scene.lcc, vertices[i],
sierpinskiCarpetUpdateAttributes);
} }
vertices.clear(); vertices.clear();
(scene.lcc)->free_mark(markSurfaces); (scene.lcc)->free_mark(markSurfaces);
(scene.lcc)->free_mark(markVertices); (scene.lcc)->free_mark(markVertices);
if (!duringConstructionUpdateAttributes) if (!sierpinskiCarpetUpdateAttributes)
{ {
scene.lcc->correct_invalid_attributes(); scene.lcc->correct_invalid_attributes();
} }
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
timer.stop(); timer.stop();
std::cout<<"Time to decrease the level of sierpinski carpet (" std::cout<<"Sierpinski carpet "
<<this->sierpinskiCarpetLevel+1<<" -> "<<this->sierpinskiCarpetLevel<<"): " <<this->sierpinskiCarpetLevel+1<<" -> "
<<this->sierpinskiCarpetLevel<<", "
<<"attributes updated "
<<(sierpinskiCarpetUpdateAttributes ? "DURING" : "AFTER")
<< " construction: "
<<timer.time()<<" seconds."<<std::endl; <<timer.time()<<" seconds."<<std::endl;
#endif #endif
recreate_whole_volume_list(); recreate_whole_volume_list();
QApplication::restoreOverrideCursor ();
statusBar ()->showMessage (QString ("Menger Dec"),DELAY_STATUSMSG); statusBar()->showMessage(QString ("Sierpinski carpet creation %1 -> %2").
arg(this->sierpinskiCarpetLevel+1).
arg(this->sierpinskiCarpetLevel),
DELAY_STATUSMSG);
emit(sceneChanged()); emit(sceneChanged());
} }
@ -2581,6 +2680,8 @@ void MainWindow::onSierpinskiTriangleUpdateAttributes(bool newValue)
void MainWindow::onSierpinskiTriangleInc() void MainWindow::onSierpinskiTriangleInc()
{ {
QApplication::setOverrideCursor (Qt::WaitCursor);
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -2662,13 +2763,21 @@ void MainWindow::onSierpinskiTriangleInc()
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
timer.stop(); timer.stop();
std::cout<<"Time to increase the level of sierpinski triangle (" std::cout<<"Sierpinski triangle "
<<this->sierpinskiTriangleLevel-1<<" -> "<<this->sierpinskiTriangleLevel<<") " <<this->sierpinskiTriangleLevel-1<<" -> "
<<(sierpinskiTriangleUpdateAttributes ? "DURING" : "AFTER") << " construction update attributes: " <<this->sierpinskiTriangleLevel<<", "
<<"attributes updated "
<<(sierpinskiTriangleUpdateAttributes ? "DURING" : "AFTER")
<< " construction: "
<<timer.time()<<" seconds."<<std::endl; <<timer.time()<<" seconds."<<std::endl;
#endif #endif
//CGAL_assertion( (scene.lcc)->is_valid() ); //CGAL_assertion( (scene.lcc)->is_valid() );
statusBar()->showMessage(QString ("Sierpinski triangle creation %1 -> %2").
arg(this->sierpinskiTriangleLevel-1).
arg(this->sierpinskiTriangleLevel),
DELAY_STATUSMSG);
QApplication::restoreOverrideCursor ();
emit(sceneChanged()); emit(sceneChanged());
} }
@ -2739,6 +2848,8 @@ void MainWindow::sierpinski_triangle_split_face_in_four(Dart_handle dh, bool rem
void MainWindow::onSierpinskiTriangleDec() void MainWindow::onSierpinskiTriangleDec()
{ {
QApplication::setOverrideCursor( Qt::WaitCursor );
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
CGAL::Timer timer; CGAL::Timer timer;
timer.start(); timer.start();
@ -2775,7 +2886,8 @@ void MainWindow::onSierpinskiTriangleDec()
std::vector<Dart_handle> vertices; std::vector<Dart_handle> vertices;
// Now we remove edges. // Now we remove edges.
for ( std::vector<Dart_handle>::iterator itsurfaces=sierpinskiTriangleSurfaces.begin(); for ( std::vector<Dart_handle>::iterator
itsurfaces=sierpinskiTriangleSurfaces.begin();
itsurfaces!=sierpinskiTriangleSurfaces.end(); ++itsurfaces) itsurfaces!=sierpinskiTriangleSurfaces.end(); ++itsurfaces)
{ {
Dart_handle dh = *itsurfaces; Dart_handle dh = *itsurfaces;
@ -2789,12 +2901,14 @@ void MainWindow::onSierpinskiTriangleDec()
for(std::size_t i = 0; i < edges.size(); i++) for(std::size_t i = 0; i < edges.size(); i++)
{ {
CGAL::remove_cell<LCC,1>(*scene.lcc, edges[i], duringConstructionUpdateAttributes); CGAL::remove_cell<LCC,1>(*scene.lcc, edges[i],
sierpinskiTriangleUpdateAttributes);
} }
edges.clear(); edges.clear();
// Lastly we remove vertices. // Lastly we remove vertices.
for ( std::vector<Dart_handle>::iterator itsurfaces=sierpinskiTriangleSurfaces.begin(); for ( std::vector<Dart_handle>::iterator
itsurfaces=sierpinskiTriangleSurfaces.begin();
itsurfaces!=sierpinskiTriangleSurfaces.end(); ++itsurfaces) itsurfaces!=sierpinskiTriangleSurfaces.end(); ++itsurfaces)
{ {
Dart_handle dh = scene.lcc->beta(*itsurfaces,1); Dart_handle dh = scene.lcc->beta(*itsurfaces,1);
@ -2818,7 +2932,8 @@ void MainWindow::onSierpinskiTriangleDec()
} }
(scene.lcc)->negate_mark(markSurfaces); (scene.lcc)->negate_mark(markSurfaces);
for ( std::vector<Dart_handle>::iterator itsurfaces=sierpinskiTriangleSurfaces.begin(); for ( std::vector<Dart_handle>::iterator
itsurfaces=sierpinskiTriangleSurfaces.begin();
itsurfaces!=sierpinskiTriangleSurfaces.end(); ++itsurfaces) itsurfaces!=sierpinskiTriangleSurfaces.end(); ++itsurfaces)
{ {
Dart_handle dh = scene.lcc->beta(*itsurfaces,1); Dart_handle dh = scene.lcc->beta(*itsurfaces,1);
@ -2838,7 +2953,8 @@ void MainWindow::onSierpinskiTriangleDec()
for(std::size_t i = 0; i < vertices.size(); i++) for(std::size_t i = 0; i < vertices.size(); i++)
{ {
CGAL::remove_cell<LCC,0>(*scene.lcc, vertices[i], duringConstructionUpdateAttributes); CGAL::remove_cell<LCC,0>(*scene.lcc, vertices[i],
sierpinskiTriangleUpdateAttributes);
} }
vertices.clear(); vertices.clear();
@ -2852,14 +2968,22 @@ void MainWindow::onSierpinskiTriangleDec()
#ifdef CGAL_PROFILE_LCC_DEMO #ifdef CGAL_PROFILE_LCC_DEMO
timer.stop(); timer.stop();
std::cout<<"Time to decrease the level of sierpinski triangle (" std::cout<<"Sierpinski triangle "
<<this->sierpinskiTriangleLevel+1<<" -> "<<this->sierpinskiTriangleLevel<<"): " <<this->sierpinskiTriangleLevel+1<<" -> "
<<this->sierpinskiTriangleLevel<<", "
<<"attributes updated "
<<(sierpinskiTriangleUpdateAttributes ? "DURING" : "AFTER")
<< " construction: "
<<timer.time()<<" seconds."<<std::endl; <<timer.time()<<" seconds."<<std::endl;
#endif #endif
recreate_whole_volume_list(); recreate_whole_volume_list();
statusBar()->showMessage(QString ("Sierpinski triangle creation %1 -> %2").
arg(this->sierpinskiTriangleLevel+1).
arg(this->sierpinskiTriangleLevel),
DELAY_STATUSMSG);
QApplication::restoreOverrideCursor ();
// statusBar ()->showMessage (QString ("Sirpinski Triangle Dec"),DELAY_STATUSMSG);
emit(sceneChanged()); emit(sceneChanged());
} }

View File

@ -63,7 +63,8 @@ public:
{ setupUi(this); } { setupUi(this); }
}; };
class DialogSierpinskiCarpet : public QDialog, public Ui::createSierpinskiCarpet class DialogSierpinskiCarpet : public QDialog,
public Ui::createSierpinskiCarpet
{ {
Q_OBJECT Q_OBJECT
@ -72,7 +73,8 @@ public:
{ setupUi(this); } { setupUi(this); }
}; };
class DialogSierpinskiTriangle : public QDialog, public Ui::createSierpinskiTriangle class DialogSierpinskiTriangle : public QDialog,
public Ui::createSierpinskiTriangle
{ {
Q_OBJECT Q_OBJECT
@ -158,12 +160,13 @@ public slots:
void onMengerUpdateAttributes(bool); void onMengerUpdateAttributes(bool);
void onSierpinskiCarpetChangeLevel(int); void onSierpinskiCarpetChangeLevel(int);
void onSierpinskiCarpetNeverUpdateAttributes(bool); /* void onSierpinskiCarpetNeverUpdateAttributes(bool);
void onSierpinskiCarpetDuringConstructionUpdateAttributes(bool); void onSierpinskiCarpetDuringConstructionUpdateAttributes(bool);
void onSierpinskiCarpetAfterConstructionUpdateAttributes(bool); void onSierpinskiCarpetAfterConstructionUpdateAttributes(bool);
void onSierpinskiCarpetUpdateAttributesMethodStdMap(bool); void onSierpinskiCarpetUpdateAttributesMethodStdMap(bool);
void onSierpinskiCarpetUpdateAttributesMethodTraversal(bool); void onSierpinskiCarpetUpdateAttributesMethodTraversal(bool);
void onSierpinskiCarpetComputeGeometry(bool); void onSierpinskiCarpetComputeGeometry(bool);*/
void onSierpinskiCarpetUpdateAttributes(bool);
void onSierpinskiCarpetOk(); void onSierpinskiCarpetOk();
void onSierpinskiCarpetCancel(); void onSierpinskiCarpetCancel();
void onSierpinskiCarpetInc(); void onSierpinskiCarpetInc();
@ -211,16 +214,20 @@ protected:
std::vector<Dart_handle>& faces, std::vector<Dart_handle>& faces,
int markVols); int markVols);
void sierpinski_carpet_copy_attributes_and_embed_vertex(Dart_handle dh, LCC::Point& p); void sierpinski_carpet_copy_attributes_and_embed_vertex(Dart_handle dh,
LCC::Point& p);
void sierpinski_carpet_update_geometry(); void sierpinski_carpet_update_geometry();
void sierpinski_carpet_compute_geometry(); void sierpinski_carpet_compute_geometry();
void sierpinski_carpet_compute_4x4_geometry_matrix(LCC::Point p[4][4], LCC::Point& p00, LCC::Point& p03, LCC::Point& p33, LCC::Point& p30); void sierpinski_carpet_compute_4x4_geometry_matrix(LCC::Point p[4][4],
LCC::Point& p00, LCC::Point& p03, LCC::Point& p33, LCC::Point& p30);
void sierpinski_carpet_split_edge_in_three(Dart_handle dh); void sierpinski_carpet_split_edge_in_three(Dart_handle dh);
void sierpinski_carpet_split_face_in_three(Dart_handle dh, bool removecenter); void sierpinski_carpet_split_face_in_three(Dart_handle dh,
bool removecenter);
void sierpinski_carpet_split_face_in_nine(Dart_handle dh); void sierpinski_carpet_split_face_in_nine(Dart_handle dh);
void sierpinski_triangle_split_edge_in_two(Dart_handle dh); void sierpinski_triangle_split_edge_in_two(Dart_handle dh);
void sierpinski_triangle_split_face_in_four(Dart_handle dh, bool removecenter); void sierpinski_triangle_split_face_in_four(Dart_handle dh,
bool removecenter);
Scene scene; Scene scene;
@ -237,13 +244,14 @@ protected:
int sierpinskiCarpetLevel; int sierpinskiCarpetLevel;
std::size_t nbfacesinit; std::size_t nbfacesinit;
bool neverUpdateAttributes; bool sierpinskiCarpetUpdateAttributes;
bool computeGeometry;
/*bool neverUpdateAttributes;
bool duringConstructionUpdateAttributes; bool duringConstructionUpdateAttributes;
bool afterConstructionUpdateAttributes; bool afterConstructionUpdateAttributes;
bool updateAttributesMethodStdMap; bool updateAttributesMethodStdMap;
bool updateAttributesMethodTraversal; bool updateAttributesMethodTraversal;
bool computeGeometry; bool isComputableGeometry;*/
bool isComputableGeometry;
std::vector<Dart_handle> sierpinskiCarpetSurfaces; std::vector<Dart_handle> sierpinskiCarpetSurfaces;
// utilisés seulement lorsque pas de mise à jour d'attributs // utilisés seulement lorsque pas de mise à jour d'attributs
std::map<Dart_handle, LCC::Point> dart_map; std::map<Dart_handle, LCC::Point> dart_map;

View File

@ -188,34 +188,34 @@ void Viewer::drawAllVertices()
void Viewer::initDraw() void Viewer::initDraw()
{ {
//Compile drawFacet //Compile drawFacet
std::cout << "Compile Display Lists : Faces, " << std::flush; // std::cout << "Compile Display Lists : Faces, " << std::flush;
m_dlFaces = ::glGenLists(1); m_dlFaces = ::glGenLists(1);
::glNewList(m_dlFaces, GL_COMPILE); ::glNewList(m_dlFaces, GL_COMPILE);
drawAllFaces(false); drawAllFaces(false);
::glEndList(); ::glEndList();
//Compile drawFacet with flat shading //Compile drawFacet with flat shading
std::cout << "Faces (flat shading), " << std::flush; // std::cout << "Faces (flat shading), " << std::flush;
m_dlFacesFlat = ::glGenLists(1); m_dlFacesFlat = ::glGenLists(1);
::glNewList(m_dlFacesFlat, GL_COMPILE); ::glNewList(m_dlFacesFlat, GL_COMPILE);
drawAllFaces(true); drawAllFaces(true);
::glEndList(); ::glEndList();
//Compile drawEdge //Compile drawEdge
std::cout << "edges, " << std::flush; // std::cout << "edges, " << std::flush;
m_dlEdges = ::glGenLists(1); m_dlEdges = ::glGenLists(1);
::glNewList(m_dlEdges, GL_COMPILE); ::glNewList(m_dlEdges, GL_COMPILE);
drawAllEdges(); drawAllEdges();
::glEndList(); ::glEndList();
//Compile drawvertices //Compile drawvertices
std::cout << "vertices" << std::flush; // std::cout << "vertices" << std::flush;
m_dlVertices = ::glGenLists(1); m_dlVertices = ::glGenLists(1);
::glNewList(m_dlVertices, GL_COMPILE); ::glNewList(m_dlVertices, GL_COMPILE);
drawAllVertices(); drawAllVertices();
::glEndList(); ::glEndList();
std::cout << ". DONE." << std::endl; // std::cout << ". DONE." << std::endl;
m_displayListCreated = true; m_displayListCreated = true;
} }