OpenWalnut  1.5.0dev
WVertexProperty.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2013 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 /*
26  * PointProperty.h
27  *
28  * Created on: 12.06.2013
29  * Author: renegade
30  */
31 
32 #ifndef WVERTEXPROPERTY_H_
33 #define WVERTEXPROPERTY_H_
34 
35 #include <vector>
36 #include "WNewVertex.h"
37 #include "osg/Vec3"
38 
39 
40 
41 using namespace butterfly; //NOLINT
42 using std::vector;
43 
44 /**
45  * Object that contains all necessary properties of a vertex necessary for a sufficient analysis.
46  */
48 {
49 public:
50  /**
51  * Initializes a vertex property object and sets settings to defaults.
52  */
54 
55  /**
56  * Destroys the vertex property object.
57  */
58  virtual ~WVertexProperty();
59 
60  /**
61  * Returns the attached triangle count to the current vertex.
62  * \return Attached triangle count to the current vertex.
63  */
64  size_t getTriangleCount();
65 
66  /**
67  * Registers a triangle to the current vertex.
68  * \author schwarzkopf
69  * \param triangleID Triangle ID to be registered.
70  */
71  void attachTriangle( size_t triangleID );
72 
73  /**
74  * Unregisters a triangle to the current vertex.
75  * \author schwarzkopf
76  * \param triangleID Triangle ID to be registered.
77  */
78  void detachTriangle( size_t triangleID );
79 
80  /**
81  * Get all triangle IDs attached to the current vertex. They are not organized by the
82  * correct circular order.
83  * \author schwarzkopf
84  * \return All triangle IDs attached to the current vertex.
85  */
86  vector<size_t> getAttachedTriangles();
87 
88  /**
89  * Returns a neighbor ID within the stencil by the index.
90  * Items must be added in the correct circular order in order to figure out the Butterfly
91  * stencil correctly.
92  * \author schwarzkopf
93  * \param index Position in the list of the stencil neighbor id.
94  * \return Neighbour count of a vertex that is used for the Butterfly stencil.
95  */
96  size_t getStencilNeighbourID( size_t index );
97 
98  /**
99  * Pushes a stencil neighbor vertex ID before the first Item of the list.
100  * Items must be added in the correct circular order in order to figure out the Butterfly
101  * stencil correctly.
102  * Use rather addStencilNeighbourIDToBack than this function due to the performance issue.
103  * \author schwarzkopf
104  * \param stencilNeighbourID Neighbour vertex ID to be regarded in the Butterfly stencil.
105  */
106  void insertStencilNeighbourIDToFront( size_t stencilNeighbourID );
107 
108  /**
109  * Pushs a stencil neighbour vertex ID after the last Item of the list.
110  * Items must be added in the correct circular order in order to figure out the Butterfly
111  * stencil correctly.
112  * \author schwarzkopf
113  * \param stencilNeighbourID Neighbour vertex ID to be regarded in the Butterfly stencil.
114  */
115  void addStencilNeighbourIDToBack( size_t stencilNeighbourID );
116 
117  /**
118  * Returns the Neighbor vertex count of the current vertex.
119  * \author schwarzkopf
120  * It's called "valence" in the Butterfly document sheet.
121  * \return Valence (Neighbor vertex count of the current vertex).
122  */
123  size_t getValence();
124 
125  /**
126  * Returns the bound count class of the stencil's center point
127  * \author schwarzkopf
128  * \return Bound class of the stencil (see description).
129  */
130  int getBoundClass();
131 
132  /**
133  * Sets the bound count class of the stencil's center point
134  * \author schwarzkopf
135  * \param boundCountClass Bound class of the stencil (see description)
136  */
137  void setBoundClass( int boundCountClass );
138 
139  /**
140  * Returns true if a triangle of the triangleID is connected to the vertex
141  * \author schwarzkopf
142  * \param triangleID Triangle ID which is checked for existence
143  * \return Triangle ID exists or not
144  */
145  bool containsTriangle( size_t triangleID );
146 
147  /**
148  * Attachs properties of a new vertex on a line which lies between two original
149  * vertices.
150  * \author schwarzkopf
151  * \param toID The point lies between the current ID and toID.
152  * toID must always be greater than the current vertex ID.
153  */
154  void attachNewVertex( size_t toID );
155 
156  /**
157  * Checks whether the properties of a new vertex exists between the current
158  * vertex and toID.
159  * \author schwarzkopf
160  * \param toID The point lies between the current ID and toID.
161  * toID must always be greater than the current vertex ID.
162  * \return Properties of new vertex exist or not.
163  */
164  bool newVertexExists( size_t toID );
165 
166  /**
167  * Returns properties of the new vertex between the current vertex ID and toID
168  * \author schwarzkopf
169  * \param toID The point lies between the current ID and toID.
170  * toID must always be greater than the current vertex ID.
171  * \return Properties of the new vertex.
172  */
173  WNewVertex* getNewVertexProperty( size_t toID );
174 
175  /**
176  * Returns the maximal neighbor distance within the current vertex.
177  * \author schwarzkopf
178  * \return The Maximal neighbor distance within the current vertex.
179  */
180  float getMaxNeighbourDistance();
181 
182  /**
183  * Returns summed neighbor distance within the current vertex.
184  * \author schwarzkopf
185  * \return The average neighbor distance within the current vertex.
186  * */
187  float getSumNeighbourDistance();
188 
189  /**
190  * Sets maximal neighbor distance within the current vertex.
191  * \author schwarzkopf
192  * \param maxNeighbourDistance The average neighbor distance within the current vertex.
193  */
194  void setMaxNeighbourDistance( float maxNeighbourDistance );
195 
196  /**
197  * Sets the summed neighbor distance within the current vertex.
198  * \author schwarzkopf
199  * \param sumNeighbourDistance The average neighbor distance within the current vertex.
200  */
201  void setSumNeighbourDistance( float sumNeighbourDistance );
202 
203  /**
204  * Returns the Stencil neighbor index of a particular vertex ID
205  * \author schwarzkopf
206  * \param neighbourID Vertex ID to examine.
207  * \return Array index of the Neighbour vertex ID.
208  */
209  int getStencilNeighbourIndex( size_t neighbourID );
210 
211  /**
212  * Returns the properties of new registered vertices of the current vertex. New vertices
213  * of that which are connected to a vertex with a lower ID than this vertex are not stored
214  * because each data set should be stored one timed due to the data holding issue. The
215  * method has the advantage that every new vertex can be traversed only once.
216  * \author schwarzkopf
217  * \return The properties of new registered vertices but only those which are
218  * connected to a higher neighbor vertex ID than the actual.
219  */
220  std::vector<WNewVertex*> getNewVerticesToHigherNeighborID();
221 
222 private:
223  /**
224  * List of attached triangles to the current vertex.
225  */
226  std::vector<size_t> m_attachedTriangle;
227 
228  /**
229  * List of attached new vertices of the current vertex. Due to Organization problems only that
230  * vertices are in this list which are of a higher connected vertex ID than the current.
231  * To get ones of the lower ID you should examine all neighbours of the lower ID and fetch all
232  * new points where toID equals to the current neighbor vertex ID.
233  */
234  std::vector<WNewVertex*> m_newVertices;
235 
236  /**
237  * List that keeps neighbour vertices IDs sorted by the circular order. The whole Butterfly
238  * stencil can be compound using the neighbour array of the other stencil center vertex.
239  */
240  vector<size_t> m_stencilOnNeighbours;
241 
242  /**
243  * Depicts the Vertex' kind of bound iit lies on
244  * <0: Extraordinary case. More triangles ran through than actually exist
245  * 0: Vertex lies not on the bound.
246  * 1: Vertex lies on a bound.
247  * >=2: Vertex lies on at least two bounds that are separated by triangles.
248  * or it contains a vertex connection which hits at least three triangles.
249  */
251 
252  /**
253  * Maximal Neighbor vertex distance to the current vertex.
254  */
256 
257  /**
258  * Sum of all Neighbor vertex distances to the current vertex.
259  */
261 };
262 
263 #endif // WVERTEXPROPERTY_H
Object that contains all necessary properties of a vertex necessary for a sufficient analysis.
vector< size_t > m_stencilOnNeighbours
List that keeps neighbour vertices IDs sorted by the circular order.
float m_maxNeighbourDistance
Maximal Neighbor vertex distance to the current vertex.
std::vector< WNewVertex * > m_newVertices
List of attached new vertices of the current vertex.
float m_sumNeighbourDistance
Sum of all Neighbor vertex distances to the current vertex.
std::vector< size_t > m_attachedTriangle
List of attached triangles to the current vertex.
int m_boundClass
Depicts the Vertex' kind of bound iit lies on <0: Extraordinary case.
Depicts a point that is subdivided on a line between two vertices.
Definition: WNewVertex.h:40