mirror of https://github.com/CGAL/cgal
rename property map
This commit is contained in:
parent
6d78b5b758
commit
074e31c3d1
|
|
@ -21,17 +21,17 @@ int main(int argc, char* argv[])
|
|||
const char* filename = (argc > 1) ? argv[1] : "./data/elephant.off";
|
||||
std::ifstream in(filename);
|
||||
in >> sm;
|
||||
//the heat intensity will hold the distance values from the source set
|
||||
Vertex_distance_map heat_intensity = sm.add_property_map<vertex_descriptor, double>("v:heat_intensity", 0).first;
|
||||
//property map for the distance values to the source set
|
||||
Vertex_distance_map vertex_distance = sm.add_property_map<vertex_descriptor, double>("v:distance", 0).first;
|
||||
|
||||
vertex_descriptor source = *(vertices(sm).first);
|
||||
|
||||
CGAL::Heat_method_3::estimate_geodesic_distances(sm, heat_intensity,source) ;
|
||||
CGAL::Heat_method_3::estimate_geodesic_distances(sm, vertex_distance,source) ;
|
||||
|
||||
std::cout << "Source vertex " << source << " at: " << sm.point(source) << std::endl;
|
||||
BOOST_FOREACH(vertex_descriptor vd , vertices(sm)){
|
||||
std::cout << vd << " ("<< sm.point(vd) << ")"
|
||||
<< " is at distance " << get(heat_intensity, vd) << std::endl;
|
||||
<< " is at distance " << get(vertex_distance, vd) << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -21,18 +21,18 @@ int main(int argc, char* argv[])
|
|||
const char* filename = (argc > 1) ? argv[1] : "./data/elephant.off";
|
||||
std::ifstream in(filename);
|
||||
in >> sm;
|
||||
|
||||
boost::unordered_map<vertex_descriptor, double> heat_intensity;
|
||||
// map for the distance values to the source set
|
||||
boost::unordered_map<vertex_descriptor, double> vertex_distance;
|
||||
|
||||
vertex_descriptor source = *(vertices(sm).first);
|
||||
|
||||
CGAL::Heat_method_3::estimate_geodesic_distances(sm,
|
||||
boost::make_assoc_property_map(heat_intensity),
|
||||
boost::make_assoc_property_map(vertex_distance),
|
||||
source) ;
|
||||
|
||||
std::cout << "Source vertex at: " << source->point() << std::endl;
|
||||
BOOST_FOREACH(vertex_descriptor vd , vertices(sm)){
|
||||
std::cout << vd->point() << " is at distance " << heat_intensity[vd] << std::endl;
|
||||
std::cout << vd->point() << " is at distance " << vertex_distance[vd] << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -24,15 +24,15 @@ int main(int argc, char* argv[])
|
|||
const char* filename = (argc > 1) ? argv[1] : "./data/elephant.off";
|
||||
std::ifstream in(filename);
|
||||
in >> sm;
|
||||
//the heat intensity will hold the distance values from the source set
|
||||
Vertex_distance_map heat_intensity = sm.add_property_map<vertex_descriptor, double>("v:heat_intensity", 0).first;
|
||||
//property map for the distance values to the source set
|
||||
Vertex_distance_map vertex_distance = sm.add_property_map<vertex_descriptor, double>("v:distance", 0).first;
|
||||
|
||||
Heat_method hm(sm);
|
||||
|
||||
//add the first vertex as the source set
|
||||
vertex_descriptor source = *(vertices(sm).first);
|
||||
hm.add_source(source);
|
||||
hm.estimate_geodesic_distances(heat_intensity);
|
||||
hm.estimate_geodesic_distances(vertex_distance);
|
||||
|
||||
Point_3 sp = sm.point(source);
|
||||
|
||||
|
|
@ -40,17 +40,17 @@ int main(int argc, char* argv[])
|
|||
double sdistance = 0;
|
||||
|
||||
BOOST_FOREACH(vertex_descriptor vd , vertices(sm)){
|
||||
std::cout << vd << " is at distance " << get(heat_intensity, vd) << " from " << source << std::endl;
|
||||
std::cout << vd << " is at distance " << get(vertex_distance, vd) << " from " << source << std::endl;
|
||||
if(squared_distance(sp,sm.point(vd)) > sdistance){
|
||||
far = vd;
|
||||
sdistance = squared_distance(sp,sm.point(vd));
|
||||
}
|
||||
}
|
||||
hm.add_source(far);
|
||||
hm.estimate_geodesic_distances(heat_intensity);
|
||||
hm.estimate_geodesic_distances(vertex_distance);
|
||||
|
||||
BOOST_FOREACH(vertex_descriptor vd , vertices(sm)){
|
||||
std::cout << vd << " is at distance " << get(heat_intensity, vd) << " " << std::endl;
|
||||
std::cout << vd << " is at distance " << get(vertex_distance, vd) << " " << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ int main(int argc, char* argv[])
|
|||
const char* filename = (argc > 1) ? argv[1] : "./data/elephant.off";
|
||||
std::ifstream in(filename);
|
||||
in >> sm;
|
||||
//the vertex distance map will hold the distance values from the source set
|
||||
Vertex_distance_map vdm_idt = sm.add_property_map<vertex_descriptor,double>("v:idt",0).first;
|
||||
//property map for the distance values to the source set
|
||||
Vertex_distance_map vertex_distance = sm.add_property_map<vertex_descriptor,double>("v:distance",0).first;
|
||||
|
||||
//pass in the idt object and its vertex_distance_map
|
||||
Heat_method_idt hm_idt(sm);
|
||||
|
|
@ -33,10 +33,10 @@ int main(int argc, char* argv[])
|
|||
//add the first vertex as the source set
|
||||
vertex_descriptor source = *(vertices(sm).first);
|
||||
hm_idt.add_source(source);
|
||||
hm_idt.estimate_geodesic_distances(vdm_idt);
|
||||
hm_idt.estimate_geodesic_distances(vertex_distance);
|
||||
|
||||
BOOST_FOREACH(vertex_descriptor vd , vertices(sm)){
|
||||
std::cout << vd << " is at distance " << get(vdm_idt, vd) << " from " << source << std::endl;
|
||||
std::cout << vd << " is at distance " << get(vertex_distance, vd) << " from " << source << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue