collector.h 17.6 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps  *
* version 0.1                                                                  *
* Copyright (C) 2009, IGG Team, LSIIT, University of Strasbourg                *
*                                                                              *
* 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
* Contact information: cgogn@unistra.fr                                        *
*                                                                              *
*******************************************************************************/

#ifndef __COLLECTOR_H__
#define __COLLECTOR_H__

Sylvain Thery's avatar
Sylvain Thery committed
28
#include "Container/fakeAttribute.h"
Sylvain Thery's avatar
Sylvain Thery committed
29
#include "Geometry/basic.h"
Sylvain Thery's avatar
Sylvain Thery committed
30

Pierre Kraemer's avatar
Pierre Kraemer committed
31 32 33 34 35 36 37 38 39 40
/*****************************************
 * Class hierarchy :
 * Collector (virtual)
 * - Collector_WithinSphere
 * - Collector_OneRing
 ****************************************/

namespace CGoGN
{

41 42 43
namespace Algo
{

Thery Sylvain's avatar
Thery Sylvain committed
44 45 46
namespace Surface
{

Pierre Kraemer's avatar
Pierre Kraemer committed
47 48 49 50
namespace Selection
{

/*********************************************************
51
 * Generic Collector
Pierre Kraemer's avatar
Pierre Kraemer committed
52
 *********************************************************/
53

Pierre Kraemer's avatar
Pierre Kraemer committed
54 55 56 57 58 59 60 61
template <typename PFP>
class Collector
{
protected:
	typedef typename PFP::VEC3 VEC3;
	typedef typename PFP::REAL REAL;

	typename PFP::MAP& map;
Sylvain Thery's avatar
Sylvain Thery committed
62
	unsigned int m_thread;
Pierre Kraemer's avatar
Pierre Kraemer committed
63 64 65

	Dart centerDart;

66 67
	bool isInsideCollected;

Pierre Kraemer's avatar
Pierre Kraemer committed
68 69 70 71 72 73
	std::vector<Dart> insideVertices;
	std::vector<Dart> insideEdges;
	std::vector<Dart> insideFaces;
	std::vector<Dart> border;

public:
Sylvain Thery's avatar
Sylvain Thery committed
74
	Collector(typename PFP::MAP& m, unsigned int thread =0);
Pierre Kraemer's avatar
Pierre Kraemer committed
75

Pierre Kraemer's avatar
Pierre Kraemer committed
76 77 78
	inline void init(Dart d)
	{
		centerDart = d;
79
		isInsideCollected = false;
Pierre Kraemer's avatar
Pierre Kraemer committed
80 81 82 83 84
		insideVertices.clear();
		insideEdges.clear();
		insideFaces.clear();
		border.clear();
	}
Pierre Kraemer's avatar
Pierre Kraemer committed
85

Pierre Kraemer's avatar
Pierre Kraemer committed
86 87
	virtual void collectAll(Dart d) = 0;
	virtual void collectBorder(Dart d) = 0;
Pierre Kraemer's avatar
Pierre Kraemer committed
88

Pierre Kraemer's avatar
Pierre Kraemer committed
89 90 91 92
	bool applyOnInsideVertices(FunctorType& f);
	bool applyOnInsideEdges(FunctorType& f);
	bool applyOnInsideFaces(FunctorType& f);
	bool applyOnBorder(FunctorType& f);
93

Pierre Kraemer's avatar
Pierre Kraemer committed
94
	inline void sort()
Pierre Kraemer's avatar
Pierre Kraemer committed
95 96 97 98 99 100 101
	{
		std::sort(insideVertices.begin(), insideVertices.end());
		std::sort(insideEdges.begin(), insideEdges.end());
		std::sort(insideFaces.begin(), insideFaces.end());
		std::sort(border.begin(), border.end());
	}

Pierre Kraemer's avatar
Pierre Kraemer committed
102
	inline typename PFP::MAP& getMap() { return map; }
Pierre Kraemer's avatar
Pierre Kraemer committed
103

Pierre Kraemer's avatar
Pierre Kraemer committed
104
	inline Dart getCenterDart() const { return centerDart; }
Pierre Kraemer's avatar
Pierre Kraemer committed
105

106 107 108
	inline const std::vector<Dart>& getInsideVertices() const { assert(isInsideCollected || !"getInsideVertices: inside cells have not been collected.") ; return insideVertices; }
	inline const std::vector<Dart>& getInsideEdges() const { assert(isInsideCollected || !"getInsideEdges: inside cells have not been collected.") ; return insideEdges; }
	inline const std::vector<Dart>& getInsideFaces() const { assert(isInsideCollected || !"getInsideFaces: inside cells have not been collected.") ; return insideFaces; }
Pierre Kraemer's avatar
Pierre Kraemer committed
109
	inline const std::vector<Dart>& getBorder() const { return border; }
Pierre Kraemer's avatar
Pierre Kraemer committed
110

111 112 113
	inline unsigned int getNbInsideVertices() const { assert(isInsideCollected || !"getNbInsideVertices: inside cells have not been collected.") ; return insideVertices.size(); }
	inline unsigned int getNbInsideEdges() const { assert(isInsideCollected || !"getNbInsideEdges: inside cells have not been collected.") ; return insideEdges.size(); }
	inline unsigned int getNbInsideFaces() const { assert(isInsideCollected || !"getNbInsideFaces: inside cells have not been collected.") ; return insideFaces.size(); }
Pierre Kraemer's avatar
Pierre Kraemer committed
114
	inline unsigned int getNbBorder() const { return border.size(); }
Pierre Kraemer's avatar
Pierre Kraemer committed
115 116 117

	template <typename PPFP>
	friend std::ostream& operator<<(std::ostream &out, const Collector<PPFP>& c);
118

Sylvain Thery's avatar
Sylvain Thery committed
119
	virtual REAL computeArea (const VertexAttribute<VEC3>& /*pos*/) {
120 121 122
		assert(!"Warning: Collector<PFP>::computeArea() should be overloaded in non-virtual derived classes");
		return 0.0;
	}
Sylvain Thery's avatar
Sylvain Thery committed
123 124
	virtual void computeNormalCyclesTensor (const VertexAttribute<VEC3>& /*pos*/, const EdgeAttribute<REAL>& /*edgeangle*/, typename PFP::MATRIX33&) {assert(!"Warning: Collector<PFP>::computeNormalCyclesTensor() should be overloaded in non-virtual derived classes"); }
	virtual void computeNormalCyclesTensor (const VertexAttribute<VEC3>& /*pos*/, typename PFP::MATRIX33&) {assert(!"Warning: Collector<PFP>::computeNormalCyclesTensor() should be overloaded in non-virtual derived classes"); }
125

Pierre Kraemer's avatar
Pierre Kraemer committed
126 127 128 129 130 131 132 133 134 135
};

/*********************************************************
 * Collector One Ring
 *********************************************************/

/*
 * insideVertices = centerDart
 * insideEdges = star (edges incident to centerDart)
 * insideFaces = triangles incident to centerDart
136
 * border = vertices of 1-ring -> link (set of adjacent vertices)
Pierre Kraemer's avatar
Pierre Kraemer committed
137 138 139 140 141
 *        = edges of 1-ring
 */
template <typename PFP>
class Collector_OneRing : public Collector<PFP>
{
142 143 144 145
protected:
	typedef typename PFP::VEC3 VEC3 ;
	typedef typename PFP::REAL REAL ;

Pierre Kraemer's avatar
Pierre Kraemer committed
146
public:
Sylvain Thery's avatar
Sylvain Thery committed
147 148
	Collector_OneRing(typename PFP::MAP& m, unsigned int thread=0):
		Collector<PFP>(m, thread) {}
Pierre Kraemer's avatar
Pierre Kraemer committed
149 150
	void collectAll(Dart d);
	void collectBorder(Dart d);
151 152 153

	REAL computeArea(const VertexAttribute<VEC3>& pos);
	void computeNormalCyclesTensor (const VertexAttribute<VEC3>& pos, const EdgeAttribute<REAL>&edgeangle, typename PFP::MATRIX33&);
154
	void computeNormalCyclesTensor (const VertexAttribute<VEC3>& pos, typename PFP::MATRIX33&);
Pierre Kraemer's avatar
Pierre Kraemer committed
155 156
};

157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
/*********************************************************
 * Collector One Ring around edge
 *********************************************************/

/*
 * insideVertices = 2 ends of center edge (centerDart)
 * insideEdges = center egde + edges adjacent by a vertex
 *             = union of stars of 1-rings of the 2 ends
 * insideFaces = triangles incident to the 2 ends
 * border = vertices of 1-ring -> link (set of adjacent vertices)
 *        = edges of 1-ring
 */

template <typename PFP>
class Collector_OneRing_AroundEdge : public Collector<PFP>
{
protected:
	typedef typename PFP::VEC3 VEC3 ;
	typedef typename PFP::REAL REAL ;

public:
	Collector_OneRing_AroundEdge(typename PFP::MAP& m, unsigned int thread=0):
		Collector<PFP>(m, thread) {}
	void collectAll(Dart d);
	void collectBorder(Dart d);

	REAL computeArea(const VertexAttribute<VEC3>& pos);
	void computeNormalCyclesTensor (const VertexAttribute<VEC3>& pos, const EdgeAttribute<REAL>&edgeangle, typename PFP::MATRIX33&);
185
	void computeNormalCyclesTensor (const VertexAttribute<VEC3>& pos, typename PFP::MATRIX33&);
Pierre Kraemer's avatar
Pierre Kraemer committed
186 187
};

188

Pierre Kraemer's avatar
Pierre Kraemer committed
189 190 191 192 193 194 195 196
/*********************************************************
 * Collector Within Sphere
 *********************************************************/

/*
 * collect all primitives of the connected component containing "centerDart"
 * within the sphere of radius "radius" and center "position[centerDart]"
 * (hopefully) it defines a 2-manifold (if inserting border-vertices along the border-edges)
Basile Sauvage's avatar
Basile Sauvage committed
197
 * NB : is equivalent to Collector_Vertices with CollectorCriterion_VertexWithinSphere
Pierre Kraemer's avatar
Pierre Kraemer committed
198 199 200 201 202
 */
template <typename PFP>
class Collector_WithinSphere : public Collector<PFP>
{
protected:
203 204 205 206 207
	typedef typename PFP::VEC3 VEC3 ;
	typedef typename PFP::REAL REAL ;

	const VertexAttribute<VEC3>& position;
	REAL radius;
208

Pierre Kraemer's avatar
Pierre Kraemer committed
209
public:
210
	Collector_WithinSphere(typename PFP::MAP& m, const VertexAttribute<VEC3>& p, REAL r = 0, unsigned int thread=0) :
Sylvain Thery's avatar
Sylvain Thery committed
211
		Collector<PFP>(m, thread),
Pierre Kraemer's avatar
Pierre Kraemer committed
212
		position(p),
213
		radius(r)
Pierre Kraemer's avatar
Pierre Kraemer committed
214
	{}
215 216 217
	inline void setRadius(REAL r) { radius = r; }
	inline REAL getRadius() const { return radius; }
	inline const VertexAttribute<VEC3>& getPosition() const { return position; }
Pierre Kraemer's avatar
Pierre Kraemer committed
218 219 220 221

	void collectAll(Dart d);
	void collectBorder(Dart d);

222 223
	REAL computeArea(const VertexAttribute<VEC3>& pos);
	void computeNormalCyclesTensor (const VertexAttribute<VEC3>& pos, const EdgeAttribute<REAL>& edgeangle, typename PFP::MATRIX33&);
224
	void computeNormalCyclesTensor (const VertexAttribute<VEC3>& pos, typename PFP::MATRIX33&);
Pierre Kraemer's avatar
Pierre Kraemer committed
225 226
};

227
/*********************************************************
228
 * Collector Normal Angle (Vertices)
229 230 231 232 233 234
 *********************************************************/

/*
 * collect all primitives of the connected component containing "centerDart"
 * the angle between the included vertices normal vectors and the central normal vector
 * stays under a given threshold
Basile Sauvage's avatar
Basile Sauvage committed
235
 * NB : is equivalent to Collector_Vertices with CollectorCriterion_VertexNormalAngle
236 237 238 239 240 241 242 243 244 245 246 247
 */
template <typename PFP>
class Collector_NormalAngle : public Collector<PFP>
{
protected:
	const VertexAttribute<typename PFP::VEC3>& normal ;
	typename PFP::REAL angleThreshold ;

public:
	Collector_NormalAngle(
		typename PFP::MAP& m,
		const VertexAttribute<typename PFP::VEC3>& n,
Sylvain Thery's avatar
Sylvain Thery committed
248 249
		typename PFP::REAL a,
		unsigned int thread=0
250
	) :	Collector<PFP>(m,thread), normal(n), angleThreshold(a)
251 252 253 254 255 256 257 258 259
	{}
	inline void setAngleThreshold(typename PFP::REAL a) { angleThreshold = a; }
	inline typename PFP::REAL getAngleThreshold() const { return angleThreshold; }
	inline const VertexAttribute<typename PFP::VEC3>& getNormal() const { return normal ; }

	void collectAll(Dart d) ;
	void collectBorder(Dart d) ;
};

Basile Sauvage's avatar
Basile Sauvage committed
260
/*********************************************************
Basile Sauvage's avatar
Basile Sauvage committed
261
 * Collector Criterions
Basile Sauvage's avatar
Basile Sauvage committed
262 263 264 265 266
 *********************************************************/
class CollectorCriterion
{
public :
	CollectorCriterion() {};
Sauvage's avatar
Sauvage committed
267
	virtual ~CollectorCriterion() {} ;
Basile Sauvage's avatar
Basile Sauvage committed
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
	virtual void init(Dart center) = 0;
	virtual bool isInside(Dart d) = 0;

};

template <typename PFP>
class CollectorCriterion_VertexNormalAngle : public CollectorCriterion
{ // tests if the angle between vertex normals is below some threshold
private :
	typedef typename PFP::VEC3 VEC3;
	typedef typename PFP::REAL REAL;

	const VertexAttribute<VEC3> & vertexNormals;
	REAL threshold;
	VEC3 centerNormal;
public :
	CollectorCriterion_VertexNormalAngle(const VertexAttribute<VEC3> & n, REAL th) :
		vertexNormals(n), threshold(th), centerNormal(0) {}

	void init (Dart center) {centerNormal = vertexNormals[center];}
	bool isInside (Dart d) {
		return ( Geom::angle(centerNormal, vertexNormals[d]) < threshold);
	}
};

Basile Sauvage's avatar
Basile Sauvage committed
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
template <typename PFP>
class CollectorCriterion_TriangleNormalAngle : public CollectorCriterion
{ // tests if the angle between vertex normals is below some threshold
private :
	typedef typename PFP::VEC3 VEC3;
	typedef typename PFP::REAL REAL;

	const FaceAttribute<VEC3> & faceNormals;
	REAL threshold;
	VEC3 centerNormal;
public :
	CollectorCriterion_TriangleNormalAngle(const FaceAttribute<VEC3> & n, REAL th) :
		faceNormals(n), threshold(th), centerNormal(0) {}

	void init (Dart center) {centerNormal = faceNormals[center];}
	bool isInside (Dart d) {
		return ( Geom::angle(centerNormal, faceNormals[d]) < threshold);
	}
};

Basile Sauvage's avatar
Basile Sauvage committed
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333
template <typename PFP>
class CollectorCriterion_VertexWithinSphere : public CollectorCriterion
{ // tests if the distance between vertices is below some threshold
private :
	typedef typename PFP::VEC3 VEC3;
	typedef typename PFP::REAL REAL;

	const VertexAttribute<VEC3> & vertexPositions;
	REAL threshold;
	VEC3 centerPosition;
public :
	CollectorCriterion_VertexWithinSphere(const VertexAttribute<VEC3> & p, REAL th) :
		vertexPositions(p), threshold(th), centerPosition(0) {}

	void init (Dart center) {centerPosition = vertexPositions[center];}
	bool isInside (Dart d) {
		return (vertexPositions[d] - centerPosition).norm() < threshold ;
	}
};


Basile Sauvage's avatar
Basile Sauvage committed
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
/*********************************************************
 * Collector Vertices
 *********************************************************/

/*
 * collect all vertices of the connected component containing "centerDart"
 * within a distance to centerDart defined by the CollectorCriterion
 * (hopefully) it defines a 2-manifold (if inserting border-vertices along the border-edges)
 */
template <typename PFP>
class Collector_Vertices : public Collector<PFP>
{
protected:
	CollectorCriterion & crit;

public:
	Collector_Vertices(typename PFP::MAP& m, CollectorCriterion& c, unsigned int thread=0) :
		Collector<PFP>(m, thread),
		crit(c)
	{}

	void collectAll(Dart d);
	void collectBorder(Dart d);
};


360 361 362 363 364 365 366 367
/*********************************************************
 * Collector Normal Angle (Triangles)
 *********************************************************/

/*
 * collect all primitives of the connected component containing "centerDart"
 * the angle between the included triangles normal vectors and the central normal vector
 * stays under a given threshold
Basile Sauvage's avatar
Basile Sauvage committed
368
 * NB : is equivalent to Collector_Triangles with CollectorCriterion_TriangleNormalAngle
369 370 371 372 373 374 375 376 377 378 379 380
 */
template <typename PFP>
class Collector_NormalAngle_Triangles : public Collector<PFP>
{
protected:
	const FaceAttribute<typename PFP::VEC3>& normal ;
	typename PFP::REAL angleThreshold ;

public:
	Collector_NormalAngle_Triangles(
		typename PFP::MAP& m,
		const FaceAttribute<typename PFP::VEC3>& n,
381 382 383
		typename PFP::REAL a,
		unsigned int thread=0
	) :	Collector<PFP>(m,thread), normal(n), angleThreshold(a)
384 385 386 387 388 389 390 391 392
	{}
	inline void setAngleThreshold(typename PFP::REAL a) { angleThreshold = a; }
	inline typename PFP::REAL getAngleThreshold() const { return angleThreshold; }
	inline const VertexAttribute<typename PFP::VEC3>& getNormal() const { return normal ; }

	void collectAll(Dart d) ;
	void collectBorder(Dart d) ;
};

Basile Sauvage's avatar
Basile Sauvage committed
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
/*********************************************************
 * Collector Triangles
 *********************************************************/

/*
 * collect all triangles of the connected component containing "centerDart"
 * within a distance to centerDart defined by the CollectorCriterion
 */
template <typename PFP>
class Collector_Triangles : public Collector<PFP>
{
protected:
	CollectorCriterion & crit;

public:
	Collector_Triangles(typename PFP::MAP& m, CollectorCriterion& c, unsigned int thread=0) :
		Collector<PFP>(m,thread), crit(c)
	{}

	void collectAll(Dart d) ;
	void collectBorder(Dart d) ;
};

Basile Sauvage's avatar
Basile Sauvage committed
416
/*********************************************************
417
 * Collector Dijkstra_Vertices
Basile Sauvage's avatar
Basile Sauvage committed
418 419 420 421 422
 *********************************************************/

/*
 * collect all primitives of the connected component containing "centerDart"
 * within a distance < maxDist (the shortest path follows edges)
423
 * the edge length is specified in edge_cost attribute
Basile Sauvage's avatar
Basile Sauvage committed
424
 */
425

Basile Sauvage's avatar
Basile Sauvage committed
426
template <typename PFP>
427
class Collector_Dijkstra_Vertices : public Collector<PFP>
Basile Sauvage's avatar
Basile Sauvage committed
428 429
{
protected:
430
	const EdgeAttribute<typename PFP::REAL>& edge_cost;
Basile Sauvage's avatar
Basile Sauvage committed
431 432 433 434 435 436 437 438
	typename PFP::REAL maxDist;

	typedef struct
	{
		typename std::multimap<float,Dart>::iterator it ;
		bool valid ;
		static std::string CGoGNnameOfType() { return "DijkstraVertexInfo" ; }
	} DijkstraVertexInfo ;
439
	typedef NoTypeNameAttribute<DijkstraVertexInfo> VertexInfo ;
Basile Sauvage's avatar
Basile Sauvage committed
440 441 442 443 444 445

	VertexAttribute<VertexInfo> vertexInfo ;

	std::multimap<float,Dart> front ;

public:
446
	Collector_Dijkstra_Vertices(typename PFP::MAP& m, const EdgeAttribute<typename PFP::REAL>& c, typename PFP::REAL d = 0, unsigned int thread=0) :
447
		Collector<PFP>(m,thread),
448
		edge_cost(c),
Basile Sauvage's avatar
Basile Sauvage committed
449 450 451 452
		maxDist(d)
	{
		vertexInfo = m.template addAttribute<VertexInfo, VERTEX>("vertexInfo");
	}
453
	~Collector_Dijkstra_Vertices(){
Basile Sauvage's avatar
Basile Sauvage committed
454 455 456 457 458 459 460 461 462
		this->map.removeAttribute(vertexInfo);
	}
	inline void init (Dart d) {Collector<PFP>::init(d); front.clear();}
	inline void setMaxDistance(typename PFP::REAL d) { maxDist = d; }
	inline typename PFP::REAL getMaxDist() const { return maxDist; }

	void collectAll(Dart d);
	void collectBorder(Dart d);
};
463 464


Basile Sauvage's avatar
Basile Sauvage committed
465
/*********************************************************
466
 * Collector Dijkstra
Basile Sauvage's avatar
Basile Sauvage committed
467 468 469 470 471 472 473
 *********************************************************/

/*
 * collect all primitives of the connected component containing "centerDart"
 * within a distance < maxDist (the shortest path follows edges)
 */
template <typename PFP>
474
class Collector_Dijkstra : public Collector<PFP>
Basile Sauvage's avatar
Basile Sauvage committed
475 476
{
protected:
477
	const VertexAttribute<typename PFP::VEC3>& position;
Basile Sauvage's avatar
Basile Sauvage committed
478 479 480 481 482 483 484 485
	typename PFP::REAL maxDist;

	typedef struct
	{
		typename std::multimap<float,Dart>::iterator it ;
		bool valid ;
		static std::string CGoGNnameOfType() { return "DijkstraVertexInfo" ; }
	} DijkstraVertexInfo ;
486
	typedef NoTypeNameAttribute<DijkstraVertexInfo> VertexInfo ;
Basile Sauvage's avatar
Basile Sauvage committed
487 488 489 490 491 492

	VertexAttribute<VertexInfo> vertexInfo ;

	std::multimap<float,Dart> front ;

public:
493
	Collector_Dijkstra(typename PFP::MAP& m, const VertexAttribute<typename PFP::VEC3>& p, typename PFP::REAL d = 0, unsigned int thread=0) :
Basile Sauvage's avatar
Basile Sauvage committed
494
		Collector<PFP>(m,thread),
495
		position(p),
Basile Sauvage's avatar
Basile Sauvage committed
496 497 498 499
		maxDist(d)
	{
		vertexInfo = m.template addAttribute<VertexInfo, VERTEX>("vertexInfo");
	}
500
	~Collector_Dijkstra(){
Basile Sauvage's avatar
Basile Sauvage committed
501 502 503 504 505
		this->map.removeAttribute(vertexInfo);
	}
	inline void init (Dart d) {Collector<PFP>::init(d); front.clear();}
	inline void setMaxDistance(typename PFP::REAL d) { maxDist = d; }
	inline typename PFP::REAL getMaxDist() const { return maxDist; }
506
	inline const VertexAttribute<typename PFP::VEC3>& getPosition() const { return position; }
Basile Sauvage's avatar
Basile Sauvage committed
507 508 509

	void collectAll(Dart d);
	void collectBorder(Dart d);
510 511 512
private :
	inline float edgeLength (Dart d);
//	inline Dart oppositeVertex (Dart d);
Basile Sauvage's avatar
Basile Sauvage committed
513 514 515
};


516

Pierre Kraemer's avatar
Pierre Kraemer committed
517
} // namespace Selection
Thery Sylvain's avatar
Thery Sylvain committed
518
} // surface
519
} // namespace Algo
Pierre Kraemer's avatar
Pierre Kraemer committed
520 521 522 523 524
} // namespace CGoGN

#include "Algo/Selection/collector.hpp"

#endif