Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Re: squared_distance performance
- Date: Thu, 04 Oct 2012 19:13:48 +0200
- Organization: GeometryFactory
Is this the code you used?
Using only one point to test something is not relevant IMO.
Sebastien.
On 10/04/2012 05:14 PM, topotun wrote:
Hello Sebastien.
The code is quite simple - just a combination of
/AABB_polyhedron_facet_distance_example.cpp /and /polyhedron2vrml.cpp/.
Again, I wanted to investigate the performance of the distance queries
before I augment a much larger project with this functionality. The compiler
is VS2010, no optimization, and I’ve tried both the release and the debug
versions – the relative performance of /squared_distance /w/respect to the
other two functions remains the same.
Thank you.
Denis
---
int main() {
double timer_start = 0.0;
double timer_tree = 0.0;
double timer_squared_distance = 0.0;
double timer_closest_point = 0.0;
double timer_closest_point_and_primitive = 0.0;
Polyhedron polyhedron;
const char* input_filename = "C:/Users/dvd11003/Desktop/CDL/test
part/off/mushroom.off";
std::ifstream stream(input_filename);
stream>> polyhedron;
std::cout<< "\n"<<polyhedron.size_of_vertices()<<std::endl;
//---------- AABB distance check ----------------//
// constructs AABB tree and computes internal KD-tree
// data structure to accelerate distance queries
timer_start = omp_get_wtime();
Tree tree(polyhedron.facets_begin(),polyhedron.facets_end());
tree.accelerate_distance_queries();
timer_tree = omp_get_wtime() - timer_start;
std::cout<< "Tree constructed in "<< timer_tree<< std::endl;
// query point
Point query(100.0, 56.0, 100.0);
// computes squared distance from query
timer_start = omp_get_wtime();
FT sqd = tree.squared_distance(query);
timer_squared_distance = omp_get_wtime() - timer_start;
std::cout<< "squared distance: "<< sqrt(sqd)<< " in "<<
timer_squared_distance<< std::endl;
// computes closest point
timer_start = omp_get_wtime();
Point closest = tree.closest_point(query);
timer_closest_point = omp_get_wtime() - timer_start;
std::cout<< "closest point: "<< closest<< " in "<<
timer_closest_point<< std::endl;
// computes closest point and primitive id
timer_start = omp_get_wtime();
Point_and_primitive_id pp = tree.closest_point_and_primitive(query);
timer_closest_point_and_primitive = omp_get_wtime() - timer_start;
std::cout<< "closest point: "<< pp.first<< " in "<<
timer_closest_point_and_primitive<< std::endl;
Polyhedron::Face_handle f = pp.second; // closest primitive id
//---------- end AABB distance check ----------------//
return EXIT_SUCCESS;
}
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/squared-distance-performance-tp4655960p4655972.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] squared_distance performance, topotun, 10/03/2012
- Re: [cgal-discuss] squared_distance performance, Sebastien Loriot (GeometryFactory), 10/03/2012
- [cgal-discuss] Re: squared_distance performance, topotun, 10/04/2012
- Re: [cgal-discuss] Re: squared_distance performance, Sebastien Loriot (GeometryFactory), 10/04/2012
- Re: [cgal-discuss] Re: squared_distance performance, Philipp Moeller, 10/04/2012
- [cgal-discuss] Re: squared_distance performance, topotun, 10/05/2012
- Re: [cgal-discuss] Re: squared_distance performance, Sebastien Loriot (GeometryFactory), 10/10/2012
- [cgal-discuss] Re: squared_distance performance, topotun, 10/05/2012
- [cgal-discuss] Re: squared_distance performance, topotun, 10/04/2012
- Re: [cgal-discuss] squared_distance performance, Sebastien Loriot (GeometryFactory), 10/03/2012
Archive powered by MHonArc 2.6.18.