28 #include <QFileDialog> 48 m_mesh(mesh), m_parent(parent), m_treeWidget(treeWidget), m_renderWindow(window)
52 m_dialog =
new PlanarOptimizationDialog;
59 dialog->activateWindow();
76 QSpinBox* smallRegionRemoval_box =
m_dialog->spinBox_sr;
77 if(state == Qt::Checked)
79 smallRegionRemoval_box->setEnabled(
true);
83 smallRegionRemoval_box->setEnabled(
false);
89 QCheckBox* generateTextures_box =
m_dialog->checkBox_gt;
90 QDoubleSpinBox* lineSegmentThreshold_box =
m_dialog->doubleSpinBox_ls;
91 if(state == Qt::Checked)
93 generateTextures_box->setEnabled(
true);
94 lineSegmentThreshold_box->setEnabled(
true);
98 generateTextures_box->setEnabled(
false);
99 lineSegmentThreshold_box->setEnabled(
false);
105 QSpinBox* planeIterations_box =
m_dialog->spinBox_pi;
106 int planeIterations = planeIterations_box->value();
107 QDoubleSpinBox* normalThreshold_box =
m_dialog->doubleSpinBox_nt;
108 float normalThreshold = (float)normalThreshold_box->value();
109 QSpinBox* minimalPlaneSize_box =
m_dialog->spinBox_mp;
110 int minimalPlaneSize = minimalPlaneSize_box->value();
111 QCheckBox* removeSmallRegions_box =
m_dialog->checkBox_sr;
112 bool removeSmallRegions = removeSmallRegions_box->isChecked();
113 QSpinBox* removeSmallRegionThreshold_box =
m_dialog->spinBox_sr;
114 int removeSmallRegionThreshold = (removeSmallRegions) ? removeSmallRegionThreshold_box->value() : 0;
115 QCheckBox* fillHoles_box =
m_dialog->checkBox_fh;
116 bool fillHoles = fillHoles_box->isChecked();
117 QCheckBox* retesselate_box =
m_dialog->checkBox_rt;
118 bool retesselate = retesselate_box->isChecked();
119 QCheckBox* generateTextures_box =
m_dialog->checkBox_gt;
120 bool generateTextures = generateTextures_box->isChecked();
121 QDoubleSpinBox* lineSegmentThreshold_box =
m_dialog->doubleSpinBox_ls;
122 float lineSegmentThreshold = (float)lineSegmentThreshold_box->value();
144 if (removeSmallRegions && removeSmallRegionThreshold > 0)
160 if (generateTextures)
174 vtkSmartPointer<vtkRenderer> renderer =
m_renderWindow->GetRenderers()->GetFirstRenderer();
175 bridge->addActors(renderer);
LVRPlanarOptimizationDialog(LVRMeshItem *mesh, LVRModelItem *parent, QTreeWidget *treeWidget, vtkRenderWindow *renderer)
ClusterBiMap< FaceHandle > iterativePlanarClusterGrowing(BaseMesh< BaseVecT > &mesh, FaceMap< Normal< typename BaseVecT::CoordType >> &normals, float minSinAngle, int numIterations, int minClusterSize)
Algorithm which generates planar clusters from the given mesh, drags points in clusters into regressi...
void deleteSmallPlanarCluster(BaseMesh< BaseVecT > &mesh, ClusterBiMap< FaceHandle > &clusters, size_t smallClusterThreshold)
Removes all clusters and their cotained faces from the given mesh which are smaller than the given sm...
std::shared_ptr< MeshBuffer > MeshBufferPtr
static void apply(BaseMesh< BaseVecT > &mesh, ClusterBiMap< FaceHandle > &clusters, DenseFaceMap< Normal< typename BaseVecT::CoordType >> &faceNormals, float lineFusionThreshold)
vtkRenderWindow * m_renderWindow
DenseFaceMap< Normal< typename BaseVecT::CoordType > > calcFaceNormals(const BaseMesh< BaseVecT > &mesh)
Calculates a normal for each face in the mesh.
virtual ~LVRPlanarOptimizationDialog()
QTreeWidget * m_treeWidget
MeshBufferPtr apply(const BaseMesh< BaseVecT > &mesh)
void connectSignalsAndSlots()
LVRModelItem * m_optimizedModel
void toggleSmallRegionRemoval(int state)
Main class for conversion of LVR model instances to vtk actors. This class parses the internal model ...
A map of clusters, which also saves a back-reference from handle to cluster.
boost::shared_ptr< LVRModelBridge > ModelBridgePtr
Half-edge data structure implementing the BaseMesh interface.
std::shared_ptr< Model > ModelPtr
PlanarOptimizationDialog * m_dialog
MeshBufferPtr getMeshBuffer()
void toggleRetesselation(int state)