fixed edge display for volume cells
[engrid-github.git] / src / libengrid / insertpoints.h
blob80ca3cf175dc8686f50f697d0f2777ec8cdf08fb
1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 // + +
3 // + This file is part of enGrid. +
4 // + +
5 // + Copyright 2008-2014 enGits GmbH +
6 // + +
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. +
11 // + +
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. +
16 // + +
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/>. +
19 // + +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #ifndef INSERTPOINTS_H
22 #define INSERTPOINTS_H
24 #include "surfaceoperation.h"
26 #include <vtkUnstructuredGrid.h>
27 #include <vtkPolyData.h>
28 #include <QSet>
29 #include <QVector>
30 #include "egvtkobject.h"
31 #include "vertexmeshdensity.h"
33 #include "geometrytools.h"
34 using namespace GeometryTools;
36 #include <cmath>
37 using namespace std;
39 class InsertPoints : public SurfaceOperation
42 private: // data-types
44 struct edge_t
46 stencil_t S;
47 int i_edge;
48 double L1, L2, L12;
49 double quality() const { return 0.5*min(L1,L2)/L12; }
50 bool operator< (const edge_t& E) const { return quality() < E.quality(); }
53 private: // attributes
55 int m_NumInserted;
56 double m_Threshold;
58 private: // methods
60 char getNewNodeType(stencil_t S); ///< Returns the type of the node inserted on the edge S.p[1],S.p[3] from stencil_t S
62 public:
64 InsertPoints();
65 virtual void operate();
66 int insertPoints();
67 int getNumInserted() { return m_NumInserted; }
71 #endif