class dijkstra_custom_visitor : public boost::default_dijkstra_visitor
{
public:
dijkstra_threshold(glm::dvec3 source, double threshold): s(source), threshold(threshold) {}
struct hit_threshold {};
void examine_vertex(boost::graph_traits <unGraph>::vertex_descriptor v, const unGraph& g) {
glm::dvec3 dest = boost::get(&VertexProperties::m_mid_point, g, v);
if( glm::distance(s,dest) > threshold ) throw hit_threshold();
}
double threshold;
glm::dvec3 s;
};
My 'calling' line is:
std::vector<Vertex> predecessors(boost::num_vertices(m_ugraph));
std::vector<Weight> distances(boost::num_vertices(m_ugraph), std::numeric_limits<double>::max() );
IndexMap indexMap = boost::get(boost::vertex_index, m_ugraph);
PredecessorMap predecessorMap(&predecessors[0], indexMap);
DistanceMap distanceMap(&distances[0], indexMap);
glm::dvec3 s_mid = m_ugraph[*vertex_iterator_begin].m_mid_point;
double thres = 500.0f;
boost::dijkstra_shortest_paths(m_ugraph, *vertex_iterator_begin, boost::predecessor_map(predecessorMap).distance_map(distanceMap).visitor(boost::make_dijkstra_visitor(dijkstra_custom_visitor(s_mid,thres))));
What do you think is the problem?
thanks