OpenWalnut  1.5.0dev
WNewVertex.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 #ifndef WNEWVERTEX_H
26 #define WNEWVERTEX_H
27 
28 #include <cstring>
29 
30 #include <osg/Vec3>
31 
32 
33 namespace butterfly
34 {
35 /**
36  * Depicts a point that is subdivided on a line between two vertices. It's stored in a vertex property. The second
37  * relationship is depicted by the toID field.
38  */
40 {
41 public:
42  /**
43  * Initializes properties of a new vertex with all its necessary parameters.
44  * \param toID The other point which the new vertex is interpolated between. The first point stores the new
45  * vertex object. toID is always bigger.
46  */
47  explicit WNewVertex( size_t toID );
48 
49  /**
50  * Destroys the new vertex property.
51  */
52  virtual ~WNewVertex();
53 
54  /**
55  * Returns the proposed ID of that new vertex. The ID should be equal to the one of the
56  * final Triangle Mesh.
57  * \author schwarzkopf
58  * \return ID of the new vertex.
59  */
60  size_t getNewVertexID();
61 
62  /**
63  * Sets the proposed ID for that new vertex. The ID should be equal to the one of the
64  * final Triangle Mesh.
65  * \author schwarzkopf
66  * \param newVertexID Vertex ID to set.
67  */
68  void setNewVertexID( size_t newVertexID );
69 
70  /**
71  * Returns the second vertex ID where the new vertex lies between these two points.
72  * It's still not necessary to store the first connected one. The second ID is always
73  * bigger than the first one.
74  * \author schwarzkopf
75  * \return The second connected Vertex ID.
76  */
77  size_t getToID();
78 
79  /**
80  * Sets the new vertex property whether it's valid for butterfly subdivision or not.
81  * Invalid lines are not subdivided.
82  * \author schwarzkopf
83  * \param isValid Whether the new vertex is marked to be valid for butterfly subdivision or not.
84  */
85  void setValid( bool isValid );
86 
87  /**
88  * Returns whether the new vertex is marked to be valid for the butterfly subdivison of a
89  * line between two vertices. Invalid lines are not subdivided.
90  * \author schwarzkopf
91  * \return Whether the new vertex is marked to be valid for butterfly subdivision or not.
92  */
93  bool isValid();
94 
95  /**
96  * Returns coordinates of the new vertex.
97  * \author schwarzkopf
98  * \return Coordinate of the new vertex ID.
99  */
100  osg::Vec3 getCoordinate();
101 
102  /**
103  * Sets coordinates of the new vertex.
104  * \author schwarzkopf
105  * \param coordinate coordinate of the new vertex ID.
106  */
107  void setCoordinate( osg::Vec3 coordinate );
108 
109 private:
110  /**
111  * The id of the second vertex the new vertex is connected to. The first point is defined by the
112  * number of the stored vertex property where this object lies in. The toID is always bigger than
113  * the first ID due to data organization issue.
114  */
115  size_t m_toID;
116 
117  /**
118  * ID the new vertex is proposed to have in the final triangle mesh.
119  */
121 
122  /**
123  * Coordinate of the new vertex.
124  */
125  osg::Vec3 m_coordinate;
126 
127  /**
128  * Property whether the new vertex is valid for subdivision. Not validly marked lines are not
129  * subdivided. Therefore an alternative triangulation is taken.
130  */
131  bool m_isValid;
132 };
133 
134 } //namespace butterfly
135 #endif // WNEWVERTEX_H
Depicts a point that is subdivided on a line between two vertices.
Definition: WNewVertex.h:40
void setNewVertexID(size_t newVertexID)
Sets the proposed ID for that new vertex.
Definition: WNewVertex.cpp:47
virtual ~WNewVertex()
Destroys the new vertex property.
Definition: WNewVertex.cpp:38
osg::Vec3 m_coordinate
Coordinate of the new vertex.
Definition: WNewVertex.h:125
size_t getToID()
Returns the second vertex ID where the new vertex lies between these two points.
Definition: WNewVertex.cpp:52
bool m_isValid
Property whether the new vertex is valid for subdivision.
Definition: WNewVertex.h:131
size_t getNewVertexID()
Returns the proposed ID of that new vertex.
Definition: WNewVertex.cpp:43
void setValid(bool isValid)
Sets the new vertex property whether it's valid for butterfly subdivision or not.
Definition: WNewVertex.cpp:56
osg::Vec3 getCoordinate()
Returns coordinates of the new vertex.
Definition: WNewVertex.cpp:64
bool isValid()
Returns whether the new vertex is marked to be valid for the butterfly subdivison of a line between t...
Definition: WNewVertex.cpp:60
size_t m_newVertexID
ID the new vertex is proposed to have in the final triangle mesh.
Definition: WNewVertex.h:120
void setCoordinate(osg::Vec3 coordinate)
Sets coordinates of the new vertex.
Definition: WNewVertex.cpp:68
WNewVertex(size_t toID)
Initializes properties of a new vertex with all its necessary parameters.
Definition: WNewVertex.cpp:30
size_t m_toID
The id of the second vertex the new vertex is connected to.
Definition: WNewVertex.h:115