1+ #ifndef GMDS_BLOCKSTRUCTURESIMPLIFIER_H
2+ #define GMDS_BLOCKSTRUCTURESIMPLIFIER_H
3+ /* ----------------------------------------------------------------------------*/
4+ #include " LIB_GMDS_MEDIALAXIS_export.h"
5+ #include " gmds/medialaxis/MedialAxis2D.h"
6+ #include " gmds/medialaxis/NonConformalHalfEdge.h"
7+ #include " gmds/medialaxis/MedialAxisMath.h"
8+ #include " gmds/medialaxis/QuantizationGraph.h"
9+ #include " gmds/io/IGMeshIOService.h"
10+ #include " gmds/io/VTKWriter.h"
11+ #include " gmds/ig/MeshDoctor.h"
12+ #include < gmds/ig/Mesh.h>
13+ /* ----------------------------------------------------------------------------*/
14+ namespace gmds {
15+ /* * \class dummy
16+ * \brief dummy class.
17+ */
18+ class LIB_GMDS_MEDIALAXIS_API BlockStructureSimplifier
19+ {
20+ private:
21+ // Non conformal quad block decomposition
22+ Mesh* m_mesh;
23+ // Corresponding non-conformal half edges
24+ std::vector<NonConformalHalfEdge> m_half_edges;
25+ // Quantization graph
26+ QuantizationGraph* m_quantization_graph;
27+ // Half edges length
28+ std::vector<int > m_half_edges_lengths;
29+ // Mesh after removing half edges of length zero
30+ Mesh* m_simplified_mesh;
31+
32+ public:
33+
34+ /* -------------------------------------------------------------------------*/
35+ /* * @brief Constructor.
36+ * @param AMesh
37+ */
38+ explicit BlockStructureSimplifier (Mesh &AMesh);
39+
40+ /* -------------------------------------------------------------------------*/
41+ /* * @brief Default destructor.
42+ * @param
43+ */
44+ virtual ~BlockStructureSimplifier ()=default ;
45+
46+ /* -------------------------------------------------------------------------*/
47+ /* * @brief Getters.
48+ * @param
49+ */
50+ std::vector<NonConformalHalfEdge> halfEdges (){return m_half_edges;}
51+ std::vector<int > halfEdgesLengths (){return m_half_edges_lengths;}
52+
53+ /* -------------------------------------------------------------------------*/
54+ /* * @brief Build the half edges.
55+ * @param
56+ */
57+ void buildHalfEdges ();
58+
59+ /* -------------------------------------------------------------------------*/
60+ /* * @brief Build the quantization graph nodes.
61+ * @param
62+ */
63+ void buildQuantizationGraphNodes ();
64+
65+ /* -------------------------------------------------------------------------*/
66+ /* * @brief Build the connected component of the given half edge.
67+ * @param AHalfEdgeID an half edge ID
68+ */
69+ void buildConnectedComponent (int AHalfEdgeID);
70+
71+ /* -------------------------------------------------------------------------*/
72+ /* * @brief Return the next of the next half edge of the given half edge.
73+ * @param AHalfEdgeID an half edge ID
74+ */
75+ int oppositeInQuad (int AHalfEdgeID);
76+
77+ /* -------------------------------------------------------------------------*/
78+ /* * @brief Build the connected component graph.
79+ * @param
80+ */
81+ void buildQuantizationGraph ();
82+
83+ /* -------------------------------------------------------------------------*/
84+ /* * @brief Get the quantization graph.
85+ * @param
86+ */
87+ QuantizationGraph* getQuantizationGraph ();
88+
89+ /* -------------------------------------------------------------------------*/
90+ /* * @brief Set half edges length.
91+ * @param
92+ */
93+ void setHalfEdgesLength ();
94+
95+ /* -------------------------------------------------------------------------*/
96+ /* * @brief Return the set of sides of the input geometry, each side being a set of half-edge Ids.
97+ * @param
98+ */
99+ std::vector<std::vector<TCellID>> sides ();
100+
101+ /* -------------------------------------------------------------------------*/
102+ /* * @brief Mark the T-junctions.
103+ * @param
104+ */
105+ void markTJunctions ();
106+
107+ /* -------------------------------------------------------------------------*/
108+ /* * @brief Return true if the given node is on the boundary.
109+ * @param
110+ */
111+ bool isOnBoundary (Node AN);
112+
113+ /* -------------------------------------------------------------------------*/
114+ /* * @brief Return the set of half-edges that must be non zero, ie that are adjacent to a singularity.
115+ * @param
116+ */
117+ std::vector<TCellID> nonZeroHalfEdges ();
118+
119+ /* -------------------------------------------------------------------------*/
120+ /* * @brief Return the set of groups of nodes, each group being a set of nodes connected by half-edges of length 0.
121+ * @param
122+ */
123+ std::vector<std::vector<Node>> groupsOfConfundedNodes ();
124+
125+ /* -------------------------------------------------------------------------*/
126+ /* * @brief Return true if the given node is a corner of the boundary.
127+ * @param
128+ */
129+ bool isABoundaryCorner (Node AN);
130+
131+ /* -------------------------------------------------------------------------*/
132+ /* * @brief Compute the disappearance gain for each node.
133+ * @param
134+ */
135+ void computeChosingGains ();
136+
137+ /* -------------------------------------------------------------------------*/
138+ /* * @brief Return a representative for the given group of confunded nodes.
139+ * @param AV
140+ */
141+ Node representative (std::vector<Node> AV);
142+
143+ /* -------------------------------------------------------------------------*/
144+ /* * @brief Build the simplified mesh.
145+ * @param
146+ */
147+ void buildSimplifiedMesh ();
148+
149+ /* -------------------------------------------------------------------------*/
150+ /* * @brief Set the connectivity of the simplified mesh.
151+ * @param
152+ */
153+ void setSimplifiedMeshConnectivity ();
154+
155+ /* -------------------------------------------------------------------------*/
156+ /* * @brief Get the simplified mesh.
157+ * @param
158+ */
159+ Mesh getSimplifiedMesh ();
160+
161+ /* -------------------------------------------------------------------------*/
162+ /* * @brief Write the simplified mesh.
163+ * @param
164+ */
165+ void writeSimplifiedMesh (std::basic_string<char > AFileName);
166+
167+ /* -------------------------------------------------------------------------*/
168+ /* * @brief Execute.
169+ * @param
170+ */
171+ void execute ();
172+
173+ /* -------------------------------------------------------------------------*/
174+ /* * @brief Attach 1 to edges belonging to separatricies.
175+ * @param
176+ */
177+ void markSeparatrices ();
178+
179+ /* -------------------------------------------------------------------------*/
180+ /* * @brief Attach to each face the id of the block it belongs to.
181+ * @param
182+ */
183+ void setBlocksIDs ();
184+
185+ /* -------------------------------------------------------------------------*/
186+ /* * @brief Trace the outlines of the TopMaker blocks.
187+ * @param
188+ */
189+ void traceTopMakerBlocksOutlines ();
190+
191+ /* -------------------------------------------------------------------------*/
192+ /* * @brief Attach to each face the id of the TopMaker block it belongs to.
193+ * @param
194+ */
195+ void setTopMakerBlocksIDs ();
196+ };
197+ /* ----------------------------------------------------------------------------*/
198+ } // end namespace gmds
199+ /* ----------------------------------------------------------------------------*/
200+ #endif // GMDS_BLOCKSTRUCTURESIMPLIFIER_H
0 commit comments