Debian Codegraph @

plugins/core/Standard/qHoughNormals/src/qHoughNormalsDialog.cpp

raw
1 //##########################################################################
2 //# #
3 //# CLOUDCOMPARE PLUGIN: qHoughNormals #
4 //# #
5 //# This program is free software; you can redistribute it and/or modify #
6 //# it under the terms of the GNU General Public License as published by #
7 //# the Free Software Foundation; version 2 or later of the License. #
8 //# #
9 //# This program is distributed in the hope that it will be useful, #
10 //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
11 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
12 //# GNU General Public License for more details. #
13 //# #
14 //# COPYRIGHT: Daniel Girardeau-Montaut #
15 //# #
16 //##########################################################################
17
18 #include "qHoughNormalsDialog.h"
19 #include "ui_qHoughNormalsDlg.h"
20
21 namespace {
22 #ifndef M_PI
23 constexpr double M_PI = 3.14159265358979323846264338327950288;
24 #endif
25 }
26
27 qHoughNormalsDialog::qHoughNormalsDialog(QWidget *parent)
28 : QDialog(parent)
29 , m_ui( new Ui::HoughNormalsDialog )
30 {
31 m_ui->setupUi(this);
32 }
33
34 qHoughNormalsDialog::~qHoughNormalsDialog()
35 {
36 delete m_ui;
37 }
38
39 void qHoughNormalsDialog::setParameters( const Parameters &params )
40 {
41 m_ui->kSpinBox->setValue(params.K);
42 m_ui->tSpinBox->setValue(params.T);
43 m_ui->nPhiSpinBox->setValue(params.n_phi);
44 m_ui->nRotSpinBox->setValue(params.n_rot);
45 m_ui->tolAngleSpinBox->setValue(params.tol_angle_rad * (180.0 / M_PI));
46 m_ui->kDensitySpinBox->setValue(params.k_density);
47 m_ui->useDensityCheckBox->setChecked(params.use_density);
48 }
49
50 void qHoughNormalsDialog::getParameters( Parameters &params )
51 {
52 params.K = m_ui->kSpinBox->value();
53 params.T = m_ui->tSpinBox->value();
54 params.n_phi = m_ui->nPhiSpinBox->value();
55 params.n_rot = m_ui->nRotSpinBox->value();
56 params.tol_angle_rad = m_ui->tolAngleSpinBox->value() * (M_PI / 180.0);
57 params.k_density = m_ui->kDensitySpinBox->value();
58 params.use_density = m_ui->useDensityCheckBox->isChecked();
59 }