2 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 // + This file is part of enGrid. +
6 // + Copyright 2008-2013 enGits GmbH +
8 // + enGrid is free software: you can redistribute it and/or modify +
9 // + it under the terms of the GNU General Public License as published by +
10 // + the Free Software Foundation, either version 3 of the License, or +
11 // + (at your option) any later version. +
13 // + enGrid is distributed in the hope that it will be useful, +
14 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
15 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
16 // + GNU General Public License for more details. +
18 // + You should have received a copy of the GNU General Public License +
19 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
21 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
24 #include "guicreatehexcore.h"
26 GuiCreateHexCore::GuiCreateHexCore()
30 void GuiCreateHexCore::before()
32 vec3_t
x1( 1e99
, 1e99
, 1e99
);
33 vec3_t
x2(-1e99
, -1e99
, -1e99
);
34 for (vtkIdType id_node
= 0; id_node
< m_Grid
->GetNumberOfPoints(); ++id_node
) {
36 m_Grid
->GetPoint(id_node
, x
.data());
37 for (int i
= 0; i
< 3; ++i
) {
38 x1
[i
] = min(x1
[i
], x
[i
]);
39 x2
[i
] = max(x2
[i
], x
[i
]);
42 double xmin
= min(x1
[0], min(x1
[1], x1
[2]));
43 double xmax
= max(x2
[0], max(x2
[1], x2
[2]));
44 m_X1
= vec3_t(xmin
, xmin
, xmin
);
45 m_X2
= vec3_t(xmax
, xmax
, xmax
);
47 vec3_t xi
= 0.5*(x1
+ x2
);
48 num
.setNum(xi
[0]); m_Ui
.lineEditCiX
->setText(num
);
49 num
.setNum(xi
[1]); m_Ui
.lineEditCiY
->setText(num
);
50 num
.setNum(xi
[2]); m_Ui
.lineEditCiZ
->setText(num
);
53 void GuiCreateHexCore::operate()
55 vec3_t
xi(m_Ui
.lineEditCiX
->text().toDouble(), m_Ui
.lineEditCiY
->text().toDouble(), m_Ui
.lineEditCiZ
->text().toDouble());
56 CreateHexCore
create_hex_core(m_X1
, m_X2
, xi
);