gmap3.h 6.83 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
2
3
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
4
* Copyright (C) 2009-2011, IGG Team, LSIIT, University of Strasbourg           *
Pierre Kraemer's avatar
Pierre Kraemer committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
*                                                                              *
* This library is free software; you can redistribute it and/or modify it      *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your     *
* option) any later version.                                                   *
*                                                                              *
* This library is distributed in the hope that it will be useful, but WITHOUT  *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or        *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License  *
* for more details.                                                            *
*                                                                              *
* You should have received a copy of the GNU Lesser General Public License     *
* along with this library; if not, write to the Free Software Foundation,      *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.           *
*                                                                              *
20
* Web site: http://cgogn.u-strasbg.fr/                                         *
Pierre Kraemer's avatar
Pierre Kraemer committed
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __GMAP3_H__
#define __GMAP3_H__

#include "Topology/gmap/gmap2.h"

namespace CGoGN
{

/**
* The class of 2-GMap
*/
class GMap3 : public GMap2
{
protected:
39
	AttributeMultiVector<Dart>* m_beta3 ;
Pierre Kraemer's avatar
Pierre Kraemer committed
40

41
42
	void init() ;

Pierre Kraemer's avatar
Pierre Kraemer committed
43
public:
Thomas's avatar
Thomas committed
44
45
	typedef GMap2 ParentMap;

Pierre Kraemer's avatar
Pierre Kraemer committed
46
47
48
49
50
51
	GMap3();

	virtual std::string mapTypeName();

	virtual unsigned int dimension();

52
53
	virtual void clear(bool removeAttrib);

Pierre Kraemer's avatar
Pierre Kraemer committed
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	/*! @name Basic Topological Operators
	 * Access and Modification
	 *************************************************************************/

	virtual Dart newDart();

	Dart beta3(Dart d);

	template <int N>
	Dart beta(const Dart d);

	Dart phi3(Dart d);

	template <int N>
	Dart phi(const Dart d);

	Dart alpha0(Dart d);

	Dart alpha1(Dart d);

	Dart alpha_1(Dart d);

	Dart alpha2(Dart d);

	Dart alpha_2(Dart d);

	void beta3sew(Dart d, Dart e);

	void beta3unsew(Dart d);

	void phi3sew(Dart d, Dart e);

	void phi3unsew(Dart d);

88
89
90
	/*! @name Generator and Deletor
	 *  To generate or delete volumes in a 3-map
	 *************************************************************************/
Pierre Kraemer's avatar
Pierre Kraemer committed
91
92

	//@{
93
94
95
	//! Delete a volume erasing all its darts.
	/*! The phi3-links around the volume are removed
	 *  @param d a dart of the volume
Pierre Kraemer's avatar
Pierre Kraemer committed
96
	 */
97
	void deleteVolume(Dart d);
Pierre Kraemer's avatar
Pierre Kraemer committed
98
99
100
101
102
103
104
	//@}

	/*! @name Topological Operators
	 *  Topological operations on 3-maps
	 *************************************************************************/

	//@{
105
106
	//! Cut the edge of d
	/*! @param d a dart of the edge to cut
Pierre Kraemer's avatar
Pierre Kraemer committed
107
	 */
108
	virtual void cutEdge(Dart d);
109
110
111
112
113
114
115
116

	//! Split a face inserting an edge between two vertices
	/*! \pre Dart d and e should belong to the same face and be distinct
	 *  @param d dart of first vertex
	 *  @param e dart of second vertex
	 *  @return the dart of the new edge lying in the vertex of d after the cut
	 */
	virtual void splitFace(Dart d, Dart e);
Pierre Kraemer's avatar
Pierre Kraemer committed
117

118
119
120
121
	//! Sew two oriented volumes along their faces.
	/*! The oriented faces should not be phi3-linked and have the same length
	 *  @param d a dart of the first volume
	 *  @param e a dart of the second volume
Thomas's avatar
Thomas committed
122
	 */
123
	void sewVolumes(Dart d, Dart e);
Thomas's avatar
Thomas committed
124

125
126
	//! unsew two oriented volumes along their faces.
	/*! @param d a dart of one volume
Thomas's avatar
Thomas committed
127
	 */
128
	void unsewVolumes(Dart d);
Thomas's avatar
Thomas committed
129

130
131
	//! merge to volume sewed by one face
	/*! @param d a dart of common face
Thomas's avatar
Thomas committed
132
	 */
133
134
135
	bool mergeVolumes(Dart d);
	//@}

Thomas's avatar
Thomas committed
136

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
	/*! @name Topological Queries
	 *  Return or set various topological information
	 *************************************************************************/

	//@{
	//! Test if dart d and e belong to the same oriented vertex
	/*! @param d a dart
	 *  @param e a dart
	 */
	bool sameOrientedVertex(Dart d, Dart e) ;

	//! Test if dart d and e belong to the same vertex
	/*! @param d a dart
	 *  @param e a dart
	 */
	bool sameVertex(Dart d, Dart e) ;

154
155
156
157
158
159
160
161
162
163
	//! Compute the number of edges of the vertex of d
	/*! @param d a dart
	 */
	unsigned int vertexDegree(Dart d) ;

	//! Tell if the vertex of d is on the boundary
	/*! @param d a dart
	 */
	virtual bool isBoundaryVertex(Dart d);

164
165
166
167
168
169
170
171
172
173
174
175
	//! Test if dart d and e belong to the same oriented edge
	/*! @param d a dart
	 *  @param e a dart
	 */
	bool sameOrientedEdge(Dart d, Dart e) ;

	//! Test if dart d and e belong to the same edge
	/*! @param d a dart
	 *  @param e a dart
	 */
	bool sameEdge(Dart d, Dart e) ;

176
177
178
179
180
	//! Compute the number of volumes around the edge of d
	/*! @param d a dart
	 */
	unsigned int edgeDegree(Dart d);

181
182
183
184
185
186
187
188
189
190
191
192
	//!Test if dart d and e belong to the same oriented face
	/*! @param d a dart
	 *  @param e a dart
	 */
	bool sameOrientedFace(Dart d, Dart e);

	//!Test if dart d and e belong to the same oriented face
	/*! @param d a dart
	 *  @param e a dart
	 */
	bool sameFace(Dart d, Dart e);

Thomas's avatar
Thomas committed
193
	virtual bool check();
194
	//@}
Thomas's avatar
Thomas committed
195

196

Pierre Kraemer's avatar
Pierre Kraemer committed
197
198
199
200
201
202
	/*! @name Cell Functors
	 *  Apply functors to all darts of a cell
	 *************************************************************************/

	//@{
	/**
203
204
205
206
207
208
209
210
	* Apply a functor on each dart of a vertex
	* @param d a dart of the face
	* @param fonct functor obj ref
	*/
	bool foreach_dart_of_oriented_vertex(Dart d, FunctorType& fonct, unsigned int thread=0);

	/**
	* Apply a functor on each dart of a vertex
Pierre Kraemer's avatar
Pierre Kraemer committed
211
212
213
	* @param d a dart of the face
	* @param fonct functor obj ref
	*/
Sylvain Thery's avatar
Sylvain Thery committed
214
	bool foreach_dart_of_vertex(Dart d, FunctorType& fonct, unsigned int thread=0);
Pierre Kraemer's avatar
Pierre Kraemer committed
215
216
217
218
219
220

	/**
	* Apply a functor on each dart of an edge
	* @param d a dart of the oriented face
	* @param fonct functor obj ref
	*/
Sylvain Thery's avatar
Sylvain Thery committed
221
	bool foreach_dart_of_edge(Dart d, FunctorType& fonct, unsigned int thread=0);
Pierre Kraemer's avatar
Pierre Kraemer committed
222
223
224
225
226

	//! Apply a functor on every dart of a face
	/*! @param d a dart of the volume
	 *  @param f the functor to apply
	 */
Sylvain Thery's avatar
Sylvain Thery committed
227
	bool foreach_dart_of_face(Dart d, FunctorType& fonct, unsigned int thread=0);
Pierre Kraemer's avatar
Pierre Kraemer committed
228
229
230
231
232
233


	//! Apply a functor on every dart of a volume
	/*! @param d a dart of the volume
	 *  @param f the functor to apply
	 */
Sylvain Thery's avatar
Sylvain Thery committed
234
	bool foreach_dart_of_volume(Dart d, FunctorType& fonct, unsigned int thread=0);
Pierre Kraemer's avatar
Pierre Kraemer committed
235
236
237
238
239
240

	/**
	* Apply a functor on each dart of a cc
	* @param d a dart of the cc
	* @param fonct functor obj ref
	*/
Sylvain Thery's avatar
Sylvain Thery committed
241
	bool foreach_dart_of_cc(Dart d, FunctorType& fonct, unsigned int thread=0);
Pierre Kraemer's avatar
Pierre Kraemer committed
242
243
244
245
246
247
248
249
	//@}
};

} // namespace CGoGN

#include "Topology/gmap/gmap3.hpp"

#endif