1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #include "reducesurfacetriangulation.h"
22 #include "geometrytools.h"
24 ReduceSurfaceTriangulation::ReduceSurfaceTriangulation()
27 m_PerformGeometricTests
= true;
28 m_UseProjectionForSmoothing
= false;
29 m_UseNormalCorrectionForSmoothing
= true;
30 m_AllowFeatureEdgeSwapping
= true;
31 m_RespectFeatureEdgesForDeleteNodes
= true;
32 m_FeatureAngleForDeleteNodes
= GeometryTools::deg2rad(20);
34 m_NumDelaunaySweeps
= 10;
38 void ReduceSurfaceTriangulation::pass1()
40 cout
<< "\nFirst pass of surface reduction:\n(This is the expensive part...)" << endl
;
43 m_UseNormalCorrectionForSmoothing
= true;
44 int num_initial_nodes
= m_Grid
->GetNumberOfPoints();
48 cout
<< "\npass-1 iteration-" << iter
<< ":" << endl
;
50 int num_deleted
= deleteNodes();
51 num_del_max
= max(num_del_max
, num_deleted
);
52 cout
<< "deleted nodes : " << num_deleted
<< endl
;
53 for (int i
= 0; i
< m_NumSmoothSteps
; ++i
) {
54 cout
<< " smoothing : " << i
+1 << "/" << m_NumSmoothSteps
<< endl
;
58 done
= num_deleted
<= max(num_initial_nodes
/100, num_del_max
/100);
59 cout
<< "total nodes : " << m_Grid
->GetNumberOfPoints() << endl
;
60 cout
<< "total cells : " << m_Grid
->GetNumberOfCells() << endl
;
65 void ReduceSurfaceTriangulation::pass2()
67 cout
<< "\n\nSecond pass of surface reduction:\n(This should be quick...)" << endl
;
68 m_UseNormalCorrectionForSmoothing
= false;
72 void ReduceSurfaceTriangulation::operate()
74 setStretchingFactor(1.0);
76 //writeGrid(m_Grid, "take1");
78 //writeGrid(m_Grid, "take2");
81 createIndices(m_Grid
);