rework mesh segmentation dialog

This commit is contained in:
wmayer
2018-12-07 13:13:08 +01:00
parent 36447d71c5
commit a92014a36d
3 changed files with 133 additions and 37 deletions

View File

@@ -110,8 +110,8 @@ class MeshExport MeshCurvatureCylindricalSegment : public MeshCurvatureSurfaceSe
{
public:
MeshCurvatureCylindricalSegment(const std::vector<CurvatureInfo>& ci, unsigned long minFacets,
float tolMin, float tolMax, float radius)
: MeshCurvatureSurfaceSegment(ci, minFacets), toleranceMin(tolMin), toleranceMax(tolMax) { curvature = 1/radius;}
float tolMin, float tolMax, float curv)
: MeshCurvatureSurfaceSegment(ci, minFacets), toleranceMin(tolMin), toleranceMax(tolMax) { curvature = curv;}
virtual bool TestFacet (const MeshFacet &rclFacet) const;
virtual const char* GetType() const { return "Cylinder"; }
@@ -124,8 +124,8 @@ private:
class MeshExport MeshCurvatureSphericalSegment : public MeshCurvatureSurfaceSegment
{
public:
MeshCurvatureSphericalSegment(const std::vector<CurvatureInfo>& ci, unsigned long minFacets, float tol, float radius)
: MeshCurvatureSurfaceSegment(ci, minFacets), tolerance(tol) { curvature = 1/radius;}
MeshCurvatureSphericalSegment(const std::vector<CurvatureInfo>& ci, unsigned long minFacets, float tol, float curv)
: MeshCurvatureSurfaceSegment(ci, minFacets), tolerance(tol) { curvature = curv;}
virtual bool TestFacet (const MeshFacet &rclFacet) const;
virtual const char* GetType() const { return "Sphere"; }

View File

@@ -48,12 +48,18 @@ Segmentation::Segmentation(Mesh::Feature* mesh, QWidget* parent, Qt::WindowFlags
ui->setupUi(this);
ui->numPln->setRange(1, INT_MAX);
ui->numPln->setValue(100);
ui->radCyl->setRange(0, INT_MAX);
ui->crvCyl->setRange(0, INT_MAX);
ui->numCyl->setRange(1, INT_MAX);
ui->numCyl->setValue(100);
ui->radSph->setRange(0, INT_MAX);
ui->crvSph->setRange(0, INT_MAX);
ui->numSph->setRange(1, INT_MAX);
ui->numSph->setValue(100);
ui->crv1Free->setRange(-INT_MAX, INT_MAX);
ui->crv2Free->setRange(-INT_MAX, INT_MAX);
ui->numFree->setRange(1, INT_MAX);
ui->numFree->setValue(100);
ui->checkBoxSmooth->setChecked(false);
}
Segmentation::~Segmentation()
@@ -78,13 +84,19 @@ void Segmentation::accept()
meshCurv.ComputePerVertex();
std::vector<MeshCore::MeshSurfaceSegment*> segm;
if (ui->groupBoxFree->isChecked()) {
segm.push_back(new MeshCore::MeshCurvatureFreeformSegment
(meshCurv.GetCurvature(), ui->numFree->value(),
ui->tol1Free->value(), ui->tol2Free->value(),
ui->crv1Free->value(), ui->crv2Free->value()));
}
if (ui->groupBoxCyl->isChecked()) {
segm.push_back(new MeshCore::MeshCurvatureCylindricalSegment
(meshCurv.GetCurvature(), ui->numCyl->value(), ui->tol1Cyl->value(), ui->tol2Cyl->value(), ui->radCyl->value().getValue()));
(meshCurv.GetCurvature(), ui->numCyl->value(), ui->tol1Cyl->value(), ui->tol2Cyl->value(), ui->crvCyl->value()));
}
if (ui->groupBoxSph->isChecked()) {
segm.push_back(new MeshCore::MeshCurvatureSphericalSegment
(meshCurv.GetCurvature(), ui->numSph->value(), ui->tolSph->value(), ui->radSph->value().getValue()));
(meshCurv.GetCurvature(), ui->numSph->value(), ui->tolSph->value(), ui->crvSph->value()));
}
if (ui->groupBoxPln->isChecked()) {
segm.push_back(new MeshCore::MeshCurvaturePlanarSegment

View File

@@ -50,10 +50,10 @@
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="tolPln">
<property name="singleStep">
<double>0.100000000000000</double>
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.100000000000000</double>
<double>0.010000000000000</double>
</property>
</widget>
</item>
@@ -89,20 +89,17 @@
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Radius</string>
<string>Curvature</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="radCyl">
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<widget class="QDoubleSpinBox" name="crvCyl">
<property name="singleStep">
<double>0.100000000000000</double>
<double>0.010000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
<double>0.200000000000000</double>
</property>
</widget>
</item>
@@ -116,10 +113,10 @@
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="tol1Cyl">
<property name="singleStep">
<double>0.100000000000000</double>
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.100000000000000</double>
<double>0.010000000000000</double>
</property>
</widget>
</item>
@@ -133,10 +130,10 @@
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="tol2Cyl">
<property name="singleStep">
<double>0.100000000000000</double>
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.100000000000000</double>
<double>0.010000000000000</double>
</property>
</widget>
</item>
@@ -172,20 +169,17 @@
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Radius</string>
<string>Curvature</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="radSph">
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
<widget class="QDoubleSpinBox" name="crvSph">
<property name="singleStep">
<double>0.100000000000000</double>
<double>0.010000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
<double>0.200000000000000</double>
</property>
</widget>
</item>
@@ -199,10 +193,10 @@
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="tolSph">
<property name="singleStep">
<double>0.100000000000000</double>
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.100000000000000</double>
<double>0.010000000000000</double>
</property>
</widget>
</item>
@@ -226,15 +220,105 @@
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="groupBoxFree">
<property name="title">
<string>Freeform</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Max. Curvature</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="crv1Free">
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.200000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Tolerance</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="tol1Free">
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Min. Curvature</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="crv2Free">
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.200000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Tolerance</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="tol2Free">
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.010000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Minimum number of faces</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="numFree">
<property name="maximum">
<number>100000</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>