3 #ifndef GEODESIC_ALGORITHM_BASE_122806
4 #define GEODESIC_ALGORITHM_BASE_122806
32 virtual void propagate(std::vector<SurfacePoint>& sources,
34 std::vector<SurfacePoint>* stop_points = NULL) = 0;
37 std::vector<SurfacePoint>& path) = 0;
40 std::vector<SurfacePoint>& path,std::vector<unsigned>& indexVertex) = 0;
44 std::vector<SurfacePoint>& path);
46 void geodesic(std::vector<SurfacePoint>& sources,
47 std::vector<SurfacePoint>& destinations,
48 std::vector<std::vector<SurfacePoint> >& paths);
52 std::vector<SurfacePoint>& path,std::vector<unsigned>& indexVertex);
55 std::vector<SurfacePoint>& destinations,
56 std::vector<std::vector<SurfacePoint> >& paths,
57 std::vector<std::vector<unsigned> >& indexVertex);
59 double length(std::vector<SurfacePoint>& path);
63 double& best_source_distance) = 0;
67 std::cout <<
"propagation step took " <<
m_time_consumed <<
" seconds " << std::endl;
72 virtual std::string
name();
101 for(
unsigned i=0; i<path.size()-1; ++i)
103 length += path[i].distance(&path[i+1]);
111 std::cout <<
"number of the points in the path = " << path.size()
112 <<
", length of the path = " <<
length(path)
125 return "subdivision";
134 std::vector<SurfacePoint>& path)
136 std::vector<SurfacePoint> sources(1, source);
137 std::vector<SurfacePoint> stop_points(1, destination);
141 max_propagation_distance,
149 std::vector<SurfacePoint>& path,std::vector<unsigned>& indexVertex)
151 std::vector<SurfacePoint> sources(1, source);
152 std::vector<SurfacePoint> stop_points(1, destination);
156 max_propagation_distance,
163 std::vector<SurfacePoint>& destinations,
164 std::vector<std::vector<SurfacePoint> >& paths)
169 max_propagation_distance,
172 paths.resize(destinations.size());
174 for(
unsigned i=0; i<paths.size(); ++i)
181 std::vector<SurfacePoint>& destinations, std::vector<std::vector<SurfacePoint> >& paths,
182 std::vector<std::vector<unsigned> >& indexVertex)
186 std::vector<SurfacePoint> sources(1, source);
189 max_propagation_distance,
192 paths.resize(destinations.size());
193 indexVertex.resize(destinations.size());
195 for(
unsigned i=0; i<paths.size(); ++i)
202 double stop_distance)
214 std::vector<vertex_pointer> possible_vertices;
215 for(
unsigned i = 0; i < stop_points->size(); ++i)
219 possible_vertices.clear();
223 double min_distance = 1e100;
224 for(
unsigned j = 0; j < possible_vertices.size(); ++j)
226 double distance = point->
distance(possible_vertices[j]);
227 if(distance < min_distance)
229 min_distance = distance;
230 closest_vertex = possible_vertices[j];
233 assert(closest_vertex);
GeodesicAlgorithmBase(geodesic::Mesh *mesh)
virtual void trace_back_with_index(SurfacePoint &destination, std::vector< SurfacePoint > &path, std::vector< unsigned > &indexVertex)=0
virtual void trace_back(SurfacePoint &destination, std::vector< SurfacePoint > &path)=0
virtual unsigned best_source(SurfacePoint &point, double &best_source_distance)=0
virtual void print_statistics()
void set_stop_conditions(std::vector< SurfacePoint > *stop_points, double stop_distance)
void print_info_about_path(std::vector< SurfacePoint > &path)
virtual ~GeodesicAlgorithmBase()
double length(std::vector< SurfacePoint > &path)
virtual std::string name()
double m_propagation_distance_stopped
double m_max_propagation_distance
void geodesic(SurfacePoint &source, SurfacePoint &destination, std::vector< SurfacePoint > &path)
std::vector< stop_vertex_with_distace_type > m_stop_vertices
virtual void propagate(std::vector< SurfacePoint > &sources, double max_propagation_distance=GEODESIC_INF, std::vector< SurfacePoint > *stop_points=NULL)=0
std::pair< vertex_pointer, double > stop_vertex_with_distace_type
unsigned closest_vertices(SurfacePoint *p, std::vector< vertex_pointer > *storage=NULL)
double distance(double *v)
double const GEODESIC_INF