Index: voronoi_benchmark_points.cpp =================================================================== --- voronoi_benchmark_points.cpp (revision 83413) +++ voronoi_benchmark_points.cpp (working copy) @@ -26,19 +26,13 @@ typedef boost::polygon::voronoi_diagram VD_BOOST; // Includes for the CGAL library. -#include -#include -#include -#include -#include -typedef CGAL::Quotient ENT; -typedef CGAL::Simple_cartesian CK; -typedef CGAL::Simple_cartesian EK; -typedef CGAL::Segment_Delaunay_graph_filtered_traits_2< - CK, CGAL::Field_with_sqrt_tag, EK, CGAL::Field_tag> Gt; -typedef CGAL::Segment_Delaunay_graph_2 SDT_CGAL; -typedef SDT_CGAL::Point_2 Point_CGAL; +#include +#include +typedef CGAL::Exact_predicates_inexact_constructions_kernel Gt; +typedef CGAL::Delaunay_triangulation_2 DT2_CGAL; +typedef Gt::Point_2 Point_CGAL; + // Includes for the S-Hull library. #include @@ -81,11 +75,14 @@ for (int i = 0; i < NUM_TESTS; ++i) { timer.restart(); for (int j = 0; j < NUM_RUNS[i]; ++j) { - SDT_CGAL dt; + DT2_CGAL dt; + std::vector points; + points.reserve(NUM_POINTS[i]); for (int k = 0; k < NUM_POINTS[i]; ++k) { - dt.insert(Point_CGAL( + points.push_back(Point_CGAL( static_cast(gen()), static_cast(gen()))); } + dt.insert(points.begin(), points.end() ); } double time_per_test = timer.elapsed() / NUM_RUNS[i]; format_line(NUM_POINTS[i], NUM_RUNS[i], time_per_test); @@ -135,7 +132,7 @@ << std::setprecision(6); run_boost_test(); run_cgal_test(); - run_shull_test(); + //~ run_shull_test(); bf.close(); return 0; } Index: voronoi_benchmark_segments.cpp =================================================================== --- voronoi_benchmark_segments.cpp (revision 83413) +++ voronoi_benchmark_segments.cpp (working copy) @@ -25,17 +25,19 @@ typedef boost::polygon::voronoi_diagram VD_BOOST; // Includes for the CGAL library. -#include -#include -#include +#include #include #include -typedef CGAL::Quotient ENT; -typedef CGAL::Simple_cartesian CK; -typedef CGAL::Simple_cartesian EK; -typedef CGAL::Segment_Delaunay_graph_filtered_traits_2< - CK, CGAL::Field_with_sqrt_tag, EK, CGAL::Field_tag> Gt; -typedef CGAL::Segment_Delaunay_graph_2 SDT_CGAL; +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Field_with_sqrt_tag MTag; +typedef CGAL::Integral_domain_without_division_tag EMTag; +typedef CGAL::Simple_cartesian EK; + +typedef CGAL::Segment_Delaunay_graph_filtered_traits_without_intersections_2 Gt; +typedef CGAL::Segment_Delaunay_graph_2 SDT_CGAL; typedef SDT_CGAL::Point_2 Point_CGAL; typedef SDT_CGAL::Site_2 Site_CGAL; @@ -156,12 +158,55 @@ POINT_POLYGON(x1 + dx, y1 + dy))); } clean_segment_set(ssd); - SDT_CGAL dt; - for (SSD_POLYGON::iterator it = ssd.begin(); it != ssd.end(); ++it) { - dt.insert(Site_CGAL::construct_site_2( - Point_CGAL(it->low().x(), it->low().y()), - Point_CGAL(it->high().x(), it->high().y()))); + + typedef std::vector Points_container; + typedef std::vector::size_type Index_type; + typedef std::vector< std::pair > Constraints_container; + + typedef std::vector Indices; + typedef std::vector Vertices; + + Points_container points; + Constraints_container constraints; + points.reserve(ssd.size() * 2); + constraints.reserve(ssd.size()); + for(SSD_POLYGON::iterator it = ssd.begin(); it != ssd.end(); ++it) { + points.push_back(Point_CGAL(boost::polygon::x(it->low()), boost::polygon::y(it->low()))); + points.push_back(Point_CGAL(boost::polygon::x(it->high()), boost::polygon::y(it->high()))); + constraints.push_back(std::make_pair(points.size() -2, points.size() - 1)); } + + Indices indices; + indices.reserve(ssd.size()); + CGAL::Spatial_sort_traits_adapter_2 sort_traits(&(points[0])); + + + std::copy(boost::counting_iterator(0), + boost::counting_iterator(points.size()), + std::back_inserter(indices)); + + CGAL::spatial_sort(indices.begin(), indices.end(), sort_traits); + + SDT_CGAL sdg; + + Vertices vertices; + vertices.resize(points.size()); + SDT_CGAL::Vertex_handle hint; + for(Indices::const_iterator pt_ptr_it = indices.begin(), end = indices.end(); + pt_ptr_it != end; ++pt_ptr_it) { + SDT_CGAL::Vertex_handle vh = sdg.insert(points[*pt_ptr_it], hint); + hint = vh; + vertices[*pt_ptr_it] = vh; + } + + for(Constraints_container::const_iterator cit = constraints.begin(), end = constraints.end(); + cit != end; ++cit) { + const SDT_CGAL::Vertex_handle& v1 = vertices[cit->first]; + const SDT_CGAL::Vertex_handle& v2 = vertices[cit->second]; + if(v1 != v2) + sdg.insert(v1, v2); + } + } double time_per_test = (timer.elapsed() - running_times[i]) / NUM_RUNS[i]; format_line(NUM_SEGMENTS[i], NUM_RUNS[i], time_per_test);