Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

centroid.h 8.71 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-2012, 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.unistra.fr/                                           *
Pierre Kraemer's avatar
Pierre Kraemer committed
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __ALGO_GEOMETRY_CENTROID_H__
#define __ALGO_GEOMETRY_CENTROID_H__

#include "Geometry/basic.h"

namespace CGoGN
{

namespace Algo
{

36
37
38
namespace Surface
{

Pierre Kraemer's avatar
Pierre Kraemer committed
39
40
41
42
43
44
45
46
namespace Geometry
{

/**
* Compute volume centroid (generic version)
*  Pre: closed volume & embedded vertices
* Template param:
*  PFP:  as usual
47
*  V_ATT: attributes vector type  or cell type (VertexCell, FaceCell, ...)
Pierre Kraemer's avatar
Pierre Kraemer committed
48
49
50
51
* @param map the map
* @param d a dart of the face
* @param attributs the vector of attribute or cell
*/
52
template <typename PFP, typename V_ATT>
53
typename V_ATT::DATA_TYPE volumeCentroid(typename PFP::MAP& map, Vol d, const V_ATT& attributs, unsigned int thread = 0);
54

55
56
57
58
59
/**
* Compute volume centroid weighted by edge length (generic version)
*  Pre: closed volume & embedded vertices
* Template param:
*  PFP:  as usual
60
*  V_ATT: attributes vector type  or cell type (VertexCell, FaceCell, ...)
61
62
63
64
* @param map the map
* @param d a dart of the face
* @param attributs the vector of attribute or cell
*/
65
template <typename PFP, typename V_ATT>
66
typename V_ATT::DATA_TYPE volumeCentroidELW(typename PFP::MAP& map, Vol d, const V_ATT& attributs, unsigned int thread = 0);
67

Pierre Kraemer's avatar
Pierre Kraemer committed
68
69
70
71
/**
 * Compute face centroid (generic version)
 * Template param:
 *  PFP:  as usual
72
 *  V_ATT: attributes vector type  or cell type (VertexCell, FaceCell, ...)
Pierre Kraemer's avatar
Pierre Kraemer committed
73
74
75
76
 * @param map the map
 * @param d a dart of the face
 * @param attributs the vector of attribute or cell
 */
77
template <typename PFP, typename V_ATT>
78
typename V_ATT::DATA_TYPE faceCentroid(typename PFP::MAP& map, Face d, const V_ATT& attributs);
79

80
81
82
83
/**
 * Compute face centroid weighted by edge length (generic version)
 * Template param:
 *  PFP:  as usual
84
 *  V_ATT: attributes vector type  or cell type (VertexCell, FaceCell, ...)
85
86
87
88
 * @param map the map
 * @param d a dart of the face
 * @param attributs the vector of attribute or cell
 */
89
template <typename PFP, typename V_ATT>
90
typename V_ATT::DATA_TYPE faceCentroidELW(typename PFP::MAP& map, Face d, const V_ATT& attributs);
91

Pierre Kraemer's avatar
Pierre Kraemer committed
92
93
94
95
/**
 * Compute vertex neighbours centroid (generic version)
 * Template param:
 *  PFP:  as usual
96
 *  V_ATT: attributes vector type  or cell type (VertexCell, FaceCell, ...)
Pierre Kraemer's avatar
Pierre Kraemer committed
97
98
99
100
 * @param map the map
 * @param d a dart of the face
 * @param position the vector of attribute or cell
 */
101
template <typename PFP, typename V_ATT>
102
typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Vertex d, const V_ATT& attributs);
Pierre Kraemer's avatar
Pierre Kraemer committed
103

104
105
106
107
108
109
110
/**
 * Compute centroid of all faces
 * @param map the map
 * @param position position vertex attribute
 * @param face_centroid centroid face attribute
 * @param thread the thread id (default 0)
 */
111
112
template <typename PFP, typename V_ATT, typename F_ATT>
void computeCentroidFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_centroid, unsigned int thread = 0);
Pierre Kraemer's avatar
Pierre Kraemer committed
113

114
115
116
117
118
119
120
/**
 * Compute centroid of all faces (Edge Length Weighted)
 * @param map the map
 * @param position position vertex attribute
 * @param face_centroid centroid face attribute
 * @param thread the thread id (default 0)
 */
121
122
123
template <typename PFP, typename V_ATT, typename F_ATT>
void computeCentroidELWFaces(typename PFP::MAP& map, const V_ATT& position, F_ATT& face_centroid, unsigned int thread = 0) ;

124
125
126
127
128
129
130
/**
 * Compute neighborhood centroid of all vertices
 * @param map the map
 * @param position position vertex attribute
 * @param vertex_centroid centroid vertex attribute
 * @param thread the thread id (default 0)
 */
131
132
133
template <typename PFP, typename V_ATT>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const V_ATT& position, V_ATT& vertex_centroid, unsigned int thread = 0) ;

134
135
136

namespace Parallel
{
Pierre Kraemer's avatar
Pierre Kraemer committed
137

138
139
140
141
142
143
144
/**
 * Compute centroid of all faces
 * @param map the map
 * @param position position vertex attribute
 * @param face_centroid centroid face attribute
 * @param nbth the number of threads
 */
145
template <typename PFP, typename V_ATT, typename F_ATT>
146
void computeCentroidFaces(typename PFP::MAP& map,
147
		const V_ATT& position, F_ATT& face_centroid,
148
		unsigned int nbth = 0) ;
149

150
151
152
153
154
155
156
/**
 * Compute centroid of all faces (Edge Length Weighted)
 * @param map the map
 * @param position position vertex attribute
 * @param face_centroid centroid face attribute
 * @param nbth the number of threads
 */
157
template <typename PFP, typename V_ATT, typename F_ATT>
158
void computeCentroidELWFaces(typename PFP::MAP& map,
159
		const V_ATT& position, F_ATT& face_centroid,
160
		unsigned int nbth = 0) ;
161
162
163
164
165
166
167
168

/**
 * Compute neighborhood centroid of all vertices (in parallel)
 * @param map the map
 * @param position position vertex attribute
 * @param vertex_centroid centroid vertex attribute
 * @param nbth the number of threads
 */
169
template <typename PFP, typename V_ATT>
170
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
171
		const V_ATT& position, V_ATT& vertex_centroid,
172
		unsigned int nbth = 0) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
173
174
175
176
177

} // namespace Parallel



178
} // namespace Geometry
Pierre Kraemer's avatar
Pierre Kraemer committed
179
180

} // namespace Surface
Pierre Kraemer's avatar
Pierre Kraemer committed
181

182
namespace Volume
Lionel Untereiner's avatar
Lionel Untereiner committed
183
{
Pierre Kraemer's avatar
Pierre Kraemer committed
184

185
186
namespace Geometry
{
Pierre Kraemer's avatar
Pierre Kraemer committed
187

188
189
190
191
/**
 * Compute vertex neighbours centroid in map of dimension 3(generic version)
 * Template param:
 *  PFP:  as usual
192
 *  V_ATT: attributes vector type  or cell type (VertexCell, FaceCell, ...)
193
194
195
196
 * @param map the map
 * @param d a dart of the face
 * @param position the vector of attribute or cell
 */
197
template <typename PFP, typename V_ATT>
198
typename V_ATT::DATA_TYPE vertexNeighborhoodCentroid(typename PFP::MAP& map, Vertex d, const V_ATT& attributs, unsigned int thread = 0);
Lionel Untereiner's avatar
Lionel Untereiner committed
199

200
201
202
203
204
205
/**
 * compute centroid of all volumes
 * @param map the map
 * @param position vertex attribute of position
 * @param vol_centroid volume attribute where to store the centroids
 */
206
207
208
209
210
template <typename PFP, typename V_ATT, typename W_ATT>
void computeCentroidVolumes(typename PFP::MAP& map, const V_ATT& position, W_ATT& vol_centroid, unsigned int thread = 0);

template <typename PFP, typename V_ATT, typename W_ATT>
void computeCentroidELWVolumes(typename PFP::MAP& map, const V_ATT& position, W_ATT& vol_centroid, unsigned int thread = 0);
Pierre Kraemer's avatar
Pierre Kraemer committed
211

212
213
214
215
216
217
/**
 * compute centroid of all vertices
 * @param map the map
 * @param position vertex attribute of position
 * @param vertex_centroid vertex attribute to store the centroids
 */
218
219
template <typename PFP, typename V_ATT>
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map, const V_ATT& position, V_ATT& vertex_centroid, unsigned int thread = 0) ;
Lionel Untereiner's avatar
Lionel Untereiner committed
220
221


222
223
namespace Parallel
{
Pierre Kraemer's avatar
Pierre Kraemer committed
224

225
template <typename PFP, typename V_ATT, typename W_ATT>
226
void computeCentroidVolumes(typename PFP::MAP& map,
227
		const V_ATT& position, W_ATT& vol_centroid,
228
		unsigned int nbth = 0) ;
229

230

231
232
233
template <typename PFP, typename V_ATT, typename W_ATT>
void computeCentroidELWVolumes(typename PFP::MAP& map,
		const V_ATT& position, W_ATT& vol_centroid,
234
235
		unsigned int nbth = 0) ;

236
		
237
template <typename PFP, typename V_ATT>
238
void computeNeighborhoodCentroidVertices(typename PFP::MAP& map,
239
		const V_ATT& position, V_ATT& vertex_centroid,
240
		unsigned int nbth = 0) ;
Pierre Kraemer's avatar
Pierre Kraemer committed
241
242
243
244

} // namespace Parallel


Pierre Kraemer's avatar
Pierre Kraemer committed
245
} // namespace Geometry
Pierre Kraemer's avatar
Pierre Kraemer committed
246

untereiner's avatar
untereiner committed
247
} // namespace Volume
Pierre Kraemer's avatar
Pierre Kraemer committed
248
249
250
251
252
253
254
255

} // namespace Algo

} // namespace CGoGN

#include "Algo/Geometry/centroid.hpp"

#endif