bug fixes & selection functionality in the demo

This commit is contained in:
konstantinos katrioplas 2017-11-15 12:25:41 +01:00
parent 2fcef87d08
commit 45063e1346
3 changed files with 250 additions and 272 deletions

View File

@ -89,10 +89,10 @@ and provides a list of the parameters that are used in this package.
## Meshing Functions ##
- `CGAL::Polygon_mesh_processing::fair()`
- `CGAL::Polygon_mesh_processing::refine()`
- `CGAL::Polygon_mesh_processing::angle_remeshing()`
- `CGAL::Polygon_mesh_processing::area_remeshing()`
- `CGAL::Polygon_mesh_processing::compatible_remeshing()`
- `CGAL::Polygon_mesh_processing::curvature_flow()`
- `CGAL::Polygon_mesh_processing::angle_smoothing()`
- `CGAL::Polygon_mesh_processing::area_smoothing()`
- `CGAL::Polygon_mesh_processing::compatible_smoothing()`
- `CGAL::Polygon_mesh_processing::mean_curvature_flow()`
- `CGAL::Polygon_mesh_processing::triangulate_face()`
- `CGAL::Polygon_mesh_processing::triangulate_faces()`
- \link PMP_meshing_grp `CGAL::Polygon_mesh_processing::isotropic_remeshing()` \endlink

View File

@ -65,7 +65,6 @@ public:
connect(ui_widget.Run_convergence_button, SIGNAL(clicked()), this, SLOT(on_Run_convergence_clicked()));
}
QList<QAction*> actions() const
@ -99,6 +98,7 @@ public:
ui_widget.Area_spinBox->setSingleStep(1);
ui_widget.Area_spinBox->setMinimum(1);
/*
ui_widget.gd_dSpinBox->setSingleStep(0.0001);
ui_widget.gd_dSpinBox->setDecimals(4);
ui_widget.gd_dSpinBox->setMinimum(0.0001);
@ -113,6 +113,7 @@ public:
ui_widget.gd_precision_label->setToolTip("Tradeoff between precision and speed. Less is more precise.");
ui_widget.distance_label->setToolTip("Tradeoff between precision and speed. Less is more precise.");
*/
ui_widget.iterations_spinBox->setValue(20);
ui_widget.iterations_spinBox->setSingleStep(1);
@ -134,10 +135,14 @@ public Q_SLOTS:
dock_widget->show();
dock_widget->raise();
// needed?
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(index));
if(poly_item)
Scene_polyhedron_selection_item* selection_item =
qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index));
if(poly_item || selection_item)
{
init_ui();
}
@ -146,18 +151,24 @@ public Q_SLOTS:
void on_Apply_by_type_clicked()
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(index));
Polyhedron& pmesh = *poly_item->polyhedron();
Scene_polyhedron_selection_item* selection_item =
qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index));
Polyhedron& pmesh = (poly_item != NULL) ?
* poly_item->polyhedron() :
* selection_item->polyhedron();
QApplication::setOverrideCursor(Qt::WaitCursor);
if(ui_widget.Angle_checkBox->isChecked())
{
unsigned int nb_iter = ui_widget.Angle_spinBox->value();
bool use_weights = ui_widget.use_weights_checkBox->isChecked();
//bool use_weights = ui_widget.use_weights_checkBox->isChecked();
angle_smoothing(pmesh,
parameters::number_of_iterations(nb_iter).
use_weights(use_weights));
parameters::number_of_iterations(nb_iter));
poly_item->invalidateOpenGLBuffers();
Q_EMIT poly_item->itemChanged();
@ -165,11 +176,11 @@ public Q_SLOTS:
if(ui_widget.Area_checkBox->isChecked())
{
std::cout<<"Area_checkBox\n";
unsigned int nb_iter = ui_widget.Area_spinBox->value();
double gd_precision = ui_widget.gd_dSpinBox->value();
//double gd_precision = ui_widget.gd_dSpinBox->value();
area_smoothing(pmesh,
parameters::number_of_iterations(nb_iter).
gradient_descent_precision(gd_precision));
parameters::number_of_iterations(nb_iter));
poly_item->invalidateOpenGLBuffers();
Q_EMIT poly_item->itemChanged();
@ -182,7 +193,12 @@ public Q_SLOTS:
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(index));
Polyhedron& pmesh = *poly_item->polyhedron();
Scene_polyhedron_selection_item* selection_item =
qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index));
Polyhedron& pmesh = (poly_item != NULL) ?
* poly_item->polyhedron() :
* selection_item->polyhedron();
QApplication::setOverrideCursor(Qt::WaitCursor);
@ -200,21 +216,22 @@ public Q_SLOTS:
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(index));
Polyhedron& pmesh = *poly_item->polyhedron();
Scene_polyhedron_selection_item* selection_item =
qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index));
Polyhedron& pmesh = (poly_item != NULL) ?
* poly_item->polyhedron() :
* selection_item->polyhedron();
QApplication::setOverrideCursor(Qt::WaitCursor);
unsigned int nb_iter = ui_widget.curv_iterations_spinBox_2->value();
std::cout<<"is_stiffness_matrix_setup= "<<is_stiffness_matrix_setup<<std::endl;
if(!is_stiffness_matrix_setup)
{
setup_mcf_system(pmesh, nb_iter, stiffness_matrix);
is_stiffness_matrix_setup = true;
std::cout<<"STIFFNESS OK."<<std::endl;
}
// todo: pass nb_iter as named parameter
solve_mcf_system(pmesh, nb_iter, stiffness_matrix);
@ -230,20 +247,23 @@ public Q_SLOTS:
{
const Scene_interface::Item_id index = scene->mainSelectionIndex();
Scene_polyhedron_item* poly_item = qobject_cast<Scene_polyhedron_item*>(scene->item(index));
Polyhedron& pmesh = *poly_item->polyhedron();
Scene_polyhedron_selection_item* selection_item =
qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index));
Polyhedron& pmesh = (poly_item != NULL) ?
* poly_item->polyhedron() :
* selection_item->polyhedron();
QApplication::setOverrideCursor(Qt::WaitCursor);
unsigned int nb_iter = ui_widget.iterations_spinBox->value();
double dist = ui_widget.dist_dSpinBox->value();
double gd_precision = ui_widget.gd_dSpinBox->value();
bool use_weights = ui_widget.use_weights_checkBox->isChecked();
//double gd_precision = ui_widget.gd_dSpinBox->value();
//bool use_weights = ui_widget.use_weights_checkBox->isChecked();
compatible_smoothing(pmesh,
parameters::number_of_iterations(nb_iter).
distance_precision(dist).
gradient_descent_precision(gd_precision).
use_weights(use_weights));
distance_precision(dist));
poly_item->invalidateOpenGLBuffers();
Q_EMIT poly_item->itemChanged();
@ -253,7 +273,6 @@ public Q_SLOTS:
private:
QAction* actionSmoothing_;
QDockWidget* dock_widget;

View File

@ -6,276 +6,235 @@
<rect>
<x>0</x>
<y>0</y>
<width>731</width>
<height>482</height>
<width>590</width>
<height>387</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QGroupBox" name="Mesh_groupBox">
<property name="title">
<string>Mesh smoothing</string>
<widget class="QGroupBox" name="Shape_groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>230</y>
<width>571</width>
<height>121</height>
</rect>
</property>
<property name="title">
<string>Shape smoothing</string>
</property>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>551</width>
<height>33</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="MCF_Button">
<property name="text">
<string>MCF</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>551</width>
<height>33</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="modified_MCF_button">
<property name="text">
<string>Modified MCF</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QGroupBox" name="Mesh_groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>571</width>
<height>227</height>
</rect>
</property>
<property name="title">
<string>Mesh smoothing</string>
</property>
<widget class="QSplitter" name="splitter">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>551</width>
<height>183</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QGroupBox" name="Type_groupBox">
<property name="enabled">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="title">
<string/>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="gd_precision_label">
<property name="text">
<string>Gradient descent precision:</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="gd_dSpinBox">
<property name="decimals">
<number>4</number>
</property>
</widget>
</item>
</layout>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="0">
<widget class="QCheckBox" name="Area_checkBox">
<property name="text">
<string>areas</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="use_weights_checkBox">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
<item row="6" column="1">
<widget class="QSpinBox" name="Area_spinBox"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Smooth</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Iterations</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="Angle_spinBox"/>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="Angle_checkBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>use weights</string>
<string>angles</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSplitter" name="splitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<widget class="QPushButton" name="Apply_button">
<property name="text">
<string>Apply</string>
</property>
<widget class="QGroupBox" name="Type_groupBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="title">
<string>Remeshing by type </string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="0">
<widget class="QCheckBox" name="Area_checkBox">
<property name="text">
<string>area</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="Area_spinBox"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Type</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Iterations</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="Angle_spinBox"/>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="Angle_checkBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>angle</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="Apply_button">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="Compatible_groupBox">
<property name="title">
<string>Compatible remeshing algorithm </string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<widget class="QLabel" name="distance_label">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Hausdorff distance:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="dist_dSpinBox">
<property name="decimals">
<number>4</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="iterations_label">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>max iterations: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="iterations_spinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Convergence criteria</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="Run_convergence_button">
<property name="text">
<string>Run to convergence</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="Shape_groupBox">
<widget class="QGroupBox" name="Compatible_groupBox">
<property name="title">
<string>Shape smoothing</string>
<string/>
</property>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>691</width>
<height>33</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="MCF_Button">
<property name="text">
<string>MCF</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="iterations_mcf">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Iterations:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="curv_iterations_spinBox"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>691</width>
<height>33</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="modified_MCF_button">
<property name="text">
<string>Modified MCF</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="iterations_mcf_2">
<property name="text">
<string>Iterations:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="curv_iterations_spinBox_2"/>
</item>
</layout>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<widget class="QLabel" name="distance_label">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Hausdorff distance:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="dist_dSpinBox">
<property name="decimals">
<number>4</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="iterations_label">
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>max iterations: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="iterations_spinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Convergence criteria</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="Run_convergence_button">
<property name="text">
<string>Run to convergence</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</widget>
<resources/>