29 #include "ui_editConstraintDialog.h" 32 #define M_PI 3.14159265358979323846 40 _ui =
new Ui_EditConstraintDialog();
48 _ui->roll->setValue(roll);
49 _ui->pitch->setValue(pitch);
50 _ui->yaw->setValue(yaw);
52 _ui->checkBox_radians->setChecked(
true);
53 _ui->linear_sigma->setValue(linearSigma);
54 _ui->angular_sigma->setValue(angularSigma);
56 connect(
_ui->checkBox_radians, SIGNAL(stateChanged(
int)),
this, SLOT(
switchUnits()));
66 double conversion = 180.0/
M_PI;
67 if(
_ui->checkBox_radians->isChecked())
69 conversion =
M_PI/180.0;
71 QVector<QDoubleSpinBox*> boxes;
72 boxes.push_back(
_ui->roll);
73 boxes.push_back(
_ui->pitch);
74 boxes.push_back(
_ui->yaw);
75 boxes.push_back(
_ui->angular_sigma);
76 for(
int i=0; i<boxes.size(); ++i)
78 double value = boxes[i]->value()*conversion;
79 if(
_ui->checkBox_radians->isChecked())
81 if(boxes[i]!=
_ui->angular_sigma)
83 boxes[i]->setMinimum(-
M_PI);
85 boxes[i]->setMaximum(
M_PI);
86 boxes[i]->setSuffix(
" rad");
87 boxes[i]->setSingleStep(0.01);
91 if(boxes[i]!=
_ui->angular_sigma)
93 boxes[i]->setMinimum(-180);
95 boxes[i]->setMaximum(180);
96 boxes[i]->setSuffix(
" deg");
97 boxes[i]->setSingleStep(1);
99 boxes[i]->setValue(value);
105 double conversion = 1.0f;
106 if(!
_ui->checkBox_radians->isChecked())
108 conversion =
M_PI/180.0;
110 return Transform(
_ui->x->value(),
_ui->y->value(),
_ui->z->value(),
_ui->roll->value()*conversion,
_ui->pitch->value()*conversion,
_ui->yaw->value()*conversion);
115 return _ui->linear_sigma->value()*
_ui->linear_sigma->value();
119 double conversion = 1.0f;
120 if(!
_ui->checkBox_radians->isChecked())
122 conversion =
M_PI/180.0;
124 double value =
_ui->angular_sigma->value()*conversion;
GLM_FUNC_DECL T roll(detail::tquat< T, P > const &x)
virtual ~EditConstraintDialog()
double getAngularVariance() const
GLM_FUNC_DECL T pitch(detail::tquat< T, P > const &x)
double getLinearVariance() const
Transform getTransform() const
EditConstraintDialog(const Transform &constraint, double linearSigma=1, double angularSigma=1, QWidget *parent=0)
Ui_EditConstraintDialog * _ui
GLM_FUNC_DECL T yaw(detail::tquat< T, P > const &x)