1 #ifndef TRIANGLEMESHGEODESICMAP_H_ 2 #define TRIANGLEMESHGEODESICMAP_H_ 32 template <
typename TGMap >
33 bool proceed(std::size_t, TGMap &) {
return true; }
36 template <
typename TPrec >
42 template <
typename TGMap >
43 typename boost::enable_if<boost::is_same<TPrec, typename TGMap::precision_type>,
bool>::type
44 proceed(std::size_t i, TGMap & gmap)
const 46 return (*(gmap.distanceMap()))[i] < m_threshold;
53 template <
typename TIterator >
60 this->init(begin, end);
63 void init(TIterator begin, TIterator end)
67 m_count = std::distance(m_begin, m_end);
70 template <
typename TGMap >
73 if (std::find(m_begin, m_end, i) != m_end)
75 if (--m_count == 0)
return false;
152 template <
typename TVertices,
typename TNeighborhoods,
typename TPrec,
typename TStopGhost = ghost::GMapStop_None,
typename TStoragePolicy = policy::GMap_DefaultStorage_sparse_vect_dbl >
180 typedef typename TStoragePolicy::Label
Label;
191 typedef std::priority_queue<
192 std::pair<VertexIndex, TPrec>,
193 std::vector<std::pair<VertexIndex, TPrec> >,
201 Mesh_distance_map(
const TVertices & vertices,
const TNeighborhoods & neighc,
const TStopGhost & sp);
208 const TStopGhost &
stopGhost()
const {
return m_stopGhost; }
223 void init(VertexIndex iVertex);
229 template <
typename TVertexIndex >
230 void init(std::vector<TVertexIndex> & startPoints, std::vector<TPrec> & startDist);
240 virtual TPrec distanceEstimate(VertexIndex iVertex) = 0;
267 template <
typename TVertices,
typename TNeighborhoods,
typename TPrec,
typename TStopGhost = ghost::GMapStop_None,
typename TStoragePolicy = policy::GMap_DefaultStorage_sparse_vect_dbl >
270 :
public Mesh_distance_map<TVertices, TNeighborhoods, TPrec, TStopGhost, TStoragePolicy>
282 : Base(vertices, neighc) {}
284 : Base(vertices, neighc, sp) {}
287 TPrec distanceEstimate(VertexIndex iVertex);
300 template <
typename TVertices,
typename TCircularNeighborhood,
typename TPrec,
typename TStopGhost = ghost::GMapStop_None,
typename TStoragePolicy = policy::GMap_DefaultStorage_sparse_vect_dbl >
303 :
public Mesh_distance_map<TVertices, TCircularNeighborhood, TPrec, TStopGhost, TStoragePolicy>
314 : Base(vertices, neighc) {}
316 : Base(vertices, neighc, sp) {}
319 TPrec distanceEstimate(VertexIndex iVertex);
333 template <
typename TVertices,
typename TCircularNeighborhoods,
typename TPrec,
typename TStopGhost = ghost::GMapStop_None,
typename TStoragePolicy = policy::GMap_DefaultStorage_sparse_vect_dbl >
335 :
public Mesh_distance_map<TVertices, TCircularNeighborhoods, TPrec, TStopGhost, TStoragePolicy>
346 : Base(vertices, neighc)
347 , m_clusterLabel(new
std::vector<unsigned int>(vertices.
size(),0))
351 , m_clusterLabel(new
std::vector<unsigned int>(vertices.
size(),0))
358 template <
typename TVertexIndex >
359 void init(std::vector<TVertexIndex> & startPoints, std::vector<TPrec> & startDist)
361 unsigned int count = 1;
362 for (
typename std::vector<TVertexIndex>::iterator i = startPoints.begin(); i != startPoints.end(); ++i)
365 (*m_clusterLabel)[*i] = count++;
367 this->Base::init(startPoints, startDist);
371 TPrec distanceEstimate(VertexIndex iVertex);
385 template <
typename TVertices,
typename TFaces,
typename TPrec >
389 TVertices
const & vertices
390 , TFaces
const & faces
TStoragePolicy::Label Label
void distance_to_neighbors(TVertices const &vertices, TFaces const &faces, TPrec distance, std::vector< til::sparse_vector< TPrec > > &res)
Returns neighbors that are below a certain geodesic distance, along with their distance.
void init(std::vector< TVertexIndex > &startPoints, std::vector< TPrec > &startDist)
Mesh_distance_map< TVertices, TCircularNeighborhood, TPrec, TStopGhost, TStoragePolicy > Base
GMapStop_MyPointsDone(TIterator begin, TIterator end)
Triangle_mesh_geodesic_map(const TVertices &vertices, const TCircularNeighborhood &neighc, const TStopGhost &sp)
til::sparse_vector< TPrec > DistCollection
Graph_distance_map(const TVertices &vertices, const TNeighborhoods &neighc, const TStopGhost &sp)
Base::VertexIndex VertexIndex
TStoragePolicy::DistCollection DistCollection
shared_ptr< LabelCollection > m_pLabel
std::priority_queue< std::pair< VertexIndex, TPrec >, std::vector< std::pair< VertexIndex, TPrec > >, Greater_Pair2< VertexIndex, TPrec > > Queue
TStoragePolicy::LabelCollection LabelCollection
Base::VertexIndex VertexIndex
Triangle_mesh_geodesic_map(const TVertices &vertices, const TCircularNeighborhood &neighc)
shared_ptr< const LabelCollection > labels() const
shared_ptr< std::vector< unsigned int > > clusterLabels()
Mesh_distance_map< TVertices, TCircularNeighborhoods, TPrec, TStopGhost, TStoragePolicy > Base
Belongs to package Box Do not include directly, include til/Box.h instead.
Voronoi_triangle_mesh_geodesic_map(const TVertices &vertices, const TCircularNeighborhoods &neighc, const TStopGhost &sp)
TNeighborhoods::value_type Neighborhood
Mesh_distance_map< TVertices, TNeighborhoods, TPrec, TStopGhost, TStoragePolicy > Base
numeric_array< T, D > size(const Box< T, D > &box)
Return the size of a box.
Mesh_distance_map< TVertices, TNeighborhoods, TPrec, TStopGhost, TStoragePolicy > Self
const TVertices & m_vertices
This file contains forward declarations of classes defined in the TIL library.
A class that mimic the behavior of std::vector but with a storage policy focused on sparse data...
Voronoi_triangle_mesh_geodesic_map(const TVertices &vertices, const TCircularNeighborhoods &neighc)
const TStopGhost & stopGhost() const
boost::enable_if< boost::is_same< TPrec, typename TGMap::precision_type >, bool >::type proceed(std::size_t i, TGMap &gmap) const
shared_ptr< LabelCollection > labels()
bool proceed(std::size_t i, TGMap &)
Graph_distance_map(const TVertices &vertices, const TNeighborhoods &neighc)
const TNeighborhoods & m_neighc
shared_ptr< DistCollection > distanceMap()
Base::Neighborhood Neighborhood
til::sparse_vector< Label > LabelCollection
GMapStop_AboveThreshold(TPrec threshold)
Base::Neighborhood Neighborhood
Base::Neighborhood Neighborhood
Base::VertexIndex VertexIndex
virtual ~Mesh_distance_map()
void init(TIterator begin, TIterator end)
operator> on the second member of a pair.
shared_ptr< const DistCollection > distanceMap() const
Get computed distance map.
shared_ptr< DistCollection > m_pDist
bool proceed(std::size_t, TGMap &)