From 5fc500a6a338f0089f5e60a3d4968847d5d5dd9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Thu, 26 May 2011 15:34:36 +0000 Subject: [PATCH 02/64] testfile to check for copy_n --- .gitattributes | 1 + .../testfiles/CGAL_CFG_NO_CPP0X_COPY_N.cpp | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Installation/config/testfiles/CGAL_CFG_NO_CPP0X_COPY_N.cpp diff --git a/.gitattributes b/.gitattributes index 2b2b283cc35..8ce7bb57342 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1634,6 +1634,7 @@ Installation/config/support/print_QT_version.cpp -text Installation/config/support/print_TAUCS_version.cpp -text Installation/config/support/print_ZLIB_version.cpp -text Installation/config/support/test_BOOST_THREAD.cpp -text +Installation/config/testfiles/CGAL_CFG_NO_CPP0X_COPY_N.cpp -text Installation/config/testfiles/CGAL_CFG_NO_CPP0X_ISFINITE.cpp -text Installation/config/version.h.in -text Installation/doc_tex/Installation/cmakelogo.png -text svneol=unset#image/png diff --git a/Installation/config/testfiles/CGAL_CFG_NO_CPP0X_COPY_N.cpp b/Installation/config/testfiles/CGAL_CFG_NO_CPP0X_COPY_N.cpp new file mode 100644 index 00000000000..562effc9c69 --- /dev/null +++ b/Installation/config/testfiles/CGAL_CFG_NO_CPP0X_COPY_N.cpp @@ -0,0 +1,39 @@ +// Copyright (c) 2011 GeometryFactory (France). All rights reserved. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; version 2.1 of the License. +// See the file LICENSE.LGPL distributed with CGAL. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Phillip Möller + +//| If a compiler does not support std::copy_n (from C++0x) +//| CGAL_CFG_NO_CPP0X_COPY_N is set. + +#undef NDEBUG +#include +#include + +int main() +{ + int arr[] = {1, 2, 3, 4, 5 }; + int arr2[] = {0, 0, 0, 0, 0 }; + std::copy_n(arr, 3, arr2); + + assert(arr2[0] == 1); + assert(arr2[1] == 2); + assert(arr2[2] == 3); + assert(arr2[3] == 0); + assert(arr2[4] == 0); + return 0; +} From 52d16577170c5e94e95fb1be8711f70912c5edad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Thu, 26 May 2011 18:14:58 +0000 Subject: [PATCH 03/64] Replaced CGAL::copy_n in all files with CGAL::cpp0x::copy_n --- .../Alpha_shapes_2/ex_alpha_shapes_2.cpp | 2 +- .../test/Alpha_shapes_2/test_alpha.cpp | 2 +- .../triangle_self_intersect.cpp | 2 +- .../triangle_self_intersect_pointers.cpp | 2 +- CGAL_ipelets/demo/CGAL_ipelets/generator.cpp | 6 ++-- .../demo/Convex_hull_3/quickhull_3_demo.cpp | 2 +- .../examples/Convex_hull_3/dynamic_hull_3.cpp | 2 +- .../Convex_hull_3/incremental_hull_3.cpp | 2 +- .../examples/Convex_hull_3/quickhull_3.cpp | 2 +- .../quickhull_degenerate_test_3.cpp | 2 +- .../test/Convex_hull_3/quickhull_test_3.cpp | 2 +- .../Filtered_kernel/orientation_3.cpp | 2 +- Generator/demo/Generator/qt3/generator.cpp | 2 +- Generator/doc_tex/Generator/generators.tex | 2 +- .../Generator/random_degenerate_point_set.cpp | 2 +- Generator/examples/Generator/random_grid.cpp | 2 +- .../examples/Generator/random_segments1.cpp | 2 +- Generator/include/CGAL/random_convex_set_2.h | 2 +- Generator/test/Generator/test_generators.cpp | 28 +++++++++---------- GraphicsView/demo/Generator/Generator_2.cpp | 2 +- .../demo/Interpolation/surface_voronoi.cpp | 4 +-- .../Interpolation/interpolation_2.cpp | 2 +- .../surface_neighbor_coordinates_3.cpp | 2 +- .../CGAL/_test_interpolation_functions_2.cpp | 2 +- .../CGAL/_test_regular_neighbors_2.cpp | 2 +- .../CGAL/_test_surface_neighbors_3.cpp | 6 ++-- .../Matrix_search/rectangular_p_center_2.cpp | 2 +- .../rectangular_p_center_2_random1_test.cpp | 2 +- .../rectangular_p_center_2_random2_test.cpp | 2 +- Min_annulus_d/web/Min_annulus_d.aw | 2 +- Nef_2/noweb/Segment_overlay.lw | 2 +- Point_set_2/test/Point_set_2/range_search.cpp | 2 +- .../test/Point_set_2/range_search_fcn.cpp | 2 +- .../include/CGAL/QP_solver/QP_solver_impl.h | 2 +- Robustness/demo/Robustness/robustness.cpp | 4 +-- STL_Extension/include/CGAL/algorithm.h | 8 ++++++ .../Qt3/spatial_searching.cpp | 8 +++--- .../Building_kd_tree_with_ddim_points.cpp | 2 +- ...Orthogonal_incremental_neighbor_search.cpp | 2 +- .../test/Spatial_searching/Splitters.cpp | 2 +- .../examples/Triangulation_2/hierarchy.cpp | 2 +- .../CGAL/_test_cls_delaunay_hierarchy_2.h | 2 +- .../demo/Triangulation_3/Scene.cpp | 2 +- .../demo/Triangulation_3/Viewer.cpp | 2 +- 44 files changed, 73 insertions(+), 65 deletions(-) diff --git a/Alpha_shapes_2/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp b/Alpha_shapes_2/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp index aca832be0d6..b185f4e6084 100644 --- a/Alpha_shapes_2/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp +++ b/Alpha_shapes_2/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp @@ -79,7 +79,7 @@ file_input(OutputIterator out) int n; is >> n; std::cout << "Reading " << n << " points from file" << std::endl; - CGAL::copy_n(std::istream_iterator(is), n, out); + CGAL::cpp0x::copy_n(std::istream_iterator(is), n, out); return true; } diff --git a/Alpha_shapes_2/test/Alpha_shapes_2/test_alpha.cpp b/Alpha_shapes_2/test/Alpha_shapes_2/test_alpha.cpp index 7d5d2d32d71..f72f9a98d30 100644 --- a/Alpha_shapes_2/test/Alpha_shapes_2/test_alpha.cpp +++ b/Alpha_shapes_2/test/Alpha_shapes_2/test_alpha.cpp @@ -89,7 +89,7 @@ file_input(OutputIterator out) int n; is >> n; std::cout << "Reading " << n << " points from file" << std::endl; - CGAL::copy_n(std::istream_iterator(is), n, out); + CGAL::cpp0x::copy_n(std::istream_iterator(is), n, out); return true; } diff --git a/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect.cpp b/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect.cpp index c080174f30a..0642e4e9b56 100644 --- a/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect.cpp +++ b/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect.cpp @@ -35,7 +35,7 @@ int main() { typedef CGAL::Join_input_iterator_3 Triangle_gen; Pts points( 1); // in centered cube [-1,1)^3 Triangle_gen triangle_gen( points, points, points); - CGAL::copy_n( triangle_gen, 10, std::back_inserter(triangles)); + CGAL::cpp0x::copy_n( triangle_gen, 10, std::back_inserter(triangles)); // Create the corresponding vector of bounding boxes std::vector boxes; diff --git a/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp b/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp index b3cab305fd4..640d1a31796 100644 --- a/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp +++ b/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp @@ -35,7 +35,7 @@ int main() { typedef CGAL::Join_input_iterator_3 Triangle_gen; Pts points( 1); // in centered cube [-1,1)^3 Triangle_gen triangle_gen( points, points, points); - CGAL::copy_n( triangle_gen, 10, std::back_inserter(triangles)); + CGAL::cpp0x::copy_n( triangle_gen, 10, std::back_inserter(triangles)); // Create the corresponding vector of bounding boxes std::vector boxes; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp b/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp index f38581d4e00..93def51c62c 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp @@ -101,7 +101,7 @@ void generator::protected_run(int fn) switch(fn){ case 0:{//random point in a circle CGAL::Random_points_in_disc_2 gs( size); - CGAL::copy_n( gs, nbelements, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gs, nbelements, std::back_inserter(points)); } break; @@ -112,7 +112,7 @@ void generator::protected_run(int fn) case 6: case 2://points in a square : side = {CGAL::Random_points_in_square_2 gc (size); - CGAL::copy_n( gc, nbelements, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gc, nbelements, std::back_inserter(points)); } break; @@ -139,7 +139,7 @@ void generator::protected_run(int fn) typedef CGAL::Creator_uniform_2< Point_2, Segment_2> Seg_creator; typedef CGAL::Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator; Seg_iterator g( p1, p2); - CGAL::copy_n( g, nbelements, std::back_inserter(segments) ); + CGAL::cpp0x::copy_n( g, nbelements, std::back_inserter(segments) ); break; }; diff --git a/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp b/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp index 28135c29e06..3bd02fc30a5 100644 --- a/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp +++ b/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp @@ -115,7 +115,7 @@ int main(int argc, char* argv[]) Generator gen(100.0); // generate num points and copy them to a vector - CGAL::copy_n( gen, num, std::back_inserter(points) ); + CGAL::cpp0x::copy_n( gen, num, std::back_inserter(points) ); // define object to hold convex hull CGAL::Object ch_object; diff --git a/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp b/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp index 6da2c4e83f5..1b63b8c8130 100644 --- a/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp @@ -17,7 +17,7 @@ int main() // generate 250 points randomly on a sphere of radius 100.0 // and insert them into the triangulation - CGAL::copy_n(gen, 250, std::back_inserter(points) ); + CGAL::cpp0x::copy_n(gen, 250, std::back_inserter(points) ); Delaunay T; T.insert(points.begin(), points.end()); diff --git a/Convex_hull_3/examples/Convex_hull_3/incremental_hull_3.cpp b/Convex_hull_3/examples/Convex_hull_3/incremental_hull_3.cpp index e9ecb2a274f..f9a34addbb4 100644 --- a/Convex_hull_3/examples/Convex_hull_3/incremental_hull_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/incremental_hull_3.cpp @@ -26,7 +26,7 @@ int main() std::vector V; // generate 250 points randomly on a sphere of radius 100.0 and copy // them to a vector - CGAL::copy_n( gen, 250, std::back_inserter(V) ); + CGAL::cpp0x::copy_n( gen, 250, std::back_inserter(V) ); Polyhedron P; // define polyhedron to hold convex hull diff --git a/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp b/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp index a8946950c8b..be700f78704 100644 --- a/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp @@ -23,7 +23,7 @@ int main() // generate 250 points randomly on a sphere of radius 100.0 // and copy them to a vector std::vector points; - CGAL::copy_n( gen, 250, std::back_inserter(points) ); + CGAL::cpp0x::copy_n( gen, 250, std::back_inserter(points) ); // define object to hold convex hull CGAL::Object ch_object; diff --git a/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp b/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp index 187ccc45d2a..1ef90204110 100644 --- a/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp @@ -128,7 +128,7 @@ void test_collinear() // generate 100 points on the segment with endpoints (0,0) and (1,0) CGAL::Random_points_on_segment_2 g(Point_2(0,0), Point_2(1,0)); - CGAL::copy_n(g, 100, std::back_inserter(point_2_list)); + CGAL::cpp0x::copy_n(g, 100, std::back_inserter(point_2_list)); std::list::iterator point_it = point_2_list.begin(); point_3_list.push_back(Point_3(0,0,0)); diff --git a/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp b/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp index 1aaa4b8130d..f20dcc162f5 100644 --- a/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp @@ -104,7 +104,7 @@ int main() std::cerr << "Testing 500 random points" << std::endl; std::vector points; Generator g(500); - CGAL::copy_n( g, num, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, num, std::back_inserter(points)); assert(points.size() == num); diff --git a/Filtered_kernel/benchmark/Filtered_kernel/orientation_3.cpp b/Filtered_kernel/benchmark/Filtered_kernel/orientation_3.cpp index c2fa744ce67..bade708b43a 100644 --- a/Filtered_kernel/benchmark/Filtered_kernel/orientation_3.cpp +++ b/Filtered_kernel/benchmark/Filtered_kernel/orientation_3.cpp @@ -31,7 +31,7 @@ int main() std::vector points; points.reserve(N); CGAL::Random_points_in_sphere_3 g( 100.0); - CGAL::copy_n( g, N, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, N, std::back_inserter(points)); timer.stop(); std::cout << "Fill vector: " << timer.time() << " sec" << std::endl; timer.reset(); diff --git a/Generator/demo/Generator/qt3/generator.cpp b/Generator/demo/Generator/qt3/generator.cpp index 7b2c6a89c58..c6dc23940cf 100644 --- a/Generator/demo/Generator/qt3/generator.cpp +++ b/Generator/demo/Generator/qt3/generator.cpp @@ -305,7 +305,7 @@ private slots: typedef CGAL::Creator_uniform_2< Point_2, Segment> Seg_creator; typedef CGAL::Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator; Seg_iterator g( p1, p2); - CGAL::copy_n( g, 200, std::back_inserter(list_of_segments)); + CGAL::cpp0x::copy_n( g, 200, std::back_inserter(list_of_segments)); something_changed(); } diff --git a/Generator/doc_tex/Generator/generators.tex b/Generator/doc_tex/Generator/generators.tex index b37c859088f..428ddff9065 100644 --- a/Generator/doc_tex/Generator/generators.tex +++ b/Generator/doc_tex/Generator/generators.tex @@ -18,7 +18,7 @@ Two kinds of point generators are provided: first, random point generators and second deterministic point generators. Most random point generators and a few deterministic point generators are provided as input iterators. The input iterators model an infinite sequence of -points. The function \ccc{CGAL::copy_n()} can be used to copy a +points. The function \ccc{CGAL::cpp0x::copy_n()} can be used to copy a finite sequence; see Section~\ref{sectionCopyN}. The iterator adaptor \ccc{Counting_iterator} can be used to create finite iterator ranges; see Section~\ref{sectionCountingIterator}. diff --git a/Generator/examples/Generator/random_degenerate_point_set.cpp b/Generator/examples/Generator/random_degenerate_point_set.cpp index d63cd85e63b..db2581177db 100644 --- a/Generator/examples/Generator/random_degenerate_point_set.cpp +++ b/Generator/examples/Generator/random_degenerate_point_set.cpp @@ -20,7 +20,7 @@ int main() { // Create 600 points within a disc of radius 150. Random_points_in_disc_2 g( 150.0); - CGAL::copy_n( g, 600, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, 600, std::back_inserter(points)); // Create 200 points from a 15 x 15 grid. points_on_square_grid_2( 250.0, 200, std::back_inserter(points),Creator()); diff --git a/Generator/examples/Generator/random_grid.cpp b/Generator/examples/Generator/random_grid.cpp index d13cc88b628..df565b34c8c 100644 --- a/Generator/examples/Generator/random_grid.cpp +++ b/Generator/examples/Generator/random_grid.cpp @@ -31,7 +31,7 @@ int main() { // Create 250 points within a disc of radius 150. Random_points_in_disc_2 g( 150.0); - CGAL::copy_n( g, 250, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, 250, std::back_inserter(points)); // Check that we have really created 500 points. assert( points.size() == 500); diff --git a/Generator/examples/Generator/random_segments1.cpp b/Generator/examples/Generator/random_segments1.cpp index 158a9793da9..6fe4e366d81 100644 --- a/Generator/examples/Generator/random_segments1.cpp +++ b/Generator/examples/Generator/random_segments1.cpp @@ -35,7 +35,7 @@ int main() { typedef Creator_uniform_2< Point, Segment> Seg_creator; typedef Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator; Seg_iterator g( p1, p2); - CGAL::copy_n( g, 200, std::back_inserter(segs)); + CGAL::cpp0x::copy_n( g, 200, std::back_inserter(segs)); assert( segs.size() == 200); for ( Vector::iterator i = segs.begin(); i != segs.end(); i++){ diff --git a/Generator/include/CGAL/random_convex_set_2.h b/Generator/include/CGAL/random_convex_set_2.h index b064d137b45..6240b2c1a2f 100644 --- a/Generator/include/CGAL/random_convex_set_2.h +++ b/Generator/include/CGAL/random_convex_set_2.h @@ -71,7 +71,7 @@ random_convex_set_2( std::size_t n, // build random point set: Container points; points.reserve( n); - CGAL::copy_n( pg, n, back_inserter( points)); + CGAL::cpp0x::copy_n( pg, n, back_inserter( points)); // compute centroid of points: Point_2 centroid = CGAL::centroid( points.begin(), points.end(), t ); diff --git a/Generator/test/Generator/test_generators.cpp b/Generator/test/Generator/test_generators.cpp index 384cf662fb7..ff5c76de963 100644 --- a/Generator/test/Generator/test_generators.cpp +++ b/Generator/test/Generator/test_generators.cpp @@ -56,7 +56,7 @@ void test_point_generators_2() { std::vector points; points.reserve(1000); Random_points_in_disc_2 g1( 100.0); - CGAL::copy_n( g1, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g1, 100, std::back_inserter(points)); Random_points_on_circle_2 g2( 100.0); Random_points_in_square_2 g3( 100.0); Random_points_on_square_2 g4( 100.0); @@ -65,11 +65,11 @@ void test_point_generators_2() { Points_on_segment_2 g5a( Point_2( 50,-50), Point_2(-50, 50), 50); - CGAL::copy_n( g2, 100, std::back_inserter(points)); - CGAL::copy_n( g3, 100, std::back_inserter(points)); - CGAL::copy_n( g4, 100, std::back_inserter(points)); - CGAL::copy_n( g5, 50, std::back_inserter(points)); - CGAL::copy_n( g5a, 50, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g2, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g3, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g4, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g5, 50, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g5a, 50, std::back_inserter(points)); points_on_square_grid_2( 50.0, (std::size_t)1, std::back_inserter(points), Creator()); points_on_square_grid_2( 50.0, (std::size_t)2, @@ -90,7 +90,7 @@ void test_point_generators_2() { // the 100 x 100 square. 10 pixel perturbation allowed. Random_points_in_square_2 g6( 90.0); int count = 100 ; - CGAL::copy_n( g6, count, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g6, count, std::back_inserter(points)); std::vector::iterator i2 = points.end(); std::vector::iterator i1 = i2 ; std::advance(i1,-count); @@ -117,11 +117,11 @@ void test_point_generators_3() { std::vector points; points.reserve(500); Random_points_in_sphere_3 g1( 100.0); - CGAL::copy_n( g1, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g1, 100, std::back_inserter(points)); Random_points_on_sphere_3 g2( 100.0); Random_points_in_cube_3 g3( 100.0); - CGAL::copy_n( g2, 100, std::back_inserter(points)); - CGAL::copy_n( g3, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g2, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g3, 100, std::back_inserter(points)); points_on_cube_grid_3( 50.0, (std::size_t)1, std::back_inserter(points), Creator()); points_on_cube_grid_3( 50.0, (std::size_t)2, @@ -171,7 +171,7 @@ void test_point_generators_d() // 100 random points in dim 36 std::cout<<" cube dim 36"< gen (36, 1.0); - CGAL::copy_n( gen, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gen, 100, std::back_inserter(points)); i+=100; std::cout<<" done"< gen (4, 100.0); - CGAL::copy_n( gen, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gen, 100, std::back_inserter(points)); std::cout<<" done"< gen (3, 1.0); - CGAL::copy_n( gen, nb_g, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gen, nb_g, std::back_inserter(points)); std::cout<<" done"< gen (26, 1.0); - CGAL::copy_n( gen, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gen, 100, std::back_inserter(points)); std::cout<<" done"< Seg_creator; typedef CGAL::Join_input_iterator_2< Rpos_generator, Rpoc_generator, Seg_creator> Seg_iterator; Seg_iterator g( rpos, rpoc); - CGAL::copy_n( g, 200, std::back_inserter(segments)); + CGAL::cpp0x::copy_n( g, 200, std::back_inserter(segments)); emit(changed()); } diff --git a/Interpolation/demo/Interpolation/surface_voronoi.cpp b/Interpolation/demo/Interpolation/surface_voronoi.cpp index 7737d73ec3b..1b5431d2211 100644 --- a/Interpolation/demo/Interpolation/surface_voronoi.cpp +++ b/Interpolation/demo/Interpolation/surface_voronoi.cpp @@ -92,7 +92,7 @@ void generate_sphere_points(const int& n, //the test point + normal Point &p, Vector &normal){ CGAL::Random_points_on_sphere_3 g(r); - CGAL::copy_n( g, n, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n, std::back_inserter(points)); p = Point(0,0, r); normal = Vector(p - CGAL::ORIGIN); } @@ -108,7 +108,7 @@ void generate_cylinder_points(const int& n, Point_2_vector points_2; points_2.reserve(n); CGAL::Random_points_on_circle_2 g(r); - CGAL::copy_n( g, n , std::back_inserter(points_2)); + CGAL::cpp0x::copy_n( g, n , std::back_inserter(points_2)); CGAL::Random random; double h; diff --git a/Interpolation/examples/Interpolation/interpolation_2.cpp b/Interpolation/examples/Interpolation/interpolation_2.cpp index a345174897d..c67aeeeb1f9 100644 --- a/Interpolation/examples/Interpolation/interpolation_2.cpp +++ b/Interpolation/examples/Interpolation/interpolation_2.cpp @@ -49,7 +49,7 @@ int main() // Create n+m-4 points within a disc of radius 2 double r_d = 3; CGAL::Random_points_in_disc_2 g(r_d ); - CGAL::copy_n( g, n+m, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n+m, std::back_inserter(points)); Delaunay_triangulation T; diff --git a/Interpolation/examples/Interpolation/surface_neighbor_coordinates_3.cpp b/Interpolation/examples/Interpolation/surface_neighbor_coordinates_3.cpp index 84f4291551a..333c68708fb 100644 --- a/Interpolation/examples/Interpolation/surface_neighbor_coordinates_3.cpp +++ b/Interpolation/examples/Interpolation/surface_neighbor_coordinates_3.cpp @@ -25,7 +25,7 @@ int main() std::cout << "Generate " << n << " random points on a sphere." << std::endl; CGAL::Random_points_on_sphere_3 g(1); - CGAL::copy_n( g, n, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n, std::back_inserter(points)); Point_3 p(1, 0,0); Vector_3 normal(p-CGAL::ORIGIN); diff --git a/Interpolation/test/Interpolation/include/CGAL/_test_interpolation_functions_2.cpp b/Interpolation/test/Interpolation/include/CGAL/_test_interpolation_functions_2.cpp index 5a76f8885ab..1832dfe634e 100644 --- a/Interpolation/test/Interpolation/include/CGAL/_test_interpolation_functions_2.cpp +++ b/Interpolation/test/Interpolation/include/CGAL/_test_interpolation_functions_2.cpp @@ -218,7 +218,7 @@ _test_interpolation_functions_2_delaunay( const Triangul &, // Create n+m-4 points within a disc of radius 2 CGAL::Random_points_in_square_2 g(r); - CGAL::copy_n( g, n+m, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n+m, std::back_inserter(points)); CGAL::Random random; diff --git a/Interpolation/test/Interpolation/include/CGAL/_test_regular_neighbors_2.cpp b/Interpolation/test/Interpolation/include/CGAL/_test_regular_neighbors_2.cpp index 9a2e9e63ed3..00612e909c5 100644 --- a/Interpolation/test/Interpolation/include/CGAL/_test_regular_neighbors_2.cpp +++ b/Interpolation/test/Interpolation/include/CGAL/_test_regular_neighbors_2.cpp @@ -87,7 +87,7 @@ _test_regular_neighbors_2( const Triangul & ) // Create n+m-4 points within a disc of radius 2 CGAL::Random_points_in_square_2 g(r); - CGAL::copy_n( g, n+m, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n+m, std::back_inserter(points)); CGAL::Random random; diff --git a/Interpolation/test/Interpolation/include/CGAL/_test_surface_neighbors_3.cpp b/Interpolation/test/Interpolation/include/CGAL/_test_surface_neighbors_3.cpp index cc54335e23b..19c39f06ab7 100644 --- a/Interpolation/test/Interpolation/include/CGAL/_test_surface_neighbors_3.cpp +++ b/Interpolation/test/Interpolation/include/CGAL/_test_surface_neighbors_3.cpp @@ -316,7 +316,7 @@ _test_surface_neighbors_3_sphere( const Triangul & ) // Create n+m-4 points on a sphere of radius 2 CGAL::Random_points_on_sphere_3 g(r); - CGAL::copy_n( g, n+m, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n+m, std::back_inserter(points)); for(int i=0; i()); else{ CGAL::Random_points_in_square_2 g(r); - CGAL::copy_n( g, n, std::back_inserter(points_2_data)); + CGAL::cpp0x::copy_n( g, n, std::back_inserter(points_2_data)); } for(int i=0; i < n; i++){ T.insert(transform(Point(points_2_data[i].x(),points_2_data[i].y(), -r))); @@ -376,7 +376,7 @@ _test_surface_neighbors_3_cube(const Triangul &, const Transformation& std::vector points_2_test; points_2_test.reserve(m); CGAL::Random_points_in_square_2 g2(r-1.0); - CGAL::copy_n( g2, m, std::back_inserter(points_2_test)); + CGAL::cpp0x::copy_n( g2, m, std::back_inserter(points_2_test)); int k=0; for(int i=0;i(3) = @begin std::vector points_@1; points_@1.reserve( 100); - CGAL::copy_n( CGAL::Random_points_on_@3_@2( 0x100000), + CGAL::cpp0x::copy_n( CGAL::Random_points_on_@3_@2( 0x100000), 100, std::back_inserter( points_@1)); @end diff --git a/Nef_2/noweb/Segment_overlay.lw b/Nef_2/noweb/Segment_overlay.lw index f69a4d48c68..0c7bb65609d 100644 --- a/Nef_2/noweb/Segment_overlay.lw +++ b/Nef_2/noweb/Segment_overlay.lw @@ -2243,7 +2243,7 @@ int main(int argc, char** argv) for (int i = 0; i < 100; ++i,++sit) L.push_back(*sit); - // CGAL::copy_n(sit,100, std::back_inserter(L)); + // CGAL::cpp0x::copy_n(sit,100, std::back_inserter(L)); std::ofstream of("input.log"); for (lit = L.begin(); lit!= L.end(); ++lit) diff --git a/Point_set_2/test/Point_set_2/range_search.cpp b/Point_set_2/test/Point_set_2/range_search.cpp index c84ad86a302..ea50a69e862 100644 --- a/Point_set_2/test/Point_set_2/range_search.cpp +++ b/Point_set_2/test/Point_set_2/range_search.cpp @@ -42,7 +42,7 @@ int main() std::list points; std::list LV; - CGAL::copy_n(rpg, 1000, std::back_inserter(points)); + CGAL::cpp0x::copy_n(rpg, 1000, std::back_inserter(points)); PSet.insert(points.begin(), points.end()); Point_2 p(10, 10), q(50, 10), r(50, 50), s(10, 50); diff --git a/Point_set_2/test/Point_set_2/range_search_fcn.cpp b/Point_set_2/test/Point_set_2/range_search_fcn.cpp index 902e7e65ed9..df7fffd03d1 100644 --- a/Point_set_2/test/Point_set_2/range_search_fcn.cpp +++ b/Point_set_2/test/Point_set_2/range_search_fcn.cpp @@ -45,7 +45,7 @@ int main() std::list points; std::list LV; - CGAL::copy_n(rpg, 1000, std::back_inserter(points)); + CGAL::cpp0x::copy_n(rpg, 1000, std::back_inserter(points)); PSet.insert(points.begin(), points.end()); Point_2 p(10, 10), q(50, 10), r(50, 50), s(10, 50); diff --git a/QP_solver/include/CGAL/QP_solver/QP_solver_impl.h b/QP_solver/include/CGAL/QP_solver/QP_solver_impl.h index 95d82aa7892..431f6d4584e 100644 --- a/QP_solver/include/CGAL/QP_solver/QP_solver_impl.h +++ b/QP_solver/include/CGAL/QP_solver/QP_solver_impl.h @@ -417,7 +417,7 @@ ratio_test_init__A_Cj( Value_iterator A_Cj_it, int j_, Tag_true) // store exact version of `A_Cj' (implicit conversion) if ( j_ < qp_n) { // original variable - CGAL::copy_n( *(qp_A + j_), qp_m, A_Cj_it); + CGAL::cpp0x::copy_n( *(qp_A + j_), qp_m, A_Cj_it); } else { // artificial variable diff --git a/Robustness/demo/Robustness/robustness.cpp b/Robustness/demo/Robustness/robustness.cpp index 077595a4c8c..fb0cfcef417 100644 --- a/Robustness/demo/Robustness/robustness.cpp +++ b/Robustness/demo/Robustness/robustness.cpp @@ -490,8 +490,8 @@ private slots: hdouble_segments.clear(); hdouble_segments2.clear(); - CGAL::copy_n( g, 100, std::back_inserter( double_segments) ); - CGAL::copy_n( g, 100, std::back_inserter( double_segments2) ); + CGAL::cpp0x::copy_n( g, 100, std::back_inserter( double_segments) ); + CGAL::cpp0x::copy_n( g, 100, std::back_inserter( double_segments2) ); CGAL::Cartesian_converter converter; std::transform( double_segments.begin(), diff --git a/STL_Extension/include/CGAL/algorithm.h b/STL_Extension/include/CGAL/algorithm.h index 40d69a03636..37d030e92f9 100644 --- a/STL_Extension/include/CGAL/algorithm.h +++ b/STL_Extension/include/CGAL/algorithm.h @@ -32,6 +32,14 @@ namespace CGAL { +namespace cpp0x { +#ifndef CGAL_CFG_NO_CPP0X_COPY_N + using std::copy_n; +#else + using CGAL::copy_n; +#endif +} // cpp0x + // copy_n is usually in the STL as well, but not in the official // standard. We provide our own copy_n. It is planned for C++0x. diff --git a/Spatial_searching/demo/Spatial_searching/Qt3/spatial_searching.cpp b/Spatial_searching/demo/Spatial_searching/Qt3/spatial_searching.cpp index d8a65d7fd64..1a8ea5add72 100644 --- a/Spatial_searching/demo/Spatial_searching/Qt3/spatial_searching.cpp +++ b/Spatial_searching/demo/Spatial_searching/Qt3/spatial_searching.cpp @@ -171,7 +171,7 @@ private slots: typedef CGAL::Kd_tree Tree; std::list l, res; - CGAL::copy_n(vector_of_points.begin(), vector_of_points.size(), + CGAL::cpp0x::copy_n(vector_of_points.begin(), vector_of_points.size(), std::back_inserter(l)); std::cout << "construct tree with " << l.size() << " points" << std::endl; Tree d(l.begin(), l.end()); @@ -195,7 +195,7 @@ private slots: typedef CGAL::Kd_tree Tree; std::list l, res; - CGAL::copy_n(vector_of_points.begin(), vector_of_points.size(), + CGAL::cpp0x::copy_n(vector_of_points.begin(), vector_of_points.size(), std::back_inserter(l)); Tree d(l.begin(), l.end()); d.search( std::back_inserter( res ), exact_range); @@ -269,7 +269,7 @@ private slots: typedef CGAL::Kd_tree Tree; std::list l; - CGAL::copy_n(vector_of_points.begin(), vector_of_points.size(), + CGAL::cpp0x::copy_n(vector_of_points.begin(), vector_of_points.size(), std::back_inserter(l)); // Tree d(vector_of_points.begin(), vector_of_points.end(), tr); Neighbour_search::Tree d(l.begin(), l.end()); @@ -277,7 +277,7 @@ private slots: const int query_point_number=30; CGAL::Random_points_in_square_2 h( 1.0); std::vector query_points; - CGAL::copy_n( h, query_point_number, std::back_inserter(query_points)); + CGAL::cpp0x::copy_n( h, query_point_number, std::back_inserter(query_points)); std::vector nearest_neighbour; diff --git a/Spatial_searching/test/Spatial_searching/Building_kd_tree_with_ddim_points.cpp b/Spatial_searching/test/Spatial_searching/Building_kd_tree_with_ddim_points.cpp index 514e7eb1440..c083a1ba565 100644 --- a/Spatial_searching/test/Spatial_searching/Building_kd_tree_with_ddim_points.cpp +++ b/Spatial_searching/test/Spatial_searching/Building_kd_tree_with_ddim_points.cpp @@ -32,7 +32,7 @@ int main() { std::vector points; Point_generator g(3); - CGAL::copy_n( g, N, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, N, std::back_inserter(points)); g++; Point query = *g; diff --git a/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp b/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp index 0eb0c330cf5..fbf6735de2f 100644 --- a/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp +++ b/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp @@ -63,7 +63,7 @@ main() { // in a register with a distance in memory CGAL::Set_ieee_double_precision pfr; - CGAL::copy_n( g, 1000, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, 1000, std::back_inserter(points)); Tree t(points.begin(), points.end()); g++; diff --git a/Spatial_searching/test/Spatial_searching/Splitters.cpp b/Spatial_searching/test/Spatial_searching/Splitters.cpp index 142b47bb247..552e1f4d8f0 100644 --- a/Spatial_searching/test/Spatial_searching/Splitters.cpp +++ b/Spatial_searching/test/Spatial_searching/Splitters.cpp @@ -101,7 +101,7 @@ main() { Vector points; Random_points g( 150.0); - CGAL::copy_n( g, 1000, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, 1000, std::back_inserter(points)); g++; Point query = *g; diff --git a/Triangulation_2/examples/Triangulation_2/hierarchy.cpp b/Triangulation_2/examples/Triangulation_2/hierarchy.cpp index 879fdb2cd73..677a7398240 100644 --- a/Triangulation_2/examples/Triangulation_2/hierarchy.cpp +++ b/Triangulation_2/examples/Triangulation_2/hierarchy.cpp @@ -21,7 +21,7 @@ int main( ) std::cout << "insertion of 1000 random points" << std::endl; Triangulation t; CGAL::Random_points_in_square_2 g(1.); - CGAL::copy_n( g, 1000, std::back_inserter(t)); + CGAL::cpp0x::copy_n( g, 1000, std::back_inserter(t)); //verbose mode of is_valid ; shows the number of vertices at each level std::cout << "The number of vertices at successive levels" << std::endl; diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_hierarchy_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_hierarchy_2.h index 0b1b5a8955e..7772ddfba27 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_hierarchy_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_hierarchy_2.h @@ -40,7 +40,7 @@ _test_cls_delaunay_hierarchy_2( const Dh & ) std::cout << " insertion removal of 1000 points" << std::endl; Delaunay_hierarchy dh; CGAL::Random_points_in_square_2 g(1.); - CGAL::copy_n( g, 1000, std::back_inserter(dh)); + CGAL::cpp0x::copy_n( g, 1000, std::back_inserter(dh)); dh.locate(Point(0.,0.)); diff --git a/Triangulation_3/demo/Triangulation_3/Scene.cpp b/Triangulation_3/demo/Triangulation_3/Scene.cpp index 8dae8c1aa8d..fe49f5d1b70 100644 --- a/Triangulation_3/demo/Triangulation_3/Scene.cpp +++ b/Triangulation_3/demo/Triangulation_3/Scene.cpp @@ -27,7 +27,7 @@ void Scene::generatePoints(int num) /* Insert them into the point list: */ /* 1. use CGAL's copy function --tested */ list pts; - CGAL::copy_n( pts_generator, num, std::back_inserter(pts) ); + CGAL::cpp0x::copy_n( pts_generator, num, std::back_inserter(pts) ); /* 2. use STL's function */ //for (int i=0; im_dt.number_of_vertices() == 0 ) { CGAL::Random_points_in_cube_3 pts_generator(1.0); - CGAL::copy_n( pts_generator, 100, std::back_inserter(m_incrementalPts) ); + CGAL::cpp0x::copy_n( pts_generator, 100, std::back_inserter(m_incrementalPts) ); } else { for(QList::iterator vit = m_pScene->m_vhArray.begin(); vit < m_pScene->m_vhArray.end(); ++vit) { From 7bcaa0b7547cce3b566e99e4e01169775a851fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Thu, 26 May 2011 18:25:29 +0000 Subject: [PATCH 04/64] marked CGAL::copy_n deprecated and added cpp0x::copy_n --- .../doc_tex/STL_Extension_ref/intro.tex | 1 + .../STL_Extension_ref/stl_extension.tex | 45 ++++++++++++------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/STL_Extension/doc_tex/STL_Extension_ref/intro.tex b/STL_Extension/doc_tex/STL_Extension_ref/intro.tex index f28535b4df6..780b8c99a1a 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/intro.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/intro.tex @@ -46,6 +46,7 @@ \subsection*{Generic Algorithms} +\ccRefIdfierPage{CGAL::cpp0x::copy_n}\\ \ccRefIdfierPage{CGAL::copy_n}\\ \ccRefIdfierPage{CGAL::min_max_element}\\ %% Michael: I commented these, as I think they should be replaced by combining diff --git a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex index f3183e2fa79..45a2b2f4f49 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex @@ -50,27 +50,38 @@ \end{ccRefFunction} %% +---------------------------------------------+ -\begin{ccRefFunction}{copy_n} - \label{sectionCopyN} - \ccDefinition The function \ccRefName\ copies $n$ items from an - input iterator to an output iterator which is useful for possibly - infinite - sequences of random geometric objects.\footnote{% - The \stl\ release June 13, 1997, from SGI contains an equivalent - function, but it is not part of the ISO standard.} +\begin{ccRefFunction}{cpp0x::copy_n} + There is actually no class in namespace \ccc{CGAL::cpp0x} with this name, but a using declaration which + imports a function from another namespace. By order of priority: the one in namespace + \ccc{std} is used (provided by C++0x), if not found, then the one in namespace + \ccc{CGAL} is used. +\end{ccRefFunction} + +\begin{ccRefFunction}{copy_n} + This function is deprecated \ccc{cpp0x::copy_n} should be used instead. + \begin{ccDeprecated} + \label{sectionCopyN} + + \ccDefinition The function \ccRefName\ copies $n$ items from an + input iterator to an output iterator which is useful for possibly + infinite + sequences of random geometric objects.\footnote{% + The \stl\ release June 13, 1997, from SGI contains an equivalent + function, but it is not part of the ISO standard.} - \ccInclude{CGAL/algorithm.h} + \ccInclude{CGAL/algorithm.h} - \ccThree{OutputIterator}{copy_n}{} - \ccFunction{template OutputIterator copy_n(InputIterator first, Size n, - OutputIterator result);}{copies the first $n$ items from - \ccc{first} to \ccc{result}. Returns the value of \ccc{result} - after inserting the $n$ items.} + \ccThree{OutputIterator}{copy_n}{} + \ccFunction{template OutputIterator copy_n(InputIterator first, Size n, + OutputIterator result);}{copies the first $n$ items from + \ccc{first} to \ccc{result}. Returns the value of \ccc{result} + after inserting the $n$ items.} - \ccSeeAlso - \ccRefIdfierPage{CGAL::Counting_iterator} + \ccSeeAlso + \ccRefIdfierPage{CGAL::Counting_iterator} + \end{ccDeprecated} \end{ccRefFunction} %% +---------------------------------------------+ From f2f32f007f8c80466004910c3e2eb5b3e59ff1fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Wed, 1 Jun 2011 14:05:51 +0000 Subject: [PATCH 05/64] Added a benchmark for copy_n --- .gitattributes | 2 + .../benchmark/copy_n_benchmark/CMakeLists.txt | 33 +++++ .../copy_n_benchmark/copy_n_benchmark.cpp | 134 ++++++++++++++++++ 3 files changed, 169 insertions(+) create mode 100644 STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt create mode 100644 STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp diff --git a/.gitattributes b/.gitattributes index 8ce7bb57342..bff1a547968 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3177,6 +3177,8 @@ Ridges_3/examples/Ridges_3/data/poly2x^2+y^2-0.062500.off -text svneol=unset#app Ridges_3/examples/Ridges_3/skip_vcproj_auto_generation -text Ridges_3/test/Ridges_3/data/ellipsoid.off -text svneol=unset#application/octet-stream Robustness/demo/Robustness/help/index.html svneol=native#text/html +STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt -text +STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp -text STL_Extension/doc_tex/STL_Extension/plusplus.png -text STL_Extension/test/STL_Extension/test_Uncertain.cpp -text STL_Extension/test/STL_Extension/test_type_traits.cpp -text diff --git a/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt b/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt new file mode 100644 index 00000000000..55b0bca2cde --- /dev/null +++ b/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt @@ -0,0 +1,33 @@ +# Created by the script cgal_create_cmake_script +# This is the CMake script for compiling a CGAL application. + + +project( copy_n_benchmark_example ) + +cmake_minimum_required(VERSION 2.6.2) +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6) + if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3) + cmake_policy(VERSION 2.8.4) + else() + cmake_policy(VERSION 2.6) + endif() +endif() + +find_package(CGAL QUIET COMPONENTS Core ) + +if ( CGAL_FOUND ) + + include( ${CGAL_USE_FILE} ) + + include( CGAL_CreateSingleSourceCGALProgram ) + + include_directories (BEFORE ../../include) + + create_single_source_cgal_program( "copy_n_benchmark.cpp" ) + +else() + + message(STATUS "This program requires the CGAL library, and will not be compiled.") + +endif() + diff --git a/STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp b/STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp new file mode 100644 index 00000000000..bba79c1278a --- /dev/null +++ b/STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +namespace CGAL { + template + OutputIterator copy_n( InputIterator first, + Size n, + OutputIterator result) + { + // copies the first `n' items from `first' to `result'. Returns + // the value of `result' after inserting the `n' items. + while( n--) { + *result = *first; + first++; + result++; + } + return result; + } +} + +//class with non-trivial copy ctor +class non_trivial_cctor +{ +public: + non_trivial_cctor() { data = new char[n]; std::fill_n(data, n, 0); } + non_trivial_cctor(const non_trivial_cctor& x) { data = new char[n]; std::copy(x.data, x.data + n, this->data); } + ~non_trivial_cctor() { delete[] data; } +private: + const static int n; + char* data; +}; + +const int non_trivial_cctor::n = 64; + +int format_output(const char* lib, const char* container, const char* to, int n, float time) { + return std::printf("| %s || %s || %s || %d || %.4fM items/sec\n", lib, container, to, n, time); +} + +struct std_tag {}; +struct cgal_tag {}; + +template +inline double test(ForwardIterator it, Size n, OutputIterator result, int repeats, std_tag) { + boost::timer timer; + timer.restart(); + for (int i = 0; i < repeats; ++i) { std::copy_n(it, n, result); } + return (double)n*repeats/timer.elapsed()/1.0E6; +} + +template +inline double test(ForwardIterator it, Size n, OutputIterator result, int repeats, cgal_tag) { + boost::timer timer; + timer.restart(); + for (int i = 0; i < repeats; ++i) { CGAL::copy_n(it, n, result); } + return (double)n*repeats/timer.elapsed()/1.0E6; +} + +int main(int argc, char* argv[]) { + int n = 20000000; + int repeats = 20; + + if(argc > 1) + n = boost::lexical_cast(argv[1]); + + if(argc > 2) + repeats = boost::lexical_cast(argv[2]); + + typedef std::vector vector; + typedef std::list list; + typedef std::vector vector2; + + vector v(n); + + typedef int* copy_mem; + typedef non_trivial_cctor* copy_mem2; + + copy_mem copy_m = new int[n]; + + //wiki markup header + std::cout << + "{| \n" + "! Library !! From Container !! To !! #Elements !! items/sec \n" + "|- \n"; + float item_sec; + + item_sec = test(v.begin(), n, copy_m, repeats, std_tag()); + format_output("stdlib", "vector", "int*", n, item_sec); + std::cout << "|- \n"; + + item_sec = test(v.begin(), n, copy_m, repeats, cgal_tag()); + format_output("CGAL", "vector", "int*", n, item_sec); + std::cout << "|- \n"; + + //purge + v.clear(); + std::fill_n(copy_m, n, 0); + + list l(n); + + item_sec = test(l.begin(), n, copy_m, repeats, std_tag()); + format_output("stdlib", "list", "int*", n, item_sec); + std::cout << "|- \n"; + + item_sec = test(l.begin(), n, copy_m, repeats, cgal_tag()); + format_output("CGAL", "list", "int*", n, item_sec); + std::cout << "|- \n"; + + delete[] copy_m; + + vector2 v2(n); + copy_mem2 copy_m2 = new non_trivial_cctor[n]; + + item_sec = test(v2.begin(), n, copy_m2, repeats, std_tag()); + format_output("stdlib", "vector", "non_trivial_cctor*", n, item_sec); + std::cout << "|- \n"; + + item_sec = test(v2.begin(), n, copy_m2, repeats, cgal_tag()); + format_output("CGAL", "vector", "non_trivial_cctor*", n, item_sec); + + //wiki markup footer + std::cout << "|}" << std::endl; + + + + return EXIT_SUCCESS; +} From 75e1ec4dc0b0c77de4c51f95a315a764d6d70d9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Mon, 6 Jun 2011 09:52:34 +0000 Subject: [PATCH 06/64] Added a benchmark for an actual use case. Adapted CMake to generate both benchmarks. --- .gitattributes | 1 + .../benchmark/copy_n_benchmark/CMakeLists.txt | 3 + .../copy_n_use_case_benchmark.cpp | 62 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp diff --git a/.gitattributes b/.gitattributes index bff1a547968..ec005a473ff 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3179,6 +3179,7 @@ Ridges_3/test/Ridges_3/data/ellipsoid.off -text svneol=unset#application/octet-s Robustness/demo/Robustness/help/index.html svneol=native#text/html STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt -text STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp -text +STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp -text STL_Extension/doc_tex/STL_Extension/plusplus.png -text STL_Extension/test/STL_Extension/test_Uncertain.cpp -text STL_Extension/test/STL_Extension/test_type_traits.cpp -text diff --git a/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt b/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt index 55b0bca2cde..08be2c066e6 100644 --- a/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt +++ b/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt @@ -25,6 +25,9 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "copy_n_benchmark.cpp" ) + create_single_source_cgal_program( "copy_n_use_case_benchmark.cpp" ) + + else() message(STATUS "This program requires the CGAL library, and will not be compiled.") diff --git a/STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp b/STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp new file mode 100644 index 00000000000..c4c41a714ac --- /dev/null +++ b/STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +int format_output(const char* lib, const char* generator, int n, float time) { + return std::printf("| %s || %s || %d || %.4fM items/sec\n", lib, generator, n, time); +} + +typedef CGAL::Simple_cartesian R; +typedef R::Point_2 Point; +typedef CGAL::Creator_uniform_2 Creator; +typedef std::vector Vector; + +int main(int argc, char* argv[]) { + int n = 10000000; + int repeats = 10; + + if(argc > 1) + n = boost::lexical_cast(argv[1]); + + if(argc > 2) + repeats = boost::lexical_cast(argv[2]); + + Vector points(n, Point()); + + CGAL::Random_points_in_disc_2 g( 1000.0); + boost::timer timer; + const char* generator = "Random_points_in_disc_2"; + float time; + + std::cout << + "{| \n" + "! Library !! Generator !! #Elements !! items/sec \n" + "|- \n"; + + timer.restart(); + for (int i = 0; i < repeats; ++i) { CGAL::copy_n( g, n, points.begin()); } + time = (double)n*repeats/timer.elapsed()/1.0E6; + format_output("CGAL", generator , n, time); + std::cout << "|- \n"; + +#ifndef CGAL_CFG_NO_CPP0X_COPY_N + timer.restart(); + for (int i = 0; i < repeats; ++i) { CGAL::copy_n( g, n, points.begin()); } + time = (double)n*repeats/timer.elapsed()/1.0E6; + format_output("stdlib", generator, n, time); +#else + #error "Benchmark not possible without C++0x-copy_n Support" +#endif + + //wiki markup footer + std::cout << "|}" << std::endl; +} From 386acdfb570ad76845bb41b1a129b7fc05759975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Mon, 6 Jun 2011 12:04:39 +0000 Subject: [PATCH 07/64] using CGAL::copy_n -> using CGAL::cpp0x::copy_n --- Generator/include/CGAL/random_convex_set_2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Generator/include/CGAL/random_convex_set_2.h b/Generator/include/CGAL/random_convex_set_2.h index 6240b2c1a2f..b15a2a03ea7 100644 --- a/Generator/include/CGAL/random_convex_set_2.h +++ b/Generator/include/CGAL/random_convex_set_2.h @@ -52,7 +52,7 @@ random_convex_set_2( std::size_t n, using std::partial_sum; using std::less; using std::max_element; - using CGAL::copy_n; + using CGAL::cpp0x::copy_n; typedef typename Traits::Point_2 Point_2; typedef typename Traits::FT FT; From 2472d31f0503b73936316d4208248fc091ebee02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Mon, 6 Jun 2011 12:05:54 +0000 Subject: [PATCH 08/64] Updated documentation --- Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex | 2 +- Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex | 2 +- Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex | 2 +- Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex | 2 +- Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex | 2 +- Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex | 2 +- Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex | 2 +- Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex | 2 +- Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex | 2 +- Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex | 2 +- Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex | 2 +- Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex b/Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex index 33a11fe8b40..b748b855fa2 100644 --- a/Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex +++ b/Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex @@ -54,7 +54,7 @@ spaced \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::points_on_segment} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex b/Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex index c1b988ac8ec..b4f248ce594 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex @@ -36,7 +36,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_sphere_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex b/Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex index c29ee8eb3dd..65bbc9e4079 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex @@ -38,7 +38,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_in_square_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_sphere_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex b/Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex index 99c55b88dd4..64eaaea4ca7 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex @@ -38,7 +38,7 @@ For every point $ p = \ccc{*g}$ and for all $ i} \\ \ccRefIdfierPage{CGAL::Random_points_in_cube_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex b/Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex index ee6edec4554..83760fa78be 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex @@ -39,7 +39,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_square_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex b/Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex index 779115bd2f0..00cdeb1ec45 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex @@ -38,7 +38,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_cube_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex b/Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex index da018dc9616..581f783e85c 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex @@ -38,7 +38,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex b/Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex index 9f11d1943a2..d953efe62dc 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex @@ -42,7 +42,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex b/Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex index b054fb762f7..32a14fc8e9f 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex @@ -42,7 +42,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex b/Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex index d4782106696..27c6b710f88 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex @@ -41,7 +41,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_on_circle_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_cube_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex b/Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex index 6e8cfc25465..7ad93a0bb26 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex @@ -41,7 +41,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_on_circle_2} \\ \ccRefIdfierPage{CGAL::Random_points_on_sphere_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex b/Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex index cf0a9fc3762..83725e65ea6 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex @@ -40,7 +40,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ From 00882a21bc8b6928cffa1ff2bbb63cd796c23dd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Mon, 6 Jun 2011 15:19:01 +0000 Subject: [PATCH 09/64] Changed deprecation for CGAL::copy_n to only trigger when there is an alternative. --- STL_Extension/include/CGAL/algorithm.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/STL_Extension/include/CGAL/algorithm.h b/STL_Extension/include/CGAL/algorithm.h index 37d030e92f9..0f2511fd7ec 100644 --- a/STL_Extension/include/CGAL/algorithm.h +++ b/STL_Extension/include/CGAL/algorithm.h @@ -32,6 +32,19 @@ namespace CGAL { +// copy_n is usually in the STL as well, but not in the official +// standard. We provide our own copy_n. It is planned for C++0x. +// Our own version will be marked deprecated if C++0x is +// available. +#ifndef CGAL_NO_DEPRECATED_CODE +#ifndef CGAL_CFG_NO_CPP0X_COPY_N + +template +CGAL_DEPRECATED OutputIterator copy_n( InputIterator, Size, OutputIterator); + +#endif //CGAL_CFG_NOCPP0X_COPY_N +#endif //CGAL_NO_DEPRECATED_CODE + namespace cpp0x { #ifndef CGAL_CFG_NO_CPP0X_COPY_N using std::copy_n; @@ -40,8 +53,8 @@ namespace cpp0x { #endif } // cpp0x -// copy_n is usually in the STL as well, but not in the official -// standard. We provide our own copy_n. It is planned for C++0x. +#ifndef CGAL_NO_DEPRECATED_CODE +#ifndef CGAL_CFG_NO_CPP0X_COPY_N template OutputIterator copy_n( InputIterator first, @@ -58,6 +71,8 @@ OutputIterator copy_n( InputIterator first, return result; } +#endif //CGAL_CFG_NOCPP0X_COPY_N +#endif //CGAL_NO_DEPRECATED_CODE // Not documented template inline From 171ad62f8c82a10b85556d1abfacafa0c1158703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Mon, 6 Jun 2011 15:20:10 +0000 Subject: [PATCH 10/64] Changed benchmarks to properly function without C++0x. --- .../copy_n_benchmark/copy_n_benchmark.cpp | 26 +++++++------------ .../copy_n_use_case_benchmark.cpp | 7 ++--- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp b/STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp index bba79c1278a..0b6acaec7a7 100644 --- a/STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp +++ b/STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp @@ -9,22 +9,8 @@ #include #include -namespace CGAL { - template - OutputIterator copy_n( InputIterator first, - Size n, - OutputIterator result) - { - // copies the first `n' items from `first' to `result'. Returns - // the value of `result' after inserting the `n' items. - while( n--) { - *result = *first; - first++; - result++; - } - return result; - } -} +#include +#include //class with non-trivial copy ctor class non_trivial_cctor @@ -47,6 +33,7 @@ int format_output(const char* lib, const char* container, const char* to, int n, struct std_tag {}; struct cgal_tag {}; +#ifndef CGAL_CFG_NO_CPP0X_COPY_N template inline double test(ForwardIterator it, Size n, OutputIterator result, int repeats, std_tag) { boost::timer timer; @@ -54,6 +41,7 @@ inline double test(ForwardIterator it, Size n, OutputIterator result, int repeat for (int i = 0; i < repeats; ++i) { std::copy_n(it, n, result); } return (double)n*repeats/timer.elapsed()/1.0E6; } +#endif template inline double test(ForwardIterator it, Size n, OutputIterator result, int repeats, cgal_tag) { @@ -91,9 +79,11 @@ int main(int argc, char* argv[]) { "|- \n"; float item_sec; +#ifndef CGAL_CFG_NO_CPP0X_COPY_N item_sec = test(v.begin(), n, copy_m, repeats, std_tag()); format_output("stdlib", "vector", "int*", n, item_sec); std::cout << "|- \n"; +#endif item_sec = test(v.begin(), n, copy_m, repeats, cgal_tag()); format_output("CGAL", "vector", "int*", n, item_sec); @@ -105,9 +95,11 @@ int main(int argc, char* argv[]) { list l(n); +#ifndef CGAL_CFG_NO_CPP0X_COPY_N item_sec = test(l.begin(), n, copy_m, repeats, std_tag()); format_output("stdlib", "list", "int*", n, item_sec); std::cout << "|- \n"; +#endif item_sec = test(l.begin(), n, copy_m, repeats, cgal_tag()); format_output("CGAL", "list", "int*", n, item_sec); @@ -118,9 +110,11 @@ int main(int argc, char* argv[]) { vector2 v2(n); copy_mem2 copy_m2 = new non_trivial_cctor[n]; +#ifndef CGAL_CFG_NO_CPP0X_COPY_N item_sec = test(v2.begin(), n, copy_m2, repeats, std_tag()); format_output("stdlib", "vector", "non_trivial_cctor*", n, item_sec); std::cout << "|- \n"; +#endif item_sec = test(v2.begin(), n, copy_m2, repeats, cgal_tag()); format_output("CGAL", "vector", "non_trivial_cctor*", n, item_sec); diff --git a/STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp b/STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp index c4c41a714ac..7c6a298ee2a 100644 --- a/STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp +++ b/STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp @@ -10,6 +10,9 @@ #include #include +#include + + int format_output(const char* lib, const char* generator, int n, float time) { return std::printf("| %s || %s || %d || %.4fM items/sec\n", lib, generator, n, time); @@ -50,11 +53,9 @@ int main(int argc, char* argv[]) { #ifndef CGAL_CFG_NO_CPP0X_COPY_N timer.restart(); - for (int i = 0; i < repeats; ++i) { CGAL::copy_n( g, n, points.begin()); } + for (int i = 0; i < repeats; ++i) { std::copy_n( g, n, points.begin()); } time = (double)n*repeats/timer.elapsed()/1.0E6; format_output("stdlib", generator, n, time); -#else - #error "Benchmark not possible without C++0x-copy_n Support" #endif //wiki markup footer From 93c9475bbcf806dd8d90c21060d36a2e1c80cb5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 6 Jun 2011 15:49:40 +0000 Subject: [PATCH 11/64] missing comma and namespace CGAL to avoid confusion --- STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex index 45a2b2f4f49..211af707a98 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex @@ -59,7 +59,7 @@ \end{ccRefFunction} \begin{ccRefFunction}{copy_n} - This function is deprecated \ccc{cpp0x::copy_n} should be used instead. + This function is deprecated, \ccc{CGAL::cpp0x::copy_n} should be used instead. \begin{ccDeprecated} \label{sectionCopyN} From 8eb07481ba725bd89007a3c40015e33e8c853ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Tue, 7 Jun 2011 09:03:54 +0000 Subject: [PATCH 12/64] Added ccInclude. --- STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex index 211af707a98..b8a3cdafa2b 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex @@ -56,6 +56,8 @@ imports a function from another namespace. By order of priority: the one in namespace \ccc{std} is used (provided by C++0x), if not found, then the one in namespace \ccc{CGAL} is used. + + \ccInclude{CGAL/algorithm.h} \end{ccRefFunction} \begin{ccRefFunction}{copy_n} From ef85dcaebb2463fead009f7e4801e67950e88fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Fri, 10 Jun 2011 13:26:42 +0000 Subject: [PATCH 13/64] Added a test for copy_n and fixed a bug where you would only end up with a linker error instead of a "no such definition" error when CGAL_NO_DEPRECATED_CODE was used --- STL_Extension/include/CGAL/algorithm.h | 54 ++++++++++--------- .../test/STL_Extension/test_stl_extension.cpp | 11 ++++ 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/STL_Extension/include/CGAL/algorithm.h b/STL_Extension/include/CGAL/algorithm.h index 0f2511fd7ec..d7d9d3f2e88 100644 --- a/STL_Extension/include/CGAL/algorithm.h +++ b/STL_Extension/include/CGAL/algorithm.h @@ -27,6 +27,7 @@ #define CGAL_ALGORITHM_H #include +#include #include #include @@ -34,32 +35,13 @@ namespace CGAL { // copy_n is usually in the STL as well, but not in the official // standard. We provide our own copy_n. It is planned for C++0x. -// Our own version will be marked deprecated if C++0x is -// available. +// Our own version is declared deprecated, if std::copy_n is +// available. If std::copy_n is available + +#ifndef CGAL_CFG_NO_CPP0X_COPY_N #ifndef CGAL_NO_DEPRECATED_CODE -#ifndef CGAL_CFG_NO_CPP0X_COPY_N - template -CGAL_DEPRECATED OutputIterator copy_n( InputIterator, Size, OutputIterator); - -#endif //CGAL_CFG_NOCPP0X_COPY_N -#endif //CGAL_NO_DEPRECATED_CODE - -namespace cpp0x { -#ifndef CGAL_CFG_NO_CPP0X_COPY_N - using std::copy_n; -#else - using CGAL::copy_n; -#endif -} // cpp0x - -#ifndef CGAL_NO_DEPRECATED_CODE -#ifndef CGAL_CFG_NO_CPP0X_COPY_N - -template -OutputIterator copy_n( InputIterator first, - Size n, - OutputIterator result) +CGAL_DEPRECATED OutputIterator copy_n( InputIterator first, Size n, OutputIterator result ) { // copies the first `n' items from `first' to `result'. Returns // the value of `result' after inserting the `n' items. @@ -70,9 +52,29 @@ OutputIterator copy_n( InputIterator first, } return result; } +#endif // CGAL_NO_DEPRECATED_CODE +#else +template +OutputIterator copy_n( InputIterator first, Size n, OutputIterator result ) +{ + // copies the first `n' items from `first' to `result'. Returns + // the value of `result' after inserting the `n' items. + while( n--) { + *result = *first; + first++; + result++; + } + return result; +} +#endif // CGAL_CFG_NO_CPP0X_COPY_N -#endif //CGAL_CFG_NOCPP0X_COPY_N -#endif //CGAL_NO_DEPRECATED_CODE +namespace cpp0x { +#ifndef CGAL_CFG_NO_CPP0X_COPY_N + using std::copy_n; +#else + using CGAL::copy_n; +#endif +} // cpp0x // Not documented template inline diff --git a/STL_Extension/test/STL_Extension/test_stl_extension.cpp b/STL_Extension/test/STL_Extension/test_stl_extension.cpp index e4fd55710f4..1e635007171 100644 --- a/STL_Extension/test/STL_Extension/test_stl_extension.cpp +++ b/STL_Extension/test/STL_Extension/test_stl_extension.cpp @@ -9016,6 +9016,16 @@ void test_predecessor_successor() CGAL_assertion(successor(successor(V.begin())) == predecessor(V.end())); } +void test_copy_n() { + std::vector V; + for(int i = 0; i < 10; ++i) + V.push_back(i); + + std::vector V2(5); + cpp0x::copy_n(V.begin(), 5, V2.begin()); + + CGAL_assertion(std::equal(V2.begin(), V2.end(), V.begin())); +} int main() { init_global_data(); @@ -9038,6 +9048,7 @@ int main() { test_predecessor_successor(); clean_global_data(); test_tuple(); + test_copy_n(); return 0; } // EOF // From cf4814da583d7366ec9db4f4cf08fe29d186d458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Thu, 16 Jun 2011 11:09:59 +0000 Subject: [PATCH 14/64] Doc now explains copy_n and gives the standard paragraph, fixed typo in code documentation --- STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex | 6 +++++- STL_Extension/include/CGAL/algorithm.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex index b8a3cdafa2b..4f92c6fe2b9 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex @@ -53,10 +53,14 @@ \begin{ccRefFunction}{cpp0x::copy_n} There is actually no class in namespace \ccc{CGAL::cpp0x} with this name, but a using declaration which - imports a function from another namespace. By order of priority: the one in namespace + imports a function from another namespace. By order of priority: the one in namespace \ccc{std} is used (provided by C++0x), if not found, then the one in namespace \ccc{CGAL} is used. + \ccDefinition The function \ccRefName\ copies $n$ items from an + input iterator to an output iterator. Its exact behaviour is + defined in $\mathsection 25.3.1$ of the C++0x standard. + \ccInclude{CGAL/algorithm.h} \end{ccRefFunction} diff --git a/STL_Extension/include/CGAL/algorithm.h b/STL_Extension/include/CGAL/algorithm.h index d7d9d3f2e88..220f7a1aa60 100644 --- a/STL_Extension/include/CGAL/algorithm.h +++ b/STL_Extension/include/CGAL/algorithm.h @@ -36,7 +36,7 @@ namespace CGAL { // copy_n is usually in the STL as well, but not in the official // standard. We provide our own copy_n. It is planned for C++0x. // Our own version is declared deprecated, if std::copy_n is -// available. If std::copy_n is available +// available. #ifndef CGAL_CFG_NO_CPP0X_COPY_N #ifndef CGAL_NO_DEPRECATED_CODE From b587dcdf7bce64c0dbb9d17bb4fc4d5c38a7703b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Thu, 16 Jun 2011 11:34:06 +0000 Subject: [PATCH 15/64] Added mathsection to the available symbols in documentation. --- Manual_tools/src/latex_converter_config/html/latex.sty | 1 + 1 file changed, 1 insertion(+) diff --git a/Manual_tools/src/latex_converter_config/html/latex.sty b/Manual_tools/src/latex_converter_config/html/latex.sty index 7993bc2de23..3a9d76673d1 100644 --- a/Manual_tools/src/latex_converter_config/html/latex.sty +++ b/Manual_tools/src/latex_converter_config/html/latex.sty @@ -1452,6 +1452,7 @@ \newcommand{\vdots}{\lcRawHtml{ }} \newcommand{\ddots}{\lcRawHtml{ }} \newcommand{\varnothing}{\lcRawHtml{ }} +\newcommand{\mathsection}{\lcRawHtml{ § }} \newcommand{\left}{} \newcommand{\right}{} From fd67bbec24c3f3ebe4932ede091b918bdb96e2f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Thu, 16 Jun 2011 11:37:22 +0000 Subject: [PATCH 16/64] Reverted 64153 as it is already in next --- Manual_tools/src/latex_converter_config/html/latex.sty | 1 - 1 file changed, 1 deletion(-) diff --git a/Manual_tools/src/latex_converter_config/html/latex.sty b/Manual_tools/src/latex_converter_config/html/latex.sty index 3a9d76673d1..7993bc2de23 100644 --- a/Manual_tools/src/latex_converter_config/html/latex.sty +++ b/Manual_tools/src/latex_converter_config/html/latex.sty @@ -1452,7 +1452,6 @@ \newcommand{\vdots}{\lcRawHtml{ }} \newcommand{\ddots}{\lcRawHtml{ }} \newcommand{\varnothing}{\lcRawHtml{ }} -\newcommand{\mathsection}{\lcRawHtml{ § }} \newcommand{\left}{} \newcommand{\right}{} From 3e98f1c856bd176f7b6bb18b5073b8496132db82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Thu, 23 Jun 2011 14:06:57 +0000 Subject: [PATCH 17/64] Removed reference to CGAL --- .../doc_tex/STL_Extension_ref/stl_extension.tex | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex index 0efe8f5a206..81bdd1f3d3a 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex @@ -52,10 +52,11 @@ %% +---------------------------------------------+ \begin{ccRefFunction}{cpp0x::copy_n} - There is actually no class in namespace \ccc{CGAL::cpp0x} with this name, but a using declaration which - imports a function from another namespace. By order of priority: the one in namespace - \ccc{std} is used (provided by C++0x), if not found, then the one in namespace - \ccc{CGAL} is used. + There is actually no class in namespace \ccc{CGAL::cpp0x} with this + name, but a using declaration which imports a function from another + namespace. By order of priority: the one in namespace \ccc{std} is + used (provided by C++0x), if not found, a replacement + implementation is used. \ccDefinition The function \ccRefName\ copies $n$ items from an input iterator to an output iterator. Its exact behaviour is From bfcfc89b01b4ac8c9de3831eca0c08c4bf186307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Thu, 23 Jun 2011 14:43:02 +0000 Subject: [PATCH 18/64] Small change to avoid confusion about empty namespace/replacement function --- .../doc_tex/STL_Extension_ref/stl_extension.tex | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex index 81bdd1f3d3a..0b0801b6819 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex @@ -52,11 +52,10 @@ %% +---------------------------------------------+ \begin{ccRefFunction}{cpp0x::copy_n} - There is actually no class in namespace \ccc{CGAL::cpp0x} with this - name, but a using declaration which imports a function from another - namespace. By order of priority: the one in namespace \ccc{std} is - used (provided by C++0x), if not found, a replacement - implementation is used. + This provides an implementation of the standard function + \ccc{copy_n} from the C++0x standard. If \ccc{copy_n} is available + in the \ccc{std::} namespace a using declaration is used, otherwise + an alternative implementation from \cgal\ is used. \ccDefinition The function \ccRefName\ copies $n$ items from an input iterator to an output iterator. Its exact behaviour is From 836a1b19f9a492bbfd7151f07a9a136dadf3e6fb Mon Sep 17 00:00:00 2001 From: Sandhyaa Radhakrishnan Date: Thu, 11 Aug 2011 20:16:47 +0000 Subject: [PATCH 20/64] Minkowski sum using BSO --- .../include/CGAL/minkowski_sum_2.h | 32 +++++++++++++++---- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h b/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h index c510c4f5b81..26ae28e7cde 100644 --- a/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h +++ b/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h @@ -21,6 +21,11 @@ #include #include + +#include +#include +#include + #include #include #include @@ -74,15 +79,28 @@ minkowski_sum_2 (const Polygon_2& pgn1, const Polygon_2& pgn2, const DecompositionStrategy&) { - Minkowski_sum_by_decomposition_2 mink_sum; - Polygon_2 sum_bound; - std::list > sum_holes; + Minkowski_sum_by_decomposition_2 mink_sum; + std::list > sub_sum_polygons; - mink_sum (pgn1, pgn2, sum_bound, std::back_inserter(sum_holes)); + typedef typename Kernel::Point_2 Point_2; + typedef CGAL::Arr_segment_traits_2 Arr_segment_traits; + typedef CGAL::Gps_segment_traits_2 Traits_2; + typedef CGAL::General_polygon_set_2 General_polygon_set_2; + typedef Polygon_with_holes_2 Polygon_with_holes_2; + typedef std::list Polygon_with_holes_list; + - return (Polygon_with_holes_2 (sum_bound, - sum_holes.begin(), - sum_holes.end())); + mink_sum (pgn1, pgn2, std::back_inserter(sub_sum_polygons)); + + General_polygon_set_2 gps; + + gps.join(sub_sum_polygons.begin(),sub_sum_polygons.end()); + + Polygon_with_holes_list sum; + + gps.polygons_with_holes(std::back_inserter(sum)); + + return (*(sum.begin())); } } //namespace CGAL From b17c94322b5944181c55a2750ff3a3a67e03977b Mon Sep 17 00:00:00 2001 From: Sandhyaa Radhakrishnan Date: Thu, 11 Aug 2011 20:17:28 +0000 Subject: [PATCH 21/64] Minkowski sum using BSO --- .../Minkowski_sum_2/Minkowski_sum_decomp_2.h | 86 +++++-------------- 1 file changed, 22 insertions(+), 64 deletions(-) diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h index 72b5c4ba836..24c88c0fe87 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h @@ -20,9 +20,6 @@ #define CGAL_MINKOWSKI_SUM_DECOMP_2_H #include -#include -#include -#include namespace CGAL { @@ -46,7 +43,7 @@ private: typedef typename Kernel::Point_2 Point_2; typedef typename Kernel::Vector_2 Vector_2; typedef typename Kernel::Direction_2 Direction_2; - + // Kernel functors: typedef typename Kernel::Equal_2 Equal_2; typedef typename Kernel::Compare_angle_with_x_axis_2 Compare_angle_2; @@ -63,16 +60,6 @@ private: typedef std::list Polygons_list; typedef typename Polygons_list::iterator Polygons_iterator; - // Traits-related types: - typedef Arr_segment_traits_2 Segment_traits_2; - typedef Arr_labeled_traits_2 Traits_2; - - typedef typename Segment_traits_2::X_monotone_curve_2 Segment_2; - typedef typename Traits_2::X_monotone_curve_2 Labeled_segment_2; - typedef std::list Segments_list; - - typedef Union_of_segment_cycles_2 Union_2; - // Data members: Equal_2 f_equal; Compare_angle_2 f_compare_angle; @@ -107,18 +94,17 @@ public: * Compute the Minkowski sum of two simple polygons. * \param pgn1 The first polygon. * \param pgn2 The second polygon. - * \param sum_bound Output: A polygon respresenting the outer boundary - * of the Minkowski sum. - * \param sum_holes Output: An output iterator for the holes in the sum, - * represented as simple polygons. + * \param sub_sum_polygons Output: An output iterator for the sub-sums of all + * pairs of sub-polygons in the sum, + * represented as simple polygons. * \pre Both input polygons are simple. - * \return A past-the-end iterator for the holes in the sum. + * \return A past-the-end iterator for the sub-sums of all pairs of + * sub-polygons in the sum. */ template OutputIterator operator() (const Polygon_2& pgn1, const Polygon_2& pgn2, - Polygon_2& sum_bound, - OutputIterator sum_holes) const + OutputIterator sub_sum_polygons) const { CGAL_precondition (pgn1.is_simple()); CGAL_precondition (pgn2.is_simple()); @@ -134,55 +120,41 @@ public: // Compute the sub-sums of all pairs of sub-polygons. Polygons_iterator end1 = sub_pgns1.end(); Polygons_iterator end2 = sub_pgns2.end(); - unsigned int sum_index = 0; Polygons_iterator curr1, curr2; - Segments_list boundary_segments; for (curr1 = sub_pgns1.begin(); curr1 != end1; ++curr1) { for (curr2 = sub_pgns2.begin(); curr2 != end2; ++curr2) { // Compute the sum of the current pair of convex sub-polygons. - sum_index++; - _compute_sum_of_convex (sum_index, - *curr1, - *curr2, - std::back_inserter (boundary_segments)); + Polygon_2 sub_sum; + _compute_sum_of_convex (*curr1, *curr2, sub_sum); + + *sub_sum_polygons = sub_sum; + sub_sum_polygons++; + } } - - // Compute the union of the polygons that represent the Minkowski sums - // of all sub-polygon pairs. - Union_2 unite; - - sum_holes = unite (boundary_segments.begin(), boundary_segments.end(), - sum_bound, sum_holes); - - return (sum_holes); + + return (sub_sum_polygons); } private: /*! * Compute the Minkowski sum of two convex polygons. - * \param sum_index The index of the sub-sum. * \param pgn1 The first convex polygon. * \param pgn2 The second convex polygon. - * \param soi Output: An output iterator for the labeled segments along - * the counterclockwise-oriented Minkowski sum. - * \return A past-the-end iterator for the output segments. + * \param sub_sum Output: Polygon which is the sub sum of the two convex polygons */ - template - SegmentsOutputIter _compute_sum_of_convex (unsigned int sum_index, - const Polygon_2& pgn1, - const Polygon_2& pgn2, - SegmentsOutputIter soi) const + void _compute_sum_of_convex (const Polygon_2& pgn1, + const Polygon_2& pgn2, + Polygon_2& sub_sum) const { // Find the bottom-left vertex in both polygons. Vertex_circulator first1, curr1, next1; Vertex_circulator bottom_left1; Comparison_result res; - bottom_left1 = curr1 = first1 = pgn1.vertices_circulator(); ++curr1; while (curr1 != first1) @@ -220,7 +192,6 @@ private: ++next2; // Compute the Minkowski sum. - unsigned int seg_index = 0; Point_2 first_pt; Point_2 curr_pt; Point_2 prev_pt; @@ -240,19 +211,15 @@ private: // This is the first point we have computed. first_pt = prev_pt = curr_pt; is_first = false; + sub_sum.push_back(first_pt); } else { // Add a segment from the previously summed point to the current one. res = f_compare_xy (prev_pt, curr_pt); CGAL_assertion (res != EQUAL); - *soi = Labeled_segment_2 (Segment_2 (prev_pt, curr_pt), - X_curve_label ((res == SMALLER), - sum_index, - seg_index, false)); - ++soi; - seg_index++; prev_pt = curr_pt; + sub_sum.push_back(curr_pt); } // Compare the angles the current edges form with the x-axis. @@ -291,16 +258,7 @@ private: } while (curr1 != bottom_left1 || curr2 != bottom_left2); - // Add the final segment to close the outer boundary. - res = f_compare_xy (prev_pt, first_pt); - CGAL_assertion (res != EQUAL); - *soi = Labeled_segment_2 (Segment_2 (prev_pt, first_pt), - X_curve_label ((res == SMALLER), - sum_index, - seg_index, true)); - ++soi; - - return (soi); + return; } }; From 38a9418904b71a7e0b537e2517e7dc2407c9c576 Mon Sep 17 00:00:00 2001 From: Sandhyaa Radhakrishnan Date: Thu, 11 Aug 2011 20:18:19 +0000 Subject: [PATCH 22/64] Minkowski sum using BSO benchmark --- .gitattributes | 8 + Minkowski_sum_2/benchmark/data/chain.dat | 114 ++++++++++++++ Minkowski_sum_2/benchmark/data/comb.dat | 77 +++++++++ Minkowski_sum_2/benchmark/data/fork.dat | 67 ++++++++ Minkowski_sum_2/benchmark/data/knife.dat | 78 +++++++++ Minkowski_sum_2/benchmark/data/random.dat | 62 ++++++++ Minkowski_sum_2/benchmark/data/random2.dat | 148 ++++++++++++++++++ Minkowski_sum_2/benchmark/data/star.dat | 82 ++++++++++ .../benchmark/sum_by_decomposition.cpp | 70 +++++++++ 9 files changed, 706 insertions(+) create mode 100644 Minkowski_sum_2/benchmark/data/chain.dat create mode 100644 Minkowski_sum_2/benchmark/data/comb.dat create mode 100644 Minkowski_sum_2/benchmark/data/fork.dat create mode 100644 Minkowski_sum_2/benchmark/data/knife.dat create mode 100644 Minkowski_sum_2/benchmark/data/random.dat create mode 100644 Minkowski_sum_2/benchmark/data/random2.dat create mode 100644 Minkowski_sum_2/benchmark/data/star.dat create mode 100644 Minkowski_sum_2/benchmark/sum_by_decomposition.cpp diff --git a/.gitattributes b/.gitattributes index 8934bf9f7fa..52516f3c531 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2577,6 +2577,14 @@ Min_sphere_of_spheres_d/test_extensive/stability/maple/balls-on-boundary-3.mws - Min_sphere_of_spheres_d/web/figs/heuristic/excess.xfig -text svneol=unset#application/octet-stream Min_sphere_of_spheres_d/web/figs/mbex/mbex.xfig -text svneol=unset#application/octet-stream Min_sphere_of_spheres_d/web/figs/pivot/cex.xfig -text svneol=unset#application/octet-stream +Minkowski_sum_2/benchmark/data/chain.dat -text +Minkowski_sum_2/benchmark/data/comb.dat -text +Minkowski_sum_2/benchmark/data/fork.dat -text +Minkowski_sum_2/benchmark/data/knife.dat -text +Minkowski_sum_2/benchmark/data/random.dat -text +Minkowski_sum_2/benchmark/data/random2.dat -text +Minkowski_sum_2/benchmark/data/star.dat -text +Minkowski_sum_2/benchmark/sum_by_decomposition.cpp -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/Minkowski_sum_2.png -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/approx_offset.fig -text svneol=unset#application/octet-stream Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/approx_offset.gif -text svneol=unset#image/gif diff --git a/Minkowski_sum_2/benchmark/data/chain.dat b/Minkowski_sum_2/benchmark/data/chain.dat new file mode 100644 index 00000000000..bbd30b4b01f --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/chain.dat @@ -0,0 +1,114 @@ +82 +1150840/1 3269680/1 +2009089/1 622385/1 +3563659/1 -1685869/1 +5694160/1 -3476329/1 +8235589/1 -4610310/1 +10991099/1 -5000000/1 +13747300/1 -4615210/1 +16290799/1 -3485749/1 +18424400/1 -1699079/1 +19983099/1 606407/1 +21100000/1 1000000/1 +22000000/1 -1000000/1 +23100000/1 1000000/1 +24000000/1 -1000000/1 +25100000/1 1000000/1 +26000000/1 -1000000/1 +27100000/1 1000000/1 +28000000/1 -1000000/1 +29100000/1 1000000/1 +30000000/1 -1000000/1 +31100000/1 1000000/1 +32000000/1 -1000000/1 +33100000/1 1000000/1 +34000000/1 -1000000/1 +35100000/1 1000000/1 +36000000/1 -1000000/1 +37100000/1 1000000/1 +38000000/1 -1000000/1 +39100000/1 1000000/1 +40000000/1 -1000000/1 +42014300/1 4388269/1 +43571599/1 6694679/1 +45704200/1 8482609/1 +48246999/1 9613579/1 +51003000/1 10000000/1 +53758699/1 9611950/1 +56300799/1 8479470/1 +58432399/1 6690280/1 +59988299/1 4382939/1 +60848100/1 1736160/1 +61150799/1 3269680/1 +62009099/1 622385/1 +63563699/1 -1685869/1 +65694200/1 -3476329/1 +68235600/1 -4610310/1 +70991099/1 -5000000/1 +73747299/1 -4615210/1 +76290799/1 -3485749/1 +78424399/1 -1699079/1 +79983100/1 606407/1 +81100000/1 1000000/1 +82000000/1 -1000000/1 +83100000/1 1000000/1 +84000000/1 -1000000/1 +85100000/1 1000000/1 +86000000/1 -1000000/1 +87100000/1 1000000/1 +88000000/1 -1000000/1 +89100000/1 1000000/1 +90000000/1 -1000000/1 +91100000/1 1000000/1 +92000000/1 -1000000/1 +93100000/1 1000000/1 +94000000/1 -1000000/1 +95100000/1 1000000/1 +96000000/1 -1000000/1 +97100000/1 1000000/1 +98000000/1 -1000000/1 +99100000/1 1000000/1 +100000000/1 -1000000/1 +102013999/1 4388269/1 +103572000/1 6694679/1 +105703999/1 8482609/1 +108247000/1 9613579/1 +111002999/1 10000000/1 +113758999/1 9611950/1 +116301000/1 8479470/1 +118432000/1 6690280/1 +119987999/1 4382939/1 +120847999/1 1736160/1 +121100000/1 -30000000/1 +0/1 -30000000/1 +30 +3000000/1 5000000/1 +2934470/1 5623619/1 +2740729/1 6219990/1 +2427259/1 6763070/1 +1606200/1 6783289/1 +1500509/1 7597780/1 +927727/1 7852949/1 +314410/1 7983479/1 +-312641/1 7983659/1 +-740828/1 7282799/1 +-1498969/1 7598669/1 +-2006419/1 7230309/1 +-2426210/1 6764510/1 +-2740009/1 6221620/1 +-2347280/1 5500289/1 +-3000000/1 5001779/1 +-2934839/1 4378120/1 +-2741460/1 3781630/1 +-2428300/1 3238369/1 +-1607249/1 3217660/1 +-1502050/1 2403110/1 +-929418/1 2147599/1 +-316178/1 2016709/1 +310873/1 2016150/1 +739475/1 2716759/1 +1497429/1 2400440/1 +2005099/1 2768500/1 +2425169/1 3234060/1 +2739279/1 3776759/1 +2346980/1 4498319/1 diff --git a/Minkowski_sum_2/benchmark/data/comb.dat b/Minkowski_sum_2/benchmark/data/comb.dat new file mode 100644 index 00000000000..fd7a9cde92d --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/comb.dat @@ -0,0 +1,77 @@ +53 +1250/1 100/1 +1250/1 50/1 +0/1 50/1 +0/1 100/1 +25/1 250/1 +50/1 100/1 +75/1 250/1 +100/1 100/1 +125/1 250/1 +150/1 100/1 +175/1 250/1 +200/1 100/1 +225/1 250/1 +250/1 100/1 +275/1 250/1 +300/1 100/1 +325/1 250/1 +350/1 100/1 +375/1 250/1 +400/1 100/1 +425/1 250/1 +450/1 100/1 +475/1 250/1 +500/1 100/1 +525/1 250/1 +550/1 100/1 +575/1 250/1 +600/1 100/1 +625/1 250/1 +650/1 100/1 +675/1 250/1 +700/1 100/1 +725/1 250/1 +750/1 100/1 +775/1 250/1 +800/1 100/1 +825/1 250/1 +850/1 100/1 +875/1 250/1 +900/1 100/1 +925/1 250/1 +950/1 100/1 +975/1 250/1 +1000/1 100/1 +1025/1 250/1 +1050/1 100/1 +1075/1 250/1 +1100/1 100/1 +1125/1 250/1 +1150/1 100/1 +1175/1 250/1 +1200/1 100/1 +1225/1 250/1 +22 +20/1 0/1 +-20/1 0/1 +-19/1 7/1 +-17/1 9/1 +-15/1 11/1 +-13/1 13/1 +-11/1 15/1 +-9/1 17/1 +-7/1 19/1 +-5/1 21/1 +-3/1 23/1 +-1/1 25/1 +1/1 27/1 +3/1 29/1 +5/1 31/1 +7/1 33/1 +9/1 35/1 +11/1 37/1 +13/1 39/1 +15/1 41/1 +17/1 43/1 +19/1 45/1 diff --git a/Minkowski_sum_2/benchmark/data/fork.dat b/Minkowski_sum_2/benchmark/data/fork.dat new file mode 100644 index 00000000000..243ed16b268 --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/fork.dat @@ -0,0 +1,67 @@ +34 +-500/1 -500/1 +-500/1 100/1 +0/1 102/1 +-500/1 104/1 +-500/1 200/1 +0/1 202/1 +-500/1 204/1 +-500/1 300/1 +0/1 302/1 +-500/1 304/1 +-500/1 400/1 +0/1 402/1 +-500/1 404/1 +-500/1 500/1 +0/1 502/1 +-500/1 504/1 +-510/1 500/1 +-510/1 -510/1 +500/1 -510/1 +504/1 -500/1 +502/1 0/1 +500/1 -500/1 +404/1 -500/1 +402/1 0/1 +400/1 -500/1 +304/1 -500/1 +302/1 0/1 +300/1 -500/1 +204/1 -500/1 +202/1 0/1 +200/1 -500/1 +104/1 -500/1 +102/1 0/1 +100/1 -500/1 +31 +0/1 0/1 +0/1 100/1 +2/1 600/1 +4/1 100/1 +20/1 100/1 +22/1 600/1 +24/1 100/1 +40/1 100/1 +42/1 600/1 +44/1 100/1 +60/1 100/1 +62/1 600/1 +64/1 100/1 +80/1 100/1 +82/1 600/1 +84/1 100/1 +100/1 80/1 +600/1 78/1 +100/1 76/1 +100/1 60/1 +600/1 58/1 +100/1 56/1 +100/1 40/1 +600/1 38/1 +100/1 36/1 +100/1 20/1 +600/1 18/1 +100/1 16/1 +100/1 0/1 +600/1 -2/1 +100/1 -4/1 diff --git a/Minkowski_sum_2/benchmark/data/knife.dat b/Minkowski_sum_2/benchmark/data/knife.dat new file mode 100644 index 00000000000..36fb830be37 --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/knife.dat @@ -0,0 +1,78 @@ +64 +100/1 -10/1 +100/1 500/1 +500/1 498/1 +110/1 495/1 +110/1 450/1 +500/1 448/1 +110/1 445/1 +110/1 400/1 +500/1 398/1 +110/1 395/1 +110/1 350/1 +500/1 348/1 +110/1 345/1 +110/1 300/1 +500/1 298/1 +110/1 295/1 +110/1 250/1 +500/1 248/1 +110/1 245/1 +110/1 200/1 +500/1 198/1 +110/1 195/1 +110/1 150/1 +500/1 148/1 +110/1 145/1 +110/1 100/1 +500/1 98/1 +110/1 95/1 +110/1 50/1 +500/1 48/1 +110/1 45/1 +110/1 0/1 +600/1 0/1 +602/1 500/1 +605/1 0/1 +610/1 0/1 +612/1 500/1 +615/1 0/1 +620/1 0/1 +622/1 500/1 +625/1 0/1 +630/1 0/1 +632/1 500/1 +635/1 0/1 +640/1 0/1 +642/1 500/1 +645/1 0/1 +650/1 0/1 +652/1 500/1 +655/1 0/1 +660/1 0/1 +662/1 500/1 +665/1 0/1 +670/1 0/1 +672/1 500/1 +675/1 0/1 +680/1 0/1 +682/1 500/1 +685/1 0/1 +690/1 0/1 +692/1 500/1 +695/1 0/1 +700/1 0/1 +700/1 -10/1 +12 +0/1 0/1 +10/1 2/1 +0/1 5/1 +10/1 7/1 +0/1 10/1 +10/1 12/1 +0/1 15/1 +10/1 17/1 +0/1 20/1 +10/1 22/1 +0/1 25/1 +420/1 12/1 diff --git a/Minkowski_sum_2/benchmark/data/random.dat b/Minkowski_sum_2/benchmark/data/random.dat new file mode 100644 index 00000000000..4b5ddd0cc2e --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/random.dat @@ -0,0 +1,62 @@ +40 +579/1 768/1 +307/1 750/1 +700/1 726/1 +420/1 604/1 +448/1 640/1 +218/1 753/1 +213/1 657/1 +366/1 615/1 +370/1 450/1 +516/1 410/1 +565/1 554/1 +730/1 547/1 +829/1 669/1 +879/1 542/1 +707/1 287/1 +754/1 502/1 +710/1 521/1 +536/1 362/1 +419/1 299/1 +376/1 326/1 +319/1 399/1 +259/1 536/1 +352/1 446/1 +348/1 504/1 +233/1 608/1 +350/1 113/1 +201/1 520/1 +313/1 108/1 +465/1 71/1 +740/1 2/1 +347/1 290/1 +504/1 227/1 +704/1 131/1 +962/1 42/1 +966/1 418/1 +976/1 481/1 +922/1 609/1 +940/1 435/1 +883/1 389/1 +950/1 790/1 +20 +-67/1 -56/1 +-43/1 15/1 +6/1 -79/1 +82/1 47/1 +9/1 -40/1 +-9/1 -14/1 +24/1 78/1 +-45/1 45/1 +-71/1 -21/1 +-76/1 -1/1 +-72/1 58/1 +18/1 96/1 +84/1 56/1 +92/1 -54/1 +95/1 -89/1 +85/1 -5/1 +58/1 -44/1 +-2/1 -88/1 +-31/1 -74/1 +-78/1 -85/1 diff --git a/Minkowski_sum_2/benchmark/data/random2.dat b/Minkowski_sum_2/benchmark/data/random2.dat new file mode 100644 index 00000000000..0c4de884e82 --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/random2.dat @@ -0,0 +1,148 @@ +64 +100/1 -10/1 +100/1 500/1 +500/1 498/1 +110/1 495/1 +110/1 450/1 +500/1 448/1 +110/1 445/1 +110/1 400/1 +500/1 398/1 +110/1 395/1 +110/1 350/1 +500/1 348/1 +110/1 345/1 +110/1 300/1 +500/1 298/1 +110/1 295/1 +110/1 250/1 +500/1 248/1 +110/1 245/1 +110/1 200/1 +500/1 198/1 +110/1 195/1 +110/1 150/1 +500/1 148/1 +110/1 145/1 +110/1 100/1 +500/1 98/1 +110/1 95/1 +110/1 50/1 +500/1 48/1 +110/1 45/1 +110/1 0/1 +600/1 0/1 +602/1 500/1 +605/1 0/1 +610/1 0/1 +612/1 500/1 +615/1 0/1 +620/1 0/1 +622/1 500/1 +625/1 0/1 +630/1 0/1 +632/1 500/1 +635/1 0/1 +640/1 0/1 +642/1 500/1 +645/1 0/1 +650/1 0/1 +652/1 500/1 +655/1 0/1 +660/1 0/1 +662/1 500/1 +665/1 0/1 +670/1 0/1 +672/1 500/1 +675/1 0/1 +680/1 0/1 +682/1 500/1 +685/1 0/1 +690/1 0/1 +692/1 500/1 +695/1 0/1 +700/1 0/1 +700/1 -10/1 +82 +1150840/1 3269680/1 +2009089/1 622385/1 +3563659/1 -1685869/1 +5694160/1 -3476329/1 +8235589/1 -4610310/1 +10991099/1 -5000000/1 +13747300/1 -4615210/1 +16290799/1 -3485749/1 +18424400/1 -1699079/1 +19983099/1 606407/1 +21100000/1 1000000/1 +22000000/1 -1000000/1 +23100000/1 1000000/1 +24000000/1 -1000000/1 +25100000/1 1000000/1 +26000000/1 -1000000/1 +27100000/1 1000000/1 +28000000/1 -1000000/1 +29100000/1 1000000/1 +30000000/1 -1000000/1 +31100000/1 1000000/1 +32000000/1 -1000000/1 +33100000/1 1000000/1 +34000000/1 -1000000/1 +35100000/1 1000000/1 +36000000/1 -1000000/1 +37100000/1 1000000/1 +38000000/1 -1000000/1 +39100000/1 1000000/1 +40000000/1 -1000000/1 +42014300/1 4388269/1 +43571599/1 6694679/1 +45704200/1 8482609/1 +48246999/1 9613579/1 +51003000/1 10000000/1 +53758699/1 9611950/1 +56300799/1 8479470/1 +58432399/1 6690280/1 +59988299/1 4382939/1 +60848100/1 1736160/1 +61150799/1 3269680/1 +62009099/1 622385/1 +63563699/1 -1685869/1 +65694200/1 -3476329/1 +68235600/1 -4610310/1 +70991099/1 -5000000/1 +73747299/1 -4615210/1 +76290799/1 -3485749/1 +78424399/1 -1699079/1 +79983100/1 606407/1 +81100000/1 1000000/1 +82000000/1 -1000000/1 +83100000/1 1000000/1 +84000000/1 -1000000/1 +85100000/1 1000000/1 +86000000/1 -1000000/1 +87100000/1 1000000/1 +88000000/1 -1000000/1 +89100000/1 1000000/1 +90000000/1 -1000000/1 +91100000/1 1000000/1 +92000000/1 -1000000/1 +93100000/1 1000000/1 +94000000/1 -1000000/1 +95100000/1 1000000/1 +96000000/1 -1000000/1 +97100000/1 1000000/1 +98000000/1 -1000000/1 +99100000/1 1000000/1 +100000000/1 -1000000/1 +102013999/1 4388269/1 +103572000/1 6694679/1 +105703999/1 8482609/1 +108247000/1 9613579/1 +111002999/1 10000000/1 +113758999/1 9611950/1 +116301000/1 8479470/1 +118432000/1 6690280/1 +119987999/1 4382939/1 +120847999/1 1736160/1 +121100000/1 -30000000/1 +0/1 -30000000/1 diff --git a/Minkowski_sum_2/benchmark/data/star.dat b/Minkowski_sum_2/benchmark/data/star.dat new file mode 100644 index 00000000000..8ef429efb99 --- /dev/null +++ b/Minkowski_sum_2/benchmark/data/star.dat @@ -0,0 +1,82 @@ +40 +90000000/1 0/1 +99384600/1 7820260/1 +97553700/1 15447999/1 +85641899/1 18156499/1 +90454300/1 29384500/1 +85360599/1 35350099/1 +73517200/1 32356499/1 +72708799/1 44545600/1 +65462099/1 47549200/1 +56267899/1 39505900/1 +50014800/1 50000000/1 +42194400/1 49387000/1 +37652800/1 38046699/1 +27317599/1 44559100/1 +20627500/1 40462999/1 +21728299/1 28296800/1 +9563089/1 29408400/1 +5461110/1 22721999/1 +11964300/1 12381000/1 +619995/1 7849530/1 +8/1 29632/1 +10488599/1 -6232789/1 +2437109/1 -15419800/1 +5434210/1 -22669200/1 +17622599/1 -23488399/1 +14618500/1 -35329099/1 +20579599/1 -40428199/1 +31811900/1 -35625700/1 +34509699/1 -47539999/1 +42135800/1 -49377699/1 +49964400/1 -40000000/1 +57776400/1 -49391599/1 +65405799/1 -47567500/1 +68124800/1 -35657999/1 +79348500/1 -40480399/1 +85318700/1 -35392000/1 +82335599/1 -23545900/1 +94525400/1 -22748400/1 +97535400/1 -15504400/1 +89500300/1 -6303029/1 +40 +40000000/1 50000000/1 +49384600/1 57820299/1 +47553699/1 65448000/1 +35641899/1 68156500/1 +40454300/1 79384500/1 +35360599/1 85350099/1 +23517199/1 82356500/1 +22708799/1 94545600/1 +15462100/1 97549199/1 +6267909/1 89505899/1 +14816/1 100000000/1 +-7805629/1 99387000/1 +-12347199/1 88046699/1 +-22682400/1 94559100/1 +-29372500/1 90462999/1 +-28271699/1 78296799/1 +-40436900/1 79408399/1 +-44538900/1 72722000/1 +-38035700/1 62380999/1 +-49380000/1 57849500/1 +-50000000/1 50029599/1 +-39511399/1 43767200/1 +-47562900/1 34580200/1 +-44565800/1 27330799/1 +-32377400/1 26511599/1 +-35381499/1 14670900/1 +-29420400/1 9571810/1 +-18188100/1 14374299/1 +-15490299/1 2460010/1 +-7864159/1 622323/1 +-35559/1 10000000/1 +7776349/1 608419/1 +15405799/1 2432539/1 +18124799/1 14341999/1 +29348500/1 9519559/1 +35318700/1 14608000/1 +32335599/1 26454099/1 +44525400/1 27251600/1 +47535399/1 34495600/1 +39500299/1 43697000/1 diff --git a/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp b/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp new file mode 100644 index 00000000000..feda0bb46ac --- /dev/null +++ b/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp @@ -0,0 +1,70 @@ +//! \file examples/Minkowski_sum_2/sum_by_decomposition.cpp +// Computing the Minkowski sum of two non-convex polygons read from a file +// using the small-side angle-bisector decomposition strategy. + +#include +#include +#include +#include +#include + +#include + +#if !defined(CGAL_MINKOWSKI_SUM_2_SERIAL) && defined(_OPENMP) +#include +#endif + +#include "print_utils.h" + +struct Kernel : public CGAL::Exact_predicates_exact_constructions_kernel {}; + +typedef Kernel::Point_2 Point_2; +typedef CGAL::Polygon_2 Polygon_2; +typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; + +int main () +{ + // Open the input file. + std::ifstream in_file ("random2.dat"); + + if (! in_file.is_open()) + { + std::cerr << "Failed to open the input file." << std::endl; + return (1); + } + + // Read the two polygons from the file and compute their Minkowski sum. + Polygon_2 P, Q; + + in_file >> P >> Q; + in_file.close(); + + // Compute the Minkowski sum using the decomposition approach. + CGAL::Small_side_angle_bisector_decomposition_2 ssab_decomp; + + time_t s,e; + s = time(NULL); + + #if !defined(CGAL_MINKOWSKI_SUM_2_SERIAL) && defined(_OPENMP) + double start,end; + start = omp_get_wtime(); + #endif + + Polygon_with_holes_2 sum = minkowski_sum_2 (P, Q, ssab_decomp); + + #if !defined(CGAL_MINKOWSKI_SUM_2_SERIAL) && defined(_OPENMP) + end = omp_get_wtime(); + #endif + + e = time(NULL); + + #if !defined(CGAL_MINKOWSKI_SUM_2_SERIAL) && defined(_OPENMP) + std::cout << "Done! time using omp_get_wtime() (" << end-start << " seconds)." << std::endl; + #endif + + std::cout << "Done! time using time() (" << difftime(e,s) << " seconds)." << std::endl; + + std::cout << "P (+) Q = "; print_polygon_with_holes (sum); + + return (0); +} From 407f15ce76daf67ea6978ed51493c0205af9166c Mon Sep 17 00:00:00 2001 From: Ophir Setter Date: Fri, 12 Aug 2011 06:45:27 +0000 Subject: [PATCH 23/64] moving benchmark inside a Minkowski_sum_2 folder --- .gitattributes | 16 ++++++++-------- .../{ => Minkowski_sum_2}/data/chain.dat | 0 .../{ => Minkowski_sum_2}/data/comb.dat | 0 .../{ => Minkowski_sum_2}/data/fork.dat | 0 .../{ => Minkowski_sum_2}/data/knife.dat | 0 .../{ => Minkowski_sum_2}/data/random.dat | 0 .../{ => Minkowski_sum_2}/data/random2.dat | 0 .../{ => Minkowski_sum_2}/data/star.dat | 0 .../sum_by_decomposition.cpp | 0 9 files changed, 8 insertions(+), 8 deletions(-) rename Minkowski_sum_2/benchmark/{ => Minkowski_sum_2}/data/chain.dat (100%) rename Minkowski_sum_2/benchmark/{ => Minkowski_sum_2}/data/comb.dat (100%) rename Minkowski_sum_2/benchmark/{ => Minkowski_sum_2}/data/fork.dat (100%) rename Minkowski_sum_2/benchmark/{ => Minkowski_sum_2}/data/knife.dat (100%) rename Minkowski_sum_2/benchmark/{ => Minkowski_sum_2}/data/random.dat (100%) rename Minkowski_sum_2/benchmark/{ => Minkowski_sum_2}/data/random2.dat (100%) rename Minkowski_sum_2/benchmark/{ => Minkowski_sum_2}/data/star.dat (100%) rename Minkowski_sum_2/benchmark/{ => Minkowski_sum_2}/sum_by_decomposition.cpp (100%) diff --git a/.gitattributes b/.gitattributes index 52516f3c531..2011a6df713 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2577,14 +2577,14 @@ Min_sphere_of_spheres_d/test_extensive/stability/maple/balls-on-boundary-3.mws - Min_sphere_of_spheres_d/web/figs/heuristic/excess.xfig -text svneol=unset#application/octet-stream Min_sphere_of_spheres_d/web/figs/mbex/mbex.xfig -text svneol=unset#application/octet-stream Min_sphere_of_spheres_d/web/figs/pivot/cex.xfig -text svneol=unset#application/octet-stream -Minkowski_sum_2/benchmark/data/chain.dat -text -Minkowski_sum_2/benchmark/data/comb.dat -text -Minkowski_sum_2/benchmark/data/fork.dat -text -Minkowski_sum_2/benchmark/data/knife.dat -text -Minkowski_sum_2/benchmark/data/random.dat -text -Minkowski_sum_2/benchmark/data/random2.dat -text -Minkowski_sum_2/benchmark/data/star.dat -text -Minkowski_sum_2/benchmark/sum_by_decomposition.cpp -text +Minkowski_sum_2/benchmark/Minkowski_sum_2/data/chain.dat -text +Minkowski_sum_2/benchmark/Minkowski_sum_2/data/comb.dat -text +Minkowski_sum_2/benchmark/Minkowski_sum_2/data/fork.dat -text +Minkowski_sum_2/benchmark/Minkowski_sum_2/data/knife.dat -text +Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random.dat -text +Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random2.dat -text +Minkowski_sum_2/benchmark/Minkowski_sum_2/data/star.dat -text +Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/Minkowski_sum_2.png -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/approx_offset.fig -text svneol=unset#application/octet-stream Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/approx_offset.gif -text svneol=unset#image/gif diff --git a/Minkowski_sum_2/benchmark/data/chain.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/chain.dat similarity index 100% rename from Minkowski_sum_2/benchmark/data/chain.dat rename to Minkowski_sum_2/benchmark/Minkowski_sum_2/data/chain.dat diff --git a/Minkowski_sum_2/benchmark/data/comb.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/comb.dat similarity index 100% rename from Minkowski_sum_2/benchmark/data/comb.dat rename to Minkowski_sum_2/benchmark/Minkowski_sum_2/data/comb.dat diff --git a/Minkowski_sum_2/benchmark/data/fork.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/fork.dat similarity index 100% rename from Minkowski_sum_2/benchmark/data/fork.dat rename to Minkowski_sum_2/benchmark/Minkowski_sum_2/data/fork.dat diff --git a/Minkowski_sum_2/benchmark/data/knife.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/knife.dat similarity index 100% rename from Minkowski_sum_2/benchmark/data/knife.dat rename to Minkowski_sum_2/benchmark/Minkowski_sum_2/data/knife.dat diff --git a/Minkowski_sum_2/benchmark/data/random.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random.dat similarity index 100% rename from Minkowski_sum_2/benchmark/data/random.dat rename to Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random.dat diff --git a/Minkowski_sum_2/benchmark/data/random2.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random2.dat similarity index 100% rename from Minkowski_sum_2/benchmark/data/random2.dat rename to Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random2.dat diff --git a/Minkowski_sum_2/benchmark/data/star.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/star.dat similarity index 100% rename from Minkowski_sum_2/benchmark/data/star.dat rename to Minkowski_sum_2/benchmark/Minkowski_sum_2/data/star.dat diff --git a/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp similarity index 100% rename from Minkowski_sum_2/benchmark/sum_by_decomposition.cpp rename to Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp From 1f9e77c31154ed81561cccab296bf9f6dfa1b01b Mon Sep 17 00:00:00 2001 From: Sandhyaa Radhakrishnan Date: Fri, 12 Aug 2011 10:19:56 +0000 Subject: [PATCH 24/64] BSO union moved inside Minkowski_sum_decomp_2.h --- .../include/CGAL/minkowski_sum_2.h | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h b/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h index 26ae28e7cde..a39e0984e09 100644 --- a/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h +++ b/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h @@ -22,10 +22,6 @@ #include #include -#include -#include -#include - #include #include #include @@ -79,28 +75,15 @@ minkowski_sum_2 (const Polygon_2& pgn1, const Polygon_2& pgn2, const DecompositionStrategy&) { - Minkowski_sum_by_decomposition_2 mink_sum; - std::list > sub_sum_polygons; + Minkowski_sum_by_decomposition_2 mink_sum; - typedef typename Kernel::Point_2 Point_2; - typedef CGAL::Arr_segment_traits_2 Arr_segment_traits; - typedef CGAL::Gps_segment_traits_2 Traits_2; - typedef CGAL::General_polygon_set_2 General_polygon_set_2; typedef Polygon_with_holes_2 Polygon_with_holes_2; - typedef std::list Polygon_with_holes_list; + Polygon_with_holes_2 sum; - mink_sum (pgn1, pgn2, std::back_inserter(sub_sum_polygons)); + sum = mink_sum (pgn1, pgn2); - General_polygon_set_2 gps; - - gps.join(sub_sum_polygons.begin(),sub_sum_polygons.end()); - - Polygon_with_holes_list sum; - - gps.polygons_with_holes(std::back_inserter(sum)); - - return (*(sum.begin())); + return (sum); } } //namespace CGAL From 32fb5ecc07fb425713e61ebf69d08f11f0c52ac8 Mon Sep 17 00:00:00 2001 From: Sandhyaa Radhakrishnan Date: Fri, 12 Aug 2011 10:20:25 +0000 Subject: [PATCH 25/64] BSO union moved inside Minkowski_sum_decomp_2.h --- .../Minkowski_sum_2/Minkowski_sum_decomp_2.h | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h index 24c88c0fe87..4e77016addd 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h @@ -20,6 +20,12 @@ #define CGAL_MINKOWSKI_SUM_DECOMP_2_H #include +#include + +#include +#include +#include +#include namespace CGAL { @@ -28,12 +34,13 @@ namespace CGAL { * their decomposition two convex sub-polygons, taking the pairwise sums and * computing the union of the sub-sums. */ -template +template class Minkowski_sum_by_decomposition_2 { public: typedef DecompStrategy_ Decomposition_strategy; + typedef Container_ Container; typedef typename Decomposition_strategy::Polygon_2 Polygon_2; private: @@ -60,6 +67,12 @@ private: typedef std::list Polygons_list; typedef typename Polygons_list::iterator Polygons_iterator; + typedef CGAL::Arr_segment_traits_2 Arr_segment_traits; + typedef CGAL::Gps_segment_traits_2 Traits_2; + typedef CGAL::General_polygon_set_2 General_polygon_set_2; + typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; + typedef std::list Polygon_with_holes_list; + // Data members: Equal_2 f_equal; Compare_angle_2 f_compare_angle; @@ -94,17 +107,12 @@ public: * Compute the Minkowski sum of two simple polygons. * \param pgn1 The first polygon. * \param pgn2 The second polygon. - * \param sub_sum_polygons Output: An output iterator for the sub-sums of all - * pairs of sub-polygons in the sum, - * represented as simple polygons. * \pre Both input polygons are simple. - * \return A past-the-end iterator for the sub-sums of all pairs of - * sub-polygons in the sum. + * \return The resulting polygon with holes, representing the sum. */ - template - OutputIterator operator() (const Polygon_2& pgn1, - const Polygon_2& pgn2, - OutputIterator sub_sum_polygons) const + Polygon_with_holes_2 + operator() (const Polygon_2& pgn1, + const Polygon_2& pgn2) const { CGAL_precondition (pgn1.is_simple()); CGAL_precondition (pgn2.is_simple()); @@ -113,6 +121,7 @@ public: Decomposition_strategy decomp_strat; Polygons_list sub_pgns1; Polygons_list sub_pgns2; + Polygons_list sub_sum_polygons; decomp_strat (pgn1, std::back_inserter(sub_pgns1)); decomp_strat (pgn2, std::back_inserter(sub_pgns2)); @@ -130,13 +139,20 @@ public: Polygon_2 sub_sum; _compute_sum_of_convex (*curr1, *curr2, sub_sum); - *sub_sum_polygons = sub_sum; - sub_sum_polygons++; + sub_sum_polygons.push_back(sub_sum); } } + + General_polygon_set_2 gps; + + gps.join(sub_sum_polygons.begin(),sub_sum_polygons.end()); + + Polygon_with_holes_list sum; + + gps.polygons_with_holes(std::back_inserter(sum)); - return (sub_sum_polygons); + return (*(sum.begin())); } private: From 0bd5a1fe1bd119f08320389ecc0d684c53239548 Mon Sep 17 00:00:00 2001 From: Sandhyaa Radhakrishnan Date: Sat, 13 Aug 2011 03:08:36 +0000 Subject: [PATCH 26/64] Benchmark program for Minkowski sum --- .gitattributes | 2 + Minkowski_sum_2/benchmark/print_utils.h | 53 +++++++++++++++++++ .../benchmark/sum_by_decomposition.cpp | 50 +++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 Minkowski_sum_2/benchmark/print_utils.h create mode 100644 Minkowski_sum_2/benchmark/sum_by_decomposition.cpp diff --git a/.gitattributes b/.gitattributes index 2011a6df713..3e56f233319 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2585,6 +2585,8 @@ Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random.dat -text Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random2.dat -text Minkowski_sum_2/benchmark/Minkowski_sum_2/data/star.dat -text Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp -text +Minkowski_sum_2/benchmark/print_utils.h -text +Minkowski_sum_2/benchmark/sum_by_decomposition.cpp -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/Minkowski_sum_2.png -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/approx_offset.fig -text svneol=unset#application/octet-stream Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/approx_offset.gif -text svneol=unset#image/gif diff --git a/Minkowski_sum_2/benchmark/print_utils.h b/Minkowski_sum_2/benchmark/print_utils.h new file mode 100644 index 00000000000..3b030eb7bac --- /dev/null +++ b/Minkowski_sum_2/benchmark/print_utils.h @@ -0,0 +1,53 @@ +#ifndef _PRINT_UTILS_H_ +#define _PRINT_UTILS_H_ + +#include +#include + +//----------------------------------------------------------------------------- +// Pretty-print a CGAL polygon. +// +template +void print_polygon (const CGAL::Polygon_2& P) +{ + typename CGAL::Polygon_2::Vertex_const_iterator vit; + + std::cout << "[ " << P.size() << " vertices:"; + for (vit = P.vertices_begin(); vit != P.vertices_end(); ++vit) + std::cout << " (" << *vit << ')'; + std::cout << " ]" << std::endl; + + return; +} + +//----------------------------------------------------------------------------- +// Pretty-print a polygon with holes. +// +template +void print_polygon_with_holes + (const CGAL::Polygon_with_holes_2& pwh) +{ + if (! pwh.is_unbounded()) + { + std::cout << "{ Outer boundary = "; + print_polygon (pwh.outer_boundary()); + } + else + std::cout << "{ Unbounded polygon." << std::endl; + + typename CGAL::Polygon_with_holes_2:: + Hole_const_iterator hit; + unsigned int k = 1; + + std::cout << " " << pwh.number_of_holes() << " holes:" << std::endl; + for (hit = pwh.holes_begin(); hit != pwh.holes_end(); ++hit, ++k) + { + std::cout << " Hole #" << k << " = "; + print_polygon (*hit); + } + std::cout << " }" << std::endl; + + return; +} + +#endif diff --git a/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp b/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp new file mode 100644 index 00000000000..4015b9d0d93 --- /dev/null +++ b/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp @@ -0,0 +1,50 @@ +//! \file examples/Minkowski_sum_2/sum_by_decomposition.cpp +// Computing the Minkowski sum of two non-convex polygons read from a file +// using the small-side angle-bisector decomposition strategy. + +#include +#include +#include +#include +#include +#include +#include "print_utils.h" + +struct Kernel : public CGAL::Exact_predicates_exact_constructions_kernel {}; + +typedef Kernel::Point_2 Point_2; +typedef CGAL::Polygon_2 Polygon_2; +typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; + +int main () +{ + CGAL::Timer t_mink_sum; + // Open the input file. + std::ifstream in_file ("data/random2.dat"); + + if (! in_file.is_open()) + { + std::cerr << "Failed to open the input file." << std::endl; + return (1); + } + + // Read the two polygons from the file and compute their Minkowski sum. + Polygon_2 P, Q; + + in_file >> P >> Q; + in_file.close(); + + + // Compute the Minkowski sum using the decomposition approach. + CGAL::Small_side_angle_bisector_decomposition_2 ssab_decomp; + + t_mink_sum.start(); + + Polygon_with_holes_2 sum = minkowski_sum_2 (P, Q, ssab_decomp); + + t_mink_sum.stop(); + + std::cout << "Done! Time:" << t_mink_sum.time() << " seconds\n P (+) Q = "; print_polygon_with_holes (sum); + + return (0); +} From 2adb126cb388b6b8f5760cce2fdf2af6cddadfb4 Mon Sep 17 00:00:00 2001 From: Ophir Setter Date: Sat, 13 Aug 2011 06:25:44 +0000 Subject: [PATCH 27/64] moved files again --- .gitattributes | 3 +- .../{ => Minkowski_sum_2}/print_utils.h | 0 .../Minkowski_sum_2/sum_by_decomposition.cpp | 34 +++---------- .../benchmark/sum_by_decomposition.cpp | 50 ------------------- 4 files changed, 8 insertions(+), 79 deletions(-) rename Minkowski_sum_2/benchmark/{ => Minkowski_sum_2}/print_utils.h (100%) delete mode 100644 Minkowski_sum_2/benchmark/sum_by_decomposition.cpp diff --git a/.gitattributes b/.gitattributes index 3e56f233319..7cbf7c9c5c7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2584,9 +2584,8 @@ Minkowski_sum_2/benchmark/Minkowski_sum_2/data/knife.dat -text Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random.dat -text Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random2.dat -text Minkowski_sum_2/benchmark/Minkowski_sum_2/data/star.dat -text +Minkowski_sum_2/benchmark/Minkowski_sum_2/print_utils.h -text Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp -text -Minkowski_sum_2/benchmark/print_utils.h -text -Minkowski_sum_2/benchmark/sum_by_decomposition.cpp -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/Minkowski_sum_2.png -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/approx_offset.fig -text svneol=unset#application/octet-stream Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/approx_offset.gif -text svneol=unset#image/gif diff --git a/Minkowski_sum_2/benchmark/print_utils.h b/Minkowski_sum_2/benchmark/Minkowski_sum_2/print_utils.h similarity index 100% rename from Minkowski_sum_2/benchmark/print_utils.h rename to Minkowski_sum_2/benchmark/Minkowski_sum_2/print_utils.h diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp index feda0bb46ac..4015b9d0d93 100644 --- a/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp +++ b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp @@ -7,13 +7,7 @@ #include #include #include - -#include - -#if !defined(CGAL_MINKOWSKI_SUM_2_SERIAL) && defined(_OPENMP) -#include -#endif - +#include #include "print_utils.h" struct Kernel : public CGAL::Exact_predicates_exact_constructions_kernel {}; @@ -24,8 +18,9 @@ typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; int main () { + CGAL::Timer t_mink_sum; // Open the input file. - std::ifstream in_file ("random2.dat"); + std::ifstream in_file ("data/random2.dat"); if (! in_file.is_open()) { @@ -39,32 +34,17 @@ int main () in_file >> P >> Q; in_file.close(); + // Compute the Minkowski sum using the decomposition approach. CGAL::Small_side_angle_bisector_decomposition_2 ssab_decomp; - time_t s,e; - s = time(NULL); - - #if !defined(CGAL_MINKOWSKI_SUM_2_SERIAL) && defined(_OPENMP) - double start,end; - start = omp_get_wtime(); - #endif + t_mink_sum.start(); Polygon_with_holes_2 sum = minkowski_sum_2 (P, Q, ssab_decomp); - #if !defined(CGAL_MINKOWSKI_SUM_2_SERIAL) && defined(_OPENMP) - end = omp_get_wtime(); - #endif + t_mink_sum.stop(); - e = time(NULL); - - #if !defined(CGAL_MINKOWSKI_SUM_2_SERIAL) && defined(_OPENMP) - std::cout << "Done! time using omp_get_wtime() (" << end-start << " seconds)." << std::endl; - #endif - - std::cout << "Done! time using time() (" << difftime(e,s) << " seconds)." << std::endl; - - std::cout << "P (+) Q = "; print_polygon_with_holes (sum); + std::cout << "Done! Time:" << t_mink_sum.time() << " seconds\n P (+) Q = "; print_polygon_with_holes (sum); return (0); } diff --git a/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp b/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp deleted file mode 100644 index 4015b9d0d93..00000000000 --- a/Minkowski_sum_2/benchmark/sum_by_decomposition.cpp +++ /dev/null @@ -1,50 +0,0 @@ -//! \file examples/Minkowski_sum_2/sum_by_decomposition.cpp -// Computing the Minkowski sum of two non-convex polygons read from a file -// using the small-side angle-bisector decomposition strategy. - -#include -#include -#include -#include -#include -#include -#include "print_utils.h" - -struct Kernel : public CGAL::Exact_predicates_exact_constructions_kernel {}; - -typedef Kernel::Point_2 Point_2; -typedef CGAL::Polygon_2 Polygon_2; -typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; - -int main () -{ - CGAL::Timer t_mink_sum; - // Open the input file. - std::ifstream in_file ("data/random2.dat"); - - if (! in_file.is_open()) - { - std::cerr << "Failed to open the input file." << std::endl; - return (1); - } - - // Read the two polygons from the file and compute their Minkowski sum. - Polygon_2 P, Q; - - in_file >> P >> Q; - in_file.close(); - - - // Compute the Minkowski sum using the decomposition approach. - CGAL::Small_side_angle_bisector_decomposition_2 ssab_decomp; - - t_mink_sum.start(); - - Polygon_with_holes_2 sum = minkowski_sum_2 (P, Q, ssab_decomp); - - t_mink_sum.stop(); - - std::cout << "Done! Time:" << t_mink_sum.time() << " seconds\n P (+) Q = "; print_polygon_with_holes (sum); - - return (0); -} From 87e1ca2d10029c8bbcfb5757c49a4c6fb850aa5f Mon Sep 17 00:00:00 2001 From: Ophir Setter Date: Sat, 13 Aug 2011 06:30:57 +0000 Subject: [PATCH 28/64] argv to the benchmark program --- .../benchmark/Minkowski_sum_2/sum_by_decomposition.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp index 4015b9d0d93..3417fe5da6a 100644 --- a/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp +++ b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp @@ -16,11 +16,17 @@ typedef Kernel::Point_2 Point_2; typedef CGAL::Polygon_2 Polygon_2; typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; -int main () +int main (int argc, char * argv[]) { CGAL::Timer t_mink_sum; + // Open the input file. - std::ifstream in_file ("data/random2.dat"); + if (argc < 2) { + std::cerr << "Failed to open the input file." << std::endl; + return (1); + } + + std::ifstream in_file (argv[1]); if (! in_file.is_open()) { From c746897a1feeb149d7efef2cb01876e7e1cf3ee0 Mon Sep 17 00:00:00 2001 From: Sandhyaa Radhakrishnan Date: Mon, 15 Aug 2011 07:26:13 +0000 Subject: [PATCH 29/64] Benchmark program --- .../benchmark/Minkowski_sum_2/sum_by_decomposition.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp index 3417fe5da6a..37cec85b4a8 100644 --- a/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp +++ b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp @@ -20,7 +20,6 @@ int main (int argc, char * argv[]) { CGAL::Timer t_mink_sum; - // Open the input file. if (argc < 2) { std::cerr << "Failed to open the input file." << std::endl; return (1); From 4be5cb2f12a1518f36c955f940071d633d05c0e9 Mon Sep 17 00:00:00 2001 From: Sandhyaa Radhakrishnan Date: Mon, 22 Aug 2011 06:16:24 +0000 Subject: [PATCH 30/64] using bso union and no OpenMP --- .../benchmark/Minkowski_sum_2/sum_by_decomposition.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp index 37cec85b4a8..2cf46e4d500 100644 --- a/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp +++ b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp @@ -20,6 +20,7 @@ int main (int argc, char * argv[]) { CGAL::Timer t_mink_sum; + if (argc < 2) { std::cerr << "Failed to open the input file." << std::endl; return (1); From d57ace521d377bdce9924404f0cbaeaa2477cc7c Mon Sep 17 00:00:00 2001 From: Sandhyaa Radhakrishnan Date: Mon, 22 Aug 2011 06:21:00 +0000 Subject: [PATCH 31/64] using bso union and no OpenMP --- Minkowski_sum_2/include/CGAL/minkowski_sum_2.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h b/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h index a39e0984e09..5a730c6f4eb 100644 --- a/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h +++ b/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h @@ -38,6 +38,7 @@ namespace CGAL { * \param pgn2 The second polygon. * \return The resulting polygon with holes, representing the sum. */ + template Polygon_with_holes_2 minkowski_sum_2 (const Polygon_2& pgn1, From 6054161601cbc47322b1db8550e60a043e7e8036 Mon Sep 17 00:00:00 2001 From: Sandhyaa Radhakrishnan Date: Mon, 22 Aug 2011 06:22:05 +0000 Subject: [PATCH 32/64] using bso union and no OpenMP --- .../include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h index 4e77016addd..d37d74997d8 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h @@ -34,6 +34,7 @@ namespace CGAL { * their decomposition two convex sub-polygons, taking the pairwise sums and * computing the union of the sub-sums. */ + template class Minkowski_sum_by_decomposition_2 { From c495e8059f1d6d2adbc734e85f2eb27cacf9d63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Fri, 26 Aug 2011 11:31:00 +0000 Subject: [PATCH 33/64] inline link to the recent draft for copy_ --- STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex index 0b0801b6819..a8264f6d7f4 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex @@ -58,8 +58,9 @@ an alternative implementation from \cgal\ is used. \ccDefinition The function \ccRefName\ copies $n$ items from an - input iterator to an output iterator. Its exact behaviour is - defined in $\mathsection 25.3.1$ of the C++0x standard. + input iterator to an output iterator. Its exact behaviour is defined + in $\mathsection 25.3.1$ of the C++ standard draft + \href{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf}{N3242}. \ccInclude{CGAL/algorithm.h} \end{ccRefFunction} From f9b288db902d1abadd893cb009368b52797cb05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Fri, 26 Aug 2011 14:34:10 +0000 Subject: [PATCH 34/64] Merged branch ^/branches/features/gsoc2011-copy_n-pmoeller. Small feature page: https://cgal.geometryfactory.com/CGAL/Members/wiki/Features/Small_Features/Replace_copy_n --- .../Alpha_shapes_2/ex_alpha_shapes_2.cpp | 2 +- .../test/Alpha_shapes_2/test_alpha.cpp | 2 +- .../triangle_self_intersect.cpp | 2 +- .../triangle_self_intersect_pointers.cpp | 2 +- CGAL_ipelets/demo/CGAL_ipelets/generator.cpp | 6 +-- .../compare_different_approach.cpp | 2 +- .../Convex_hull_3/is_on_positive_side.cpp | 2 +- .../demo/Convex_hull_3/quickhull_3_demo.cpp | 2 +- .../examples/Convex_hull_3/dynamic_hull_3.cpp | 2 +- .../Convex_hull_3/incremental_hull_3.cpp | 2 +- .../examples/Convex_hull_3/quickhull_3.cpp | 2 +- .../quickhull_degenerate_test_3.cpp | 2 +- .../test/Convex_hull_3/quickhull_test_3.cpp | 2 +- .../Filtered_kernel/orientation_3.cpp | 2 +- Generator/demo/Generator/qt3/generator.cpp | 2 +- Generator/doc_tex/Generator/generators.tex | 2 +- .../Points_on_segment_2_functor.tex | 2 +- .../Generator_ref/Random_points_in_ball_d.tex | 2 +- .../Generator_ref/Random_points_in_cube_3.tex | 2 +- .../Generator_ref/Random_points_in_cube_d.tex | 2 +- .../Generator_ref/Random_points_in_disc_2.tex | 2 +- .../Random_points_in_sphere_3.tex | 2 +- .../Random_points_in_square_2.tex | 2 +- .../Random_points_on_circle_2.tex | 2 +- .../Random_points_on_segment_2.tex | 2 +- .../Random_points_on_sphere_3.tex | 2 +- .../Random_points_on_sphere_d.tex | 2 +- .../Random_points_on_square_2.tex | 2 +- .../Generator/random_degenerate_point_set.cpp | 2 +- Generator/examples/Generator/random_grid.cpp | 2 +- .../examples/Generator/random_segments1.cpp | 2 +- Generator/include/CGAL/random_convex_set_2.h | 4 +- Generator/test/Generator/test_generators.cpp | 28 +++++------ GraphicsView/demo/Generator/Generator_2.cpp | 2 +- .../demo/Interpolation/surface_voronoi.cpp | 4 +- .../Interpolation/interpolation_2.cpp | 2 +- .../surface_neighbor_coordinates_3.cpp | 2 +- .../CGAL/_test_interpolation_functions_2.cpp | 2 +- .../CGAL/_test_regular_neighbors_2.cpp | 2 +- .../CGAL/_test_surface_neighbors_3.cpp | 6 +-- .../Matrix_search/rectangular_p_center_2.cpp | 2 +- .../rectangular_p_center_2_random1_test.cpp | 2 +- .../rectangular_p_center_2_random2_test.cpp | 2 +- Min_annulus_d/web/Min_annulus_d.aw | 2 +- Nef_2/noweb/Segment_overlay.lw | 2 +- Point_set_2/test/Point_set_2/range_search.cpp | 2 +- .../test/Point_set_2/range_search_fcn.cpp | 2 +- .../include/CGAL/QP_solver/QP_solver_impl.h | 2 +- Robustness/demo/Robustness/robustness.cpp | 4 +- .../doc_tex/STL_Extension_ref/intro.tex | 1 + .../STL_Extension_ref/stl_extension.tex | 50 +++++++++++++------ STL_Extension/include/CGAL/algorithm.h | 33 ++++++++++-- .../test/STL_Extension/test_stl_extension.cpp | 11 ++++ .../Qt3/spatial_searching.cpp | 8 +-- .../Building_kd_tree_with_ddim_points.cpp | 3 +- ...Orthogonal_incremental_neighbor_search.cpp | 2 +- .../test/Spatial_searching/Splitters.cpp | 2 +- .../examples/Triangulation_2/hierarchy.cpp | 2 +- .../CGAL/_test_cls_delaunay_hierarchy_2.h | 2 +- .../demo/Triangulation_3/Scene.cpp | 2 +- .../demo/Triangulation_3/Viewer.cpp | 2 +- 61 files changed, 156 insertions(+), 100 deletions(-) diff --git a/Alpha_shapes_2/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp b/Alpha_shapes_2/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp index aca832be0d6..b185f4e6084 100644 --- a/Alpha_shapes_2/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp +++ b/Alpha_shapes_2/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp @@ -79,7 +79,7 @@ file_input(OutputIterator out) int n; is >> n; std::cout << "Reading " << n << " points from file" << std::endl; - CGAL::copy_n(std::istream_iterator(is), n, out); + CGAL::cpp0x::copy_n(std::istream_iterator(is), n, out); return true; } diff --git a/Alpha_shapes_2/test/Alpha_shapes_2/test_alpha.cpp b/Alpha_shapes_2/test/Alpha_shapes_2/test_alpha.cpp index 7d5d2d32d71..f72f9a98d30 100644 --- a/Alpha_shapes_2/test/Alpha_shapes_2/test_alpha.cpp +++ b/Alpha_shapes_2/test/Alpha_shapes_2/test_alpha.cpp @@ -89,7 +89,7 @@ file_input(OutputIterator out) int n; is >> n; std::cout << "Reading " << n << " points from file" << std::endl; - CGAL::copy_n(std::istream_iterator(is), n, out); + CGAL::cpp0x::copy_n(std::istream_iterator(is), n, out); return true; } diff --git a/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect.cpp b/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect.cpp index c080174f30a..0642e4e9b56 100644 --- a/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect.cpp +++ b/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect.cpp @@ -35,7 +35,7 @@ int main() { typedef CGAL::Join_input_iterator_3 Triangle_gen; Pts points( 1); // in centered cube [-1,1)^3 Triangle_gen triangle_gen( points, points, points); - CGAL::copy_n( triangle_gen, 10, std::back_inserter(triangles)); + CGAL::cpp0x::copy_n( triangle_gen, 10, std::back_inserter(triangles)); // Create the corresponding vector of bounding boxes std::vector boxes; diff --git a/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp b/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp index b3cab305fd4..640d1a31796 100644 --- a/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp +++ b/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp @@ -35,7 +35,7 @@ int main() { typedef CGAL::Join_input_iterator_3 Triangle_gen; Pts points( 1); // in centered cube [-1,1)^3 Triangle_gen triangle_gen( points, points, points); - CGAL::copy_n( triangle_gen, 10, std::back_inserter(triangles)); + CGAL::cpp0x::copy_n( triangle_gen, 10, std::back_inserter(triangles)); // Create the corresponding vector of bounding boxes std::vector boxes; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp b/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp index f38581d4e00..93def51c62c 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp @@ -101,7 +101,7 @@ void generator::protected_run(int fn) switch(fn){ case 0:{//random point in a circle CGAL::Random_points_in_disc_2 gs( size); - CGAL::copy_n( gs, nbelements, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gs, nbelements, std::back_inserter(points)); } break; @@ -112,7 +112,7 @@ void generator::protected_run(int fn) case 6: case 2://points in a square : side = {CGAL::Random_points_in_square_2 gc (size); - CGAL::copy_n( gc, nbelements, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gc, nbelements, std::back_inserter(points)); } break; @@ -139,7 +139,7 @@ void generator::protected_run(int fn) typedef CGAL::Creator_uniform_2< Point_2, Segment_2> Seg_creator; typedef CGAL::Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator; Seg_iterator g( p1, p2); - CGAL::copy_n( g, nbelements, std::back_inserter(segments) ); + CGAL::cpp0x::copy_n( g, nbelements, std::back_inserter(segments) ); break; }; diff --git a/Convex_hull_3/benchmark/Convex_hull_3/compare_different_approach.cpp b/Convex_hull_3/benchmark/Convex_hull_3/compare_different_approach.cpp index 8094e016e7d..b50c1038cc1 100644 --- a/Convex_hull_3/benchmark/Convex_hull_3/compare_different_approach.cpp +++ b/Convex_hull_3/benchmark/Convex_hull_3/compare_different_approach.cpp @@ -43,7 +43,7 @@ int main(int argc,char** argv) if (argc==1){ CGAL::Random_points_in_sphere_3 gen(1.0); int nbpt=1000000; - CGAL::copy_n( gen, nbpt, std::back_inserter(points) ); + CGAL::cpp0x::copy_n( gen, nbpt, std::back_inserter(points) ); std::cout << "Using " << 1000000 << " random points in the unit ball\n"; } else{ diff --git a/Convex_hull_3/benchmark/Convex_hull_3/is_on_positive_side.cpp b/Convex_hull_3/benchmark/Convex_hull_3/is_on_positive_side.cpp index a9e37bcdd28..f9020343d45 100644 --- a/Convex_hull_3/benchmark/Convex_hull_3/is_on_positive_side.cpp +++ b/Convex_hull_3/benchmark/Convex_hull_3/is_on_positive_side.cpp @@ -157,7 +157,7 @@ int main() points.reserve(nb_pts); K::Point_3 p=*gen++,q=*gen++,r=*gen++; - CGAL::copy_n(gen,nb_pts,std::back_inserter(points)); + CGAL::cpp0x::copy_n(gen,nb_pts,std::back_inserter(points)); std::vector res0; res0.reserve(nb_pts); std::vector res1; res1.reserve(nb_pts); diff --git a/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp b/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp index 28135c29e06..3bd02fc30a5 100644 --- a/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp +++ b/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp @@ -115,7 +115,7 @@ int main(int argc, char* argv[]) Generator gen(100.0); // generate num points and copy them to a vector - CGAL::copy_n( gen, num, std::back_inserter(points) ); + CGAL::cpp0x::copy_n( gen, num, std::back_inserter(points) ); // define object to hold convex hull CGAL::Object ch_object; diff --git a/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp b/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp index 46585091a6d..1698e3e8b0f 100644 --- a/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp @@ -20,7 +20,7 @@ int main() // generate 250 points randomly on a sphere of radius 100.0 // and insert them into the triangulation - CGAL::copy_n(gen, 250, std::back_inserter(points) ); + CGAL::cpp0x::copy_n(gen, 250, std::back_inserter(points) ); Delaunay T; T.insert(points.begin(), points.end()); diff --git a/Convex_hull_3/examples/Convex_hull_3/incremental_hull_3.cpp b/Convex_hull_3/examples/Convex_hull_3/incremental_hull_3.cpp index e9ecb2a274f..f9a34addbb4 100644 --- a/Convex_hull_3/examples/Convex_hull_3/incremental_hull_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/incremental_hull_3.cpp @@ -26,7 +26,7 @@ int main() std::vector V; // generate 250 points randomly on a sphere of radius 100.0 and copy // them to a vector - CGAL::copy_n( gen, 250, std::back_inserter(V) ); + CGAL::cpp0x::copy_n( gen, 250, std::back_inserter(V) ); Polyhedron P; // define polyhedron to hold convex hull diff --git a/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp b/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp index 56551ca1bc8..273e0902a45 100644 --- a/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp @@ -32,7 +32,7 @@ int main() // generate 250 points randomly on a sphere of radius 100.0 // and copy them to a vector std::vector points; - CGAL::copy_n( gen, 250, std::back_inserter(points) ); + CGAL::cpp0x::copy_n( gen, 250, std::back_inserter(points) ); // define polyhedron to hold convex hull Polyhedron_3 poly; diff --git a/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp b/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp index 9f98304a4c8..08b097aa6aa 100644 --- a/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp @@ -143,7 +143,7 @@ void test_collinear() // generate 100 points on the segment with endpoints (0,0) and (1,0) CGAL::Random_points_on_segment_2 g(Point_2(0,0), Point_2(1,0)); - CGAL::copy_n(g, 100, std::back_inserter(point_2_list)); + CGAL::cpp0x::copy_n(g, 100, std::back_inserter(point_2_list)); std::list::iterator point_it = point_2_list.begin(); point_3_list.push_back(Point_3(0,0,0)); diff --git a/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp b/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp index ed6fbaedf50..4a48e87b7f3 100644 --- a/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp @@ -131,7 +131,7 @@ int main() std::cerr << "Testing 500 random points" << std::endl; std::vector points; Generator g(500); - CGAL::copy_n( g, num, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, num, std::back_inserter(points)); assert(points.size() == num); diff --git a/Filtered_kernel/benchmark/Filtered_kernel/orientation_3.cpp b/Filtered_kernel/benchmark/Filtered_kernel/orientation_3.cpp index c2fa744ce67..bade708b43a 100644 --- a/Filtered_kernel/benchmark/Filtered_kernel/orientation_3.cpp +++ b/Filtered_kernel/benchmark/Filtered_kernel/orientation_3.cpp @@ -31,7 +31,7 @@ int main() std::vector points; points.reserve(N); CGAL::Random_points_in_sphere_3 g( 100.0); - CGAL::copy_n( g, N, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, N, std::back_inserter(points)); timer.stop(); std::cout << "Fill vector: " << timer.time() << " sec" << std::endl; timer.reset(); diff --git a/Generator/demo/Generator/qt3/generator.cpp b/Generator/demo/Generator/qt3/generator.cpp index 7b2c6a89c58..c6dc23940cf 100644 --- a/Generator/demo/Generator/qt3/generator.cpp +++ b/Generator/demo/Generator/qt3/generator.cpp @@ -305,7 +305,7 @@ private slots: typedef CGAL::Creator_uniform_2< Point_2, Segment> Seg_creator; typedef CGAL::Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator; Seg_iterator g( p1, p2); - CGAL::copy_n( g, 200, std::back_inserter(list_of_segments)); + CGAL::cpp0x::copy_n( g, 200, std::back_inserter(list_of_segments)); something_changed(); } diff --git a/Generator/doc_tex/Generator/generators.tex b/Generator/doc_tex/Generator/generators.tex index b37c859088f..428ddff9065 100644 --- a/Generator/doc_tex/Generator/generators.tex +++ b/Generator/doc_tex/Generator/generators.tex @@ -18,7 +18,7 @@ Two kinds of point generators are provided: first, random point generators and second deterministic point generators. Most random point generators and a few deterministic point generators are provided as input iterators. The input iterators model an infinite sequence of -points. The function \ccc{CGAL::copy_n()} can be used to copy a +points. The function \ccc{CGAL::cpp0x::copy_n()} can be used to copy a finite sequence; see Section~\ref{sectionCopyN}. The iterator adaptor \ccc{Counting_iterator} can be used to create finite iterator ranges; see Section~\ref{sectionCountingIterator}. diff --git a/Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex b/Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex index 33a11fe8b40..b748b855fa2 100644 --- a/Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex +++ b/Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex @@ -54,7 +54,7 @@ spaced \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::points_on_segment} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex b/Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex index c1b988ac8ec..b4f248ce594 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex @@ -36,7 +36,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_sphere_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex b/Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex index c29ee8eb3dd..65bbc9e4079 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex @@ -38,7 +38,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_in_square_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_sphere_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex b/Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex index 99c55b88dd4..64eaaea4ca7 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex @@ -38,7 +38,7 @@ For every point $ p = \ccc{*g}$ and for all $ i} \\ \ccRefIdfierPage{CGAL::Random_points_in_cube_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex b/Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex index ee6edec4554..83760fa78be 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex @@ -39,7 +39,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_square_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex b/Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex index 779115bd2f0..00cdeb1ec45 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex @@ -38,7 +38,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_cube_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex b/Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex index da018dc9616..581f783e85c 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex @@ -38,7 +38,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex b/Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex index 9f11d1943a2..d953efe62dc 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex @@ -42,7 +42,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex b/Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex index b054fb762f7..32a14fc8e9f 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex @@ -42,7 +42,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex b/Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex index d4782106696..27c6b710f88 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex @@ -41,7 +41,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_on_circle_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_cube_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex b/Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex index 6e8cfc25465..7ad93a0bb26 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex @@ -41,7 +41,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_on_circle_2} \\ \ccRefIdfierPage{CGAL::Random_points_on_sphere_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex b/Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex index cf0a9fc3762..83725e65ea6 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex @@ -40,7 +40,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/examples/Generator/random_degenerate_point_set.cpp b/Generator/examples/Generator/random_degenerate_point_set.cpp index d63cd85e63b..db2581177db 100644 --- a/Generator/examples/Generator/random_degenerate_point_set.cpp +++ b/Generator/examples/Generator/random_degenerate_point_set.cpp @@ -20,7 +20,7 @@ int main() { // Create 600 points within a disc of radius 150. Random_points_in_disc_2 g( 150.0); - CGAL::copy_n( g, 600, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, 600, std::back_inserter(points)); // Create 200 points from a 15 x 15 grid. points_on_square_grid_2( 250.0, 200, std::back_inserter(points),Creator()); diff --git a/Generator/examples/Generator/random_grid.cpp b/Generator/examples/Generator/random_grid.cpp index d13cc88b628..df565b34c8c 100644 --- a/Generator/examples/Generator/random_grid.cpp +++ b/Generator/examples/Generator/random_grid.cpp @@ -31,7 +31,7 @@ int main() { // Create 250 points within a disc of radius 150. Random_points_in_disc_2 g( 150.0); - CGAL::copy_n( g, 250, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, 250, std::back_inserter(points)); // Check that we have really created 500 points. assert( points.size() == 500); diff --git a/Generator/examples/Generator/random_segments1.cpp b/Generator/examples/Generator/random_segments1.cpp index 158a9793da9..6fe4e366d81 100644 --- a/Generator/examples/Generator/random_segments1.cpp +++ b/Generator/examples/Generator/random_segments1.cpp @@ -35,7 +35,7 @@ int main() { typedef Creator_uniform_2< Point, Segment> Seg_creator; typedef Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator; Seg_iterator g( p1, p2); - CGAL::copy_n( g, 200, std::back_inserter(segs)); + CGAL::cpp0x::copy_n( g, 200, std::back_inserter(segs)); assert( segs.size() == 200); for ( Vector::iterator i = segs.begin(); i != segs.end(); i++){ diff --git a/Generator/include/CGAL/random_convex_set_2.h b/Generator/include/CGAL/random_convex_set_2.h index b064d137b45..b15a2a03ea7 100644 --- a/Generator/include/CGAL/random_convex_set_2.h +++ b/Generator/include/CGAL/random_convex_set_2.h @@ -52,7 +52,7 @@ random_convex_set_2( std::size_t n, using std::partial_sum; using std::less; using std::max_element; - using CGAL::copy_n; + using CGAL::cpp0x::copy_n; typedef typename Traits::Point_2 Point_2; typedef typename Traits::FT FT; @@ -71,7 +71,7 @@ random_convex_set_2( std::size_t n, // build random point set: Container points; points.reserve( n); - CGAL::copy_n( pg, n, back_inserter( points)); + CGAL::cpp0x::copy_n( pg, n, back_inserter( points)); // compute centroid of points: Point_2 centroid = CGAL::centroid( points.begin(), points.end(), t ); diff --git a/Generator/test/Generator/test_generators.cpp b/Generator/test/Generator/test_generators.cpp index 384cf662fb7..ff5c76de963 100644 --- a/Generator/test/Generator/test_generators.cpp +++ b/Generator/test/Generator/test_generators.cpp @@ -56,7 +56,7 @@ void test_point_generators_2() { std::vector points; points.reserve(1000); Random_points_in_disc_2 g1( 100.0); - CGAL::copy_n( g1, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g1, 100, std::back_inserter(points)); Random_points_on_circle_2 g2( 100.0); Random_points_in_square_2 g3( 100.0); Random_points_on_square_2 g4( 100.0); @@ -65,11 +65,11 @@ void test_point_generators_2() { Points_on_segment_2 g5a( Point_2( 50,-50), Point_2(-50, 50), 50); - CGAL::copy_n( g2, 100, std::back_inserter(points)); - CGAL::copy_n( g3, 100, std::back_inserter(points)); - CGAL::copy_n( g4, 100, std::back_inserter(points)); - CGAL::copy_n( g5, 50, std::back_inserter(points)); - CGAL::copy_n( g5a, 50, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g2, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g3, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g4, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g5, 50, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g5a, 50, std::back_inserter(points)); points_on_square_grid_2( 50.0, (std::size_t)1, std::back_inserter(points), Creator()); points_on_square_grid_2( 50.0, (std::size_t)2, @@ -90,7 +90,7 @@ void test_point_generators_2() { // the 100 x 100 square. 10 pixel perturbation allowed. Random_points_in_square_2 g6( 90.0); int count = 100 ; - CGAL::copy_n( g6, count, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g6, count, std::back_inserter(points)); std::vector::iterator i2 = points.end(); std::vector::iterator i1 = i2 ; std::advance(i1,-count); @@ -117,11 +117,11 @@ void test_point_generators_3() { std::vector points; points.reserve(500); Random_points_in_sphere_3 g1( 100.0); - CGAL::copy_n( g1, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g1, 100, std::back_inserter(points)); Random_points_on_sphere_3 g2( 100.0); Random_points_in_cube_3 g3( 100.0); - CGAL::copy_n( g2, 100, std::back_inserter(points)); - CGAL::copy_n( g3, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g2, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g3, 100, std::back_inserter(points)); points_on_cube_grid_3( 50.0, (std::size_t)1, std::back_inserter(points), Creator()); points_on_cube_grid_3( 50.0, (std::size_t)2, @@ -171,7 +171,7 @@ void test_point_generators_d() // 100 random points in dim 36 std::cout<<" cube dim 36"< gen (36, 1.0); - CGAL::copy_n( gen, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gen, 100, std::back_inserter(points)); i+=100; std::cout<<" done"< gen (4, 100.0); - CGAL::copy_n( gen, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gen, 100, std::back_inserter(points)); std::cout<<" done"< gen (3, 1.0); - CGAL::copy_n( gen, nb_g, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gen, nb_g, std::back_inserter(points)); std::cout<<" done"< gen (26, 1.0); - CGAL::copy_n( gen, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gen, 100, std::back_inserter(points)); std::cout<<" done"< Seg_creator; typedef CGAL::Join_input_iterator_2< Rpos_generator, Rpoc_generator, Seg_creator> Seg_iterator; Seg_iterator g( rpos, rpoc); - CGAL::copy_n( g, 200, std::back_inserter(segments)); + CGAL::cpp0x::copy_n( g, 200, std::back_inserter(segments)); emit(changed()); } diff --git a/Interpolation/demo/Interpolation/surface_voronoi.cpp b/Interpolation/demo/Interpolation/surface_voronoi.cpp index 7737d73ec3b..1b5431d2211 100644 --- a/Interpolation/demo/Interpolation/surface_voronoi.cpp +++ b/Interpolation/demo/Interpolation/surface_voronoi.cpp @@ -92,7 +92,7 @@ void generate_sphere_points(const int& n, //the test point + normal Point &p, Vector &normal){ CGAL::Random_points_on_sphere_3 g(r); - CGAL::copy_n( g, n, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n, std::back_inserter(points)); p = Point(0,0, r); normal = Vector(p - CGAL::ORIGIN); } @@ -108,7 +108,7 @@ void generate_cylinder_points(const int& n, Point_2_vector points_2; points_2.reserve(n); CGAL::Random_points_on_circle_2 g(r); - CGAL::copy_n( g, n , std::back_inserter(points_2)); + CGAL::cpp0x::copy_n( g, n , std::back_inserter(points_2)); CGAL::Random random; double h; diff --git a/Interpolation/examples/Interpolation/interpolation_2.cpp b/Interpolation/examples/Interpolation/interpolation_2.cpp index a345174897d..c67aeeeb1f9 100644 --- a/Interpolation/examples/Interpolation/interpolation_2.cpp +++ b/Interpolation/examples/Interpolation/interpolation_2.cpp @@ -49,7 +49,7 @@ int main() // Create n+m-4 points within a disc of radius 2 double r_d = 3; CGAL::Random_points_in_disc_2 g(r_d ); - CGAL::copy_n( g, n+m, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n+m, std::back_inserter(points)); Delaunay_triangulation T; diff --git a/Interpolation/examples/Interpolation/surface_neighbor_coordinates_3.cpp b/Interpolation/examples/Interpolation/surface_neighbor_coordinates_3.cpp index 84f4291551a..333c68708fb 100644 --- a/Interpolation/examples/Interpolation/surface_neighbor_coordinates_3.cpp +++ b/Interpolation/examples/Interpolation/surface_neighbor_coordinates_3.cpp @@ -25,7 +25,7 @@ int main() std::cout << "Generate " << n << " random points on a sphere." << std::endl; CGAL::Random_points_on_sphere_3 g(1); - CGAL::copy_n( g, n, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n, std::back_inserter(points)); Point_3 p(1, 0,0); Vector_3 normal(p-CGAL::ORIGIN); diff --git a/Interpolation/test/Interpolation/include/CGAL/_test_interpolation_functions_2.cpp b/Interpolation/test/Interpolation/include/CGAL/_test_interpolation_functions_2.cpp index 5a76f8885ab..1832dfe634e 100644 --- a/Interpolation/test/Interpolation/include/CGAL/_test_interpolation_functions_2.cpp +++ b/Interpolation/test/Interpolation/include/CGAL/_test_interpolation_functions_2.cpp @@ -218,7 +218,7 @@ _test_interpolation_functions_2_delaunay( const Triangul &, // Create n+m-4 points within a disc of radius 2 CGAL::Random_points_in_square_2 g(r); - CGAL::copy_n( g, n+m, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n+m, std::back_inserter(points)); CGAL::Random random; diff --git a/Interpolation/test/Interpolation/include/CGAL/_test_regular_neighbors_2.cpp b/Interpolation/test/Interpolation/include/CGAL/_test_regular_neighbors_2.cpp index 9a2e9e63ed3..00612e909c5 100644 --- a/Interpolation/test/Interpolation/include/CGAL/_test_regular_neighbors_2.cpp +++ b/Interpolation/test/Interpolation/include/CGAL/_test_regular_neighbors_2.cpp @@ -87,7 +87,7 @@ _test_regular_neighbors_2( const Triangul & ) // Create n+m-4 points within a disc of radius 2 CGAL::Random_points_in_square_2 g(r); - CGAL::copy_n( g, n+m, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n+m, std::back_inserter(points)); CGAL::Random random; diff --git a/Interpolation/test/Interpolation/include/CGAL/_test_surface_neighbors_3.cpp b/Interpolation/test/Interpolation/include/CGAL/_test_surface_neighbors_3.cpp index cc54335e23b..19c39f06ab7 100644 --- a/Interpolation/test/Interpolation/include/CGAL/_test_surface_neighbors_3.cpp +++ b/Interpolation/test/Interpolation/include/CGAL/_test_surface_neighbors_3.cpp @@ -316,7 +316,7 @@ _test_surface_neighbors_3_sphere( const Triangul & ) // Create n+m-4 points on a sphere of radius 2 CGAL::Random_points_on_sphere_3 g(r); - CGAL::copy_n( g, n+m, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n+m, std::back_inserter(points)); for(int i=0; i()); else{ CGAL::Random_points_in_square_2 g(r); - CGAL::copy_n( g, n, std::back_inserter(points_2_data)); + CGAL::cpp0x::copy_n( g, n, std::back_inserter(points_2_data)); } for(int i=0; i < n; i++){ T.insert(transform(Point(points_2_data[i].x(),points_2_data[i].y(), -r))); @@ -376,7 +376,7 @@ _test_surface_neighbors_3_cube(const Triangul &, const Transformation& std::vector points_2_test; points_2_test.reserve(m); CGAL::Random_points_in_square_2 g2(r-1.0); - CGAL::copy_n( g2, m, std::back_inserter(points_2_test)); + CGAL::cpp0x::copy_n( g2, m, std::back_inserter(points_2_test)); int k=0; for(int i=0;i(3) = @begin std::vector points_@1; points_@1.reserve( 100); - CGAL::copy_n( CGAL::Random_points_on_@3_@2( 0x100000), + CGAL::cpp0x::copy_n( CGAL::Random_points_on_@3_@2( 0x100000), 100, std::back_inserter( points_@1)); @end diff --git a/Nef_2/noweb/Segment_overlay.lw b/Nef_2/noweb/Segment_overlay.lw index f69a4d48c68..0c7bb65609d 100644 --- a/Nef_2/noweb/Segment_overlay.lw +++ b/Nef_2/noweb/Segment_overlay.lw @@ -2243,7 +2243,7 @@ int main(int argc, char** argv) for (int i = 0; i < 100; ++i,++sit) L.push_back(*sit); - // CGAL::copy_n(sit,100, std::back_inserter(L)); + // CGAL::cpp0x::copy_n(sit,100, std::back_inserter(L)); std::ofstream of("input.log"); for (lit = L.begin(); lit!= L.end(); ++lit) diff --git a/Point_set_2/test/Point_set_2/range_search.cpp b/Point_set_2/test/Point_set_2/range_search.cpp index c84ad86a302..ea50a69e862 100644 --- a/Point_set_2/test/Point_set_2/range_search.cpp +++ b/Point_set_2/test/Point_set_2/range_search.cpp @@ -42,7 +42,7 @@ int main() std::list points; std::list LV; - CGAL::copy_n(rpg, 1000, std::back_inserter(points)); + CGAL::cpp0x::copy_n(rpg, 1000, std::back_inserter(points)); PSet.insert(points.begin(), points.end()); Point_2 p(10, 10), q(50, 10), r(50, 50), s(10, 50); diff --git a/Point_set_2/test/Point_set_2/range_search_fcn.cpp b/Point_set_2/test/Point_set_2/range_search_fcn.cpp index 902e7e65ed9..df7fffd03d1 100644 --- a/Point_set_2/test/Point_set_2/range_search_fcn.cpp +++ b/Point_set_2/test/Point_set_2/range_search_fcn.cpp @@ -45,7 +45,7 @@ int main() std::list points; std::list LV; - CGAL::copy_n(rpg, 1000, std::back_inserter(points)); + CGAL::cpp0x::copy_n(rpg, 1000, std::back_inserter(points)); PSet.insert(points.begin(), points.end()); Point_2 p(10, 10), q(50, 10), r(50, 50), s(10, 50); diff --git a/QP_solver/include/CGAL/QP_solver/QP_solver_impl.h b/QP_solver/include/CGAL/QP_solver/QP_solver_impl.h index 95d82aa7892..431f6d4584e 100644 --- a/QP_solver/include/CGAL/QP_solver/QP_solver_impl.h +++ b/QP_solver/include/CGAL/QP_solver/QP_solver_impl.h @@ -417,7 +417,7 @@ ratio_test_init__A_Cj( Value_iterator A_Cj_it, int j_, Tag_true) // store exact version of `A_Cj' (implicit conversion) if ( j_ < qp_n) { // original variable - CGAL::copy_n( *(qp_A + j_), qp_m, A_Cj_it); + CGAL::cpp0x::copy_n( *(qp_A + j_), qp_m, A_Cj_it); } else { // artificial variable diff --git a/Robustness/demo/Robustness/robustness.cpp b/Robustness/demo/Robustness/robustness.cpp index 077595a4c8c..fb0cfcef417 100644 --- a/Robustness/demo/Robustness/robustness.cpp +++ b/Robustness/demo/Robustness/robustness.cpp @@ -490,8 +490,8 @@ private slots: hdouble_segments.clear(); hdouble_segments2.clear(); - CGAL::copy_n( g, 100, std::back_inserter( double_segments) ); - CGAL::copy_n( g, 100, std::back_inserter( double_segments2) ); + CGAL::cpp0x::copy_n( g, 100, std::back_inserter( double_segments) ); + CGAL::cpp0x::copy_n( g, 100, std::back_inserter( double_segments2) ); CGAL::Cartesian_converter converter; std::transform( double_segments.begin(), diff --git a/STL_Extension/doc_tex/STL_Extension_ref/intro.tex b/STL_Extension/doc_tex/STL_Extension_ref/intro.tex index f28535b4df6..780b8c99a1a 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/intro.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/intro.tex @@ -46,6 +46,7 @@ \subsection*{Generic Algorithms} +\ccRefIdfierPage{CGAL::cpp0x::copy_n}\\ \ccRefIdfierPage{CGAL::copy_n}\\ \ccRefIdfierPage{CGAL::min_max_element}\\ %% Michael: I commented these, as I think they should be replaced by combining diff --git a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex index f085905948b..a8264f6d7f4 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex @@ -50,27 +50,45 @@ \end{ccRefFunction} %% +---------------------------------------------+ -\begin{ccRefFunction}{copy_n} - \label{sectionCopyN} + +\begin{ccRefFunction}{cpp0x::copy_n} + This provides an implementation of the standard function + \ccc{copy_n} from the C++0x standard. If \ccc{copy_n} is available + in the \ccc{std::} namespace a using declaration is used, otherwise + an alternative implementation from \cgal\ is used. \ccDefinition The function \ccRefName\ copies $n$ items from an - input iterator to an output iterator which is useful for possibly - infinite - sequences of random geometric objects.\footnote{% - The \stl\ release June 13, 1997, from SGI contains an equivalent - function, but it is not part of the ISO standard.} - + input iterator to an output iterator. Its exact behaviour is defined + in $\mathsection 25.3.1$ of the C++ standard draft + \href{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf}{N3242}. + \ccInclude{CGAL/algorithm.h} +\end{ccRefFunction} + +\begin{ccRefFunction}{copy_n} + This function is deprecated, \ccc{CGAL::cpp0x::copy_n} should be used instead. + \begin{ccDeprecated} + \label{sectionCopyN} + + \ccDefinition The function \ccRefName\ copies $n$ items from an + input iterator to an output iterator which is useful for possibly + infinite + sequences of random geometric objects.\footnote{% + The \stl\ release June 13, 1997, from SGI contains an equivalent + function, but it is not part of the ISO standard.} - \ccThree{OutputIterator}{copy_n}{} - \ccFunction{template OutputIterator copy_n(InputIterator first, Size n, - OutputIterator result);}{copies the first $n$ items from - \ccc{first} to \ccc{result}. Returns the value of \ccc{result} - after inserting the $n$ items.} + \ccInclude{CGAL/algorithm.h} - \ccSeeAlso - \ccRefIdfierPage{CGAL::Counting_iterator} + \ccThree{OutputIterator}{copy_n}{} + \ccFunction{template OutputIterator copy_n(InputIterator first, Size n, + OutputIterator result);}{copies the first $n$ items from + \ccc{first} to \ccc{result}. Returns the value of \ccc{result} + after inserting the $n$ items.} + + \ccSeeAlso + \ccRefIdfierPage{CGAL::Counting_iterator} + \end{ccDeprecated} \end{ccRefFunction} %% +---------------------------------------------+ diff --git a/STL_Extension/include/CGAL/algorithm.h b/STL_Extension/include/CGAL/algorithm.h index 40d69a03636..220f7a1aa60 100644 --- a/STL_Extension/include/CGAL/algorithm.h +++ b/STL_Extension/include/CGAL/algorithm.h @@ -27,18 +27,21 @@ #define CGAL_ALGORITHM_H #include +#include #include #include namespace CGAL { // copy_n is usually in the STL as well, but not in the official -// standard. We provide our own copy_n. It is planned for C++0x. +// standard. We provide our own copy_n. It is planned for C++0x. +// Our own version is declared deprecated, if std::copy_n is +// available. +#ifndef CGAL_CFG_NO_CPP0X_COPY_N +#ifndef CGAL_NO_DEPRECATED_CODE template -OutputIterator copy_n( InputIterator first, - Size n, - OutputIterator result) +CGAL_DEPRECATED OutputIterator copy_n( InputIterator first, Size n, OutputIterator result ) { // copies the first `n' items from `first' to `result'. Returns // the value of `result' after inserting the `n' items. @@ -49,7 +52,29 @@ OutputIterator copy_n( InputIterator first, } return result; } +#endif // CGAL_NO_DEPRECATED_CODE +#else +template +OutputIterator copy_n( InputIterator first, Size n, OutputIterator result ) +{ + // copies the first `n' items from `first' to `result'. Returns + // the value of `result' after inserting the `n' items. + while( n--) { + *result = *first; + first++; + result++; + } + return result; +} +#endif // CGAL_CFG_NO_CPP0X_COPY_N +namespace cpp0x { +#ifndef CGAL_CFG_NO_CPP0X_COPY_N + using std::copy_n; +#else + using CGAL::copy_n; +#endif +} // cpp0x // Not documented template inline diff --git a/STL_Extension/test/STL_Extension/test_stl_extension.cpp b/STL_Extension/test/STL_Extension/test_stl_extension.cpp index e4fd55710f4..1e635007171 100644 --- a/STL_Extension/test/STL_Extension/test_stl_extension.cpp +++ b/STL_Extension/test/STL_Extension/test_stl_extension.cpp @@ -9016,6 +9016,16 @@ void test_predecessor_successor() CGAL_assertion(successor(successor(V.begin())) == predecessor(V.end())); } +void test_copy_n() { + std::vector V; + for(int i = 0; i < 10; ++i) + V.push_back(i); + + std::vector V2(5); + cpp0x::copy_n(V.begin(), 5, V2.begin()); + + CGAL_assertion(std::equal(V2.begin(), V2.end(), V.begin())); +} int main() { init_global_data(); @@ -9038,6 +9048,7 @@ int main() { test_predecessor_successor(); clean_global_data(); test_tuple(); + test_copy_n(); return 0; } // EOF // diff --git a/Spatial_searching/demo/Spatial_searching/Qt3/spatial_searching.cpp b/Spatial_searching/demo/Spatial_searching/Qt3/spatial_searching.cpp index d8a65d7fd64..1a8ea5add72 100644 --- a/Spatial_searching/demo/Spatial_searching/Qt3/spatial_searching.cpp +++ b/Spatial_searching/demo/Spatial_searching/Qt3/spatial_searching.cpp @@ -171,7 +171,7 @@ private slots: typedef CGAL::Kd_tree Tree; std::list l, res; - CGAL::copy_n(vector_of_points.begin(), vector_of_points.size(), + CGAL::cpp0x::copy_n(vector_of_points.begin(), vector_of_points.size(), std::back_inserter(l)); std::cout << "construct tree with " << l.size() << " points" << std::endl; Tree d(l.begin(), l.end()); @@ -195,7 +195,7 @@ private slots: typedef CGAL::Kd_tree Tree; std::list l, res; - CGAL::copy_n(vector_of_points.begin(), vector_of_points.size(), + CGAL::cpp0x::copy_n(vector_of_points.begin(), vector_of_points.size(), std::back_inserter(l)); Tree d(l.begin(), l.end()); d.search( std::back_inserter( res ), exact_range); @@ -269,7 +269,7 @@ private slots: typedef CGAL::Kd_tree Tree; std::list l; - CGAL::copy_n(vector_of_points.begin(), vector_of_points.size(), + CGAL::cpp0x::copy_n(vector_of_points.begin(), vector_of_points.size(), std::back_inserter(l)); // Tree d(vector_of_points.begin(), vector_of_points.end(), tr); Neighbour_search::Tree d(l.begin(), l.end()); @@ -277,7 +277,7 @@ private slots: const int query_point_number=30; CGAL::Random_points_in_square_2 h( 1.0); std::vector query_points; - CGAL::copy_n( h, query_point_number, std::back_inserter(query_points)); + CGAL::cpp0x::copy_n( h, query_point_number, std::back_inserter(query_points)); std::vector nearest_neighbour; diff --git a/Spatial_searching/test/Spatial_searching/Building_kd_tree_with_ddim_points.cpp b/Spatial_searching/test/Spatial_searching/Building_kd_tree_with_ddim_points.cpp index 48f3ee6a1eb..61d06222cef 100644 --- a/Spatial_searching/test/Spatial_searching/Building_kd_tree_with_ddim_points.cpp +++ b/Spatial_searching/test/Spatial_searching/Building_kd_tree_with_ddim_points.cpp @@ -43,6 +43,7 @@ void run(const std::vector& points,const Point& query) boost::make_transform_iterator(points.begin(),Create_point_with_info()), boost::make_transform_iterator(points.end(),Create_point_with_info()) ); + o_tree.statistics(std::cout); typename K_search::Tree tree( @@ -97,7 +98,7 @@ int main() { std::vector points; Point_generator g(3); - CGAL::copy_n( g, N, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, N, std::back_inserter(points)); g++; Point query = *g; diff --git a/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp b/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp index 10a1250f5fb..cc38a1e7632 100644 --- a/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp +++ b/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp @@ -55,7 +55,7 @@ void run() // in a register with a distance in memory CGAL::Set_ieee_double_precision pfr; - CGAL::copy_n( g, 1000, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, 1000, std::back_inserter(points)); typename K_search::Tree t( boost::make_transform_iterator(points.begin(),Create_point_with_info()), diff --git a/Spatial_searching/test/Spatial_searching/Splitters.cpp b/Spatial_searching/test/Spatial_searching/Splitters.cpp index a27e35ebeea..56ccdb93fb6 100644 --- a/Spatial_searching/test/Spatial_searching/Splitters.cpp +++ b/Spatial_searching/test/Spatial_searching/Splitters.cpp @@ -91,7 +91,7 @@ main() { Vector points; Random_points g( 150.0); - CGAL::copy_n( g, 1000, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, 1000, std::back_inserter(points)); g++; Point query = *g; diff --git a/Triangulation_2/examples/Triangulation_2/hierarchy.cpp b/Triangulation_2/examples/Triangulation_2/hierarchy.cpp index 879fdb2cd73..677a7398240 100644 --- a/Triangulation_2/examples/Triangulation_2/hierarchy.cpp +++ b/Triangulation_2/examples/Triangulation_2/hierarchy.cpp @@ -21,7 +21,7 @@ int main( ) std::cout << "insertion of 1000 random points" << std::endl; Triangulation t; CGAL::Random_points_in_square_2 g(1.); - CGAL::copy_n( g, 1000, std::back_inserter(t)); + CGAL::cpp0x::copy_n( g, 1000, std::back_inserter(t)); //verbose mode of is_valid ; shows the number of vertices at each level std::cout << "The number of vertices at successive levels" << std::endl; diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_hierarchy_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_hierarchy_2.h index 0b1b5a8955e..7772ddfba27 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_hierarchy_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_hierarchy_2.h @@ -40,7 +40,7 @@ _test_cls_delaunay_hierarchy_2( const Dh & ) std::cout << " insertion removal of 1000 points" << std::endl; Delaunay_hierarchy dh; CGAL::Random_points_in_square_2 g(1.); - CGAL::copy_n( g, 1000, std::back_inserter(dh)); + CGAL::cpp0x::copy_n( g, 1000, std::back_inserter(dh)); dh.locate(Point(0.,0.)); diff --git a/Triangulation_3/demo/Triangulation_3/Scene.cpp b/Triangulation_3/demo/Triangulation_3/Scene.cpp index 8dae8c1aa8d..fe49f5d1b70 100644 --- a/Triangulation_3/demo/Triangulation_3/Scene.cpp +++ b/Triangulation_3/demo/Triangulation_3/Scene.cpp @@ -27,7 +27,7 @@ void Scene::generatePoints(int num) /* Insert them into the point list: */ /* 1. use CGAL's copy function --tested */ list pts; - CGAL::copy_n( pts_generator, num, std::back_inserter(pts) ); + CGAL::cpp0x::copy_n( pts_generator, num, std::back_inserter(pts) ); /* 2. use STL's function */ //for (int i=0; im_dt.number_of_vertices() == 0 ) { CGAL::Random_points_in_cube_3 pts_generator(1.0); - CGAL::copy_n( pts_generator, 100, std::back_inserter(m_incrementalPts) ); + CGAL::cpp0x::copy_n( pts_generator, 100, std::back_inserter(m_incrementalPts) ); } else { for(QList::iterator vit = m_pScene->m_vhArray.begin(); vit < m_pScene->m_vhArray.end(); ++vit) { From 9369f7ba93700dc94e3761f02e880b55b7f3f165 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 26 Aug 2011 14:47:45 +0000 Subject: [PATCH 35/64] Add "benchmark" to dont_submit We do not want "benchmark" in the releases. --- STL_Extension/dont_submit | 1 + 1 file changed, 1 insertion(+) create mode 100644 STL_Extension/dont_submit diff --git a/STL_Extension/dont_submit b/STL_Extension/dont_submit new file mode 100644 index 00000000000..d83a1b2ff5c --- /dev/null +++ b/STL_Extension/dont_submit @@ -0,0 +1 @@ +benchmark From 98b3de43660bbdef0276b3a1b6aec7f96f7d9de6 Mon Sep 17 00:00:00 2001 From: Sandhyaa Radhakrishnan Date: Fri, 26 Aug 2011 19:17:08 +0000 Subject: [PATCH 36/64] Benchmark program accepting 2 files --- .../Minkowski_sum_2/sum_by_decomposition.cpp | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp index 2cf46e4d500..f204e2c88ab 100644 --- a/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp +++ b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp @@ -20,26 +20,40 @@ int main (int argc, char * argv[]) { CGAL::Timer t_mink_sum; - - if (argc < 2) { - std::cerr << "Failed to open the input file." << std::endl; - return (1); - } - - std::ifstream in_file (argv[1]); - - if (! in_file.is_open()) + if (argc < 3) { - std::cerr << "Failed to open the input file." << std::endl; + std::cerr << "Usage: " << argv[0] + << " " + << std::endl; return (1); } - // Read the two polygons from the file and compute their Minkowski sum. + std::ifstream in_file1 (argv[1]); + + if (! in_file1.is_open()) + { + std::cerr << "Failed to open the input file 1." << std::endl; + return (1); + } + + // Read the two polygons from the files and compute their Minkowski sum. Polygon_2 P, Q; - in_file >> P >> Q; - in_file.close(); + in_file1 >> P; + in_file1.close(); + + std::ifstream in_file2 (argv[2]); + + if (! in_file2.is_open()) + { + std::cerr << "Failed to open the input file 2." << std::endl; + return (1); + } + + in_file2 >> Q; + + in_file2.close(); // Compute the Minkowski sum using the decomposition approach. CGAL::Small_side_angle_bisector_decomposition_2 ssab_decomp; From 810bc0343511d800624e3a8aa1ccb5813d372295 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 28 Aug 2011 09:58:15 +0000 Subject: [PATCH 37/64] Fixed ArrangementDirectionalXMonotoneTraits_2 concept --- .../Arr_dir_x_monotone_traits.tex | 203 ++++++++++++++---- 1 file changed, 160 insertions(+), 43 deletions(-) diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Arr_dir_x_monotone_traits.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Arr_dir_x_monotone_traits.tex index 5ea46fc3ee1..d96a3b72740 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Arr_dir_x_monotone_traits.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Arr_dir_x_monotone_traits.tex @@ -7,7 +7,7 @@ \begin{ccRefConcept}{ArrangementDirectionalXMonotoneTraits_2} \ccDefinition - +% =========== This concept refines the basic arrangement $x$-monotone traits concept. A model of this concept is able to handle \emph{directed} $x$-monotone curves that intersect in their interior. Namely, an instance of the @@ -16,8 +16,8 @@ that intersect in their interior. Namely, an instance of the (lexicographically smaller) endpoint and a \emph{right} endpoint. If the traits class is also a model of \ccc{ArrangementDirectionalXMonotoneTraits_2}, the $x$-monotone curve is -also required to have a direction, namely one of these two endpoint is -viewed as its \emph{source} and the other as its \emph{target}. +also required to have a direction, namely one of these two endpoint serves +as its \emph{source} and the other as its \emph{target}. \ccRefines \ccc{ArrangementXMonotoneTraits_2} @@ -29,51 +29,22 @@ viewed as its \emph{source} and the other as its \emph{target}. \ccThreeToTwo \ccNestedType{Compare_endpoints_xy_2} -{provides the operator~: \\ - \ccc{Comparison_result operator() (X_monotone_curve_2 c)} \\ - which accepts an input curve \ccc{c} and compare its source and target - point. It returns \ccc{SMALLER} if the curve is directed from left to right - (lexicographically --- i.e., in case of a vertical line segment, this means - it is directed upward), and \ccc{LARGER} if it is directed from right to - left.} +{models the concept \ccc{ArrDirectionalTraits::CompareEndpointsXy_2}.} \ccNestedType{Construct_opposite_2} -{provides the operator~: \\ - \ccc{X_monotone_curve_2 operator() (X_monotone_curve_2 c)} \\ - which accepts an $x$-monotone curve \ccc{c} and returns its opposite curve, - namely a curve whose graph is the same as \ccc{c}'s, and whose source and - target are swapped with respect to \ccc{c}'s source and target.} - -In addition, the two following functors, required by the concept -\ccc{ArrangementXMonotoneTraits_2} should operate as follows: +{models the concept \ccc{ArrDirectionalTraits::ConstructOpposite_2}.} \ccNestedType{Intersect_2} -{provides the operator (templated by the \ccc{OutputIterator} type)~: \\ - \ccc{OutputIterator operator() (X_monotone_curve_2 c1, X_monotone_curve_2 c2, - OutputIterator oi)} \\ - which computes the intersections of \ccc{c1} and \ccc{c2} and inserts them - {\sl in an ascending lexicographic $xy$-order} into the output iterator. - The value-type of \ccc{OutputIterator} is \ccc{CGAL::Object}, where each - \ccc{Object} either wraps a \ccc{pair} instance, which - represents an intersection point with its multiplicity (in case the - multiplicity is undefined or not known, it should be set to $0$) or an - \ccc{X_monotone_curve_2} instance, representing an overlapping subcurve of - \ccc{c1} and \ccc{c2}. In the latter case, if \ccc{c1} and \ccc{c2} have the - same direction, then the overlapping subcurves should also be directed the - same way; otherwise, they can be associated with an arbitrary direction. - The operator returns a past-the-end iterator for the output sequence.} +{models the concept \ccc{ArrDirectionalTraits::Intersect_2}.} \ccNestedType{Split_2} -{provides the operator~: \\ - \ccc{void operator() (X_monotone_curve_2 c, Point_2 p, - X_monotone_curve_2& c1, X_monotone_curve_2& c2)} \\ - which accepts an input curve \ccc{c} and a split point \ccc{p} in its - interior. It splits \ccc{c} at the split point into two subcurves \ccc{c1} - and \ccc{c2}, such that \ccc{p} is \ccc{c1}'s {\sl right} endpoint and - \ccc{c2}'s {\sl left} endpoint. The direction of \ccc{c} should be preserved: - in case \ccc{c} is directed from left to right then \ccc{p} becomes \ccc{c1}'s - target and \ccc{c2}'s source; otherwise, \ccc{p} becomes \ccc{c2}'s - target and \ccc{c1}'s source.} +{models the concept \ccc{ArrDirectionalTraits::Split_2}.} + +\ccNestedType{Are_mergeable_2} +{models the concept \ccc{ArrDirectionalTraits::AreMergeable_2}.} + +\ccNestedType{Merge_2} +{models the concept \ccc{ArrDirectionalTraits::Merge_2}.} \ccCreation \ccCreationVariable{traits} @@ -104,7 +75,9 @@ In addition, the two following functors, required by the concept \ccc{CGAL::Arr_non_caching_segment_traits_2} \\ \ccc{CGAL::Arr_circle_segment_traits_2} \\ \ccc{CGAL::Arr_conic_traits_2} \\ -\ccc{CGAL::Arr_rational_arc_traits_2} +\ccc{CGAL::Arr_rational_function_traits_2}\\ +\ccc{CGAL::Arr_Bezier_curve_traits_2}\\ +\ccc{CGAL::Arr_algebraic_segment_traits_2} \ccSeeAlso %========= @@ -115,3 +88,147 @@ In addition, the two following functors, required by the concept \end{ccRefConcept} \ccRefPageEnd + +%%%%%%%% Functors %%%%%%%% + +%%%%%%%% Intersect_2 +% ================== +\ccRefPageBegin +\begin{ccRefConcept}{ArrDirectionalTraits::Intersect_2} +\ccRefines{Functor} + +\ccHasModels\ccc{ArrangementDirectionalXMonotoneTraits_2::Intersect_2} + +\ccCreationVariable{fo} + +\ccMethod{Output_iterator operator()(ArrDirectionalTraits::X_monotone_curve_2 xc1, + ArrDirectionalTraits::X_monotone_curve_2 xc2, + Output_iterator& oi);} + {computes the intersections of \ccc{xc1} and \ccc{xc2} and + inserts them \emph{in an ascending lexicographic $xy$-order} into the + output iterator \ccc{oi}. The value-type of \ccc{Output_iterator} is + \ccc{CGAL::Object}, where each \ccc{Object} wraps either a + \ccc{pair} object, which + represents an intersection point with its multiplicity (in case the + multiplicity is undefined or unknown, it is set to $0$) or an + \ccc{ArrDirectionalTraits::X_monotone_curve_2} object, representing an + overlapping subcurve of \ccc{xc1} and \ccc{xc2}. In the latter case, + the overlapping subcurves are given the direction of \ccc{xc1} and + \ccc{xc2} if their directions are identical. Otherwise, the overlapping + subcurves are given an arbitrary direction. The operator returns a + past-the-end iterator for the output sequence.} +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% Split_2 +% ============== +\ccRefPageBegin +\begin{ccRefConcept}{ArrDirectionalTraits::Split_2} +\ccRefines{Functor} + +\ccHasModels\ccc{ArrangementDirectionalXMonotoneTraits_2::Split_2} + +\ccCreationVariable{fo} +\def\ccTagRmConstRefPair{\ccFalse}% +\ccMethod{void operator()(ArrDirectionalTraits::X_monotone_curve_2 xc, + ArrDirectionalTraits::Point_2 p, + ArrDirectionalTraits::X_monotone_curve_2& xc1, + ArrDirectionalTraits::X_monotone_curve_2& xc2);} + {accepts an input curve \ccc{xc} and a split point \ccc{p} in its + interior. It splits \ccc{xc} at the split point into two subcurves + \ccc{xc1} and \ccc{xc2}, such that \ccc{p} is \ccc{xc1}'s \emph{right} + endpoint and \ccc{xc2}'s \emph{left} endpoint. The direction of \ccc{xc} + is preserved. That is, in case \ccc{xc} is directed from left to right, + \ccc{p} becomes \ccc{xc1}'s target and \ccc{c2}'s source; + otherwise, \ccc{p} becomes \ccc{xc2}'s target and \ccc{xc1}'s source.}% +\ccTagDefaults +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% AreMergeable_2 +% ===================== +\ccRefPageBegin +\begin{ccRefConcept}{ArrDirectionalTraits::AreMergeable_2} +\ccRefines{Functor} + +\ccHasModels\ccc{ArrangementDirectionalXMonotoneTraits_2::Are_mergeable_2} + +\ccCreationVariable{fo} +\def\ccTagRmConstRefPair{\ccFalse}% +\ccMethod{bool operator()(ArrDirectionalTraits::X_monotone_curve_2 xc1, + ArrDirectionalTraits::X_monotone_curve_2 xc2);} + {accepts two $x$-monotone curves \ccc{xc1} and \ccc{xc2} and determines + whether they can be merged to form a single $x$-monotone curve. + \ccc{xc1} and \ccc{xc2} are mergeable if their underlying curves are + identical, they share a common endpoint, and they do not bend to form + a non-$x$-monotone curve. + \ccPrecond{The target point of \ccc{xc1} and the source point \ccc{xc2} + coincide or the source point of \ccc{xc2} and the target + point \ccc{xc2} coincide.}} +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% Merge_2 +% ============== +\ccRefPageBegin +\begin{ccRefConcept}{ArrDirectionalTraits::Merge_2} +\ccRefines{Functor} + +\ccHasModels\ccc{ArrangementDirectionalXMonotoneTraits_2::Merge_2} + +\ccCreationVariable{fo} +\def\ccTagRmConstRefPair{\ccFalse}% +\ccMethod{void operator()(ArrDirectionalTraits::X_monotone_curve_2 xc1, + ArrDirectionalTraits::X_monotone_curve_2 xc2, + ArrDirectionalTraits::X_monotone_curve_2& xc);} + {accepts two \emph{mergeable} $x$-monotone curves \ccc{xc1} and + \ccc{xc2} and asigns \ccc{xc} with the merged curve. If the target + point of \ccc{xc1} and the source point of \ccc{xc2} coincide; then + the source point of \ccc{xc1} and the target point of \ccc{xc2} become + the source and target points of \ccc{xc}, respectively. If the target + point of \ccc{xc2} and the source point of \ccc{xc1} coincide; then + the source point of \ccc{xc2} and the target point of \ccc{xc1} become + the source and target points of \ccc{xc}, respectively. + \ccPrecond{\ccc{are_mergeable_2}(\ccc{xc1}, \ccc{xc2}) is true.}} +\ccTagDefaults +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% CompareEndpointsXy_2 +% =========================== +\ccRefPageBegin +\begin{ccRefConcept}{ArrDirectionalTraits::CompareEndpointsXy_2} +\ccRefines{Functor} + +\ccHasModels\ccc{ArrangementDirectionalXMonotoneTraits_2::CompareEndpointsXy_2} + +\ccCreationVariable{fo} +\def\ccTagRmConstRefPair{\ccFalse}% +\ccMethod{Comparison_result operator()(ArrDirectionalTraits::X_monotone_curve_2 xc);} + {accepts an input curve \ccc{xc} and compares its source and target + points. It returns \ccc{SMALLER} if the curve is directed from + lexicographically left to right, and \ccc{LARGER} if it is directed + from lexicographically right to left.} + +\ccTagDefaults +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% ConstructOpposite_2 +% =========================== +\ccRefPageBegin +\begin{ccRefConcept}{ArrDirectionalTraits::ConstructOpposite_2} +\ccRefines{Functor} + +\ccHasModels\ccc{ArrangementDirectionalXMonotoneTraits_2::ConstructOpposite_2} + +\ccCreationVariable{fo} +\def\ccTagRmConstRefPair{\ccFalse}% +\ccMethod{ArrDirectionalTraits::X_monotone_curve_2 operator()(ArrDirectionalTraits::X_monotone_curve_2 xc);} + {accepts an $x$-monotone curve \ccc{xc} and returns its opposite curve, + namely a curve whose graph is the same as \ccc{xc}'s, and whose source and + target are swapped with respect to \ccc{xc}'s source and target.} + +\ccTagDefaults +\end{ccRefConcept} +\ccRefPageEnd From 4b3e1036864c4b90e697b8ff38d07fbddb850e61 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 28 Aug 2011 09:59:40 +0000 Subject: [PATCH 38/64] Fixed ArrangementXMonotoneTraits_2 and ArrangementDirectionalXMonotoneTraits_2 concepts --- .../Arr_x_monotone_traits.tex | 38 ++++--- .../include/CGAL/Arr_Bezier_curve_traits_2.h | 23 +++- .../CGAL/Arr_circle_segment_traits_2.h | 37 ++++-- .../include/CGAL/Arr_conic_traits_2.h | 29 +++-- .../include/CGAL/Arr_curve_data_traits_2.h | 3 + .../Arr_geodesic_arc_on_sphere_traits_2.h | 4 +- ..._great_circular_arc_on_cylinder_traits_2.h | 8 +- .../include/CGAL/Arr_linear_traits_2.h | 52 +++++---- .../CGAL/Arr_non_caching_segment_traits_2.h | 106 ++++++++++------- .../include/CGAL/Arr_polycurve_traits_2.h | 92 ++++++++------- .../include/CGAL/Arr_polyline_traits_2.h | 62 ++++++---- .../include/CGAL/Arr_rational_arc_traits_2.h | 26 ++++- .../CGAL/Arr_rational_function_traits_2.h | 24 +++- .../include/CGAL/Arr_segment_traits_2.h | 107 ++++++++++-------- 14 files changed, 376 insertions(+), 235 deletions(-) diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_x_monotone_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_x_monotone_traits.tex index 5e1d7833b44..a1db1051a5a 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_x_monotone_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_x_monotone_traits.tex @@ -55,9 +55,9 @@ supported, the \ccc{Has_merge_category} tag should be defined as \ccThree{Construct_x_monotone_curve_2~~~}{}{\hspace*{7cm}} \ccThreeToTwo -\ccCreationVariable{traits} % \ccCreation -%========== +\ccCreationVariable{traits} +%========================== \ccHeading{Accessing Functor Objects} % =================================== @@ -109,9 +109,9 @@ the \ccc{Has_merge_category} tag should be defined as \ccc{Tag_true} (and \ccCreationVariable{fo} -\ccMethod{Output_iterator intersect(ArrTraits::X_monotone_curve_2 xc1, - ArrTraits::X_monotone_curve_2 xc2, - Output_iterator& oi);}{% +\ccMethod{Output_iterator operator()(ArrTraits::X_monotone_curve_2 xc1, + ArrTraits::X_monotone_curve_2 xc2, + Output_iterator& oi);}{% computes the intersections of \ccc{xc1} and \ccc{xc2} and inserts them {\sl in an ascending lexicographic $xy$-order} into the output iterator \ccc{oi}. The value-type of \ccc{Output_iterator} is @@ -136,10 +136,10 @@ the \ccc{Has_merge_category} tag should be defined as \ccc{Tag_true} (and \ccCreationVariable{fo} \def\ccTagRmConstRefPair{\ccFalse}% -\ccMethod{void split(ArrTraits::X_monotone_curve_2 xc, - ArrTraits::Point_2 p, - ArrTraits::X_monotone_curve_2& xc1, - ArrTraits::X_monotone_curve_2& xc2);}{% +\ccMethod{void operator()(ArrTraits::X_monotone_curve_2 xc, + ArrTraits::Point_2 p, + ArrTraits::X_monotone_curve_2& xc1, + ArrTraits::X_monotone_curve_2& xc2);}{% accepts an input curve \ccc{xc} and a split point \ccc{p} in its interior. It splits \ccc{xc} at the split point into two subcurves \ccc{xc1} and \ccc{xc2}, such that \ccc{p} is \ccc{xc1}'s {\sl right} endpoint and @@ -158,11 +158,14 @@ the \ccc{Has_merge_category} tag should be defined as \ccc{Tag_true} (and \ccCreationVariable{fo} -\ccMethod{bool are_mergeable(ArrTraits::X_monotone_curve_2 xc1, - ArrTraits::X_monotone_curve_2 xc2);}{% - accepts two $x$-monotone curves \ccc{xc1} and \ccc{xc2} that share - a common endpoint, and determines whether they can be merged to form - a single continuous $x$-monotone curve.} +\ccMethod{bool operator()(ArrTraits::X_monotone_curve_2 xc1, + ArrTraits::X_monotone_curve_2 xc2);}{% + accepts two $x$-monotone curves \ccc{xc1} and \ccc{xc2} and determines + whether they can be merged to form a single $x$-monotone curve. + \ccc{xc1} and \ccc{xc2} are mergeable if their underlying curves are + identical, they share a common endpoint, and they do not bend to form + a non-$x$-monotone curve.} + % \ccPrecond{\ccc{xc1} and \ccc{xc2} share a common endpoint.}} \end{ccRefConcept} \ccRefPageEnd @@ -179,9 +182,10 @@ the \ccc{Has_merge_category} tag should be defined as \ccc{Tag_true} (and \def\ccTagRmConstRefPair{\ccFalse}% \ccMethod{void merge(ArrTraits::X_monotone_curve_2 xc1, ArrTraits::X_monotone_curve_2 xc2, - ArrTraits::X_monotone_curve_2& xc);}{% - accepts two {\em mergeable} $x$-monotone curves \ccc{xc1} and \ccc{xc2} - (see definition above), and sets\ccc{xc} to be the merged curve.} + ArrTraits::X_monotone_curve_2& xc);}{% + accepts two \emph{mergeable} $x$-monotone curves \ccc{xc1} and \ccc{xc2} + and asigns \ccc{xc} with the merged curve. + \ccPrecond{\ccc{are_mergeable_2}(\ccc{xc1}, \ccc{xc2}) is true.}} \ccTagDefaults \end{ccRefConcept} \ccRefPageEnd diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h index bd62bb16fb0..38a7a5efff9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h @@ -716,23 +716,38 @@ public: } /*! \class Merge_2 - * The Merge_2 functor. + * A functor that merges two x-monotone arcs into one. */ class Merge_2 { + typedef Arr_Bezier_curve_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_Bezier_curve_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve (segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same conic curve and share a common endpoint. + * \pre The two curves are mergeable. */ void operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { + CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1)); + c = cv1.merge (cv2); return; } @@ -741,7 +756,7 @@ public: /*! Get a Merge_2 functor object. */ Merge_2 merge_2_object () const { - return Merge_2(); + return Merge_2(this); } //@} diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h index 4ebe902f307..d831d4021f0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h @@ -36,7 +36,7 @@ namespace CGAL { /*! \class * A traits class for maintaining an arrangement of circles. */ -template +template class Arr_circle_segment_traits_2 { public: @@ -46,12 +46,12 @@ public: typedef typename Kernel::Point_2 Rational_point_2; typedef typename Kernel::Segment_2 Rational_segment_2; typedef typename Kernel::Circle_2 Rational_circle_2; - typedef _One_root_point_2 Point_2; + typedef _One_root_point_2 Point_2; typedef typename Point_2::CoordNT CoordNT; - typedef _Circle_segment_2 Curve_2; - typedef _X_monotone_circle_segment_2 X_monotone_curve_2; + typedef _Circle_segment_2 Curve_2; + typedef _X_monotone_circle_segment_2 X_monotone_curve_2; typedef unsigned int Multiplicity; - typedef Arr_circle_segment_traits_2 Self; + typedef Arr_circle_segment_traits_2 Self; // Category tags: typedef Tag_true Has_left_category; @@ -385,7 +385,7 @@ public: class Make_x_monotone_2 { private: - typedef Arr_circle_segment_traits_2 Self; + typedef Arr_circle_segment_traits_2 Self; bool m_use_cache; @@ -608,32 +608,47 @@ public: return Are_mergeable_2(); } + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { + protected: + typedef Arr_circle_segment_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_circle_segment_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve. * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same conic curve and share a common endpoint. + * \pre The two curves are mergeable. */ void operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { + CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1)); + c = cv1; c.merge (cv2); - - return; } }; /*! Get a Merge_2 functor object. */ Merge_2 merge_2_object () const { - return Merge_2(); + return Merge_2(this); } class Compare_endpoints_xy_2 diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h index 3a216f962ae..517bdd0e198 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h @@ -660,32 +660,47 @@ public: return Are_mergeable_2(); } + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { + protected: + typedef Arr_conic_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_conic_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve (segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same conic curve and share a common endpoint. + * \pre The two curves are mergeable. */ void operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { + CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1)); + c = cv1; c.merge (cv2); - - return; } }; - /*! Get a Merge_2 functor object. */ - Merge_2 merge_2_object () const + /*! Obtain a Merge_2 functor object. */ + Merge_2 merge_2_object() const { - return Merge_2(); + return Merge_2(this); } //@} diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h index e98084cb6ba..99185c83a22 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h @@ -338,6 +338,9 @@ public: return Are_mergeable_2 (this); } + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { private: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h index 1b0e4000e3d..34f2e3fc4e7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h @@ -1934,9 +1934,7 @@ public: * \param xc1 the first curve. * \param xc2 the second curve. * \param xc Output: the merged curve. - * \pre the two curves are mergeable. That is, they are supported by the - * same plane or oposite planes and share a common endpoint that is - * not on the discontinuity arc. + * \pre the two curves are mergeable. */ void operator()(const X_monotone_curve_2& xc1, const X_monotone_curve_2& xc2, diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_great_circular_arc_on_cylinder_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_great_circular_arc_on_cylinder_traits_2.h index 2af862ddff7..23e8d3098f9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_great_circular_arc_on_cylinder_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_great_circular_arc_on_cylinder_traits_2.h @@ -2117,7 +2117,9 @@ public: Are_mergeable_2 are_mergeable_2_object() const { return Are_mergeable_2(this); } - /*! A functor that merges two x-monotone arcs into one */ + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { protected: typedef Arr_great_circular_arc_on_cylinder_traits_2 Traits; @@ -2137,9 +2139,7 @@ public: * \param xc1 the first curve. * \param xc2 the second curve. * \param xc Output: the merged curve. - * \pre the two curves are mergeable. That is, they are supported by the - * same plane or oposite planes and share a common endpoint that is - * not on the discontinuity arc. + * \pre the two curves are mergeable. */ void operator()(const X_monotone_curve_2 & xc1, const X_monotone_curve_2 & xc2, diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h index a7e81a049e6..43f8e8ca0fe 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h @@ -1511,68 +1511,72 @@ public: return Are_mergeable_2(); } + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { + protected: + typedef Arr_linear_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_linear_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve (segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same line and share a common endpoint. + * \pre The two curves are mergeable. */ void operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { - CGAL_precondition (! cv1.is_degenerate()); - CGAL_precondition (! cv2.is_degenerate()); + CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1)); - Kernel kernel; - typename Kernel::Equal_2 equal = kernel.equal_2_object(); + CGAL_precondition(!cv1.is_degenerate()); + CGAL_precondition(!cv2.is_degenerate()); - CGAL_precondition - (equal (cv1.supp_line(), - cv2.supp_line()) || - equal (cv1.supp_line(), - kernel.construct_opposite_line_2_object()(cv2.supp_line()))); + Equal_2 equal = m_traits->equal_2_object(); // Check which curve extends to the right of the other. if (cv1.has_right() && cv2.has_left() && - equal (cv1.right(), cv2.left())) + equal(cv1.right(), cv2.left())) { // cv2 extends cv1 to the right. c = cv1; if (cv2.has_right()) - c.set_right (cv2.right()); + c.set_right(cv2.right()); else c.set_right(); // Unbounded endpoint. } - else - { - CGAL_precondition (cv2.has_right() && cv1.has_left() && - equal (cv2.right(), cv1.left())); + else { + CGAL_precondition(cv2.has_right() && cv1.has_left() && + equal(cv2.right(), cv1.left())); // cv1 extends cv2 to the right. c = cv2; if (cv1.has_right()) - c.set_right (cv1.right()); + c.set_right(cv1.right()); else c.set_right(); // Unbounded endpoint. } - - return; } }; /*! Obtain a Merge_2 functor object. */ - Merge_2 merge_2_object () const - { - return Merge_2(); - } + Merge_2 merge_2_object () const { return Merge_2(this); } //@} /// \name Functor definitions for the landmarks point-location strategy. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h index 78a565c5b3a..fa2fc1fbe06 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h @@ -283,88 +283,106 @@ public: /*! \class * A functor for testing whether two segments are mergeable. */ - class Are_mergeable_2 - { + class Are_mergeable_2 { + protected: + typedef Arr_non_caching_segment_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Are_mergeable_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_non_caching_segment_traits_2; + public: /*! * Check whether it is possible to merge two given x-monotone curves. * \param cv1 The first curve. * \param cv2 The second curve. - * \return (true) if the two segments are mergeable - if they are supported - * by the same line and share a common endpoint; (false) otherwise. + * \return (true) if the two curves are mergeable, that is, if they are + * supported by the same line; (false) otherwise. + * \pre cv1 and cv2 share a common endpoint. */ bool operator()(const X_monotone_curve_2 & cv1, const X_monotone_curve_2 & cv2) const { - Base base; - Equal_2 equal = base.equal_2_object(); - Construct_min_vertex_2 min_vertex = base.construct_min_vertex_2_object(); - Construct_max_vertex_2 max_vertex = base.construct_max_vertex_2_object(); - + const Base* base = m_traits; + Equal_2 equal = base->equal_2_object(); + Construct_min_vertex_2 min_vertex = base->construct_min_vertex_2_object(); + Construct_max_vertex_2 max_vertex = base->construct_max_vertex_2_object(); + if (!equal(max_vertex(cv1), min_vertex(cv2)) && + !equal(max_vertex(cv2), min_vertex(cv1))) + return false; + // Check if the two curves have the same supporting line. - if (base.compare_slope_2_object()(cv1,cv2) != EQUAL) - return (false); - - // Check if the left endpoint of one curve is the right endpoint of the - // other. - return (equal(max_vertex(cv1), min_vertex(cv2)) || - equal(max_vertex(cv2), min_vertex(cv1))); + return (base->compare_slope_2_object()(cv1, cv2) == EQUAL); } }; /*! Obtain an Are_mergeable_2 functor object */ Are_mergeable_2 are_mergeable_2_object() const - { - return Are_mergeable_2(); - } + { return Are_mergeable_2(this); } - /*! \class - * A functor for merging two segments into one. + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. */ - class Merge_2 - { + class Merge_2 { + protected: + typedef Arr_non_caching_segment_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_non_caching_segment_traits_2; + public: /*! * Merge two given segments into a single segment. * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same line and share a common endpoint. + * \pre The two curves are mergeable. */ void operator()(const X_monotone_curve_2 & cv1, const X_monotone_curve_2 & cv2, X_monotone_curve_2 & c) const { - Base base; - CGAL_precondition(base.compare_slope_2_object()(cv2, cv1) == EQUAL); - Equal_2 equal = base.equal_2_object(); - Construct_min_vertex_2 min_vertex = base.construct_min_vertex_2_object(); - Construct_max_vertex_2 max_vertex = base.construct_max_vertex_2_object(); + CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1)); + + const Base* base = m_traits; + Equal_2 equal = base->equal_2_object(); + Construct_min_vertex_2 min_vertex = base->construct_min_vertex_2_object(); + Construct_max_vertex_2 max_vertex = base->construct_max_vertex_2_object(); // Check which curve extends to the right of the other. - const Point_2 & right1 = max_vertex(cv1); - const Point_2 & left2 = min_vertex(cv2); - const Point_2 & left1 = min_vertex(cv1); - const Point_2 & right2 = max_vertex(cv2); + const Point_2& left1 = min_vertex(cv1); + const Point_2& right1 = max_vertex(cv1); + const Point_2& left2 = min_vertex(cv2); + const Point_2& right2 = max_vertex(cv2); - if (!equal(right1, left2)) { - // cv1 extends cv2 to the right. - CGAL_precondition(base.equal_2_object()(right2, left1)); - c = base.construct_segment_2_object()(left2, right1); + if (equal(right1, left2)) { + // cv2 extends cv1 to the right. + c = base->construct_segment_2_object()(left1, right2); return; } - // cv2 extends cv1 to the right. - c = base.construct_segment_2_object()(left1, right2); + // cv1 extends cv2 to the right. + CGAL_precondition(equal(right2, left1)); + + c = base->construct_segment_2_object()(left2, right1); } }; /*! Obtain a Merge_2 functor object */ - Merge_2 merge_2_object() const - { - return Merge_2(); - } + Merge_2 merge_2_object() const { return Merge_2(this); } //@} //! \name Functor definitions for the Boolean set-operations. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h index 31a8b33e86d..64b4df00d9d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h @@ -18,23 +18,23 @@ // Author(s) : Efi Fogel // Ron Wein -#ifndef CGAL_ARR_POLYLINE_TRAITS_2_H -#define CGAL_ARR_POLYLINE_TRAITS_2_H +#ifndef CGAL_ARR_POLYCURVE_TRAITS_2_H +#define CGAL_ARR_POLYCURVE_TRAITS_2_H /*! \file - * The traits-class for the linear piece-wiese(polyline) type of curves of the + * The traits-class for the piece-wise type of curves of the * arrangement package. */ #include #include #include -#include +#include namespace CGAL { template -class Arr_polyline_traits_2 { +class Arr_polycurve_traits_2 { public: typedef T_SegmentTraits_2 Segment_traits_2; @@ -49,7 +49,7 @@ public: typedef Arr_oblivious_side_tag Right_side_category; private: - typedef Arr_polyline_traits_2 Self; + typedef Arr_polycurve_traits_2 Self; // Data members: Segment_traits_2 m_seg_traits; // The base segment-traits class. @@ -59,11 +59,16 @@ private: public: /*! Default constructor */ - Arr_polyline_traits_2() : m_seg_traits() {} + Arr_polycurve_traits_2() : m_seg_traits() {} + + /*! Obtain the segment traits. + * \return the segment traits. + */ + const Segment_traits_2* segment_traits_2() const { return &m_seg_traits; } /// \name Types and functors inherited from the base segment traits. //@{ - + // Traits types: typedef typename Segment_traits_2::Point_2 Point_2; typedef typename Segment_traits_2::Curve_2 Segment_2; @@ -183,7 +188,7 @@ public: class Compare_y_at_x_2 { private: - typedef Arr_polyline_traits_2 Self; + typedef Arr_polycurve_traits_2 Self; const Segment_traits_2 * m_seg_traits; public: @@ -221,7 +226,7 @@ public: class Compare_y_at_x_left_2 { private: - typedef Arr_polyline_traits_2 Self; + typedef Arr_polycurve_traits_2 Self; const Segment_traits_2 * m_seg_traits; @@ -267,7 +272,7 @@ public: class Compare_y_at_x_right_2 { private: - typedef Arr_polyline_traits_2 Self; + typedef Arr_polycurve_traits_2 Self; const Segment_traits_2 * m_seg_traits; public: @@ -521,7 +526,7 @@ public: class Split_2 { private: - typedef Arr_polyline_traits_2 Self; + typedef Arr_polycurve_traits_2 Self; const Segment_traits_2 * m_seg_traits; @@ -598,7 +603,7 @@ public: class Intersect_2 { private: - typedef Arr_polyline_traits_2 Self; + typedef Arr_polycurve_traits_2 Self; const Segment_traits_2 * m_seg_traits; public: @@ -842,47 +847,59 @@ public: return Are_mergeable_2(&m_seg_traits); } + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { - private: - const Segment_traits_2 * m_seg_traits; + protected: + typedef Arr_polycurve_traits_2 Traits; - public: - /*! Constructor. */ - Merge_2(const Segment_traits_2 * traits) : m_seg_traits(traits) {} + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + friend class Arr_polycurve_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve(segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable. That is, they share a common - * endpoint. + * \pre The two curves are mergeable. */ void operator()(const X_monotone_curve_2 & cv1, const X_monotone_curve_2 & cv2, X_monotone_curve_2 & c) const { - typename Segment_traits_2::Construct_min_vertex_2 min_vertex = - m_seg_traits->construct_min_vertex_2_object(); - typename Segment_traits_2::Construct_max_vertex_2 max_vertex = - m_seg_traits->construct_max_vertex_2_object(); - typename Segment_traits_2::Equal_2 equal = m_seg_traits->equal_2_object(); + CGAL_precondition(m_traits->are_mergeable_2_object()(cv1, cv2)); + + const Segment_traits_2* seg_traits = m_traits->segment_traits_2(); + + Construct_min_vertex_2 min_vertex = + m_traits->construct_min_vertex_2_object(); + Construct_max_vertex_2 max_vertex = + m_traits->construct_max_vertex_2_object(); + Equal_2 equal = m_traits->equal_2_object(); const unsigned int n1 = cv1.size(); const unsigned int n2 = cv2.size(); unsigned int i; c.clear(); - if (equal(max_vertex(cv1[n1 - 1]), min_vertex(cv2[0]))) { + if (equal(max_vertex(cv1), min_vertex(cv2))) { // cv2 extends cv1 to the right: for (i = 0; i < n1 - 1; ++i) c.push_back(cv1[i]); - // Try to merge tthe to contiguous line segments: - if (m_seg_traits->are_mergeable_2_object()(cv1[n1 - 1], cv2[0])) { + // Try to merge the two contiguous line segments: + if (seg_traits->are_mergeable_2_object()(cv1[n1 - 1], cv2[0])) { Segment_2 seg; - m_seg_traits->merge_2_object()(cv1[n1 - 1], cv2[0], seg); + seg_traits->merge_2_object()(cv1[n1 - 1], cv2[0], seg); c.push_back(seg); } else { c.push_back(cv1[n1 - 1]); @@ -891,15 +908,17 @@ public: for (i = 1; i < n2; ++i) c.push_back(cv2[i]); - } else if (equal(max_vertex(cv2[n2 - 1]), min_vertex(cv1[0]))) { + } else { + CGAL_precondition(equal(max_vertex(cv2), min_vertex(cv1))); + // cv1 extends cv2 to the right: for (i = 0; i < n2 - 1; ++i) c.push_back(cv2[i]); - // Try to merge tthe to contiguous line segments: - if (m_seg_traits->are_mergeable_2_object()(cv2[n2 - 1], cv1[0])) { + // Try to merge the two contiguous line segments: + if (seg_traits->are_mergeable_2_object()(cv2[n2 - 1], cv1[0])) { Segment_2 seg; - m_seg_traits->merge_2_object()(cv2[n2 - 1], cv1[0], seg); + seg_traits->merge_2_object()(cv2[n2 - 1], cv1[0], seg); c.push_back(seg); } else { c.push_back(cv2[n2 - 1]); @@ -908,17 +927,12 @@ public: for (i = 1; i < n1; ++i) c.push_back(cv1[i]); - } else { - CGAL_precondition_msg(false, "The curves are not mergeable."); } } }; /*! Get a Merge_2 functor object. */ - Merge_2 merge_2_object() const - { - return Merge_2(&m_seg_traits); - } + Merge_2 merge_2_object() const { return Merge_2(this); } ///@} /// \name Functor definitions for the landmarks point-location strategy. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h index d520158dbf4..356f4b1bd67 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h @@ -61,6 +61,11 @@ public: /*! Default constructor */ Arr_polyline_traits_2() : m_seg_traits() {} + /*! Obtain the segment traits. + * \return the segment traits. + */ + const Segment_traits_2* segment_traits_2() const { return &m_seg_traits; } + /// \name Types and functors inherited from the base segment traits. //@{ @@ -842,47 +847,59 @@ public: return Are_mergeable_2(&m_seg_traits); } + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { - private: - const Segment_traits_2 * m_seg_traits; + protected: + typedef Arr_polyline_traits_2 Traits; - public: - /*! Constructor. */ - Merge_2(const Segment_traits_2 * traits) : m_seg_traits(traits) {} + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + friend class Arr_polyline_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve(segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable. That is, they share a common - * endpoint. + * \pre The two curves are mergeable. */ void operator()(const X_monotone_curve_2 & cv1, const X_monotone_curve_2 & cv2, X_monotone_curve_2 & c) const { - typename Segment_traits_2::Construct_min_vertex_2 min_vertex = - m_seg_traits->construct_min_vertex_2_object(); - typename Segment_traits_2::Construct_max_vertex_2 max_vertex = - m_seg_traits->construct_max_vertex_2_object(); - typename Segment_traits_2::Equal_2 equal = m_seg_traits->equal_2_object(); + CGAL_precondition(m_traits->are_mergeable_2_object()(cv1, cv2)); + + const Segment_traits_2* seg_traits = m_traits->segment_traits_2(); + + Construct_min_vertex_2 min_vertex = + m_traits->construct_min_vertex_2_object(); + Construct_max_vertex_2 max_vertex = + m_traits->construct_max_vertex_2_object(); + Equal_2 equal = m_traits->equal_2_object(); const unsigned int n1 = cv1.size(); const unsigned int n2 = cv2.size(); unsigned int i; c.clear(); - if (equal(max_vertex(cv1[n1 - 1]), min_vertex(cv2[0]))) { + if (equal(max_vertex(cv1), min_vertex(cv2))) { // cv2 extends cv1 to the right: for (i = 0; i < n1 - 1; ++i) c.push_back(cv1[i]); // Try to merge tthe to contiguous line segments: - if (m_seg_traits->are_mergeable_2_object()(cv1[n1 - 1], cv2[0])) { + if (seg_traits->are_mergeable_2_object()(cv1[n1 - 1], cv2[0])) { Segment_2 seg; - m_seg_traits->merge_2_object()(cv1[n1 - 1], cv2[0], seg); + seg_traits->merge_2_object()(cv1[n1 - 1], cv2[0], seg); c.push_back(seg); } else { c.push_back(cv1[n1 - 1]); @@ -891,15 +908,17 @@ public: for (i = 1; i < n2; ++i) c.push_back(cv2[i]); - } else if (equal(max_vertex(cv2[n2 - 1]), min_vertex(cv1[0]))) { + } else { + CGAL_precondition(equal(max_vertex(cv2), min_vertex(cv1))); + // cv1 extends cv2 to the right: for (i = 0; i < n2 - 1; ++i) c.push_back(cv2[i]); // Try to merge tthe to contiguous line segments: - if (m_seg_traits->are_mergeable_2_object()(cv2[n2 - 1], cv1[0])) { + if (seg_traits->are_mergeable_2_object()(cv2[n2 - 1], cv1[0])) { Segment_2 seg; - m_seg_traits->merge_2_object()(cv2[n2 - 1], cv1[0], seg); + seg_traits->merge_2_object()(cv2[n2 - 1], cv1[0], seg); c.push_back(seg); } else { c.push_back(cv2[n2 - 1]); @@ -908,17 +927,12 @@ public: for (i = 1; i < n1; ++i) c.push_back(cv1[i]); - } else { - CGAL_precondition_msg(false, "The curves are not mergeable."); } } }; /*! Get a Merge_2 functor object. */ - Merge_2 merge_2_object() const - { - return Merge_2(&m_seg_traits); - } + Merge_2 merge_2_object() const { return Merge_2(this); } ///@} /// \name Functor definitions for the landmarks point-location strategy. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rational_arc_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_rational_arc_traits_2.h index d88baa23cea..5404d208b39 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rational_arc_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rational_arc_traits_2.h @@ -505,33 +505,47 @@ public: return Are_mergeable_2(); } - /*! A functor that merges two curves into one. */ + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { + protected: + typedef Arr_rational_arc_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_rational_arc_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve (segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same conic curve and share a common endpoint. + * \pre The two curves are mergeable. */ void operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { + CGAL_precondition(m_traits->are_mergeable_2_object()(cv1, cv2)); + c = cv1; c.merge (cv2); - - return; } }; /*! Obtain a Merge_2 functor object. */ Merge_2 merge_2_object () const { - return Merge_2(); + return Merge_2(this); } //@} diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h index a16a60a5358..074ee5e9b82 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h @@ -934,22 +934,38 @@ public: return Are_mergeable_2(); } - /*! A functor that merges two curves into one. */ + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { + protected: + typedef Arr_rational_function_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_rational_function_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve (segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same conic curve and share a common endpoint. + * \pre The two curves are mergeable. */ void operator()(const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { + CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1)); + c = cv1; c.merge(cv2); } @@ -958,7 +974,7 @@ public: /*! Obtain a Merge_2 functor object. */ Merge_2 merge_2_object() const { - return Merge_2(); + return Merge_2(this); } //@} diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h index f3abc0fb63e..e6f8ea1aa8b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h @@ -849,89 +849,100 @@ public: return Intersect_2(); } - class Are_mergeable_2 - { + class Are_mergeable_2 { + protected: + typedef Arr_segment_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Are_mergeable_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_segment_traits_2; + public: /*! * Check whether it is possible to merge two given x-monotone curves. * \param cv1 The first curve. * \param cv2 The second curve. - * \return (true) if the two curves are mergeable - if they are supported - * by the same line and share a common endpoint; (false) otherwise. + * \return (true) if the two curves are mergeable, that is, if they are + * supported by the same line; (false) otherwise. + * \pre cv1 and cv2 share a common endpoint. */ bool operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2) const { - Kernel kernel; - typename Kernel::Equal_2 equal = kernel.equal_2_object(); - - // Check if the two curves have the same supporting line. - if (! equal (cv1.line(), cv2.line()) && - ! equal (cv1.line(), - kernel.construct_opposite_line_2_object() (cv2.line()))) - return (false); - - // Check if the left endpoint of one curve is the right endpoint of the - // other. - return (equal (cv1.right(), cv2.left()) || - equal (cv2.right(), cv1.left())); + if (!m_traits->equal_2_object()(cv1.right(), cv2.left()) && + !m_traits->equal_2_object()(cv2.right(), cv1.left())) + return false; + + // Check whether the two curves have the same supporting line. + const Kernel* kernel = m_traits; + typename Kernel::Equal_2 equal = kernel->equal_2_object(); + return (equal(cv1.line(), cv2.line()) || + equal(cv1.line(), + kernel->construct_opposite_line_2_object()(cv2.line()))); } }; /*! Get an Are_mergeable_2 functor object. */ - Are_mergeable_2 are_mergeable_2_object () const - { - return Are_mergeable_2(); - } + Are_mergeable_2 are_mergeable_2_object() const + { return Are_mergeable_2(this); } - class Merge_2 - { + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ + class Merge_2 { + protected: + typedef Arr_segment_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_segment_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve (segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same line and share a common endpoint. + * \pre The two curves are mergeable. */ - void operator() (const X_monotone_curve_2& cv1, - const X_monotone_curve_2& cv2, - X_monotone_curve_2& c) const + void operator()(const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2, + X_monotone_curve_2& c) const { - Kernel kernel; - typename Kernel::Equal_2 equal = kernel.equal_2_object(); - - CGAL_precondition - (equal (cv1.line(), cv2.line()) || - equal (cv1.line(), - kernel.construct_opposite_line_2_object() (cv2.line()))); + CGAL_precondition(m_traits->are_mergeable_2_object()(cv1, cv2)); + Equal_2 equal = m_traits->equal_2_object(); + // Check which curve extends to the right of the other. - if (equal (cv1.right(), cv2.left())) - { + if (equal(cv1.right(), cv2.left())) { // cv2 extends cv1 to the right. c = cv1; - c.set_right (cv2.right()); + c.set_right(cv2.right()); } - else - { - CGAL_precondition (equal (cv2.right(), cv1.left())); + else { + CGAL_precondition(equal(cv2.right(), cv1.left())); // cv1 extends cv2 to the right. c = cv2; - c.set_right (cv1.right()); + c.set_right(cv1.right()); } - - return; } }; /*! Get a Merge_2 functor object. */ - Merge_2 merge_2_object () const - { - return Merge_2(); - } + Merge_2 merge_2_object () const { return Merge_2(this); } //@} /// \name Functor definitions for the landmarks point-location strategy. From da450a9f6142bc455896c5c27bfbef5e2adf6d7b Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Sun, 28 Aug 2011 10:20:31 +0000 Subject: [PATCH 39/64] Fixed ArrangementDirectionalXMonotoneTraits_2 concept --- .../Arr_Bezier_traits.tex | 11 +++++- .../Arr_circle_segment_traits.tex | 8 +++- .../Arr_conic_traits.tex | 11 +++++- .../Arr_non_caching_segment_traits.tex | 13 +++++-- .../Arr_rational_function_traits.tex | 6 +++ .../Arr_segment_traits.tex | 39 +++++++++++-------- 6 files changed, 64 insertions(+), 24 deletions(-) diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_Bezier_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_Bezier_traits.tex index 4ac3e0c109d..b385c0d4c9a 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_Bezier_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_Bezier_traits.tex @@ -52,11 +52,18 @@ parameter, with \ccc{Cartesian} and respectively. The number types in this case are provided by the {\sc Core} library, with its ability to exactly represent simple algebraic numbers. +While \ccRefName{} models the concept +\ccc{ArrangementDirectionalXMonotoneTraits_2}, the implementation of +the \ccc{Arr_mergeable_2} operation does not enforce the input curves +to have the same direction as a precondition. Moreover, \ccRefName{} +supports the merging of curves of opposite directions. + \ccInclude{CGAL/Arr_Bezier_curve_traits_2.h} \ccIsModel - \ccc{ArrangementTraits_2} - + \ccc{ArrangementTraits_2}\\ + \ccc{ArrangementDirectionalXMonotoneTraits_2} + \ccTypes %------- diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_circle_segment_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_circle_segment_traits.tex index 5039dc482c0..9e7b559787b 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_circle_segment_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_circle_segment_traits.tex @@ -37,11 +37,17 @@ enables efficient comparison among different extensions. For more details see the documentation of \ccRefIdfierPage{CGAL::Sqrt_extension}\\ +While \ccRefName{} models the concept +\ccc{ArrangementDirectionalXMonotoneTraits_2}, the implementation of +the \ccc{Arr_mergeable_2} operation does not enforce the input curves +to have the same direction as a precondition. Moreover, \ccRefName{} +supports the merging of curves of opposite directions. \ccInclude{CGAL/Arr_circle_segment_traits_2.h} \ccIsModel - \ccc{ArrangementTraits_2} + \ccc{ArrangementTraits_2}\\ + \ccc{ArrangementDirectionalXMonotoneTraits_2} \subsection*{Class Arr\_circle\_segment\_traits\_2$<$Kernel$>$::Point\_2} diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_conic_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_conic_traits.tex index bda7e8478c6..e36ec04eeb0 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_conic_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_conic_traits.tex @@ -75,11 +75,18 @@ ability to exactly represent simple algebraic numbers. The traits class inherits its point type from \ccc{AlgKernel::Point_2}, and defines a curve and $x$-monotone curve types, as detailed below. +While the \ccRefName{} models the concept +\ccc{ArrangementDirectionalXMonotoneTraits_2}, the implementation of +the \ccc{Arr_mergeable_2} operation does not enforce the input curves +to have the same direction as a precondition. Moreover, \ccRefName{} +supports the merging of curves of opposite directions. + \ccInclude{CGAL/Arr_conic_traits_2.h} \ccIsModel - \ccc{ArrangementTraits_2} \\ - \ccc{ArrangementLandmarkTraits_2} \\ + \ccc{ArrangementTraits_2}\\ + \ccc{ArrangementLandmarkTraits_2}\\ + \ccc{ArrangementDirectionalXMonotoneTraits_2} \ccTypes %------- diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_non_caching_segment_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_non_caching_segment_traits.tex index 93bfc5a52bf..85773de4cad 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_non_caching_segment_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_non_caching_segment_traits.tex @@ -33,12 +33,19 @@ The \ccStyle{Arr_segment_traits_2} traits class avoids this cascading problem, and should be the default choice for implementing arrangements of line segments. It is recommended to use \ccRefName\ only for very sparse arrangements of huge sets of input segments. - + +While \ccRefName{} models the concept +\ccc{ArrangementDirectionalXMonotoneTraits_2}, the implementation of +the \ccc{Arr_mergeable_2} operation does not enforce the input curves +to have the same direction as a precondition. Moreover, \ccRefName{} +supports the merging of curves of opposite directions. + \ccInclude{CGAL/Arr_non_caching_segment_traits_2.h} \ccIsModel - \ccc{ArrangementTraits_2} \\ - \ccc{ArrangementLandmarkTraits_2} \\ + \ccc{ArrangementTraits_2}\\ + \ccc{ArrangementLandmarkTraits_2}\\ + \ccc{ArrangementDirectionalXMonotoneTraits_2} \ccInheritsFrom \ccc{Arr_non_caching_segment_basic_traits_2} diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_rational_function_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_rational_function_traits.tex index 6be3a3e60ca..0b4ec12395a 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_rational_function_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_rational_function_traits.tex @@ -72,6 +72,12 @@ The cache is automatically cleaned up from time to time. The amortized clean up costs are constant. However, there is also a separate member function that cleans up the cache on demand. +While \ccRefName{} models the concept +\ccc{ArrangementDirectionalXMonotoneTraits_2}, the implementation of +the \ccc{Arr_mergeable_2} operation does not enforce the input curves +to have the same direction as a precondition. Moreover, \ccRefName{} +supports the merging of curves of opposite directions. + \ccInclude{CGAL/Arr_rational_function_traits_2.h} \ccIsModel diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_segment_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_segment_traits.tex index 5651c0b057f..12a280a9c00 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_segment_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_segment_traits.tex @@ -13,23 +13,23 @@ \ccDefinition %============ -The traits class \ccRefName\ is a model of the \ccc{ArrangementTraits_2} -concept that allow the construction and maintenance of arrangements of +The traits class \ccRefName{} is a model of the \ccc{ArrangementTraits_2} +concept, which allows the construction and maintenance of arrangements of line segments. It should be parameterized with a \cgal-kernel model that is templated in turn with a number type. To avoid numerical errors and robustness problems, the number type should support exact rational arithmetic --- that is, the number type should support the arithmetic -operations $+$, $-$, $\times$ and $\div$ that should be carried out -without loss of precision. +operations $+$, $-$, $\times$ and $\div$ carried out without loss of +precision. For example, instantiating the traits -template with kernels such as \ccStyle{Cartesian >}, -or \ccStyle{Homogeneous} ensures the exact and robust operation of +template with kernels, such as \ccStyle{Cartesian >}, +or \ccStyle{Homogeneous}, ensures the exact and robust operation of the application. In particular, the \ccStyle{Cartesian} achieves -the fastest running times in most cases. Using other (inexact) number +the fastest running times in most cases. Using other inexact number types (for example, instantiating the template with -\ccStyle{Simple_cartesian}) is possible at the user's own risk: -selecting an inexact number type usually leads to faster running time at +\ccStyle{Simple_cartesian}) is at the user's own risk: +Selecting an inexact number type usually leads to faster running time at the expense of possible robustness problems. For optimal performance, we recommend instantiating the traits class with @@ -38,9 +38,9 @@ the default \ccc{Exact_predicates_exact_constructions_kernel} provided by only a minor overhead (in comparison to working with a fast, inexact number type) for most inputs. -\ccRefName\ defines \ccc{Kernel::Point_2} as its point type. However, it -does {\sl not} define \ccc{Kernel::Segment_2} as its curve type, as one may -expect. The reason is that the kernel segment is represented by its +\ccRefName{} defines \ccc{Kernel::Point_2} as its point type. However, it +does {\sl not} define \ccc{Kernel::Segment_2} as its curve type, as one +may expect. The reason is that the kernel segment is represented by its two endpoints only, while the traits class needs to store extra data with its segments, in order to efficiently operate on them. Nevertheless, the nested \ccc{X_monotone_curve_2} and \ccc{Curve_2} types (in this @@ -48,7 +48,7 @@ case both types refer to the same class, as {\sl every} line segment is (weakly) $x$-monotone) can however be converted to the type \ccc{Kernel::Segment_2}. -\ccRefName\ achieves faster running times than the +\ccRefName{} achieves faster running times than the \ccStyle{Arr_non_caching_segment_traits_2} traits-class, when arrangements with relatively many intersection points are constructed. It also allows for working with less accurate, yet computationally @@ -56,16 +56,23 @@ efficient number types, such as \ccStyle{Quotient}, which represents floating-point numbers with an unbounded mantissa, but with a bounded exponent. Using this traits class is therefore highly recommended for almost all applications that rely on arrangements of line segments. -On the other hand, \ccRefName\ uses more space and stores extra data with +On the other hand, \ccRefName{} uses more space and stores extra data with each segment, so constructing arrangements of huge sets of non-intersecting segments (or segments that intersect very sparsely) could be more efficient with the \ccStyle{Arr_non_caching_segment_traits_2} traits-class. +While \ccRefName{} models the concept +\ccc{ArrangementDirectionalXMonotoneTraits_2}, the implementation of +the \ccc{Arr_mergeable_2} operation does not enforce the input curves +to have the same direction as a precondition. Moreover, \ccRefName{} +supports the merging of curves of opposite directions. + \ccInclude{CGAL/Arr_segment_traits_2.h} \ccIsModel - \ccc{ArrangementTraits_2} \\ - \ccc{ArrangementLandmarkTraits_2} + \ccc{ArrangementTraits_2}\\ + \ccc{ArrangementLandmarkTraits_2}\\ + \ccc{ArrangementDirectionalXMonotoneTraits_2} \end{ccRefClass} From bccb169c0bcf857edb94a72698695c32d741a8f2 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 29 Aug 2011 15:14:11 +0000 Subject: [PATCH 40/64] CGAL -> \cgal --- Modular_arithmetic/doc_tex/Modular_arithmetic/main.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modular_arithmetic/doc_tex/Modular_arithmetic/main.tex b/Modular_arithmetic/doc_tex/Modular_arithmetic/main.tex index bb7e7cfab2d..4925d41bf8c 100644 --- a/Modular_arithmetic/doc_tex/Modular_arithmetic/main.tex +++ b/Modular_arithmetic/doc_tex/Modular_arithmetic/main.tex @@ -40,7 +40,7 @@ of the class, that is, \ccc{CGAL::Residue} is not thread-safe in this case. In case \ccc{CGAL_HAS_THREADS} the implementation of the class is thread safe using \ccc{boost::thread_specific_ptr}. However, this may cause some performance -penalty. Hence, it may be advisable to configure \ccc{CGAL} with +penalty. Hence, it may be advisable to configure \cgal\ with \ccc{CGAL_HAS_NO_THREADS}. \end{ccAdvanced} @@ -68,4 +68,4 @@ The class \ccc{CGAL::Residue} is based on the C-code of Sylvain Pion et. al. as it was presented in \cite{bepp-sdrns-99}. The remaining part of the package is the result of the integration process -of the NumeriX library of \exacus\ \cite{beh+-eeeafcs-05} into CGAL. \ No newline at end of file +of the NumeriX library of \exacus\ \cite{beh+-eeeafcs-05} into \cgal. From 9e2a08d5b17afeed64a3023b87bf3b65f5c36483 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 30 Aug 2011 12:57:14 +0000 Subject: [PATCH 41/64] typo --- .../include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h index 9661569d7e1..2e257043e00 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h @@ -776,7 +776,7 @@ Arr_construction_sl_visitor::insert_at_vertices if (res->is_on_inner_ccb() || res->twin()->is_on_inner_ccb()) { // In case a new face has been created (pointed by the new halfedge // we obtained), we have to examine the holes and isolated vertices - // in the existing face (pointed be the twin halfedge) and relocate + // in the existing face (pointed by the twin halfedge) and relocate // the relevant features in the new face. CGAL_assertion(res->face() != res->twin()->face()); this->relocate_in_new_face (res); From 5a9e13452f07851bb34b87aff4213f99b0f14362 Mon Sep 17 00:00:00 2001 From: Efi Fogel Date: Tue, 30 Aug 2011 13:15:42 +0000 Subject: [PATCH 42/64] fixed a bug where a deleted event was accessed --- .../CGAL/Sweep_line_2/Sweep_line_2_impl.h | 57 ++++++++----------- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h index 098c266c496..b282c930522 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h @@ -417,42 +417,30 @@ _intersect (Subcurve *c1, Subcurve *c2) // The two subCurves may start at the same point, in that case we ignore the // first intersection point (if we got to that stage, they cannot overlap). - if (reinterpret_cast(c1->left_event()) == this->m_currentEvent && - reinterpret_cast(c2->left_event()) == this->m_currentEvent) - { - CGAL_PRINT(" [Skipping common left endpoint...]\n";); - ++vi; - } - else - { - // In case both left curve-ends have boundary conditions and are not - // open, check whether the left endpoints are the same. If they are, - // skip the first intersection point. - const Arr_parameter_space ps_x1 = - this->m_traits->parameter_space_in_x_2_object()(c1->last_curve(), - ARR_MIN_END); - const Arr_parameter_space ps_y1 = - this->m_traits->parameter_space_in_y_2_object()(c1->last_curve(), - ARR_MIN_END); - const Arr_parameter_space ps_x2 = - this->m_traits->parameter_space_in_x_2_object()(c2->last_curve(), - ARR_MIN_END); - const Arr_parameter_space ps_y2 = - this->m_traits->parameter_space_in_y_2_object()(c2->last_curve(), - ARR_MIN_END); - if ((ps_x1 == ps_x2) && (ps_y1 == ps_y2) && - ((ps_x1 != ARR_INTERIOR) || (ps_y2 != ARR_INTERIOR)) && - this->m_traits->is_closed_2_object()(c1->last_curve(), ARR_MIN_END) && - this->m_traits->is_closed_2_object()(c2->last_curve(), ARR_MIN_END)) + const Arr_parameter_space ps_x1 = + this->m_traits->parameter_space_in_x_2_object()(c1->last_curve(), + ARR_MIN_END); + const Arr_parameter_space ps_y1 = + this->m_traits->parameter_space_in_y_2_object()(c1->last_curve(), + ARR_MIN_END); + const Arr_parameter_space ps_x2 = + this->m_traits->parameter_space_in_x_2_object()(c2->last_curve(), + ARR_MIN_END); + const Arr_parameter_space ps_y2 = + this->m_traits->parameter_space_in_y_2_object()(c2->last_curve(), + ARR_MIN_END); + + if ((ps_x1 == ps_x2) && (ps_y1 == ps_y2) && + this->m_traits->is_closed_2_object()(c1->last_curve(), ARR_MIN_END) && + this->m_traits->is_closed_2_object()(c2->last_curve(), ARR_MIN_END)) + { + if (this->m_traits->equal_2_object() + (this->m_traits->construct_min_vertex_2_object()(c1->last_curve()), + this->m_traits->construct_min_vertex_2_object()(c2->last_curve()))) { - if (this->m_traits->equal_2_object() - (this->m_traits->construct_min_vertex_2_object() (c1->last_curve()), - this->m_traits->construct_min_vertex_2_object() (c2->last_curve()))) - { - CGAL_PRINT(" [Skipping common left endpoint on boundary ...]\n";); - ++vi; - } + CGAL_PRINT(" [Skipping common left endpoint on boundary ...]\n";); + ++vi; } } @@ -513,6 +501,7 @@ _intersect (Subcurve *c1, Subcurve *c2) const std::pair *xp_point; + // Efi: why not skipping in a loop?check only one (that is, why not in a loop)? if(vi != vi_end) { xp_point = object_cast > (&(*vi)); From 30e61afa0a112552f9d577fb62a9c8c4a6b58461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 30 Aug 2011 16:00:03 +0000 Subject: [PATCH 43/64] add debug macro to indicated when an event is updated remove extra; add a comment --- .../include/CGAL/Basic_sweep_line_2.h | 4 ++++ .../include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Basic_sweep_line_2.h b/Arrangement_on_surface_2/include/CGAL/Basic_sweep_line_2.h index 5c0303e21b9..9c0d6ff3125 100644 --- a/Arrangement_on_surface_2/include/CGAL/Basic_sweep_line_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Basic_sweep_line_2.h @@ -44,6 +44,7 @@ #define CGAL_PRINT_INSERT(a) #define CGAL_PRINT_ERASE(a) #define CGAL_PRINT_NEW_EVENT(p, e) +#define CGAL_PRINT_UPDATE_EVENT(p, e) #define CGAL_PRINT(a) #else @@ -62,6 +63,9 @@ #define CGAL_PRINT_NEW_EVENT(p, e) \ { std::cout << "%%% a new event was created at " << (p) << std::endl; \ (e)->Print(); } +#define CGAL_PRINT_UPDATE_EVENT(p, e) \ +{ std::cout << "%%% an event was updated at " << (p) << std::endl; \ + (e)->Print(); } #define CGAL_PRINT(a) { std::cout << a ; } #endif diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h index 40f910cef91..56f86903b30 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h @@ -486,7 +486,7 @@ void Basic_sweep_line_2::_sort_left_curves() Subcurve *curve = *(m_currentEvent->left_curves_begin()); Status_line_iterator sl_iter = curve->hint(); CGAL_assertion (*sl_iter == curve); - + //look for the first curve in the vertical ordering that is also in the left curve of the event for (++sl_iter; sl_iter != m_statusLine.end(); ++sl_iter) { if (std::find (m_currentEvent->left_curves_begin(), @@ -530,7 +530,7 @@ void Basic_sweep_line_2::_sort_left_curves() m_currentEvent->left_curves_end(), *sl_iter) == m_currentEvent->left_curves_end()) { - m_currentEvent->replace_left_curves(++sl_iter,end);; + m_currentEvent->replace_left_curves(++sl_iter,end); } else { @@ -717,8 +717,11 @@ _push_event (const Point_2& pt, Attribute type, // Insert the new event into the queue using the hint we got when we // looked for it. m_queue->insert_before (pair_res.first, e); + CGAL_PRINT_NEW_EVENT(pt, e); + } + else{ + CGAL_PRINT_UPDATE_EVENT(pt, e); } - CGAL_PRINT_NEW_EVENT(pt, e); // Return the resulting event and a flag indicating whether we have created // a new event. From a29c905ee0134212ed456abd743a7869979a75eb Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Wed, 31 Aug 2011 14:30:07 +0000 Subject: [PATCH 45/64] Replace BOOST_STATIC_ASSERT by CGAL_static_assertion. --- .../Algebraic_foundations/fraction_traits.cpp | 4 +- .../Algebraic_foundations/interoperable.cpp | 2 +- .../include/CGAL/Algebraic_structure_traits.h | 2 +- .../include/CGAL/Coercion_traits.h | 2 +- .../include/CGAL/Scalar_factor_traits.h | 4 +- .../CGAL/Test/_test_algebraic_structure.h | 54 +++++++++---------- .../include/CGAL/Test/_test_coercion_traits.h | 8 +-- .../include/CGAL/Test/_test_fraction_traits.h | 10 ++-- .../include/CGAL/Test/_test_rational_traits.h | 2 +- .../include/CGAL/Test/_test_real_embeddable.h | 18 +++---- .../Algebraic_extension_traits.cpp | 24 ++++----- .../Algebraic_structure_traits.cpp | 10 ++-- .../Algebraic_foundations/Coercion_traits.cpp | 14 ++--- .../Real_embeddable_traits.cpp | 6 +-- .../Scalar_factor_traits.cpp | 14 ++--- .../Algebraic_curve_kernel_2.h | 14 ++--- .../Algebraic_kernel_d/Algebraic_real_d_1.h | 2 +- .../algebraic_curve_kernel_2_tools.h | 6 +-- .../Real_embeddable_traits_extension.cpp | 16 +++--- .../CGAL/_test_algebraic_curve_kernel_2.h | 8 +-- .../include/CGAL/_test_algebraic_kernel_1.h | 10 ++-- .../include/CGAL/_test_algebraic_kernel_2.h | 16 +++--- .../include/CGAL/_test_real_comparable.h | 18 +++---- .../Get_arithmetic_kernel.cpp | 6 +-- .../include/CGAL/Arr_dcel_base.h | 4 +- .../include/CGAL/Arr_overlay_2.h | 10 ++-- .../CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h | 4 +- .../CGAL/Arr_rat_arc/Rational_arc_d_1.h | 4 +- .../Arrangement_on_surface_2/test_tags.cpp | 16 +++--- .../include/CGAL/Combinatorial_map.h | 11 ---- Combinatorial_map/include/CGAL/Dart.h | 12 ----- .../CGAL/internal/Combinatorial_map_utility.h | 4 +- .../quick_hull_default_traits.cpp | 14 ++--- .../include/CGAL/Bigfloat_interval_traits.h | 2 +- .../Test/_test_bigfloat_interval_traits.h | 4 +- .../include/CGAL/Test/_test_convert_to_bfi.h | 4 +- .../include/CGAL/Test/_test_interval_traits.h | 8 +-- Kernel_23/include/CGAL/Circle_2.h | 4 +- Kernel_23/include/CGAL/Circle_3.h | 4 +- Kernel_23/include/CGAL/Direction_2.h | 4 +- Kernel_23/include/CGAL/Direction_3.h | 4 +- Kernel_23/include/CGAL/Iso_cuboid_3.h | 4 +- Kernel_23/include/CGAL/Iso_rectangle_2.h | 4 +- Kernel_23/include/CGAL/Line_2.h | 4 +- Kernel_23/include/CGAL/Line_3.h | 4 +- Kernel_23/include/CGAL/Plane_3.h | 4 +- Kernel_23/include/CGAL/Point_2.h | 4 +- Kernel_23/include/CGAL/Point_3.h | 4 +- Kernel_23/include/CGAL/Ray_2.h | 4 +- Kernel_23/include/CGAL/Ray_3.h | 4 +- Kernel_23/include/CGAL/Segment_2.h | 4 +- Kernel_23/include/CGAL/Segment_3.h | 4 +- Kernel_23/include/CGAL/Sphere_3.h | 4 +- Kernel_23/include/CGAL/Tetrahedron_3.h | 4 +- Kernel_23/include/CGAL/Triangle_2.h | 4 +- Kernel_23/include/CGAL/Triangle_3.h | 4 +- Kernel_23/include/CGAL/Vector_2.h | 4 +- Kernel_23/include/CGAL/Vector_3.h | 4 +- .../Kinetic/Default_instantaneous_kernel.h | 6 +-- .../Kinetic/internal/Instantaneous_adaptor.h | 2 +- .../include/CGAL/Polynomial/basic.h | 4 +- Number_types/include/CGAL/Lazy_exact_nt.h | 6 +-- Number_types/include/CGAL/Root_of_traits.h | 2 +- .../include/CGAL/Test/test_root_of_traits.h | 12 ++--- Number_types/include/CGAL/mpq_class.h | 2 +- Number_types/include/CGAL/mpz_class.h | 2 +- .../CGAL/simplest_rational_in_interval.h | 4 +- Number_types/include/CGAL/to_rational.h | 4 +- .../test/Number_types/Coercion_traits.cpp | 14 ++--- .../test/Number_types/Lazy_exact_nt_new.cpp | 10 ++-- .../test/Number_types/Quotient_new.cpp | 6 +-- .../test/Number_types/Sqrt_extension.cpp | 8 +-- .../include/CGAL/Test/test_root_of_2_traits.h | 6 +-- .../Number_types/known_bit_size_integers.cpp | 18 +++---- Polynomial/include/CGAL/Exponent_vector.h | 2 +- Polynomial/include/CGAL/Polynomial.h | 2 +- .../Polynomial/Algebraic_structure_traits.h | 2 +- .../include/CGAL/Polynomial/Polynomial_type.h | 2 +- .../include/CGAL/Polynomial/subresultants.h | 2 +- Polynomial/include/CGAL/Polynomial_traits_d.h | 4 +- .../CGAL/Test/_test_polynomial_traits_d.h | 48 ++++++++--------- .../test/Polynomial/Coercion_traits.cpp | 2 +- .../test/Polynomial/Get_arithmetic_kernel.cpp | 4 +- .../Polynomial/Polynomial_type_generator.cpp | 6 +-- Polynomial/test/Polynomial/test_polynomial.h | 6 +-- Ridges_3/include/CGAL/Ridges.h | 10 ++-- Ridges_3/include/CGAL/Umbilics.h | 8 +-- .../include/CGAL/Handle_with_policy.h | 10 ++-- .../test/STL_Extension/test_Cache.cpp | 14 ++--- .../test/STL_Extension/test_stl_extension.cpp | 8 +-- Surface_mesher/include/CGAL/Point_traits.h | 2 +- .../CGAL/Surface_mesher/Combining_oracle.h | 4 +- .../CGAL/Weighted_point_with_surface_index.h | 8 +-- 93 files changed, 339 insertions(+), 362 deletions(-) diff --git a/Algebraic_foundations/examples/Algebraic_foundations/fraction_traits.cpp b/Algebraic_foundations/examples/Algebraic_foundations/fraction_traits.cpp index a05c03cee23..3958bc2c7b2 100644 --- a/Algebraic_foundations/examples/Algebraic_foundations/fraction_traits.cpp +++ b/Algebraic_foundations/examples/Algebraic_foundations/fraction_traits.cpp @@ -10,8 +10,8 @@ int main(){ typedef FT::Numerator_type Numerator_type; typedef FT::Denominator_type Denominator_type; - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); Numerator_type numerator; Denominator_type denominator; diff --git a/Algebraic_foundations/examples/Algebraic_foundations/interoperable.cpp b/Algebraic_foundations/examples/Algebraic_foundations/interoperable.cpp index bec92a98776..5967bbf089d 100644 --- a/Algebraic_foundations/examples/Algebraic_foundations/interoperable.cpp +++ b/Algebraic_foundations/examples/Algebraic_foundations/interoperable.cpp @@ -10,7 +10,7 @@ binary_func(const A& a , const B& b){ typedef CGAL::Coercion_traits CT; // check for explicit interoperability - BOOST_STATIC_ASSERT((CT::Are_explicit_interoperable::value)); + CGAL_static_assertion((CT::Are_explicit_interoperable::value)); // CT::Cast is used to to convert both types into the coercion type typename CT::Cast cast; diff --git a/Algebraic_foundations/include/CGAL/Algebraic_structure_traits.h b/Algebraic_foundations/include/CGAL/Algebraic_structure_traits.h index 875bfc63004..804aeefb0a9 100644 --- a/Algebraic_foundations/include/CGAL/Algebraic_structure_traits.h +++ b/Algebraic_foundations/include/CGAL/Algebraic_structure_traits.h @@ -355,7 +355,7 @@ class Algebraic_structure_traits_base< Type_, Type& r ) const { typedef Coercion_traits< NT1, NT2 > CT; typedef typename CT::Type Type; - BOOST_STATIC_ASSERT(( + CGAL_static_assertion(( ::boost::is_same::value)); typename Coercion_traits< NT1, NT2 >::Cast cast; diff --git a/Algebraic_foundations/include/CGAL/Coercion_traits.h b/Algebraic_foundations/include/CGAL/Coercion_traits.h index e7b17217a65..6a8ee091f53 100644 --- a/Algebraic_foundations/include/CGAL/Coercion_traits.h +++ b/Algebraic_foundations/include/CGAL/Coercion_traits.h @@ -43,7 +43,7 @@ #define CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( NT, Result_type ) \ template < class CT_Type_1, class CT_Type_2 > \ Result_type operator()( const CT_Type_1& x, const CT_Type_2& y ) const { \ - BOOST_STATIC_ASSERT((::boost::is_same< \ + CGAL_static_assertion((::boost::is_same< \ typename Coercion_traits< CT_Type_1, CT_Type_2 >::Type, NT \ >::value)); \ \ diff --git a/Algebraic_foundations/include/CGAL/Scalar_factor_traits.h b/Algebraic_foundations/include/CGAL/Scalar_factor_traits.h index 105dc498953..f59315ccb4d 100644 --- a/Algebraic_foundations/include/CGAL/Scalar_factor_traits.h +++ b/Algebraic_foundations/include/CGAL/Scalar_factor_traits.h @@ -92,13 +92,13 @@ public: // determine extractable scalar factor Scalar operator () (const NT& a) { - BOOST_STATIC_ASSERT(( ::boost::is_same< NT,Scalar >::value)); + CGAL_static_assertion(( ::boost::is_same< NT,Scalar >::value)); typedef typename Algebraic_structure_traits::Algebraic_category SAT; return scalar_factor(a, SAT()); } // determine extractable scalar factor Scalar operator () (const NT& a, const Scalar& d) { - BOOST_STATIC_ASSERT(( ::boost::is_same< NT,Scalar >::value)); + CGAL_static_assertion(( ::boost::is_same< NT,Scalar >::value)); typedef typename Algebraic_structure_traits::Algebraic_category SAT; return scalar_factor(a,d,SAT()); } diff --git a/Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h b/Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h index 3ac283bdd34..69de72f17d8 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h @@ -31,7 +31,7 @@ #include //#include -#include +#include #include #include #include @@ -48,7 +48,7 @@ template void check_result_type(AdaptableFunctor, ResultType){ typedef typename AdaptableFunctor::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); } // check nothing for CGAL::Null_functor template @@ -110,12 +110,12 @@ void test_algebraic_structure_intern( const CGAL::Integral_domain_tag& ) { CGAL_SNAP_AST_FUNCTORS(AST); using CGAL::Null_functor; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (!::boost::is_same< Integral_division, Null_functor >::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Divides, Null_functor >::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Is_zero, Null_functor >::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Is_one, Null_functor >::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Square, Null_functor >::value)); + CGAL_static_assertion((!::boost::is_same< Divides, Null_functor >::value)); + CGAL_static_assertion((!::boost::is_same< Is_zero, Null_functor >::value)); + CGAL_static_assertion((!::boost::is_same< Is_one, Null_functor >::value)); + CGAL_static_assertion((!::boost::is_same< Square, Null_functor >::value)); // functor const Is_zero is_zero = Is_zero(); @@ -194,7 +194,7 @@ void test_algebraic_structure_intern( CGAL_SNAP_AST_FUNCTORS(AST); using CGAL::Null_functor; - BOOST_STATIC_ASSERT((!::boost::is_same< Gcd, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< Gcd, Null_functor>::value)); const Gcd gcd = Gcd(); assert( gcd( AS ( 0), AS ( 0)) == unit_normal( AS (0) ) ); @@ -256,9 +256,9 @@ void test_algebraic_structure_intern( const CGAL::Euclidean_ring_tag&) { CGAL_SNAP_AST_FUNCTORS(AST); using CGAL::Null_functor; - BOOST_STATIC_ASSERT((!::boost::is_same< Div, Null_functor>::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Mod, Null_functor>::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Div_mod, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< Div, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< Mod, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< Div_mod, Null_functor>::value)); const Div div=Div(); const Mod mod=Mod(); @@ -374,7 +374,7 @@ void test_algebraic_structure_intern( const CGAL::Field_with_sqrt_tag& ) { CGAL_SNAP_AST_FUNCTORS(AST); - BOOST_STATIC_ASSERT((!::boost::is_same< Sqrt, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< Sqrt, Null_functor>::value)); const Sqrt sqrt =Sqrt(); AS a(4); @@ -597,11 +597,11 @@ class Test_is_square { typedef typename Is_square::first_argument_type First_argument_type; typedef typename Is_square::second_argument_type Second_argument_type; typedef typename Is_square::result_type Result_type; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same< AS , First_argument_type>::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same< AS& , Second_argument_type>::value)); - //BOOST_STATIC_ASSERT(( ::boost::is_same< bool , Result_type>::value)); + //CGAL_static_assertion(( ::boost::is_same< bool , Result_type>::value)); bool b = Result_type(true); CGAL_USE(b); AS test_number = AS(3)*AS(3); @@ -630,8 +630,8 @@ public: void operator() (const Sqrt& sqrt) { typedef typename Sqrt::argument_type Argument_type; typedef typename Sqrt::result_type Result_type; - BOOST_STATIC_ASSERT(( ::boost::is_same< AS , Argument_type>::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same< AS , Result_type>::value)); + CGAL_static_assertion(( ::boost::is_same< AS , Argument_type>::value)); + CGAL_static_assertion(( ::boost::is_same< AS , Result_type>::value)); typedef Algebraic_structure_traits AST; typedef typename AST::Is_exact Is_exact; assert( !Is_exact::value || AS (3) == sqrt( AS (9))); @@ -653,11 +653,11 @@ public: typedef typename Root::first_argument_type First_argument_type; typedef typename Root::second_argument_type Second_argument_type; typedef typename Root::result_type Result_type; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same< AS , Second_argument_type>::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same< AS , Result_type>::value)); AS epsilon(1); assert( test_equality_epsilon( AS (2), @@ -781,7 +781,7 @@ void test_algebraic_structure(){ typedef CGAL::Algebraic_structure_traits< AS > AST; CGAL_SNAP_AST_FUNCTORS(AST); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef typename AST::Boolean Boolean; assert(!Boolean()); @@ -794,14 +794,14 @@ void test_algebraic_structure(){ using CGAL::Integral_domain_without_division_tag; using CGAL::Null_functor; // Test for desired exactness - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same< typename AST::Is_exact, Is_exact >::value)); - BOOST_STATIC_ASSERT(( ::boost::is_convertible< Tag, + CGAL_static_assertion(( ::boost::is_convertible< Tag, Integral_domain_without_division_tag >::value )); - BOOST_STATIC_ASSERT(( ::boost::is_same< Tag, Algebraic_category>::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Simplify, Null_functor>::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Unit_part, Null_functor>::value)); + CGAL_static_assertion(( ::boost::is_same< Tag, Algebraic_category>::value)); + CGAL_static_assertion((!::boost::is_same< Simplify, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< Unit_part, Null_functor>::value)); const Simplify simplify=Simplify();; const Unit_part unit_part= Unit_part(); @@ -919,7 +919,7 @@ void test_algebraic_structure( const AS & a, const AS & b, const AS & c) { typedef CGAL::Algebraic_structure_traits AST; typedef typename AST::Is_numerical_sensitive Is_numerical_sensitive; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( !(::boost::is_same::value)); } diff --git a/Algebraic_foundations/include/CGAL/Test/_test_coercion_traits.h b/Algebraic_foundations/include/CGAL/Test/_test_coercion_traits.h index a1d9e65719f..eb75d48dbc2 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_coercion_traits.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_coercion_traits.h @@ -329,7 +329,7 @@ void test_implicit_interoperable_one_way() { typedef typename CT::Type C; typedef typename CT::Are_implicit_interoperable Are_implicit_interoperable; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same::value)); assert((::boost::is_same::value)); @@ -349,9 +349,9 @@ void test_explicit_interoperable_one_way(){ typedef typename CT::Cast Cast; typedef typename Cast::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); + CGAL_static_assertion((::boost::is_same::value)); typename CT::Cast cast; A a(3); diff --git a/Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h b/Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h index 9e7e63d0025..22d11d8da5e 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h @@ -44,11 +44,11 @@ void test_fraction_traits(){ typedef typename FT::Decompose Decompose; typedef typename FT::Compose Compose; - BOOST_STATIC_ASSERT( (::boost::is_same::value)); - BOOST_STATIC_ASSERT( (::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); + CGAL_static_assertion( (::boost::is_same::value)); + CGAL_static_assertion( (::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); // Decompose diff --git a/Algebraic_foundations/include/CGAL/Test/_test_rational_traits.h b/Algebraic_foundations/include/CGAL/Test/_test_rational_traits.h index c7451b9dd96..a02703146d0 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_rational_traits.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_rational_traits.h @@ -38,7 +38,7 @@ void test_rational_traits(){ typedef Rational_traits Rational_traits; typedef typename Rational_traits::RT RT; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); assert( Rational_traits().numerator(x) == RT(7)); assert( Rational_traits().denominator(x) == RT(2)); diff --git a/Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h b/Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h index 4daa960d50a..6cc9a5854e0 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -58,8 +58,8 @@ namespace CGAL { void operator() (const ToDouble& to_double) { typedef typename ToDouble::argument_type Argument_type; typedef typename ToDouble::result_type Result_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); assert(42.0 == to_double(Type(42))); } }; @@ -79,8 +79,8 @@ namespace CGAL { typedef typename To_interval::argument_type Argument_type; typedef typename To_interval::result_type Result_type; typedef std::pair Interval_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); // assert(NiX::in(42.0,to_Interval(Type(42)))); // Instead of 'NiX::in': @@ -145,7 +145,7 @@ void test_real_embeddable() { CGAL_SNAP_RET_FUNCTORS(RET); typedef typename RET::Is_real_embeddable Is_real_embeddable; using CGAL::Tag_true; - BOOST_STATIC_ASSERT(( ::boost::is_same< Is_real_embeddable, Tag_true>::value)); + CGAL_static_assertion(( ::boost::is_same< Is_real_embeddable, Tag_true>::value)); typedef typename RET::Boolean Boolean; typedef typename RET::Sign Sign; @@ -251,20 +251,20 @@ void test_not_real_embeddable() { typedef CGAL::Real_embeddable_traits RET; typedef typename RET::Is_real_embeddable Is_real_embeddable; using CGAL::Tag_false; - BOOST_STATIC_ASSERT(( ::boost::is_same< Is_real_embeddable, Tag_false>::value)); + CGAL_static_assertion(( ::boost::is_same< Is_real_embeddable, Tag_false>::value)); } //template //void test_rounded_log2_abs(Type zero, CGAL::Null_functor, CeilLog2Abs) { // typedef CGAL::Null_functor Null_functor; -// BOOST_STATIC_ASSERT(( ::boost::is_same< CeilLog2Abs, Null_functor>::value)); +// CGAL_static_assertion(( ::boost::is_same< CeilLog2Abs, Null_functor>::value)); //} // //template //void test_rounded_log2_abs(Type zero, FloorLog2Abs fl_log, CeilLog2Abs cl_log) { // typedef CGAL::Null_functor Null_functor; -// BOOST_STATIC_ASSERT((!::boost::is_same< CeilLog2Abs, Null_functor>::value)); +// CGAL_static_assertion((!::boost::is_same< CeilLog2Abs, Null_functor>::value)); // // assert( fl_log(Type( 7)) == 2 ); // assert( cl_log(Type( 7)) == 3 ); diff --git a/Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits.cpp index 9ac4edc9d3e..ca89fa93700 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits.cpp @@ -8,27 +8,27 @@ int main(){ typedef CGAL::Algebraic_extension_traits AET; typedef AET::Type Type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef AET::Is_extended Is_extended; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same::value)); typedef AET::Normalization_factor Normalization_factor; { typedef Normalization_factor::argument_type argument_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef Normalization_factor::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); Normalization_factor nfac; assert(nfac(3)==1); } typedef AET::Denominator_for_algebraic_integers DFAI; { typedef DFAI::argument_type argument_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef DFAI::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); DFAI dfai; assert(dfai(3)==1); } @@ -38,18 +38,18 @@ int main(){ typedef CGAL::Algebraic_extension_traits AET; typedef AET::Type Type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef AET::Is_extended Is_extended; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same::value)); typedef AET::Normalization_factor Normalization_factor; { typedef Normalization_factor::argument_type argument_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef Normalization_factor::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); Normalization_factor nfac; assert(nfac(EXT(3))==1); assert(nfac(EXT(3,0,5))==1); @@ -58,9 +58,9 @@ int main(){ typedef AET::Denominator_for_algebraic_integers DFAI; { typedef DFAI::argument_type argument_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef DFAI::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); DFAI dfai; assert(dfai(EXT(3))==1); assert(dfai(EXT(3,0,5))==1); diff --git a/Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits.cpp index 7c1f3f8cbae..6c3722c4f81 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits.cpp @@ -6,7 +6,7 @@ #define CGAL_IS_AST_NULL_FUNCTOR(NAME) \ { \ typedef AST::NAME NAME; \ - BOOST_STATIC_ASSERT( \ + CGAL_static_assertion( \ (::boost::is_same::value)); \ } @@ -14,16 +14,16 @@ int main(){ typedef CGAL::Algebraic_structure_traits AST; typedef AST::Type Type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef AST::Algebraic_category Algebraic_category; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same::value)); typedef AST::Is_exact Is_exact; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef AST::Is_numerical_sensitive Is_sensitive; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); CGAL_IS_AST_NULL_FUNCTOR ( Simplify); CGAL_IS_AST_NULL_FUNCTOR ( Unit_part); diff --git a/Algebraic_foundations/test/Algebraic_foundations/Coercion_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Coercion_traits.cpp index fe1b943969a..cd462d85753 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Coercion_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Coercion_traits.cpp @@ -4,21 +4,21 @@ int main(){ { typedef CGAL::Coercion_traits CT; - BOOST_STATIC_ASSERT(( boost::is_same::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion(( boost::is_same::value)); + CGAL_static_assertion( ( boost::is_same::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( boost::is_same::value)); assert( 5 == CT::Cast()(5)); } { typedef CGAL::Coercion_traits CT; -// BOOST_STATIC_ASSERT(( boost::is_same::value)); - BOOST_STATIC_ASSERT( +// CGAL_static_assertion(( boost::is_same::value)); + CGAL_static_assertion( ( boost::is_same::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( boost::is_same::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( boost::is_same::value)); } } diff --git a/Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits.cpp index 30ef04c7de8..60edf2c2a8d 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits.cpp @@ -6,7 +6,7 @@ #define CGAL_IS_RET_NULL_FUNCTOR(NAME) \ { \ typedef RET::NAME NAME; \ - BOOST_STATIC_ASSERT( \ + CGAL_static_assertion( \ (::boost::is_same::value)); \ } @@ -14,10 +14,10 @@ int main(){ typedef CGAL::Real_embeddable_traits RET; typedef RET::Type Type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef RET::Is_real_embeddable Is_real_embeddable; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); CGAL_IS_RET_NULL_FUNCTOR(Abs); CGAL_IS_RET_NULL_FUNCTOR(Sgn); diff --git a/Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits.cpp index c6bac8b1703..7a0f03fb503 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits.cpp @@ -6,27 +6,27 @@ int main(){ typedef CGAL::Scalar_factor_traits SFT; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef SFT::Scalar_factor Scalar_factor; { typedef Scalar_factor::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef Scalar_factor::argument_type argument_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); } typedef SFT::Scalar_div Scalar_div; { typedef Scalar_div::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef Scalar_div::first_argument_type first_argument_type; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same::value)); typedef Scalar_div::second_argument_type second_argument_type; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same::value)); } diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h index b7dba1a05e4..a21eb739874 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h @@ -33,7 +33,7 @@ #include -#include +#include #include #include @@ -562,16 +562,16 @@ public: Curve_analysis_2 _construct_defining_polynomial_from(Bound b) const { typedef CGAL::Fraction_traits FT; // We rely on the fact that the Bound is a fraction - BOOST_STATIC_ASSERT((::boost::is_same::value)); typedef typename FT::Numerator_type Numerator; typedef typename FT::Denominator_type Denominator; typedef CGAL::Coercion_traits Num_coercion; - BOOST_STATIC_ASSERT((::boost::is_same + CGAL_static_assertion((::boost::is_same ::value)); typedef CGAL::Coercion_traits Denom_coercion; - BOOST_STATIC_ASSERT((::boost::is_same + CGAL_static_assertion((::boost::is_same ::value)); typename Num_coercion::Cast num_cast; @@ -2649,16 +2649,16 @@ public: Polynomial_1 operator() (const Polynomial_2& f, Bound b) const { typedef CGAL::Fraction_traits FT; // We rely on the fact that the Bound is a fraction - BOOST_STATIC_ASSERT((::boost::is_same::value)); typedef typename FT::Numerator_type Numerator; typedef typename FT::Denominator_type Denominator; typedef CGAL::Coercion_traits Num_coercion; - BOOST_STATIC_ASSERT((::boost::is_same + CGAL_static_assertion((::boost::is_same ::value)); typedef CGAL::Coercion_traits Denom_coercion; - BOOST_STATIC_ASSERT((::boost::is_same + CGAL_static_assertion((::boost::is_same ::value)); typename Num_coercion::Cast num_cast; diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h index f466c7c9f0b..dd9acd7a37b 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h @@ -78,7 +78,7 @@ class Algebraic_real_d_1 : public ::CGAL::Handle_with_policy< AlgebraicRealRep_d_1, HandlePolicy > { // currently Rational is the only supported Bound type. - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same ::Arithmetic_kernel::Rational>::value)); diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h index 48a5d74f8e2..45988ddb0bd 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h @@ -195,7 +195,7 @@ template::value_type >::value)); @@ -237,12 +237,12 @@ template typedef typename CGAL::Polynomial_traits_d::Coefficient_type Coefficient; typedef CGAL::Fraction_traits FT; - BOOST_STATIC_ASSERT((::boost::is_same::value)); typedef typename FT::Numerator_type Numerator; typedef typename FT::Denominator_type Denominator; typedef CGAL::Coercion_traits Num_coercion; - BOOST_STATIC_ASSERT((::boost::is_same + CGAL_static_assertion((::boost::is_same ::value)); Numerator p_num; diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/Real_embeddable_traits_extension.cpp b/Algebraic_kernel_d/test/Algebraic_kernel_d/Real_embeddable_traits_extension.cpp index 47a457966cd..b3b1d2ac858 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/Real_embeddable_traits_extension.cpp +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/Real_embeddable_traits_extension.cpp @@ -53,8 +53,8 @@ void test_real_embeddable_extension(const NT_&){ const Floor floor = Floor(); typedef typename Floor::argument_type Argument_type; typedef typename Floor::result_type Result_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); assert(Integer(42) == floor(NT(42))); assert(Integer(-42) == floor(NT(-42))); } @@ -63,8 +63,8 @@ void test_real_embeddable_extension(const NT_&){ const Floor_log2_abs floor_log2_abs = Floor_log2_abs(); typedef typename Floor_log2_abs::argument_type Argument_type; typedef typename Floor_log2_abs::result_type Result_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); assert(long(0) == floor_log2_abs(NT(1))); assert(long(0) == floor_log2_abs(NT(-1))); @@ -88,8 +88,8 @@ void test_real_embeddable_extension(const NT_&){ const Ceil ceil = Ceil(); typedef typename Ceil::argument_type Argument_type; typedef typename Ceil::result_type Result_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); assert(Integer(42) == ceil(NT(42))); assert(Integer(-42) == ceil(NT(-42))); } @@ -98,8 +98,8 @@ void test_real_embeddable_extension(const NT_&){ const Ceil_log2_abs ceil_log2_abs = Ceil_log2_abs(); typedef typename Ceil_log2_abs::argument_type Argument_type; typedef typename Ceil_log2_abs::result_type Result_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); assert(long(0) == ceil_log2_abs(NT(1))); assert(long(0) == ceil_log2_abs(NT(-1))); diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_curve_kernel_2.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_curve_kernel_2.h index 68deb364363..5f075d6dec5 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_curve_kernel_2.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_curve_kernel_2.h @@ -69,18 +69,18 @@ void test_algebraic_curve_kernel_2() { typedef AlgebraicCurveKernel_2 AK_2; - /* BOOST_STATIC_ASSERT( (::boost::is_same< + /* CGAL_static_assertion( (::boost::is_same< Algebraic_real_1, typename AK::Algebraic_real_1 >::value) ); - BOOST_STATIC_ASSERT((::boost::is_same< + CGAL_static_assertion((::boost::is_same< Isolator, typename AK::Isolator >::value) ); - BOOST_STATIC_ASSERT((::boost::is_same< + CGAL_static_assertion((::boost::is_same< Coefficient, typename AK::Coefficient >::value)); - BOOST_STATIC_ASSERT((::boost::is_same< + CGAL_static_assertion((::boost::is_same< Polynomial_1, typename AK::Polynomial_1 >::value));*/ diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h index c12f6f76e01..f6472fc433a 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h @@ -112,17 +112,17 @@ void test_algebraic_kernel_1(const AlgebraicKernel_d_1& ak_1){ { \ typedef typename Name::argument_type AT_; \ typedef typename Name::result_type RT_; \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ } #define CGAL_CHECK_BFUNCTION(Name,AT1,AT2,RT) \ { \ typedef typename Name::first_argument_type AT1_; \ typedef typename Name::second_argument_type AT2_; \ typedef typename Name::result_type RT_; \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ } // TODO: missing check for Construct_algebraic_real_1 diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_2.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_2.h index 6cf8d6ad735..08fb2f85c56 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_2.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_2.h @@ -101,21 +101,21 @@ void test_algebraic_kernel_2(const AlgebraicKernel_2& ak_2) { { \ typedef typename Name::argument_type AT_; \ typedef typename Name::result_type RT_; \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ } #define CGAL_CHECK_BFUNCTION(Name,AT1,AT2,RT) \ { \ typedef typename Name::first_argument_type AT1_; \ typedef typename Name::second_argument_type AT2_; \ typedef typename Name::result_type RT_; \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ } - BOOST_STATIC_ASSERT(( ::boost::is_same + CGAL_static_assertion(( ::boost::is_same ::value)); @@ -123,7 +123,7 @@ void test_algebraic_kernel_2(const AlgebraicKernel_2& ak_2) { CGAL_CHECK_UFUNCTION(Make_square_free_2,Polynomial_2,Polynomial_2); // TODO: missing check for Square_free_factorize_2 CGAL_CHECK_BFUNCTION(Is_coprime_2,Polynomial_2,Polynomial_2,bool); - BOOST_STATIC_ASSERT(( ::boost::is_same + CGAL_static_assertion(( ::boost::is_same ::value)); CGAL_CHECK_BFUNCTION(Number_of_solutions_2,Polynomial_2,Polynomial_2, size_type); @@ -133,7 +133,7 @@ void test_algebraic_kernel_2(const AlgebraicKernel_2& ak_2) { CGAL_CHECK_UFUNCTION(Compute_polynomial_y_2,Algebraic_real_2,Polynomial_1); CGAL_CHECK_BFUNCTION(Isolate_x_2,Algebraic_real_2,Polynomial_1,BInterval); CGAL_CHECK_BFUNCTION(Isolate_y_2,Algebraic_real_2,Polynomial_1,BInterval); - BOOST_STATIC_ASSERT(( ::boost::is_same + CGAL_static_assertion(( ::boost::is_same < BArray,typename Isolate_2::result_type>::value)); CGAL_CHECK_BFUNCTION(Sign_at_2,Polynomial_2,Algebraic_real_2,Sign); CGAL_CHECK_BFUNCTION(Is_zero_at_2,Polynomial_2,Algebraic_real_2,bool); diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_comparable.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_comparable.h index ca1a15b7310..7b1f23a5058 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_comparable.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_comparable.h @@ -38,7 +38,7 @@ #include #include */ #include -#include +#include #include @@ -52,8 +52,8 @@ namespace internal { void operator() (ToDouble to_double) { typedef typename ToDouble::argument_type Argument_type; typedef typename ToDouble::result_type Result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); assert(42.0 == to_double(NT(42))); } }; @@ -72,8 +72,8 @@ namespace internal { void operator() (ToInterval to_Interval) { typedef typename ToInterval::argument_type Argument_type; typedef typename ToInterval::result_type Result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same< typename Argument_type::Interval, Result_type>::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same< typename Argument_type::Interval, Result_type>::value)); // TODO: NiX::in not available!? //assert(NiX::in(42.0,to_Interval(NT(42)))); @@ -112,7 +112,7 @@ void test_real_comparable() { typedef CGAL::Real_embeddable_traits Traits; typedef typename Traits::Is_real_embeddable Is_real_comparable; using ::CGAL::Tag_true; - BOOST_STATIC_ASSERT((::boost::is_same< Is_real_comparable, Tag_true>::value)); + CGAL_static_assertion((::boost::is_same< Is_real_comparable, Tag_true>::value)); typename Traits::Compare compare; typename Traits::Sign sign; typename Traits::Abs abs; @@ -181,20 +181,20 @@ void test_not_real_comparable() { typedef CGAL::Real_embeddable_traits Traits; typedef typename Traits::Is_real_embeddable Is_real_comparable; using ::CGAL::Tag_false; - BOOST_STATIC_ASSERT((::boost::is_same< Is_real_comparable, Tag_false>::value)); + CGAL_static_assertion((::boost::is_same< Is_real_comparable, Tag_false>::value)); } template void test_rounded_log2_abs(NT zero, ::CGAL::Null_functor, CeilLog2Abs) { typedef ::CGAL::Null_functor Nulltype; - BOOST_STATIC_ASSERT((::boost::is_same< CeilLog2Abs, Nulltype>::value)); + CGAL_static_assertion((::boost::is_same< CeilLog2Abs, Nulltype>::value)); } template void test_rounded_log2_abs(NT zero, FloorLog2Abs fl_log, CeilLog2Abs cl_log) { typedef ::CGAL::Null_functor Null_functor; - BOOST_STATIC_ASSERT((!::boost::is_same< CeilLog2Abs, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< CeilLog2Abs, Null_functor>::value)); assert( fl_log(NT( 7)) == 2 ); assert( cl_log(NT( 7)) == 3 ); diff --git a/Arithmetic_kernel/test/Arithmetic_kernel/Get_arithmetic_kernel.cpp b/Arithmetic_kernel/test/Arithmetic_kernel/Get_arithmetic_kernel.cpp index e92a1e3c7c7..74cdc7d5505 100644 --- a/Arithmetic_kernel/test/Arithmetic_kernel/Get_arithmetic_kernel.cpp +++ b/Arithmetic_kernel/test/Arithmetic_kernel/Get_arithmetic_kernel.cpp @@ -16,15 +16,15 @@ int main() { typedef AK::Bigfloat_interval BFI; { typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } { typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } { typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } return 0; } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h b/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h index e6032e46a7d..fb5a27c1383 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h @@ -35,14 +35,14 @@ #include #include #include -#include +#include namespace CGAL { inline void* _clean_pointer (const void* p) { - BOOST_STATIC_ASSERT(sizeof(void*) == sizeof(size_t)); + CGAL_static_assertion(sizeof(void*) == sizeof(size_t)); const size_t mask = ~1; const size_t val = (reinterpret_cast(p) & mask); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h index e1580b2282a..102bb4fa18a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include namespace CGAL { @@ -73,16 +73,16 @@ void overlay (const Arrangement_on_surface_2& arr1, typedef Arrangement_on_surface_2 ArrRes; // some type assertions (not all, but better then nothing). - BOOST_STATIC_ASSERT((boost::is_convertible< \ + CGAL_static_assertion((boost::is_convertible< \ typename GeomTraitsA::Point_2, \ typename GeomTraitsRes::Point_2 >::value)); - BOOST_STATIC_ASSERT((boost::is_convertible< \ + CGAL_static_assertion((boost::is_convertible< \ typename GeomTraitsB::Point_2, \ typename GeomTraitsRes::Point_2 >::value)); - BOOST_STATIC_ASSERT((boost::is_convertible< \ + CGAL_static_assertion((boost::is_convertible< \ typename GeomTraitsA::X_monotone_curve_2, \ typename GeomTraitsRes::X_monotone_curve_2 >::value)); - BOOST_STATIC_ASSERT((boost::is_convertible< \ + CGAL_static_assertion((boost::is_convertible< \ typename GeomTraitsB::X_monotone_curve_2, \ typename GeomTraitsRes::X_monotone_curve_2 >::value)); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h index 7c19aa47d78..c85169b85d4 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h @@ -68,8 +68,8 @@ public: typedef std::vector > Root_multiplicity_vector; - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h index 419818cc875..5a7911fc46a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h @@ -103,8 +103,8 @@ public: typedef Algebraic_point_2 Point_2; - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp index ba73bb8347d..0efda44aa1b 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp @@ -271,38 +271,38 @@ int main () assert(ident12() == false); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< CGAL::internal::Arr_complete_left_side_category< Traits5 >::Category, CGAL::Arr_oblivious_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< CGAL::internal::Arr_complete_left_side_category< Traits1 >::Category, CGAL::Arr_open_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same::Category, CGAL::Arr_oblivious_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same::Category, CGAL::Arr_open_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< CGAL::internal::Arr_complete_top_side_category< Traits5 >::Category, CGAL::Arr_oblivious_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< CGAL::internal::Arr_complete_top_side_category< Traits1 >::Category, CGAL::Arr_open_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< CGAL::internal::Arr_complete_right_side_category< Traits5 >::Category, CGAL::Arr_oblivious_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< CGAL::internal::Arr_complete_right_side_category< Traits1 >::Category, CGAL::Arr_open_side_tag >::value) ); diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 4d39a7091b6..9e5c0f868dd 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -35,17 +35,6 @@ #pragma GCC diagnostic ignored "-Warray-bounds" #endif -// Temporary patch since CGAL_static_assertion_msg is not yet available. -#ifndef CGAL_static_assertion - -# define CGAL_static_assertion(EX) \ - BOOST_STATIC_ASSERT(EX) -# define CGAL_static_assertion_msg(EX,MSG) \ - BOOST_STATIC_ASSERT(EX) - -#endif -// end of temporary patch: to remove asap. - namespace CGAL { /** @file Combinatorial_map.h diff --git a/Combinatorial_map/include/CGAL/Dart.h b/Combinatorial_map/include/CGAL/Dart.h index 19fdcfd4006..3db4780d4fd 100644 --- a/Combinatorial_map/include/CGAL/Dart.h +++ b/Combinatorial_map/include/CGAL/Dart.h @@ -24,18 +24,6 @@ #include #include -// Temporary patch since CGAL_static_assertion_msg is not yet available. -#ifndef CGAL_static_assertion - -# define CGAL_static_assertion(EX) \ - BOOST_STATIC_ASSERT(EX) -# define CGAL_static_assertion_msg(EX,MSG) \ - BOOST_STATIC_ASSERT(EX) - -#endif -// end of temporary patch: to remove asap. - - namespace CGAL { /** @file Dart.h diff --git a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h index 1e871349ca2..1a4eae9c65c 100644 --- a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #ifdef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES #include @@ -650,7 +650,7 @@ struct Fill_disabled template struct Fill_type{ typedef void type; - BOOST_STATIC_ASSERT(size < 10); + CGAL_static_assertion(size < 10); }; template diff --git a/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp b/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp index a5a1ea0573d..22fa1ba2cbe 100644 --- a/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #ifdef CGAL_USE_LEDA @@ -29,11 +29,11 @@ using namespace CGAL::internal::Convex_hull_3; int main() { - BOOST_STATIC_ASSERT( (boost::is_same::type>::value) ); - BOOST_STATIC_ASSERT( (boost::is_same::type>::value) ); - BOOST_STATIC_ASSERT( (boost::is_same::type>::value) ); - BOOST_STATIC_ASSERT( (boost::is_same::type>::value) ); - BOOST_STATIC_ASSERT( (boost::is_same,Default_traits_for_Chull_3::type>::value) ); - BOOST_STATIC_ASSERT( (boost::is_same >::Protector,CGAL::Protect_FPU_rounding >::value) ); + CGAL_static_assertion( (boost::is_same::type>::value) ); + CGAL_static_assertion( (boost::is_same::type>::value) ); + CGAL_static_assertion( (boost::is_same::type>::value) ); + CGAL_static_assertion( (boost::is_same::type>::value) ); + CGAL_static_assertion( (boost::is_same,Default_traits_for_Chull_3::type>::value) ); + CGAL_static_assertion( (boost::is_same >::Protector,CGAL::Protect_FPU_rounding >::value) ); return 0; } diff --git a/Interval_support/include/CGAL/Bigfloat_interval_traits.h b/Interval_support/include/CGAL/Bigfloat_interval_traits.h index 50a7c71075b..1827d6a0755 100644 --- a/Interval_support/include/CGAL/Bigfloat_interval_traits.h +++ b/Interval_support/include/CGAL/Bigfloat_interval_traits.h @@ -32,7 +32,7 @@ # include #endif -#include +#include namespace CGAL { // TODO: rename this into MPFI_traits ? diff --git a/Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h b/Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h index f515bb08b25..98e7b3e0166 100644 --- a/Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h +++ b/Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -46,7 +46,7 @@ void test_bigfloat_interval_traits() { typedef typename BFIT::Is_bigfloat_interval Is_bigfloat_interval; // using CGAL::Tag_true; - BOOST_STATIC_ASSERT(( ::boost::is_same< Is_bigfloat_interval, CGAL::Tag_true>::value)); + CGAL_static_assertion(( ::boost::is_same< Is_bigfloat_interval, CGAL::Tag_true>::value)); const typename BFIT::Construct construct = typename BFIT::Construct(); const typename BFIT::Set_precision set_precision = typename BFIT::Set_precision(); diff --git a/Interval_support/include/CGAL/Test/_test_convert_to_bfi.h b/Interval_support/include/CGAL/Test/_test_convert_to_bfi.h index fb210e397de..c51e37d05dd 100644 --- a/Interval_support/include/CGAL/Test/_test_convert_to_bfi.h +++ b/Interval_support/include/CGAL/Test/_test_convert_to_bfi.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -46,7 +46,7 @@ void test_convert_to_bfi_from(BFI,CGAL::Null_tag){return;} template void test_convert_to_bfi_from(BFI,From){ typedef typename CGAL::Coercion_traits::Type CT_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); assert(CGAL::convert_to_bfi(From(0)) == BFI(0)); assert(CGAL::convert_to_bfi(From(1)) == BFI(1)); assert(CGAL::convert_to_bfi(From(2)) == BFI(2)); diff --git a/Interval_support/include/CGAL/Test/_test_interval_traits.h b/Interval_support/include/CGAL/Test/_test_interval_traits.h index b98bc26dbdb..12f7f9e482c 100644 --- a/Interval_support/include/CGAL/Test/_test_interval_traits.h +++ b/Interval_support/include/CGAL/Test/_test_interval_traits.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -42,7 +42,7 @@ template void test_with_empty_interval(CGAL::Tag_false) { typedef CGAL::Interval_traits IT; typedef typename IT::Empty Empty; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same< Empty, CGAL::Null_functor>::value)); // this part chages in case we allow empty intersection @@ -80,8 +80,8 @@ void test_interval_traits() { typedef typename IT::With_empty_interval With_empty_interval; using CGAL::Tag_true; - BOOST_STATIC_ASSERT(( ::boost::is_same< Is_interval, Tag_true>::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same< Interval_, Interval>::value)); + CGAL_static_assertion(( ::boost::is_same< Is_interval, Tag_true>::value)); + CGAL_static_assertion(( ::boost::is_same< Interval_, Interval>::value)); test_with_empty_interval(With_empty_interval()); diff --git a/Kernel_23/include/CGAL/Circle_2.h b/Kernel_23/include/CGAL/Circle_2.h index 208d387a5d6..0c2a451823b 100644 --- a/Kernel_23/include/CGAL/Circle_2.h +++ b/Kernel_23/include/CGAL/Circle_2.h @@ -25,7 +25,7 @@ #ifndef CGAL_CIRCLE_2_H #define CGAL_CIRCLE_2_H -#include +#include #include #include #include @@ -42,7 +42,7 @@ class Circle_2 : public R_::Kernel_base::Circle_2 typedef typename R_::Aff_transformation_2 Aff_transformation_2; typedef Circle_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Circle_3.h b/Kernel_23/include/CGAL/Circle_3.h index 16c347bbfd0..82a7c7ff0f5 100644 --- a/Kernel_23/include/CGAL/Circle_3.h +++ b/Kernel_23/include/CGAL/Circle_3.h @@ -30,7 +30,7 @@ #ifndef CGAL_CIRCLE_3_H #define CGAL_CIRCLE_3_H -#include +#include #include #include #include @@ -52,7 +52,7 @@ template typedef typename R_::Direction_3 Direction_3; typedef Circle_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Direction_2.h b/Kernel_23/include/CGAL/Direction_2.h index 8b978fea446..b470330882b 100644 --- a/Kernel_23/include/CGAL/Direction_2.h +++ b/Kernel_23/include/CGAL/Direction_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_DIRECTION_2_H #define CGAL_DIRECTION_2_H -#include +#include #include #include #include @@ -44,7 +44,7 @@ class Direction_2 : public R_::Kernel_base::Direction_2 typedef typename R_::Kernel_base::Direction_2 RDirection_2; typedef Direction_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Direction_3.h b/Kernel_23/include/CGAL/Direction_3.h index 76ffe708c1f..568d2e2ea7c 100644 --- a/Kernel_23/include/CGAL/Direction_3.h +++ b/Kernel_23/include/CGAL/Direction_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_DIRECTION_3_H #define CGAL_DIRECTION_3_H -#include +#include #include #include #include @@ -43,7 +43,7 @@ class Direction_3 : public R_::Kernel_base::Direction_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Direction_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Iso_cuboid_3.h b/Kernel_23/include/CGAL/Iso_cuboid_3.h index faddad5472e..07657844f31 100644 --- a/Kernel_23/include/CGAL/Iso_cuboid_3.h +++ b/Kernel_23/include/CGAL/Iso_cuboid_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_ISO_CUBOID_3_H #define CGAL_ISO_CUBOID_3_H -#include +#include #include #include #include @@ -40,7 +40,7 @@ class Iso_cuboid_3 : public R_::Kernel_base::Iso_cuboid_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Iso_cuboid_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Iso_rectangle_2.h b/Kernel_23/include/CGAL/Iso_rectangle_2.h index 3875e377d86..3d4ea099575 100644 --- a/Kernel_23/include/CGAL/Iso_rectangle_2.h +++ b/Kernel_23/include/CGAL/Iso_rectangle_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_ISO_RECTANGLE_2_H #define CGAL_ISO_RECTANGLE_2_H -#include +#include #include #include #include @@ -41,7 +41,7 @@ class Iso_rectangle_2 : public R_::Kernel_base::Iso_rectangle_2 typedef typename R_::Aff_transformation_2 Aff_transformation_2; typedef Iso_rectangle_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Line_2.h b/Kernel_23/include/CGAL/Line_2.h index b9a892faa92..d08a4225511 100644 --- a/Kernel_23/include/CGAL/Line_2.h +++ b/Kernel_23/include/CGAL/Line_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_LINE_2_H #define CGAL_LINE_2_H -#include +#include #include #include #include @@ -45,7 +45,7 @@ class Line_2 : public R_::Kernel_base::Line_2 typedef typename R_::Kernel_base::Line_2 RLine_2; typedef Line_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Line_3.h b/Kernel_23/include/CGAL/Line_3.h index 7d1f35baa83..a32dbac4d55 100644 --- a/Kernel_23/include/CGAL/Line_3.h +++ b/Kernel_23/include/CGAL/Line_3.h @@ -25,7 +25,7 @@ #ifndef CGAL_LINE_3_H #define CGAL_LINE_3_H -#include +#include #include #include #include @@ -45,7 +45,7 @@ class Line_3 : public R_::Kernel_base::Line_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Line_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Plane_3.h b/Kernel_23/include/CGAL/Plane_3.h index e2ac2b35e23..9cf4903120c 100644 --- a/Kernel_23/include/CGAL/Plane_3.h +++ b/Kernel_23/include/CGAL/Plane_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_PLANE_3_H #define CGAL_PLANE_3_H -#include +#include #include #include #include @@ -46,7 +46,7 @@ class Plane_3 : public R_::Kernel_base::Plane_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Plane_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Point_2.h b/Kernel_23/include/CGAL/Point_2.h index c1fcca5c03f..27ee6c40d63 100644 --- a/Kernel_23/include/CGAL/Point_2.h +++ b/Kernel_23/include/CGAL/Point_2.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include @@ -43,7 +43,7 @@ class Point_2 : public R_::Kernel_base::Point_2 typedef typename R_::Kernel_base::Point_2 RPoint_2; typedef Point_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Point_3.h b/Kernel_23/include/CGAL/Point_3.h index 3e8266a08c7..66b8a242c9c 100644 --- a/Kernel_23/include/CGAL/Point_3.h +++ b/Kernel_23/include/CGAL/Point_3.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include @@ -44,7 +44,7 @@ class Point_3 : public R_::Kernel_base::Point_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Point_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Ray_2.h b/Kernel_23/include/CGAL/Ray_2.h index bf1af8bab42..b6b37372380 100644 --- a/Kernel_23/include/CGAL/Ray_2.h +++ b/Kernel_23/include/CGAL/Ray_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_RAY_2_H #define CGAL_RAY_2_H -#include +#include #include #include #include @@ -46,7 +46,7 @@ class Ray_2 : public R_::Kernel_base::Ray_2 typedef typename R_::Kernel_base::Ray_2 RRay_2; typedef Ray_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Ray_3.h b/Kernel_23/include/CGAL/Ray_3.h index a7636d28c5f..c997765085e 100644 --- a/Kernel_23/include/CGAL/Ray_3.h +++ b/Kernel_23/include/CGAL/Ray_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_RAY_3_H #define CGAL_RAY_3_H -#include +#include #include #include #include @@ -43,7 +43,7 @@ class Ray_3 : public R_::Kernel_base::Ray_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Ray_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Segment_2.h b/Kernel_23/include/CGAL/Segment_2.h index d2c1f9b4d96..db0e9eb6740 100644 --- a/Kernel_23/include/CGAL/Segment_2.h +++ b/Kernel_23/include/CGAL/Segment_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_SEGMENT_2_H #define CGAL_SEGMENT_2_H -#include +#include #include #include #include @@ -45,7 +45,7 @@ class Segment_2 : public R_::Kernel_base::Segment_2 typedef typename R_::Kernel_base::Segment_2 RSegment_2; typedef Segment_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Segment_3.h b/Kernel_23/include/CGAL/Segment_3.h index d6f378adc46..bf52a886beb 100644 --- a/Kernel_23/include/CGAL/Segment_3.h +++ b/Kernel_23/include/CGAL/Segment_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_SEGMENT_3_H #define CGAL_SEGMENT_3_H -#include +#include #include #include #include @@ -44,7 +44,7 @@ class Segment_3 : public R_::Kernel_base::Segment_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Segment_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Sphere_3.h b/Kernel_23/include/CGAL/Sphere_3.h index a73b9e95747..b835fcc70c9 100644 --- a/Kernel_23/include/CGAL/Sphere_3.h +++ b/Kernel_23/include/CGAL/Sphere_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_SPHERE_3_H #define CGAL_SPHERE_3_H -#include +#include #include #include #include @@ -43,7 +43,7 @@ class Sphere_3 : public R_::Kernel_base::Sphere_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Sphere_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Tetrahedron_3.h b/Kernel_23/include/CGAL/Tetrahedron_3.h index bfaf2a2b283..1497b274004 100644 --- a/Kernel_23/include/CGAL/Tetrahedron_3.h +++ b/Kernel_23/include/CGAL/Tetrahedron_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_TETRAHEDRON_3_H #define CGAL_TETRAHEDRON_3_H -#include +#include #include #include #include @@ -39,7 +39,7 @@ class Tetrahedron_3 : public R_::Kernel_base::Tetrahedron_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Tetrahedron_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Triangle_2.h b/Kernel_23/include/CGAL/Triangle_2.h index c6cc26678b8..2bb82118163 100644 --- a/Kernel_23/include/CGAL/Triangle_2.h +++ b/Kernel_23/include/CGAL/Triangle_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_TRIANGLE_2_H #define CGAL_TRIANGLE_2_H -#include +#include #include #include #include @@ -40,7 +40,7 @@ class Triangle_2 : public R_::Kernel_base::Triangle_2 typedef typename R_::Kernel_base::Triangle_2 RTriangle_2; typedef Triangle_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Triangle_3.h b/Kernel_23/include/CGAL/Triangle_3.h index 7ab023c0264..6556e8a8434 100644 --- a/Kernel_23/include/CGAL/Triangle_3.h +++ b/Kernel_23/include/CGAL/Triangle_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_TRIANGLE_3_H #define CGAL_TRIANGLE_3_H -#include +#include #include #include #include @@ -42,7 +42,7 @@ class Triangle_3 : public R_::Kernel_base::Triangle_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Triangle_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Vector_2.h b/Kernel_23/include/CGAL/Vector_2.h index e127fd46278..f7cce5fdb3a 100644 --- a/Kernel_23/include/CGAL/Vector_2.h +++ b/Kernel_23/include/CGAL/Vector_2.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include @@ -48,7 +48,7 @@ class Vector_2 : public R_::Kernel_base::Vector_2 typedef typename R_::Kernel_base::Vector_2 RVector_2; typedef Vector_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Vector_3.h b/Kernel_23/include/CGAL/Vector_3.h index 65ef9683aba..e9682bb5934 100644 --- a/Kernel_23/include/CGAL/Vector_3.h +++ b/Kernel_23/include/CGAL/Vector_3.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -48,7 +48,7 @@ class Vector_3 : public R_::Kernel_base::Vector_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Vector_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kinetic_data_structures/include/CGAL/Kinetic/Default_instantaneous_kernel.h b/Kinetic_data_structures/include/CGAL/Kinetic/Default_instantaneous_kernel.h index 08ffcc70089..9e09f492a10 100644 --- a/Kinetic_data_structures/include/CGAL/Kinetic/Default_instantaneous_kernel.h +++ b/Kinetic_data_structures/include/CGAL/Kinetic/Default_instantaneous_kernel.h @@ -246,9 +246,9 @@ public: typedef typename Static_kernel::FT NT; typedef typename Traits::Simulator::Time Time; - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - BOOST_STATIC_ASSERT((boost::is_convertible::value)); + CGAL_static_assertion((boost::is_convertible::value)); + CGAL_static_assertion((boost::is_convertible::value)); Default_instantaneous_kernel(const Traits &tr): diff --git a/Kinetic_data_structures/include/CGAL/Kinetic/internal/Instantaneous_adaptor.h b/Kinetic_data_structures/include/CGAL/Kinetic/internal/Instantaneous_adaptor.h index 307a6e04608..cd386403eb3 100644 --- a/Kinetic_data_structures/include/CGAL/Kinetic/internal/Instantaneous_adaptor.h +++ b/Kinetic_data_structures/include/CGAL/Kinetic/internal/Instantaneous_adaptor.h @@ -36,7 +36,7 @@ class Instantaneous_adaptor { typedef typename Rep::Time Time; - BOOST_STATIC_ASSERT((boost::is_convertible::value)); + CGAL_static_assertion((boost::is_convertible::value)); public: Instantaneous_adaptor(typename Rep::Handle rep, Static_predicate pred, diff --git a/Kinetic_data_structures/include/CGAL/Polynomial/basic.h b/Kinetic_data_structures/include/CGAL/Polynomial/basic.h index 23241965068..52c9dee5f0c 100644 --- a/Kinetic_data_structures/include/CGAL/Polynomial/basic.h +++ b/Kinetic_data_structures/include/CGAL/Polynomial/basic.h @@ -23,7 +23,7 @@ #include #include -#include +#include /*! \file CGAL/Polynomial/basic.h The file which defines the basic @@ -167,7 +167,7 @@ inline Extended_sign extended_sign(const NT &nt) template inline Rt infinity() { - //BOOST_STATIC_ASSERT(std::numeric_limits::is_specialized); + //CGAL_static_assertion(std::numeric_limits::is_specialized); if (std::numeric_limits::has_infinity) return std::numeric_limits::infinity(); else return (std::numeric_limits::max)(); } diff --git a/Number_types/include/CGAL/Lazy_exact_nt.h b/Number_types/include/CGAL/Lazy_exact_nt.h index 9f3f90064fe..455fe29df48 100644 --- a/Number_types/include/CGAL/Lazy_exact_nt.h +++ b/Number_types/include/CGAL/Lazy_exact_nt.h @@ -29,7 +29,7 @@ #include #include // for Root_of functor -#include +#include #include #include @@ -914,7 +914,7 @@ struct Div_mod_selector { void operator()( const NT1& x, const NT2& y, NT& q, NT& r ) const { - BOOST_STATIC_ASSERT((::boost::is_same< + CGAL_static_assertion((::boost::is_same< typename Coercion_traits< NT1, NT2 >::Type, NT >::value)); @@ -999,7 +999,7 @@ template < typename ET > class Real_embeddable_traits< Lazy_exact_nt > : public INTERN_RET::Real_embeddable_traits_base< Lazy_exact_nt , CGAL::Tag_true > { // Every type ET of Lazy_exact_nt has to be real embeddable. - BOOST_STATIC_ASSERT((::boost::is_same< typename Real_embeddable_traits< ET > + CGAL_static_assertion((::boost::is_same< typename Real_embeddable_traits< ET > ::Is_real_embeddable, Tag_true >::value)); public: diff --git a/Number_types/include/CGAL/Root_of_traits.h b/Number_types/include/CGAL/Root_of_traits.h index cffb0341412..7a72251c11a 100644 --- a/Number_types/include/CGAL/Root_of_traits.h +++ b/Number_types/include/CGAL/Root_of_traits.h @@ -130,7 +130,7 @@ private: // We have the typedef as VC10 fails with // static_assert(FrT::Is_fraction::value) typedef typename FrT::Is_fraction ISF; - BOOST_STATIC_ASSERT((ISF::value)); + CGAL_static_assertion((ISF::value)); typedef typename FrT::Numerator_type RT; diff --git a/Number_types/include/CGAL/Test/test_root_of_traits.h b/Number_types/include/CGAL/Test/test_root_of_traits.h index 7dc7e43eb3a..87ed06fe30c 100644 --- a/Number_types/include/CGAL/Test/test_root_of_traits.h +++ b/Number_types/include/CGAL/Test/test_root_of_traits.h @@ -10,8 +10,8 @@ void test_root_of_traits(){ typedef typename RoT::Root_of_1 Root_of_1; typedef typename RoT::Root_of_2 Root_of_2; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef typename RoT::Make_root_of_2 Make_root_of_2; typedef typename RoT::Make_sqrt Make_sqrt; @@ -23,10 +23,10 @@ void test_root_of_traits(){ const Inverse& inverse = Inverse(); const Square& square = Square(); - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); { diff --git a/Number_types/include/CGAL/mpq_class.h b/Number_types/include/CGAL/mpq_class.h index 74a0db8291b..0b565b30ecf 100644 --- a/Number_types/include/CGAL/mpq_class.h +++ b/Number_types/include/CGAL/mpq_class.h @@ -38,7 +38,7 @@ // while ::__gmp_expr is the others "expressions". #define CGAL_CHECK_GMP_EXPR \ - BOOST_STATIC_ASSERT( \ + CGAL_static_assertion( \ (::boost::is_same< ::__gmp_expr< T , T >,Type>::value )); namespace CGAL { diff --git a/Number_types/include/CGAL/mpz_class.h b/Number_types/include/CGAL/mpz_class.h index 15da28bd30a..bae1ca32638 100644 --- a/Number_types/include/CGAL/mpz_class.h +++ b/Number_types/include/CGAL/mpz_class.h @@ -40,7 +40,7 @@ #define CGAL_CHECK_GMP_EXPR \ - BOOST_STATIC_ASSERT( \ + CGAL_static_assertion( \ (::boost::is_same< ::__gmp_expr< T , T >,Type>::value )); namespace CGAL { diff --git a/Number_types/include/CGAL/simplest_rational_in_interval.h b/Number_types/include/CGAL/simplest_rational_in_interval.h index e52f2e69415..b0b0056b2d9 100644 --- a/Number_types/include/CGAL/simplest_rational_in_interval.h +++ b/Number_types/include/CGAL/simplest_rational_in_interval.h @@ -48,9 +48,9 @@ simplest_rational_in_interval(double x, double y) { typedef typename FT::Compose Compose; // Must be a fraction - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); // Numerator_type,Denominator_type must be the same - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); if(x == y){ diff --git a/Number_types/include/CGAL/to_rational.h b/Number_types/include/CGAL/to_rational.h index 111f8e7aabd..6f160c730f5 100644 --- a/Number_types/include/CGAL/to_rational.h +++ b/Number_types/include/CGAL/to_rational.h @@ -41,8 +41,8 @@ to_rational(double x) typedef typename FT::Denominator_type Denominator_type; typename FT::Compose compose; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); Numerator_type num(0),den(1); diff --git a/Number_types/test/Number_types/Coercion_traits.cpp b/Number_types/test/Number_types/Coercion_traits.cpp index d9b9ccbde6c..6fcfdacb56c 100644 --- a/Number_types/test/Number_types/Coercion_traits.cpp +++ b/Number_types/test/Number_types/Coercion_traits.cpp @@ -164,9 +164,9 @@ void AT_coercion_test_for_cgal_types_rat(){ typedef typename AT::Bigfloat_interval Bigfloat_interval; - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); CGAL::test_explicit_interoperable_from_to(); CGAL::test_explicit_interoperable_from_to(); @@ -222,10 +222,10 @@ void AT_coercion_test_for_cgal_types_fws(){ typedef typename AT::Bigfloat_interval Bigfloat_interval; typedef typename AT::Field_with_sqrt Real; - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); typedef CGAL::Sqrt_extension Extn_1; diff --git a/Number_types/test/Number_types/Lazy_exact_nt_new.cpp b/Number_types/test/Number_types/Lazy_exact_nt_new.cpp index 5600adbc97b..c6aaf361767 100644 --- a/Number_types/test/Number_types/Lazy_exact_nt_new.cpp +++ b/Number_types/test/Number_types/Lazy_exact_nt_new.cpp @@ -78,9 +78,9 @@ void test_lazy_exact_nt() { typedef CGAL::Lazy_exact_nt< typename AK::Integer > LI; typedef CGAL::Lazy_exact_nt< typename AK::Rational > LR; typedef CGAL::Coercion_traits CT; - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Type,LR>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Type,LR>::value)); LI i(4); LR r(4); @@ -94,8 +94,8 @@ void test_lazy_exact_nt() { typedef CGAL::Lazy_exact_nt T1; typedef CGAL::Lazy_exact_nt T2; typedef CGAL::Coercion_traits CT; - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_false>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_false>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_false>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_false>::value)); #endif #endif } diff --git a/Number_types/test/Number_types/Quotient_new.cpp b/Number_types/test/Number_types/Quotient_new.cpp index b0cedba2594..743d9beab32 100644 --- a/Number_types/test/Number_types/Quotient_new.cpp +++ b/Number_types/test/Number_types/Quotient_new.cpp @@ -60,9 +60,9 @@ void test_quotient() { typedef typename AT::Integer I ; typedef CGAL::Quotient QI; typedef CGAL::Coercion_traits CT; - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Type,QI>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Type,QI>::value)); } } diff --git a/Number_types/test/Number_types/Sqrt_extension.cpp b/Number_types/test/Number_types/Sqrt_extension.cpp index 3e7d01c7911..e2a5fb1847b 100644 --- a/Number_types/test/Number_types/Sqrt_extension.cpp +++ b/Number_types/test/Number_types/Sqrt_extension.cpp @@ -20,7 +20,7 @@ inline void convert_to(const NT& x, RT& r){ typedef CGAL::Coercion_traits CT; typedef typename CT::Type Type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); r = typename CT::Cast()(x); } } //namespace CGAL @@ -696,15 +696,15 @@ void test_get_arithmetic_kernel(){ { typedef CGAL::Sqrt_extension EXT; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AT_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } { typedef CGAL::Sqrt_extension EXT; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AT_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } { typedef CGAL::Sqrt_extension EXT; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AT_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } } diff --git a/Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h b/Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h index 66186d7199c..6936429d8d7 100644 --- a/Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h +++ b/Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h @@ -7,12 +7,12 @@ void test_root_of_traits(){ typedef typename RoT::Root_of_1 Root_of_1; typedef typename RoT::Root_of_2 Root_of_2; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef typename RoT::Make_root_of_2 Make_root_of_2; typedef typename Make_root_of_2::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); const Make_root_of_2& make_root_of_2 = Make_root_of_2(); Root_of_2 r = make_root_of_2(T(0),T(-1),T(2)); //-sqrt(2) diff --git a/Number_types/test/Number_types/known_bit_size_integers.cpp b/Number_types/test/Number_types/known_bit_size_integers.cpp index af4fb53447c..2085172687b 100644 --- a/Number_types/test/Number_types/known_bit_size_integers.cpp +++ b/Number_types/test/Number_types/known_bit_size_integers.cpp @@ -1,24 +1,24 @@ #include #include -#include +#include int main() { std::cout << "Verifying the sizes of boost::[u]int{8,16,32,64}_t" << std::endl; - BOOST_STATIC_ASSERT(sizeof(boost::int8_t) == 1); - BOOST_STATIC_ASSERT(sizeof(boost::int16_t) == 2); - BOOST_STATIC_ASSERT(sizeof(boost::int32_t) == 4); + CGAL_static_assertion(sizeof(boost::int8_t) == 1); + CGAL_static_assertion(sizeof(boost::int16_t) == 2); + CGAL_static_assertion(sizeof(boost::int32_t) == 4); #ifndef BOOST_NO_INT64_T - BOOST_STATIC_ASSERT(sizeof(boost::int64_t) == 8); + CGAL_static_assertion(sizeof(boost::int64_t) == 8); #endif - BOOST_STATIC_ASSERT(sizeof(boost::uint8_t) == 1); - BOOST_STATIC_ASSERT(sizeof(boost::uint16_t) == 2); - BOOST_STATIC_ASSERT(sizeof(boost::uint32_t) == 4); + CGAL_static_assertion(sizeof(boost::uint8_t) == 1); + CGAL_static_assertion(sizeof(boost::uint16_t) == 2); + CGAL_static_assertion(sizeof(boost::uint32_t) == 4); #ifndef BOOST_NO_INT64_T - BOOST_STATIC_ASSERT(sizeof(boost::uint64_t) == 8); + CGAL_static_assertion(sizeof(boost::uint64_t) == 8); #endif return 0; diff --git a/Polynomial/include/CGAL/Exponent_vector.h b/Polynomial/include/CGAL/Exponent_vector.h index 73c865df730..eaa67cb271e 100644 --- a/Polynomial/include/CGAL/Exponent_vector.h +++ b/Polynomial/include/CGAL/Exponent_vector.h @@ -63,7 +63,7 @@ public: Exponent_vector(InputIterator begin , InputIterator end) :v(begin,end){ typedef typename std::iterator_traits::value_type value_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); } diff --git a/Polynomial/include/CGAL/Polynomial.h b/Polynomial/include/CGAL/Polynomial.h index cd523c07b1e..7fe1ee8b608 100644 --- a/Polynomial/include/CGAL/Polynomial.h +++ b/Polynomial/include/CGAL/Polynomial.h @@ -45,7 +45,7 @@ #include -#include +#include #ifdef CGAL_USE_LEDA #if CGAL_LEDA_VERSION >= 500 diff --git a/Polynomial/include/CGAL/Polynomial/Algebraic_structure_traits.h b/Polynomial/include/CGAL/Polynomial/Algebraic_structure_traits.h index a6c4490c3a1..b969c87a2d0 100644 --- a/Polynomial/include/CGAL/Polynomial/Algebraic_structure_traits.h +++ b/Polynomial/include/CGAL/Polynomial/Algebraic_structure_traits.h @@ -281,7 +281,7 @@ class Polynomial_algebraic_structure_traits_base< POLY, Field_tag > template < class NT1, class NT2 > void operator()( const NT1& x, const NT2& y, POLY& q, POLY& r ) const { - BOOST_STATIC_ASSERT((::boost::is_same< + CGAL_static_assertion((::boost::is_same< typename Coercion_traits< NT1, NT2 >::Type, POLY >::value)); diff --git a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h index e9b73ad44ea..ea63f428704 100644 --- a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h +++ b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h @@ -540,7 +540,7 @@ public: * Also available as non-member function. */ CGAL::Sign sign() const { -// BOOST_STATIC_ASSERT( (boost::is_same< typename Real_embeddable_traits::Is_real_embeddable, +// CGAL_static_assertion( (boost::is_same< typename Real_embeddable_traits::Is_real_embeddable, // CGAL::Tag_true>::value) ); return CGAL::sign(lcoeff()); } diff --git a/Polynomial/include/CGAL/Polynomial/subresultants.h b/Polynomial/include/CGAL/Polynomial/subresultants.h index 301955a47de..6f906c25c6e 100644 --- a/Polynomial/include/CGAL/Polynomial/subresultants.h +++ b/Polynomial/include/CGAL/Polynomial/subresultants.h @@ -785,7 +785,7 @@ namespace CGAL { CGAL::Integral_domain_without_division_tag) { // polynomial_subresultants_with_cofactors requires // a model of IntegralDomain as coefficient type; - BOOST_STATIC_ASSERT(sizeof(Polynomial_traits_d)==0); + CGAL_static_assertion(sizeof(Polynomial_traits_d)==0); return sres_out; } diff --git a/Polynomial/include/CGAL/Polynomial_traits_d.h b/Polynomial/include/CGAL/Polynomial_traits_d.h index 12136244898..47cfbb16818 100644 --- a/Polynomial/include/CGAL/Polynomial_traits_d.h +++ b/Polynomial/include/CGAL/Polynomial_traits_d.h @@ -571,7 +571,7 @@ public: template Polynomial_d construct_value_type(Input_iterator begin, Input_iterator end, NT) const { typedef CGAL::Coercion_traits CT; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); typename CT::Cast cast; return Polynomial_d( boost::make_transform_iterator(begin,cast), @@ -672,7 +672,7 @@ public: typedef Polynomial_traits_d PT; typename PT::Construct_polynomial construct; - BOOST_STATIC_ASSERT(PT::d != 0); // Coefficient_type is a Polynomial + CGAL_static_assertion(PT::d != 0); // Coefficient_type is a Polynomial std::vector coefficients; Coefficient_type zero(0); diff --git a/Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h b/Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h index a15a0fff86b..7d984c0c7fc 100644 --- a/Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h +++ b/Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h @@ -34,7 +34,7 @@ static CGAL::Random my_rnd(346); // some seed #define ASSERT_IS_NULL_FUNCTOR(T) \ - BOOST_STATIC_ASSERT((boost::is_same::value)) + CGAL_static_assertion((boost::is_same::value)) @@ -154,10 +154,10 @@ void test_construct_polynomial(const Polynomial_traits_d&){ } { // Construct_polynomial typedef typename PT::Construct_polynomial Constructor; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( !(boost::is_same< Constructor , CGAL::Null_functor >::value)); typedef typename Constructor::result_type result_type; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< result_type , Polynomial_d >::value)); typedef typename PT::Shift Shift; typedef typename PT::Evaluate Evaluate; @@ -1778,23 +1778,23 @@ void test_rebind(const PT& /*traits*/){ { const int dimension = 1; typedef typename PT:: template Rebind::Other PT_IC_1; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_IC_1::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_IC_1::Innermost_coefficient_type, IC>::value)); - BOOST_STATIC_ASSERT((PT_IC_1::d==dimension)); + CGAL_static_assertion((PT_IC_1::d==dimension)); } { const int dimension = 2; typedef typename PT:: template Rebind::Other PT_IC_2; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_IC_2::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_IC_2::Innermost_coefficient_type, IC>::value)); - BOOST_STATIC_ASSERT((PT_IC_2::d==dimension)); + CGAL_static_assertion((PT_IC_2::d==dimension)); } { const int dimension = 3; typedef typename PT:: template Rebind::Other PT_IC_3; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_IC_3::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_IC_3::Innermost_coefficient_type, IC>::value)); - BOOST_STATIC_ASSERT((PT_IC_3::d==dimension)); + CGAL_static_assertion((PT_IC_3::d==dimension)); } { typedef typename PT:: template Rebind::Other PT_IC_1; @@ -1804,11 +1804,11 @@ void test_rebind(const PT& /*traits*/){ typedef typename PT_IC_1::Polynomial_d Poly1; typedef typename PT_IC_2::Polynomial_d Poly2; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_IC_1::Coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_IC_1::Coefficient_type, IC>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename PT_IC_2::Coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_IC_2::Coefficient_type, Poly1>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename PT_IC_3::Coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_IC_3::Coefficient_type, Poly2>::value)); } @@ -1821,12 +1821,12 @@ void test_rebind(const PT& /*traits*/){ const int dimension = 4; typedef typename PT:: template Rebind::Other PT_Integer_4; typedef typename PT:: template Rebind::Other PT_Rational_4; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type, Integer>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type, Rational>::value)); - BOOST_STATIC_ASSERT((PT_Integer_4::d==dimension)); - BOOST_STATIC_ASSERT((PT_Rational_4::d==dimension)); + CGAL_static_assertion((PT_Integer_4::d==dimension)); + CGAL_static_assertion((PT_Rational_4::d==dimension)); } #endif #ifdef CGAL_USE_CORE @@ -1837,24 +1837,24 @@ void test_rebind(const PT& /*traits*/){ const int dimension = 4; typedef typename PT:: template Rebind::Other PT_Integer_4; typedef typename PT:: template Rebind::Other PT_Rational_4; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type, Integer>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type, Rational>::value)); - BOOST_STATIC_ASSERT((PT_Integer_4::d==dimension)); - BOOST_STATIC_ASSERT((PT_Rational_4::d==dimension)); + CGAL_static_assertion((PT_Integer_4::d==dimension)); + CGAL_static_assertion((PT_Rational_4::d==dimension)); } #endif { const int dimension = 4; typedef typename PT:: template Rebind::Other PT_Integer_4; typedef typename PT:: template Rebind::Other PT_Rational_4; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type, int>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type, double>::value)); - BOOST_STATIC_ASSERT((PT_Integer_4::d==dimension)); - BOOST_STATIC_ASSERT((PT_Rational_4::d==dimension)); + CGAL_static_assertion((PT_Integer_4::d==dimension)); + CGAL_static_assertion((PT_Rational_4::d==dimension)); } } diff --git a/Polynomial/test/Polynomial/Coercion_traits.cpp b/Polynomial/test/Polynomial/Coercion_traits.cpp index 36c83b9b30b..a0555c79561 100644 --- a/Polynomial/test/Polynomial/Coercion_traits.cpp +++ b/Polynomial/test/Polynomial/Coercion_traits.cpp @@ -149,7 +149,7 @@ void test_coercion_traits(){ /* { typedef CGAL::Coercion_traits CT; - BOOST_STATIC_ASSERT(( + CGAL_static_assertion(( ::boost::is_same< typename CT::Are_implicit_interoperable, CGAL::Tag_false>::value)); } diff --git a/Polynomial/test/Polynomial/Get_arithmetic_kernel.cpp b/Polynomial/test/Polynomial/Get_arithmetic_kernel.cpp index 0b40e1f58c0..15f5cbdbd22 100644 --- a/Polynomial/test/Polynomial/Get_arithmetic_kernel.cpp +++ b/Polynomial/test/Polynomial/Get_arithmetic_kernel.cpp @@ -8,11 +8,11 @@ void test_get_arithmetic_kernel(){ { typedef CGAL::Polynomial POLY; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); }{ typedef CGAL::Polynomial > POLY; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } } diff --git a/Polynomial/test/Polynomial/Polynomial_type_generator.cpp b/Polynomial/test/Polynomial/Polynomial_type_generator.cpp index 8b8e6e62e58..e29a074151e 100644 --- a/Polynomial/test/Polynomial/Polynomial_type_generator.cpp +++ b/Polynomial/test/Polynomial/Polynomial_type_generator.cpp @@ -10,14 +10,14 @@ int main(){ { typedef CGAL::Polynomial_type_generator::Type Polynomial; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); } { typedef CGAL::Polynomial_type_generator::Type Polynomial; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); } { typedef CGAL::Polynomial_type_generator::Type Polynomial; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); } } diff --git a/Polynomial/test/Polynomial/test_polynomial.h b/Polynomial/test/Polynomial/test_polynomial.h index d7a97807dbd..57babaaac6a 100644 --- a/Polynomial/test/Polynomial/test_polynomial.h +++ b/Polynomial/test/Polynomial/test_polynomial.h @@ -35,7 +35,7 @@ inline void convert_to(const NT& x, RT& r){ typedef CGAL::Coercion_traits CT; typedef typename CT::Coercion_type RET; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); r = typename CT::Cast()(x); } } //namespace CGAL @@ -879,7 +879,7 @@ void test_scalar_factor_traits(){ typedef CGAL::Scalar_factor_traits SFT; typedef typename AT::Integer Scalar; typedef typename SFT::Scalar Scalar_; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typename SFT::Scalar_factor sfac; @@ -905,7 +905,7 @@ void test_scalar_factor_traits(){ typedef CGAL::Scalar_factor_traits SFT; typedef typename AT::Integer Scalar; typedef typename SFT::Scalar Scalar_; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typename SFT::Scalar_factor sfac; diff --git a/Ridges_3/include/CGAL/Ridges.h b/Ridges_3/include/CGAL/Ridges.h index 9144593c5df..2fe457b7835 100644 --- a/Ridges_3/include/CGAL/Ridges.h +++ b/Ridges_3/include/CGAL/Ridges.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include namespace CGAL { @@ -201,10 +201,10 @@ class Ridge_approximation typedef typename TriangulatedSurfaceMesh::Facet_const_iterator Facet_const_iterator; //requirements for the templates TriangulatedSurfaceMesh and Vertex2FTPropertyMap or Vertex2VectorPropertyMap - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); typedef std::pair< Halfedge_const_handle, FT> Ridge_halfhedge; typedef CGAL::Ridge_line Ridge_line; diff --git a/Ridges_3/include/CGAL/Umbilics.h b/Ridges_3/include/CGAL/Umbilics.h index e6d3d234e1f..d87871cc971 100644 --- a/Ridges_3/include/CGAL/Umbilics.h +++ b/Ridges_3/include/CGAL/Umbilics.h @@ -96,10 +96,10 @@ template < class TriangulatedSurfaceMesh, typedef typename TriangulatedSurfaceMesh::Vertex_const_iterator Vertex_const_iterator; //requirements for the templates TriangulatedSurfaceMesh and Vertex2FTPropertyMap or Vertex2VectorPropertyMap - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); typedef CGAL::Umbilic Umbilic; diff --git a/STL_Extension/include/CGAL/Handle_with_policy.h b/STL_Extension/include/CGAL/Handle_with_policy.h index 8f89a75a5e5..64492a07654 100644 --- a/STL_Extension/include/CGAL/Handle_with_policy.h +++ b/STL_Extension/include/CGAL/Handle_with_policy.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -364,7 +364,7 @@ namespace Intern { typedef typename T::Allocator Alloc; typedef ::CGAL::Reference_counted_hierarchy_with_union Reference_counted_hierarchy_with_union; - BOOST_STATIC_ASSERT(( + CGAL_static_assertion(( ::CGAL::is_same_or_derived< Reference_counted_hierarchy_with_union, T >::value )); } typedef T Rep; @@ -768,7 +768,7 @@ private: static Rep_allocator allocator; static Rep* new_rep( const Rep& rep) { - BOOST_STATIC_ASSERT( !( + CGAL_static_assertion( !( ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value )); Rep* p = allocator.allocate(1); allocator.construct(p, rep); @@ -863,7 +863,7 @@ protected: //! argument, and the single argument template constructor no other //! constructor will work for class hierarchies of representations. Handle_with_policy( Rep* p) : ptr_( p) { - BOOST_STATIC_ASSERT(( + CGAL_static_assertion(( ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value )); //Bind bind_; // trigger compile-time check //(void)bind_; @@ -877,7 +877,7 @@ protected: //! version of \c initialize_with is applicable in this case except //! the template version with one argument. void initialize_with( Rep* p) { - BOOST_STATIC_ASSERT(( + CGAL_static_assertion(( ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value )); //Bind bind_; // trigger compile-time check //(void)bind_; diff --git a/STL_Extension/test/STL_Extension/test_Cache.cpp b/STL_Extension/test/STL_Extension/test_Cache.cpp index 61f1e209eb9..8b44a30cf1c 100644 --- a/STL_Extension/test/STL_Extension/test_Cache.cpp +++ b/STL_Extension/test/STL_Extension/test_Cache.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include struct Int_rep { @@ -57,14 +57,14 @@ struct Int_t : public CGAL::Handle_with_policy< Int_rep, Unify > { void test_typedefs(){ typedef CGAL::Cache Cache; - BOOST_STATIC_ASSERT(( ::boost::is_same< Cache::Input, int >::value )); - BOOST_STATIC_ASSERT(( ::boost::is_same< Cache::Output,double>::value )); + CGAL_static_assertion(( ::boost::is_same< Cache::Input, int >::value )); + CGAL_static_assertion(( ::boost::is_same< Cache::Output,double>::value )); typedef CGAL::Creator_1 Creator_double; - BOOST_STATIC_ASSERT(( ::boost::is_same::value )); + CGAL_static_assertion(( ::boost::is_same::value )); typedef CGAL::Creator_1 Creator_int; - BOOST_STATIC_ASSERT(( ::boost::is_same::value )); - BOOST_STATIC_ASSERT(( ::boost::is_same >::value )); - BOOST_STATIC_ASSERT(( ::boost::is_same >::value )); + CGAL_static_assertion(( ::boost::is_same::value )); + CGAL_static_assertion(( ::boost::is_same >::value )); + CGAL_static_assertion(( ::boost::is_same >::value )); } int main(){ { diff --git a/STL_Extension/test/STL_Extension/test_stl_extension.cpp b/STL_Extension/test/STL_Extension/test_stl_extension.cpp index 1e635007171..da3a20cdc27 100644 --- a/STL_Extension/test/STL_Extension/test_stl_extension.cpp +++ b/STL_Extension/test/STL_Extension/test_stl_extension.cpp @@ -8994,10 +8994,10 @@ void test_tuple(){ typedef CGAL::cpp0x::tuple T2; - BOOST_STATIC_ASSERT( CGAL::cpp0x::tuple_size::value == 0 ); - BOOST_STATIC_ASSERT( CGAL::cpp0x::tuple_size::value == 2 ); - BOOST_STATIC_ASSERT( CGAL::cpp0x::tuple_size::value == 4 ); - BOOST_STATIC_ASSERT( (boost::is_same::type,My_to_int>::value) ); + CGAL_static_assertion( CGAL::cpp0x::tuple_size::value == 0 ); + CGAL_static_assertion( CGAL::cpp0x::tuple_size::value == 2 ); + CGAL_static_assertion( CGAL::cpp0x::tuple_size::value == 4 ); + CGAL_static_assertion( (boost::is_same::type,My_to_int>::value) ); T1 t1=CGAL::cpp0x::make_tuple(1,2); int i1=-1,i2=-1; diff --git a/Surface_mesher/include/CGAL/Point_traits.h b/Surface_mesher/include/CGAL/Point_traits.h index 712dd2ae233..96879525193 100644 --- a/Surface_mesher/include/CGAL/Point_traits.h +++ b/Surface_mesher/include/CGAL/Point_traits.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace CGAL { diff --git a/Surface_mesher/include/CGAL/Surface_mesher/Combining_oracle.h b/Surface_mesher/include/CGAL/Surface_mesher/Combining_oracle.h index 6d8e552cd21..81482e86483 100644 --- a/Surface_mesher/include/CGAL/Surface_mesher/Combining_oracle.h +++ b/Surface_mesher/include/CGAL/Surface_mesher/Combining_oracle.h @@ -26,7 +26,7 @@ #include -#include +#include #include namespace CGAL { @@ -53,7 +53,7 @@ namespace CGAL { typedef typename Oracle_a::Intersection_point Intersection_point; - BOOST_STATIC_ASSERT((::boost::is_same< + CGAL_static_assertion((::boost::is_same< Intersection_point, typename Oracle_b::Intersection_point>::value)); diff --git a/Surface_mesher/include/CGAL/Weighted_point_with_surface_index.h b/Surface_mesher/include/CGAL/Weighted_point_with_surface_index.h index 9dbfcc45c50..70269987ab5 100644 --- a/Surface_mesher/include/CGAL/Weighted_point_with_surface_index.h +++ b/Surface_mesher/include/CGAL/Weighted_point_with_surface_index.h @@ -21,7 +21,7 @@ #define CGAL_WEIGHTED_POINT_WITH_SURFACE_INDEX_H #include -#include +#include #include #include @@ -36,10 +36,10 @@ class Weighted_point_with_surface_index : public Weighted_point typedef typename Point_traits::Bare_point Bare_point; typedef typename Kernel_traits::Kernel::FT FT; - BOOST_STATIC_ASSERT((Is_weighted::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); public: From 675814c5f8df7f7d7a505c5b9ff6175b64e61ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 1 Sep 2011 13:26:45 +0000 Subject: [PATCH 46/64] normalized plane now first check if FT is a fraction --- Nef_S2/include/CGAL/Nef_S2/Normalizing.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/Normalizing.h b/Nef_S2/include/CGAL/Nef_S2/Normalizing.h index c142073fa28..400002b94ad 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Normalizing.h +++ b/Nef_S2/include/CGAL/Nef_S2/Normalizing.h @@ -282,9 +282,9 @@ class Normalizing { } #endif - + template static - CGAL::Plane_3 normalized(const CGAL::Plane_3& h) { + CGAL::Plane_3 normalized(const CGAL::Plane_3& h,Tag_true) { CGAL_assertion(!(h.a()==0 && h.b()==0 && h.c()==0 && h.d()==0)); typedef typename R::FT FT; @@ -326,6 +326,26 @@ class Normalizing { composer(vec[2],1), composer(vec[3],1)); } + + + + template static + CGAL::Plane_3 normalized(const CGAL::Plane_3& h,Tag_false) { + CGAL_assertion(!(h.a()==0 && h.b()==0 && h.c()==0 && h.d()==0)); + typedef typename R::FT FT; + if (h.a()!=0) + return typename R::Plane_3(FT(1),h.b()/h.a(),h.c()/h.a(),h.d()/h.a()); + if (h.b()!=0) + return typename R::Plane_3(h.a()/h.b(),FT(1),h.c()/h.b(),h.d()/h.b()); + if (h.c()!=0) + return typename R::Plane_3(h.a()/h.c(),h.b()/h.c(),FT(1),h.d()/h.c()); + return typename R::Plane_3(h.a()/h.d(),h.b()/h.d(),h.c()/h.d(),FT(1)); + } + + template static + CGAL::Plane_3 normalized(const CGAL::Plane_3& h) { + return normalized( h,typename Fraction_traits::Is_fraction() ); + } template static CGAL::Sphere_circle normalized(CGAL::Sphere_circle& c) { From 6f62d9f418dca178e53827b3811bedf6498d8f5e Mon Sep 17 00:00:00 2001 From: Ophir Setter Date: Sat, 3 Sep 2011 15:35:00 +0000 Subject: [PATCH 47/64] removing duplicate input files --- .gitattributes | 7 - .../benchmark/Minkowski_sum_2/data/chain.dat | 114 -------------- .../benchmark/Minkowski_sum_2/data/comb.dat | 77 --------- .../benchmark/Minkowski_sum_2/data/fork.dat | 67 -------- .../benchmark/Minkowski_sum_2/data/knife.dat | 78 --------- .../benchmark/Minkowski_sum_2/data/random.dat | 62 -------- .../Minkowski_sum_2/data/random2.dat | 148 ------------------ .../benchmark/Minkowski_sum_2/data/star.dat | 82 ---------- 8 files changed, 635 deletions(-) delete mode 100644 Minkowski_sum_2/benchmark/Minkowski_sum_2/data/chain.dat delete mode 100644 Minkowski_sum_2/benchmark/Minkowski_sum_2/data/comb.dat delete mode 100644 Minkowski_sum_2/benchmark/Minkowski_sum_2/data/fork.dat delete mode 100644 Minkowski_sum_2/benchmark/Minkowski_sum_2/data/knife.dat delete mode 100644 Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random.dat delete mode 100644 Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random2.dat delete mode 100644 Minkowski_sum_2/benchmark/Minkowski_sum_2/data/star.dat diff --git a/.gitattributes b/.gitattributes index 7cbf7c9c5c7..ed3cfd055a4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2577,13 +2577,6 @@ Min_sphere_of_spheres_d/test_extensive/stability/maple/balls-on-boundary-3.mws - Min_sphere_of_spheres_d/web/figs/heuristic/excess.xfig -text svneol=unset#application/octet-stream Min_sphere_of_spheres_d/web/figs/mbex/mbex.xfig -text svneol=unset#application/octet-stream Min_sphere_of_spheres_d/web/figs/pivot/cex.xfig -text svneol=unset#application/octet-stream -Minkowski_sum_2/benchmark/Minkowski_sum_2/data/chain.dat -text -Minkowski_sum_2/benchmark/Minkowski_sum_2/data/comb.dat -text -Minkowski_sum_2/benchmark/Minkowski_sum_2/data/fork.dat -text -Minkowski_sum_2/benchmark/Minkowski_sum_2/data/knife.dat -text -Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random.dat -text -Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random2.dat -text -Minkowski_sum_2/benchmark/Minkowski_sum_2/data/star.dat -text Minkowski_sum_2/benchmark/Minkowski_sum_2/print_utils.h -text Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/Minkowski_sum_2.png -text diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/chain.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/chain.dat deleted file mode 100644 index bbd30b4b01f..00000000000 --- a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/chain.dat +++ /dev/null @@ -1,114 +0,0 @@ -82 -1150840/1 3269680/1 -2009089/1 622385/1 -3563659/1 -1685869/1 -5694160/1 -3476329/1 -8235589/1 -4610310/1 -10991099/1 -5000000/1 -13747300/1 -4615210/1 -16290799/1 -3485749/1 -18424400/1 -1699079/1 -19983099/1 606407/1 -21100000/1 1000000/1 -22000000/1 -1000000/1 -23100000/1 1000000/1 -24000000/1 -1000000/1 -25100000/1 1000000/1 -26000000/1 -1000000/1 -27100000/1 1000000/1 -28000000/1 -1000000/1 -29100000/1 1000000/1 -30000000/1 -1000000/1 -31100000/1 1000000/1 -32000000/1 -1000000/1 -33100000/1 1000000/1 -34000000/1 -1000000/1 -35100000/1 1000000/1 -36000000/1 -1000000/1 -37100000/1 1000000/1 -38000000/1 -1000000/1 -39100000/1 1000000/1 -40000000/1 -1000000/1 -42014300/1 4388269/1 -43571599/1 6694679/1 -45704200/1 8482609/1 -48246999/1 9613579/1 -51003000/1 10000000/1 -53758699/1 9611950/1 -56300799/1 8479470/1 -58432399/1 6690280/1 -59988299/1 4382939/1 -60848100/1 1736160/1 -61150799/1 3269680/1 -62009099/1 622385/1 -63563699/1 -1685869/1 -65694200/1 -3476329/1 -68235600/1 -4610310/1 -70991099/1 -5000000/1 -73747299/1 -4615210/1 -76290799/1 -3485749/1 -78424399/1 -1699079/1 -79983100/1 606407/1 -81100000/1 1000000/1 -82000000/1 -1000000/1 -83100000/1 1000000/1 -84000000/1 -1000000/1 -85100000/1 1000000/1 -86000000/1 -1000000/1 -87100000/1 1000000/1 -88000000/1 -1000000/1 -89100000/1 1000000/1 -90000000/1 -1000000/1 -91100000/1 1000000/1 -92000000/1 -1000000/1 -93100000/1 1000000/1 -94000000/1 -1000000/1 -95100000/1 1000000/1 -96000000/1 -1000000/1 -97100000/1 1000000/1 -98000000/1 -1000000/1 -99100000/1 1000000/1 -100000000/1 -1000000/1 -102013999/1 4388269/1 -103572000/1 6694679/1 -105703999/1 8482609/1 -108247000/1 9613579/1 -111002999/1 10000000/1 -113758999/1 9611950/1 -116301000/1 8479470/1 -118432000/1 6690280/1 -119987999/1 4382939/1 -120847999/1 1736160/1 -121100000/1 -30000000/1 -0/1 -30000000/1 -30 -3000000/1 5000000/1 -2934470/1 5623619/1 -2740729/1 6219990/1 -2427259/1 6763070/1 -1606200/1 6783289/1 -1500509/1 7597780/1 -927727/1 7852949/1 -314410/1 7983479/1 --312641/1 7983659/1 --740828/1 7282799/1 --1498969/1 7598669/1 --2006419/1 7230309/1 --2426210/1 6764510/1 --2740009/1 6221620/1 --2347280/1 5500289/1 --3000000/1 5001779/1 --2934839/1 4378120/1 --2741460/1 3781630/1 --2428300/1 3238369/1 --1607249/1 3217660/1 --1502050/1 2403110/1 --929418/1 2147599/1 --316178/1 2016709/1 -310873/1 2016150/1 -739475/1 2716759/1 -1497429/1 2400440/1 -2005099/1 2768500/1 -2425169/1 3234060/1 -2739279/1 3776759/1 -2346980/1 4498319/1 diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/comb.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/comb.dat deleted file mode 100644 index fd7a9cde92d..00000000000 --- a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/comb.dat +++ /dev/null @@ -1,77 +0,0 @@ -53 -1250/1 100/1 -1250/1 50/1 -0/1 50/1 -0/1 100/1 -25/1 250/1 -50/1 100/1 -75/1 250/1 -100/1 100/1 -125/1 250/1 -150/1 100/1 -175/1 250/1 -200/1 100/1 -225/1 250/1 -250/1 100/1 -275/1 250/1 -300/1 100/1 -325/1 250/1 -350/1 100/1 -375/1 250/1 -400/1 100/1 -425/1 250/1 -450/1 100/1 -475/1 250/1 -500/1 100/1 -525/1 250/1 -550/1 100/1 -575/1 250/1 -600/1 100/1 -625/1 250/1 -650/1 100/1 -675/1 250/1 -700/1 100/1 -725/1 250/1 -750/1 100/1 -775/1 250/1 -800/1 100/1 -825/1 250/1 -850/1 100/1 -875/1 250/1 -900/1 100/1 -925/1 250/1 -950/1 100/1 -975/1 250/1 -1000/1 100/1 -1025/1 250/1 -1050/1 100/1 -1075/1 250/1 -1100/1 100/1 -1125/1 250/1 -1150/1 100/1 -1175/1 250/1 -1200/1 100/1 -1225/1 250/1 -22 -20/1 0/1 --20/1 0/1 --19/1 7/1 --17/1 9/1 --15/1 11/1 --13/1 13/1 --11/1 15/1 --9/1 17/1 --7/1 19/1 --5/1 21/1 --3/1 23/1 --1/1 25/1 -1/1 27/1 -3/1 29/1 -5/1 31/1 -7/1 33/1 -9/1 35/1 -11/1 37/1 -13/1 39/1 -15/1 41/1 -17/1 43/1 -19/1 45/1 diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/fork.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/fork.dat deleted file mode 100644 index 243ed16b268..00000000000 --- a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/fork.dat +++ /dev/null @@ -1,67 +0,0 @@ -34 --500/1 -500/1 --500/1 100/1 -0/1 102/1 --500/1 104/1 --500/1 200/1 -0/1 202/1 --500/1 204/1 --500/1 300/1 -0/1 302/1 --500/1 304/1 --500/1 400/1 -0/1 402/1 --500/1 404/1 --500/1 500/1 -0/1 502/1 --500/1 504/1 --510/1 500/1 --510/1 -510/1 -500/1 -510/1 -504/1 -500/1 -502/1 0/1 -500/1 -500/1 -404/1 -500/1 -402/1 0/1 -400/1 -500/1 -304/1 -500/1 -302/1 0/1 -300/1 -500/1 -204/1 -500/1 -202/1 0/1 -200/1 -500/1 -104/1 -500/1 -102/1 0/1 -100/1 -500/1 -31 -0/1 0/1 -0/1 100/1 -2/1 600/1 -4/1 100/1 -20/1 100/1 -22/1 600/1 -24/1 100/1 -40/1 100/1 -42/1 600/1 -44/1 100/1 -60/1 100/1 -62/1 600/1 -64/1 100/1 -80/1 100/1 -82/1 600/1 -84/1 100/1 -100/1 80/1 -600/1 78/1 -100/1 76/1 -100/1 60/1 -600/1 58/1 -100/1 56/1 -100/1 40/1 -600/1 38/1 -100/1 36/1 -100/1 20/1 -600/1 18/1 -100/1 16/1 -100/1 0/1 -600/1 -2/1 -100/1 -4/1 diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/knife.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/knife.dat deleted file mode 100644 index 36fb830be37..00000000000 --- a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/knife.dat +++ /dev/null @@ -1,78 +0,0 @@ -64 -100/1 -10/1 -100/1 500/1 -500/1 498/1 -110/1 495/1 -110/1 450/1 -500/1 448/1 -110/1 445/1 -110/1 400/1 -500/1 398/1 -110/1 395/1 -110/1 350/1 -500/1 348/1 -110/1 345/1 -110/1 300/1 -500/1 298/1 -110/1 295/1 -110/1 250/1 -500/1 248/1 -110/1 245/1 -110/1 200/1 -500/1 198/1 -110/1 195/1 -110/1 150/1 -500/1 148/1 -110/1 145/1 -110/1 100/1 -500/1 98/1 -110/1 95/1 -110/1 50/1 -500/1 48/1 -110/1 45/1 -110/1 0/1 -600/1 0/1 -602/1 500/1 -605/1 0/1 -610/1 0/1 -612/1 500/1 -615/1 0/1 -620/1 0/1 -622/1 500/1 -625/1 0/1 -630/1 0/1 -632/1 500/1 -635/1 0/1 -640/1 0/1 -642/1 500/1 -645/1 0/1 -650/1 0/1 -652/1 500/1 -655/1 0/1 -660/1 0/1 -662/1 500/1 -665/1 0/1 -670/1 0/1 -672/1 500/1 -675/1 0/1 -680/1 0/1 -682/1 500/1 -685/1 0/1 -690/1 0/1 -692/1 500/1 -695/1 0/1 -700/1 0/1 -700/1 -10/1 -12 -0/1 0/1 -10/1 2/1 -0/1 5/1 -10/1 7/1 -0/1 10/1 -10/1 12/1 -0/1 15/1 -10/1 17/1 -0/1 20/1 -10/1 22/1 -0/1 25/1 -420/1 12/1 diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random.dat deleted file mode 100644 index 4b5ddd0cc2e..00000000000 --- a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random.dat +++ /dev/null @@ -1,62 +0,0 @@ -40 -579/1 768/1 -307/1 750/1 -700/1 726/1 -420/1 604/1 -448/1 640/1 -218/1 753/1 -213/1 657/1 -366/1 615/1 -370/1 450/1 -516/1 410/1 -565/1 554/1 -730/1 547/1 -829/1 669/1 -879/1 542/1 -707/1 287/1 -754/1 502/1 -710/1 521/1 -536/1 362/1 -419/1 299/1 -376/1 326/1 -319/1 399/1 -259/1 536/1 -352/1 446/1 -348/1 504/1 -233/1 608/1 -350/1 113/1 -201/1 520/1 -313/1 108/1 -465/1 71/1 -740/1 2/1 -347/1 290/1 -504/1 227/1 -704/1 131/1 -962/1 42/1 -966/1 418/1 -976/1 481/1 -922/1 609/1 -940/1 435/1 -883/1 389/1 -950/1 790/1 -20 --67/1 -56/1 --43/1 15/1 -6/1 -79/1 -82/1 47/1 -9/1 -40/1 --9/1 -14/1 -24/1 78/1 --45/1 45/1 --71/1 -21/1 --76/1 -1/1 --72/1 58/1 -18/1 96/1 -84/1 56/1 -92/1 -54/1 -95/1 -89/1 -85/1 -5/1 -58/1 -44/1 --2/1 -88/1 --31/1 -74/1 --78/1 -85/1 diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random2.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random2.dat deleted file mode 100644 index 0c4de884e82..00000000000 --- a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/random2.dat +++ /dev/null @@ -1,148 +0,0 @@ -64 -100/1 -10/1 -100/1 500/1 -500/1 498/1 -110/1 495/1 -110/1 450/1 -500/1 448/1 -110/1 445/1 -110/1 400/1 -500/1 398/1 -110/1 395/1 -110/1 350/1 -500/1 348/1 -110/1 345/1 -110/1 300/1 -500/1 298/1 -110/1 295/1 -110/1 250/1 -500/1 248/1 -110/1 245/1 -110/1 200/1 -500/1 198/1 -110/1 195/1 -110/1 150/1 -500/1 148/1 -110/1 145/1 -110/1 100/1 -500/1 98/1 -110/1 95/1 -110/1 50/1 -500/1 48/1 -110/1 45/1 -110/1 0/1 -600/1 0/1 -602/1 500/1 -605/1 0/1 -610/1 0/1 -612/1 500/1 -615/1 0/1 -620/1 0/1 -622/1 500/1 -625/1 0/1 -630/1 0/1 -632/1 500/1 -635/1 0/1 -640/1 0/1 -642/1 500/1 -645/1 0/1 -650/1 0/1 -652/1 500/1 -655/1 0/1 -660/1 0/1 -662/1 500/1 -665/1 0/1 -670/1 0/1 -672/1 500/1 -675/1 0/1 -680/1 0/1 -682/1 500/1 -685/1 0/1 -690/1 0/1 -692/1 500/1 -695/1 0/1 -700/1 0/1 -700/1 -10/1 -82 -1150840/1 3269680/1 -2009089/1 622385/1 -3563659/1 -1685869/1 -5694160/1 -3476329/1 -8235589/1 -4610310/1 -10991099/1 -5000000/1 -13747300/1 -4615210/1 -16290799/1 -3485749/1 -18424400/1 -1699079/1 -19983099/1 606407/1 -21100000/1 1000000/1 -22000000/1 -1000000/1 -23100000/1 1000000/1 -24000000/1 -1000000/1 -25100000/1 1000000/1 -26000000/1 -1000000/1 -27100000/1 1000000/1 -28000000/1 -1000000/1 -29100000/1 1000000/1 -30000000/1 -1000000/1 -31100000/1 1000000/1 -32000000/1 -1000000/1 -33100000/1 1000000/1 -34000000/1 -1000000/1 -35100000/1 1000000/1 -36000000/1 -1000000/1 -37100000/1 1000000/1 -38000000/1 -1000000/1 -39100000/1 1000000/1 -40000000/1 -1000000/1 -42014300/1 4388269/1 -43571599/1 6694679/1 -45704200/1 8482609/1 -48246999/1 9613579/1 -51003000/1 10000000/1 -53758699/1 9611950/1 -56300799/1 8479470/1 -58432399/1 6690280/1 -59988299/1 4382939/1 -60848100/1 1736160/1 -61150799/1 3269680/1 -62009099/1 622385/1 -63563699/1 -1685869/1 -65694200/1 -3476329/1 -68235600/1 -4610310/1 -70991099/1 -5000000/1 -73747299/1 -4615210/1 -76290799/1 -3485749/1 -78424399/1 -1699079/1 -79983100/1 606407/1 -81100000/1 1000000/1 -82000000/1 -1000000/1 -83100000/1 1000000/1 -84000000/1 -1000000/1 -85100000/1 1000000/1 -86000000/1 -1000000/1 -87100000/1 1000000/1 -88000000/1 -1000000/1 -89100000/1 1000000/1 -90000000/1 -1000000/1 -91100000/1 1000000/1 -92000000/1 -1000000/1 -93100000/1 1000000/1 -94000000/1 -1000000/1 -95100000/1 1000000/1 -96000000/1 -1000000/1 -97100000/1 1000000/1 -98000000/1 -1000000/1 -99100000/1 1000000/1 -100000000/1 -1000000/1 -102013999/1 4388269/1 -103572000/1 6694679/1 -105703999/1 8482609/1 -108247000/1 9613579/1 -111002999/1 10000000/1 -113758999/1 9611950/1 -116301000/1 8479470/1 -118432000/1 6690280/1 -119987999/1 4382939/1 -120847999/1 1736160/1 -121100000/1 -30000000/1 -0/1 -30000000/1 diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/star.dat b/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/star.dat deleted file mode 100644 index 8ef429efb99..00000000000 --- a/Minkowski_sum_2/benchmark/Minkowski_sum_2/data/star.dat +++ /dev/null @@ -1,82 +0,0 @@ -40 -90000000/1 0/1 -99384600/1 7820260/1 -97553700/1 15447999/1 -85641899/1 18156499/1 -90454300/1 29384500/1 -85360599/1 35350099/1 -73517200/1 32356499/1 -72708799/1 44545600/1 -65462099/1 47549200/1 -56267899/1 39505900/1 -50014800/1 50000000/1 -42194400/1 49387000/1 -37652800/1 38046699/1 -27317599/1 44559100/1 -20627500/1 40462999/1 -21728299/1 28296800/1 -9563089/1 29408400/1 -5461110/1 22721999/1 -11964300/1 12381000/1 -619995/1 7849530/1 -8/1 29632/1 -10488599/1 -6232789/1 -2437109/1 -15419800/1 -5434210/1 -22669200/1 -17622599/1 -23488399/1 -14618500/1 -35329099/1 -20579599/1 -40428199/1 -31811900/1 -35625700/1 -34509699/1 -47539999/1 -42135800/1 -49377699/1 -49964400/1 -40000000/1 -57776400/1 -49391599/1 -65405799/1 -47567500/1 -68124800/1 -35657999/1 -79348500/1 -40480399/1 -85318700/1 -35392000/1 -82335599/1 -23545900/1 -94525400/1 -22748400/1 -97535400/1 -15504400/1 -89500300/1 -6303029/1 -40 -40000000/1 50000000/1 -49384600/1 57820299/1 -47553699/1 65448000/1 -35641899/1 68156500/1 -40454300/1 79384500/1 -35360599/1 85350099/1 -23517199/1 82356500/1 -22708799/1 94545600/1 -15462100/1 97549199/1 -6267909/1 89505899/1 -14816/1 100000000/1 --7805629/1 99387000/1 --12347199/1 88046699/1 --22682400/1 94559100/1 --29372500/1 90462999/1 --28271699/1 78296799/1 --40436900/1 79408399/1 --44538900/1 72722000/1 --38035700/1 62380999/1 --49380000/1 57849500/1 --50000000/1 50029599/1 --39511399/1 43767200/1 --47562900/1 34580200/1 --44565800/1 27330799/1 --32377400/1 26511599/1 --35381499/1 14670900/1 --29420400/1 9571810/1 --18188100/1 14374299/1 --15490299/1 2460010/1 --7864159/1 622323/1 --35559/1 10000000/1 -7776349/1 608419/1 -15405799/1 2432539/1 -18124799/1 14341999/1 -29348500/1 9519559/1 -35318700/1 14608000/1 -32335599/1 26454099/1 -44525400/1 27251600/1 -47535399/1 34495600/1 -39500299/1 43697000/1 From d86728fcc24b255f97e100dca7790241bd165af5 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 5 Sep 2011 13:12:46 +0000 Subject: [PATCH 48/64] Add G. Damian (author of Combinatorial Maps) into the AUTHORS file --- Installation/AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/Installation/AUTHORS b/Installation/AUTHORS index 4c74338eb1b..069efb9a6f1 100644 --- a/Installation/AUTHORS +++ b/Installation/AUTHORS @@ -15,6 +15,7 @@ Nicolas Carrez Frédéric Cazals Raphaëlle Chaine Tran Kai Frank Da +Guillaume Damian Christophe Delage Olivier Devillers Katrin Dobrindt From 1ebb89a07e158ff614cd2e5486d67b21217cc7b4 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 5 Sep 2011 13:27:46 +0000 Subject: [PATCH 49/64] Typo on Guillaume's name --- Installation/AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Installation/AUTHORS b/Installation/AUTHORS index 069efb9a6f1..3137dea9eee 100644 --- a/Installation/AUTHORS +++ b/Installation/AUTHORS @@ -15,7 +15,7 @@ Nicolas Carrez Frédéric Cazals Raphaëlle Chaine Tran Kai Frank Da -Guillaume Damian +Guillaume Damiand Christophe Delage Olivier Devillers Katrin Dobrindt From 2f667ba6eca23fd6c01835aa5765656c9a3874c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 6 Sep 2011 06:22:29 +0000 Subject: [PATCH 50/64] DOC BUGFIX: The Splitter concepts must define an operator() which depends on the class Point_container, which is why I resurrected file Point_container.tex --- .../Spatial_searching_ref/Point_container.tex | 210 ++++++++++++++++++ .../Spatial_searching_ref/Splitter.tex | 8 +- .../doc_tex/Spatial_searching_ref/intro.tex | 6 +- .../doc_tex/Spatial_searching_ref/main.tex | 1 + 4 files changed, 221 insertions(+), 4 deletions(-) create mode 100644 Spatial_searching/doc_tex/Spatial_searching_ref/Point_container.tex diff --git a/Spatial_searching/doc_tex/Spatial_searching_ref/Point_container.tex b/Spatial_searching/doc_tex/Spatial_searching_ref/Point_container.tex new file mode 100644 index 00000000000..725b3b66e49 --- /dev/null +++ b/Spatial_searching/doc_tex/Spatial_searching_ref/Point_container.tex @@ -0,0 +1,210 @@ +% +------------------------------------------------------------------------+ +% | Reference manual page: Point_container.tex +% +------------------------------------------------------------------------+ +% | 1.07.2001 Johan W.H. Tangelder +% | Package: ASPAS +% | +\RCSdef{\RCSPointcontainerRev}{$Id$} +\RCSdefDate{\RCSPointcontainerDate}{$Date$} +% | +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ + + +\begin{ccRefClass}{Point_container} + +%% \ccHtmlCrossLink{} %% add further rules for cross referencing links +%% \ccHtmlIndexC[class]{} %% add further index entries + + +\begin{ccAdvanced} + + +\ccDefinition +A custom container for points used to build a tree. Each point container +holds the points from a rectangle associated with a node of the tree. +In the remainder of this reference page this rectangle is called the +associated rectangle. +Provides a method to split a container and a number of methods +to support the implementation of splitting rules. + +\ccInclude{CGAL/Point_container.h} + +\ccParameters + +Expects for the template argument an implementation for +$d$-dimensional points of the concept \ccc{SearchTraits}, for example +\ccc{CGAL::Cartesian_d}. + +\ccTypes + +\ccTypedef{Traits::FT FT;}{Number type.} +\ccTypedef{Traits::Point_d Point_d;}{Point type.} +\ccNestedType{iterator}{An iterator with value type \ccc{Point_d*}.} + +%---------------------------------------- +\ccCreation +\ccCreationVariable{c} + +\ccConstructor{Point_container(int d);} +{ +Construct an empty container for storing \ccc{d}-dimensional points. +} + +\ccConstructor{ +template +Point_container(int d, InputIterator begin, InputIterator end);} +{ +Construct the container of $d$-dimensional points of type \ccc{Point_d} +given by the iterator sequence \ccc{[begin, end)}.} + + + +\ccOperations + +\ccMethod{template +void split(Point_container &c2, SpatialSeparator sep, bool sliding=false);} +{Given an empty container \ccc{c2} with the same dimension as \ccVar, splits \ccVar\ into +\ccVar and \ccc{c2} using the separator \ccc{sep}. If sliding is \ccc{true} after splitting +each container contains at least one point. Container \ccVar\ should contain at least two points.} + + +\ccMethod{void swap(Point_container &c2);} +{Swap the contents of \ccVar\ and \ccc{c2}} + + +\ccMethod{void recompute_tight_bounding_box();} +{Recompute the bounding box of the points in the container.} + + +\ccMethod{iterator begin();} +{ +Return an iterator pointing to the pointer to the first point. +} + +\ccMethod{iterator end();} +{ +Return the iterator to the corresponding past-the-end iterator. +} + +\ccMethod{int dimension() const;} +{ +Return the dimension. +} + +\ccMethod{int built_coordinate();} +{ +Return coordinate for which the pointer list is built. +} + +\ccMethod{int max_span_coord();} +{ +Return coordinate where the associated rectangle has maximal span. +} + +\ccMethod{int max_tight_span_coord();} +{ +Return coordinate where the point coordinates have maximal span. +} + +\ccMethod{FT max_span_lower();} +{ +Return lower value of the interval corresponding to +\ccc{max_span_coord()}. +} + + +\ccMethod{FT max_tight_span_lower();} +{ +Return lower value of the interval corresponding to +\ccc{max_tight_span_coord()}. That is, the smallest +\ccc{max_tight_span_coord()}-th coordinate of the points in +\ccVar. +} + + +\ccMethod{FT max_span_upper();} +{ +Return upper value of the interval corresponding to +\ccc{max_span_coord()}. +} + +\ccMethod{FT max_span_upper_without_dim(int d);} +{ +Return upper value of the interval over all dimensions +without taking dimension \ccc{d} into account. +} + +\ccMethod{FT max_tight_span_upper();} +{ +Return upper value of the interval corresponding to +\ccc{max_tight_span_coord()}. +} + +\ccMethod{FT max_spread();} +{ +Return the size of the interval corresponding to \ccc{max_span_coord()}. +} + +\ccMethod{FT max_tight_spread();} +{ +Return the size of the interval corresponding to \ccc{max_tight_span_coord()}. +} + +\ccMethod{FT median(int split_coord);} +{ +Return the median value of the points stored in the container for +dimension \ccc{split_coord}. +} + +\ccMethod{const Kd_tree_rectangle & bounding_box();} +{Return the associated rectangle.} + +\ccMethod{const Kd_tree_rectangle & tight_bounding_box();} +{Return the bounding box of the items in associated rectangle.} + +\ccMethod{int max_tight_span_coord_balanced(FT aspect_ratio);} +{Return the dimension with the maximal point spread, for which after fair splitting +the ratio of the length of the longest side and the smallest side of the bounding box of +the items in associated rectangle, +does not exceed \ccc{aspect_ratio}.} + +\ccMethod{FT balanced_fair(int d, FT aspect_ratio);} +{Return the splitting value for fair splitting.} + +\ccMethod{FT balanced_sliding_fair(int d, FT aspect_ratio);} +{Return the splitting value for sliding fair splitting.} + +\ccMethod{int size();} +{ +Return the number of points stored. +} + +\ccMethod{bool empty();} +{ +Return true if no points are present, false otherwise. +} + + + + +\ccHeading{Output Routines} + +\ccFunction{ template +std::ostream& operator<<(std::ostream& s, Point_container c);} +{Prints the point container \ccVar\ to the output stream \ccc{s} and returns \ccc{s}.} + + +\ccSeeAlso + +\ccc{SearchTraits}\\ +\ccc{SpatialSeparator} + +\end{ccAdvanced} +\end{ccRefClass} + +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +% EOF +% +------------------------------------------------------------------------+ + diff --git a/Spatial_searching/doc_tex/Spatial_searching_ref/Splitter.tex b/Spatial_searching/doc_tex/Spatial_searching_ref/Splitter.tex index 76122930cd6..0ca645ca127 100644 --- a/Spatial_searching/doc_tex/Spatial_searching_ref/Splitter.tex +++ b/Spatial_searching/doc_tex/Spatial_searching_ref/Splitter.tex @@ -35,6 +35,7 @@ The concept \ccRefName\ defines the requirements for a function object class imp \ccNestedType{FT}{Number type.} \ccNestedType{Separator}{Separator.} +\ccNestedType{Container}{Typedef to an instantiation of \ccc{CGAL::Point_container}.} \ccCreationVariable{s} %% choose variable name @@ -49,8 +50,11 @@ of a cell allowed for fair splitting.} \ccMethod{unsigned int bucket_size();} {Returns the bucket size of the leaf nodes.} - - +\ccMethod{void operator()(Separator& sep, Container& c0, Container& c1) const;} +{ + Sets up \ccc{sep} and splits points of \ccc{c0} into \ccc{c0} and \ccc{c1} using \ccc{sep}. + Container \ccc{c0} should contain at least two points and \ccc{c1} must be empty. +} \end{ccAdvanced} diff --git a/Spatial_searching/doc_tex/Spatial_searching_ref/intro.tex b/Spatial_searching/doc_tex/Spatial_searching_ref/intro.tex index d567db95d27..9557c80bc93 100644 --- a/Spatial_searching/doc_tex/Spatial_searching_ref/intro.tex +++ b/Spatial_searching/doc_tex/Spatial_searching_ref/intro.tex @@ -83,7 +83,8 @@ classes that are described in the reference pages. \ccRefIdfierPage{CGAL::Kd_tree_node} \\ \ccRefIdfierPage{CGAL::Kd_tree_rectangle} \\ -\ccRefIdfierPage{CGAL::Plane_separator} +\ccRefIdfierPage{CGAL::Plane_separator} \\ +\ccRefIdfierPage{CGAL::Point_container} \ccHeading{Concepts} @@ -93,7 +94,8 @@ classes that are described in the reference pages. \ccRefConceptPage{SearchTraits} \\ \ccRefConceptPage{RangeSearchTraits} \\ \ccRefConceptPage{SpatialSeparator} \\ -\ccRefConceptPage{SpatialTree} +\ccRefConceptPage{SpatialTree}\\ +\ccRefConceptPage{Splitter} diff --git a/Spatial_searching/doc_tex/Spatial_searching_ref/main.tex b/Spatial_searching/doc_tex/Spatial_searching_ref/main.tex index aef7c3eee70..ea49759d2b7 100644 --- a/Spatial_searching/doc_tex/Spatial_searching_ref/main.tex +++ b/Spatial_searching/doc_tex/Spatial_searching_ref/main.tex @@ -28,6 +28,7 @@ \input{Spatial_searching_ref/Orthogonal_incremental_neighbor_search.tex} \input{Spatial_searching_ref/Orthogonal_k_neighbor_search.tex} \input{Spatial_searching_ref/Plane_separator.tex} +\input{Spatial_searching_ref/Point_container.tex} \input{Spatial_searching_ref/SearchTraits.tex} \input{Spatial_searching_ref/RangeSearchTraits.tex} From 68fa5cdfb7e426ead9a12656edfbba95ae87f6b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 6 Sep 2011 08:12:50 +0000 Subject: [PATCH 51/64] DOC BUGFIX: remove a remark that I forget to remove at r63613 --- .../doc_tex/Spatial_searching_ref/Search_traits_adapter.tex | 1 - 1 file changed, 1 deletion(-) diff --git a/Spatial_searching/doc_tex/Spatial_searching_ref/Search_traits_adapter.tex b/Spatial_searching/doc_tex/Spatial_searching_ref/Search_traits_adapter.tex index 9936fb63f87..ad397d7c07b 100644 --- a/Spatial_searching/doc_tex/Spatial_searching_ref/Search_traits_adapter.tex +++ b/Spatial_searching/doc_tex/Spatial_searching_ref/Search_traits_adapter.tex @@ -14,7 +14,6 @@ must be used as distance. \ccc{Key} is a type that is associated to a point of type \ccc{Base_distance::Point_d}.\\ \ccc{PointPropertyMap} is a model of \ccAnchor{http://www.boost.org/doc/libs/release/libs/property_map/doc/ReadablePropertyMap.html}{boost::ReadablePropertyMap} with \ccc{Key} as \ccc{key_type} and \ccc{Base_distance::Point_d} as \ccc{value_type}.\\ -In practice, the current implementation requires a class providing \ccc{BaseTraits::Point_d operator[] (const Key& point) const}.\\ \ccc{BaseTraits} is a model of either \ccc{SearchTraits} or \ccc{RangeSearchTraits}. \ccInheritsFrom From 5a9d789b73cf7e38eb1ffabb40d45b0ae41b0373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 6 Sep 2011 09:31:35 +0000 Subject: [PATCH 52/64] DOC BUGFIX: dos2unix to convert CR LF end-of-line to LF (fix bad looking doc page) --- AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex | 372 +++++++++--------- 1 file changed, 186 insertions(+), 186 deletions(-) diff --git a/AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex b/AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex index 4f872291da5..141419347af 100644 --- a/AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex +++ b/AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex @@ -1,186 +1,186 @@ -% +------------------------------------------------------------------------+ -% | Reference manual page: AABB_tree.tex -% +------------------------------------------------------------------------+ -% | 21.02.2009 Author -% | Package: Package -% | -\RCSdef{\RCSAABBtreeRev}{$Id: header.tex 40270 2007-09-07 15:29:10Z lsaboret $} -\RCSdefDate{\RCSAABBtreeDate}{$Date: 2007-09-07 17:29:10 +0200 (Ven, 07 sep 2007) $} -% | -\ccRefPageBegin -%%RefPage: end of header, begin of main body -% +------------------------------------------------------------------------+ - - -\begin{ccRefClass}{AABB_tree} %% add template arg's if necessary - -%% \ccHtmlCrossLink{} %% add further rules for cross referencing links -%% \ccHtmlIndexC[class]{} %% add further index entries - -\ccDefinition - -Class \ccRefName\ is a static data structure for efficient intersection and distance computations in 3D. It builds a hierarchy of axis-aligned bounding boxes (an AABB tree) from a set of 3D geometric objects, and can receive intersection and distance queries, provided that the corresponding predicates are implemented in the traits class \ccc{AT}. The template parameter \ccc{AT} stands for a traits class which must be a model of the concept \ccc{AABBTraits}. - -\ccInclude{CGAL/AABB_tree.h} - -\ccTypes -\ccNestedType{size_type;}{Unsigned integral size type.} -\ccGlue -\ccTypedef{typedef AT::FT FT;}{Number type returned by the distance queries.} -\ccGlue -\ccTypedef{typedef AT::Point_3 Point;}{Type of 3D point.} -\ccGlue -\ccTypedef{typedef AT::Primitive Primitive;}{Type of input primitive.} -\ccGlue -\ccTypedef{typedef AT::Bounding_box Bounding_box;}{Type of bounding box.} -\ccGlue -\ccTypedef{typedef std::pair Point_and_primitive_id;}{} -\ccGlue -\ccTypedef{typedef std::pair Object_and_primitive_id;}{} - -\ccCreation -\ccCreationVariable{tree} - -\ccConstructor{AABB_tree();}{Constructs an empty tree.} -\ccConstructor{template < class InputIterator> - AABB_tree( InputIterator begin, - InputIterator beyond);}{Builds the AABB tree data structure. Type \ccc{InputIterator} can be any const iterator such that \ccc{Primitive} has a constructor taking a \ccc{InputIterator} as argument. The tree stays empty if the memory allocation is not successful.} - -\ccOperations - -\ccMethod{template < class InputIterator> - void rebuild(InputIterator begin, - InputIterator beyond);}{Clears the current tree and rebuilds it from scratch. See constructor above for the parameters. } -\ccGlue -\ccMethod{void clear();}{Clears the AABB tree. } - -\ccGlue -\ccMethod{template - void insert(InputIterator begin, InputIterator beyond);} - {Add a sequence of primitives to the set of primitive of the AABB - tree. Type \ccc{InputIterator} can be any const iterator such that \ccc{Primitive} - has a constructor taking an InputIterator as argument.} -\ccGlue -\ccMethod{void insert(const Primitive p);} - {Add a primitive to the set of primitives of the AABB tree.} - -\begin{ccAdvanced} -\ccMethod{void build();} - {After one or more calls to \ccHtmlNoLinksFrom{\ccc{insert}}, the internal data structure - of \ccRefName\ must be reconstructed. This procedure has a complexity of - \ccc{O(n log(n))}, where n is the number of primitives of the tree. This - procedure is called implicitly at the first call to a query member - function. You can call \ccc{build()} explicitly to ensure that the - next call to query functions will not trigger the reconstruction of the - data structure.} -\end{ccAdvanced} - - -\ccGlue -\ccMethod{Bounding_box bbox();}{Returns the axis-aligned bounding box of the whole tree. } -\ccGlue -\ccMethod{size_type size();}{Returns the number of primitives in the tree. } -\ccGlue -\ccMethod{bool empty();}{Returns \ccc{true}, iff tree contains no primitive. } - -% INTERSECTION TESTS -\ccHeading{Intersection Tests} - -\ccMethod{template - bool do_intersect(const Query& query);}{Returns \ccc{true}, iff the query intersects at least one of the input primitives. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} -\ccGlue -\ccMethod{template - size_type number_of_intersected_primitives(const Query& query);}{Returns the number of primitives intersected by the query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} -\ccGlue -\ccMethod{template - OutputIterator - all_intersected_primitives(const Query& query, - OutputIterator out);}{Outputs to the iterator the list of all intersected primitives ids. This function does not compute the intersection points and is hence faster than the function \ccc{all_intersections} function below. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} -\ccGlue -\ccMethod{template - boost::optional - any_intersected_primitive(const Query& query);}{Returns the first encountered intersected primitive id, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} - - -% INTERSECTIONS -\ccHeading{Intersections} - -\ccMethod{template - OutputIterator - all_intersections(const Query& query, - OutputIterator out);}{Outputs to the iterator the list of all intersections between the query and input data, as objects of type \ccc{Object_and_primitive_id}. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.} -\ccGlue -\ccMethod{template - boost::optional - any_intersection(const Query& query);}{Returns the first encountered intersection, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.} - - - -% DISTANCE QUERIES -\ccHeading{Distance Queries} - -\ccMethod{FT -squared_distance(const Point& query);}{Returns the minimum squared distance between the query point and all input primitives. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} -\ccGlue -\ccMethod{Point -closest_point(const Point& query);}{Returns the point in the union of all input primitives which is closest to the query. In case there are several closest points, one arbitrarily chosen closest point is returned. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} -\ccGlue -\ccMethod{Point_and_primitive_id -closest_point_and_primitive(const Point& query);}{Returns a \ccc{Point_and_primitive_id} which realizes the smallest distance between the query point and all input primitives. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} - -% ACCELERATING THE DISTANCE QUERIES - -\ccHeading{Accelerating the Distance Queries} - -\ccMethod{bool accelerate_distance_queries();}{ Constructs an internal data structure for accelerating distance queries. This method should be called once, before the first distance query. -Returns \ccc{true}, iff the memory allocation is successful.} - -\begin{ccAdvanced} -In the following paragraphs, we discuss details of the implementation of the distance queries. We explain the internal use of hints, how the user can pass his own hints to the tree, and how the user can influence the construction of the secondary data structure used for accelerating distance queries. - -Internally, the distance queries algorithms are initialized with some hint, which has the same type as the return type of the query, and this value is refined along a traversal of the tree, until it is optimal, that is to say until it realizes the shortest distance to the primitives. In particular, the exact specification of these internal algorithms is that they minimize the distance to the object composed of the union of the primitives and the hint. - -It follows that -\begin{itemize} -\item in order to return the exact distance to the set of primitives, the algorithms need the hint to be exactly on the primitives; -\item if this is not the case, and if the hint happens to be closer to the query point than any of the primitives, then the hint is returned. -\end{itemize} -This second observation is reasonable, in the sense that providing a hint to the algorithm means claiming that this hint belongs to the union of the primitives. These considerations about the hints being exactly on the primitives or not are important: in the case where the set of primitives is a triangle soup, and if some of the primitives are large, one may want to provide a much better hint than a vertex of the triangle soup could be. It could be, for example, the barycenter of one of the triangles. But, except with the use of an exact constructions kernel, one cannot easily construct points other than the vertices, that lie exactly on a triangle soup. Hence, providing a good hint sometimes means not being able to provide it exactly on the primitives. In rare occasions, this hint can be returned as the closest point. - -In order to accelerate distance queries significantly, the AABB tree builds an internal KD-tree containing a set of potential hints, when the method \ccc{accelerate_distance_queries} is called. This KD-tree provides very good hints that allow the algorithms to run much faster than with a default hint (such as the \ccc{reference_point} of the first primitive). The set of potential hints is a sampling of the union of the primitives, which is obtained, by default, by calling the method \ccc{reference_point} of each of the primitives. However, such a sampling with one point per primitive may not be the most relevant one: if some primitives are very large, it helps inserting more than one sample on them. Conversely, a sparser sampling with less than one point per input primitive is relevant in some cases. - -For this reason, the user can provide his own set of sample points: - -\ccMethod{template -bool accelerate_distance_queries(InputIterator begin, - InputIterator beyond, - PointAndIdBuilder idb = - PointAndIdBuilder());}{ Constructs an internal KD-tree containing the specified point set, to be used as the set of potential hints for accelerating the distance queries. Iterator \ccc{InputIterator} must be accepted as argument by the operator provided by the \ccc{idb} object: this operator returns a \ccc{Point_and_primitive_id} corresponding to the object the iterator points to.} - -Note that, in some cases, the user is not able to provide ids of the primitives on which the points lie. In these cases, providing a default value for the ids of the hints is possible. Still, the user should be aware that if she uses the \ccc{closest_point_and_primitive} method, there is a (tiny) chance that a hint is returned, along with this default value as corresponding primitive id. Hence, the validity of the returned primitive id should be checked in these cases. - -As an alternative to using the KD-tree, the user can also provide the hints directly, by using the following methods: - -\ccMethod{FT -squared_distance(const Point& query, const Point& hint);}{Returns the minimum squared distance between the query point and all input primitives. The internal KD-tree is not used.} - -\ccMethod{Point -closest_point(const Point& query, const Point& hint);}{Returns the point in the union of all input primitives which is closest to the query. In case there are several closest points, one arbitrarily chosen closest point is returned. The internal KD-tree is not used.} - -\ccMethod{Point_and_primitive_id -closest_point_and_primitive(const Point& query, const Point_and_primitive_id& hint);}{Returns a \ccc{Point_and_primitive_id} which realizes the smallest distance between the query point and all input primitives. The internal KD-tree is not used.} - -\end{ccAdvanced} - -\ccSeeAlso - -\ccc{AABBTraits}, \\ -\ccc{AABBPrimitive}. - -\end{ccRefClass} - -% +------------------------------------------------------------------------+ -%%RefPage: end of main body, begin of footer -\ccRefPageEnd -% EOF -% +------------------------------------------------------------------------+ +% +------------------------------------------------------------------------+ +% | Reference manual page: AABB_tree.tex +% +------------------------------------------------------------------------+ +% | 21.02.2009 Author +% | Package: Package +% | +\RCSdef{\RCSAABBtreeRev}{$Id: header.tex 40270 2007-09-07 15:29:10Z lsaboret $} +\RCSdefDate{\RCSAABBtreeDate}{$Date: 2007-09-07 17:29:10 +0200 (Ven, 07 sep 2007) $} +% | +\ccRefPageBegin +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ + + +\begin{ccRefClass}{AABB_tree} %% add template arg's if necessary + +%% \ccHtmlCrossLink{} %% add further rules for cross referencing links +%% \ccHtmlIndexC[class]{} %% add further index entries + +\ccDefinition + +Class \ccRefName\ is a static data structure for efficient intersection and distance computations in 3D. It builds a hierarchy of axis-aligned bounding boxes (an AABB tree) from a set of 3D geometric objects, and can receive intersection and distance queries, provided that the corresponding predicates are implemented in the traits class \ccc{AT}. The template parameter \ccc{AT} stands for a traits class which must be a model of the concept \ccc{AABBTraits}. + +\ccInclude{CGAL/AABB_tree.h} + +\ccTypes +\ccNestedType{size_type;}{Unsigned integral size type.} +\ccGlue +\ccTypedef{typedef AT::FT FT;}{Number type returned by the distance queries.} +\ccGlue +\ccTypedef{typedef AT::Point_3 Point;}{Type of 3D point.} +\ccGlue +\ccTypedef{typedef AT::Primitive Primitive;}{Type of input primitive.} +\ccGlue +\ccTypedef{typedef AT::Bounding_box Bounding_box;}{Type of bounding box.} +\ccGlue +\ccTypedef{typedef std::pair Point_and_primitive_id;}{} +\ccGlue +\ccTypedef{typedef std::pair Object_and_primitive_id;}{} + +\ccCreation +\ccCreationVariable{tree} + +\ccConstructor{AABB_tree();}{Constructs an empty tree.} +\ccConstructor{template < class InputIterator> + AABB_tree( InputIterator begin, + InputIterator beyond);}{Builds the AABB tree data structure. Type \ccc{InputIterator} can be any const iterator such that \ccc{Primitive} has a constructor taking a \ccc{InputIterator} as argument. The tree stays empty if the memory allocation is not successful.} + +\ccOperations + +\ccMethod{template < class InputIterator> + void rebuild(InputIterator begin, + InputIterator beyond);}{Clears the current tree and rebuilds it from scratch. See constructor above for the parameters. } +\ccGlue +\ccMethod{void clear();}{Clears the AABB tree. } + +\ccGlue +\ccMethod{template + void insert(InputIterator begin, InputIterator beyond);} + {Add a sequence of primitives to the set of primitive of the AABB + tree. Type \ccc{InputIterator} can be any const iterator such that \ccc{Primitive} + has a constructor taking an InputIterator as argument.} +\ccGlue +\ccMethod{void insert(const Primitive p);} + {Add a primitive to the set of primitives of the AABB tree.} + +\begin{ccAdvanced} +\ccMethod{void build();} + {After one or more calls to \ccHtmlNoLinksFrom{\ccc{insert}}, the internal data structure + of \ccRefName\ must be reconstructed. This procedure has a complexity of + \ccc{O(n log(n))}, where n is the number of primitives of the tree. This + procedure is called implicitly at the first call to a query member + function. You can call \ccc{build()} explicitly to ensure that the + next call to query functions will not trigger the reconstruction of the + data structure.} +\end{ccAdvanced} + + +\ccGlue +\ccMethod{Bounding_box bbox();}{Returns the axis-aligned bounding box of the whole tree. } +\ccGlue +\ccMethod{size_type size();}{Returns the number of primitives in the tree. } +\ccGlue +\ccMethod{bool empty();}{Returns \ccc{true}, iff tree contains no primitive. } + +% INTERSECTION TESTS +\ccHeading{Intersection Tests} + +\ccMethod{template + bool do_intersect(const Query& query);}{Returns \ccc{true}, iff the query intersects at least one of the input primitives. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} +\ccGlue +\ccMethod{template + size_type number_of_intersected_primitives(const Query& query);}{Returns the number of primitives intersected by the query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} +\ccGlue +\ccMethod{template + OutputIterator + all_intersected_primitives(const Query& query, + OutputIterator out);}{Outputs to the iterator the list of all intersected primitives ids. This function does not compute the intersection points and is hence faster than the function \ccc{all_intersections} function below. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} +\ccGlue +\ccMethod{template + boost::optional + any_intersected_primitive(const Query& query);}{Returns the first encountered intersected primitive id, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} + + +% INTERSECTIONS +\ccHeading{Intersections} + +\ccMethod{template + OutputIterator + all_intersections(const Query& query, + OutputIterator out);}{Outputs to the iterator the list of all intersections between the query and input data, as objects of type \ccc{Object_and_primitive_id}. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.} +\ccGlue +\ccMethod{template + boost::optional + any_intersection(const Query& query);}{Returns the first encountered intersection, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.} + + + +% DISTANCE QUERIES +\ccHeading{Distance Queries} + +\ccMethod{FT +squared_distance(const Point& query);}{Returns the minimum squared distance between the query point and all input primitives. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} +\ccGlue +\ccMethod{Point +closest_point(const Point& query);}{Returns the point in the union of all input primitives which is closest to the query. In case there are several closest points, one arbitrarily chosen closest point is returned. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} +\ccGlue +\ccMethod{Point_and_primitive_id +closest_point_and_primitive(const Point& query);}{Returns a \ccc{Point_and_primitive_id} which realizes the smallest distance between the query point and all input primitives. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} + +% ACCELERATING THE DISTANCE QUERIES + +\ccHeading{Accelerating the Distance Queries} + +\ccMethod{bool accelerate_distance_queries();}{ Constructs an internal data structure for accelerating distance queries. This method should be called once, before the first distance query. +Returns \ccc{true}, iff the memory allocation is successful.} + +\begin{ccAdvanced} +In the following paragraphs, we discuss details of the implementation of the distance queries. We explain the internal use of hints, how the user can pass his own hints to the tree, and how the user can influence the construction of the secondary data structure used for accelerating distance queries. + +Internally, the distance queries algorithms are initialized with some hint, which has the same type as the return type of the query, and this value is refined along a traversal of the tree, until it is optimal, that is to say until it realizes the shortest distance to the primitives. In particular, the exact specification of these internal algorithms is that they minimize the distance to the object composed of the union of the primitives and the hint. + +It follows that +\begin{itemize} +\item in order to return the exact distance to the set of primitives, the algorithms need the hint to be exactly on the primitives; +\item if this is not the case, and if the hint happens to be closer to the query point than any of the primitives, then the hint is returned. +\end{itemize} +This second observation is reasonable, in the sense that providing a hint to the algorithm means claiming that this hint belongs to the union of the primitives. These considerations about the hints being exactly on the primitives or not are important: in the case where the set of primitives is a triangle soup, and if some of the primitives are large, one may want to provide a much better hint than a vertex of the triangle soup could be. It could be, for example, the barycenter of one of the triangles. But, except with the use of an exact constructions kernel, one cannot easily construct points other than the vertices, that lie exactly on a triangle soup. Hence, providing a good hint sometimes means not being able to provide it exactly on the primitives. In rare occasions, this hint can be returned as the closest point. + +In order to accelerate distance queries significantly, the AABB tree builds an internal KD-tree containing a set of potential hints, when the method \ccc{accelerate_distance_queries} is called. This KD-tree provides very good hints that allow the algorithms to run much faster than with a default hint (such as the \ccc{reference_point} of the first primitive). The set of potential hints is a sampling of the union of the primitives, which is obtained, by default, by calling the method \ccc{reference_point} of each of the primitives. However, such a sampling with one point per primitive may not be the most relevant one: if some primitives are very large, it helps inserting more than one sample on them. Conversely, a sparser sampling with less than one point per input primitive is relevant in some cases. + +For this reason, the user can provide his own set of sample points: + +\ccMethod{template +bool accelerate_distance_queries(InputIterator begin, + InputIterator beyond, + PointAndIdBuilder idb = + PointAndIdBuilder());}{ Constructs an internal KD-tree containing the specified point set, to be used as the set of potential hints for accelerating the distance queries. Iterator \ccc{InputIterator} must be accepted as argument by the operator provided by the \ccc{idb} object: this operator returns a \ccc{Point_and_primitive_id} corresponding to the object the iterator points to.} + +Note that, in some cases, the user is not able to provide ids of the primitives on which the points lie. In these cases, providing a default value for the ids of the hints is possible. Still, the user should be aware that if she uses the \ccc{closest_point_and_primitive} method, there is a (tiny) chance that a hint is returned, along with this default value as corresponding primitive id. Hence, the validity of the returned primitive id should be checked in these cases. + +As an alternative to using the KD-tree, the user can also provide the hints directly, by using the following methods: + +\ccMethod{FT +squared_distance(const Point& query, const Point& hint);}{Returns the minimum squared distance between the query point and all input primitives. The internal KD-tree is not used.} + +\ccMethod{Point +closest_point(const Point& query, const Point& hint);}{Returns the point in the union of all input primitives which is closest to the query. In case there are several closest points, one arbitrarily chosen closest point is returned. The internal KD-tree is not used.} + +\ccMethod{Point_and_primitive_id +closest_point_and_primitive(const Point& query, const Point_and_primitive_id& hint);}{Returns a \ccc{Point_and_primitive_id} which realizes the smallest distance between the query point and all input primitives. The internal KD-tree is not used.} + +\end{ccAdvanced} + +\ccSeeAlso + +\ccc{AABBTraits}, \\ +\ccc{AABBPrimitive}. + +\end{ccRefClass} + +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ From cec38470a7222dada9027a915e18a18e071e5171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 6 Sep 2011 09:52:23 +0000 Subject: [PATCH 53/64] remove exe property --- .../AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 AABB_tree/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp diff --git a/AABB_tree/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp b/AABB_tree/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp old mode 100755 new mode 100644 From fcfc1f50928d01ae46d8b647edb0da81b5c8c0b2 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 6 Sep 2011 12:54:37 +0000 Subject: [PATCH 54/64] Bug-fix to the creation of all_files.cpp by CMake It may happen that a file all_files.cpp had been created in-source by a previous in-source build. We certainly do not want to include that file in the new all_files.cpp, because .cpp files would be included twice, and that breaks the one-definition rule (ODR). Remember: in-source build is evil... --- Installation/src/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Installation/src/CMakeLists.txt b/Installation/src/CMakeLists.txt index 25ee817a177..cec8c05cd60 100644 --- a/Installation/src/CMakeLists.txt +++ b/Installation/src/CMakeLists.txt @@ -12,7 +12,13 @@ macro (build_cgal_library LIBRARY_NAME LIBRARY_DIR_NAME ADDITIONAL_FILES) foreach(source ${CGAL_LIBRARY_SOURCE_FILES}) - file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp "\#include \"${source}\"\n") + # It may happen that a file all_files.cpp had been created in-source by + # a previous in-source build. We certainly do not want to include that + # file in the new all_files.cpp because .cpp files would be included + # twice, and that breaks the one-definition rule (ODR). + if(NOT source MATCHES ".*/all_files.cpp") + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp "\#include \"${source}\"\n") + endif() endforeach() # message(STATUS "Additional files: ${ADDITIONAL_FILES}") From ef043927fdebfe14778e79326f25ca17bac7c060 Mon Sep 17 00:00:00 2001 From: Olivier Devillers Date: Tue, 6 Sep 2011 15:21:27 +0000 Subject: [PATCH 55/64] too conservative check removed, for fast removal in delaunay 2d --- Triangulation_2/include/CGAL/Triangulation_2.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index 8c37b6ce222..03b636dd79c 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -3328,11 +3328,11 @@ side_of_oriented_circle(const Point &p0, const Point &p1, const Point &p2, // We successively look whether the leading monomial, then 2nd monomial // of the determinant has non null coefficient. - // 2 iterations are enough (cf paper) + // 2 iterations are enough if p0p1p2 is positive (cf paper) for (int i=3; i>0; --i) { if (points[i] == &p) return ON_NEGATIVE_SIDE; // since p0 p1 p2 are non collinear - // and positively oriented + // and "conceptually" positively oriented Orientation o; if (points[i] == &p2 && (o = orientation(p0,p1,p)) != COLLINEAR ) return Oriented_side(o); @@ -3341,7 +3341,8 @@ side_of_oriented_circle(const Point &p0, const Point &p1, const Point &p2, if (points[i] == &p0 && (o = orientation(p,p1,p2)) != COLLINEAR ) return Oriented_side(o); } - CGAL_triangulation_assertion(false); + // CGAL_triangulation_assertion(false); + //no reason for such precondition and it invalidates fast removal in Delaunay return ON_NEGATIVE_SIDE; } From eed2074f7f523284a2876c8ab539e9bf3ba9e24f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 7 Sep 2011 09:55:59 +0000 Subject: [PATCH 56/64] Fix constness issues in AABB_tree *remove mutable data members *accelerate_distance_queries is not const *clear_search_tree is not const *root_node() const returns a const Node* *add root_note() non-const version *update documentation of AABB_tree class. function constness was not documented *update changes.html --- AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex | 30 +++++++++---------- AABB_tree/include/CGAL/AABB_tree.h | 28 ++++++++++------- .../internal/AABB_tree/AABB_search_tree.h | 4 +-- Installation/changes.html | 12 ++++++++ 4 files changed, 46 insertions(+), 28 deletions(-) diff --git a/AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex b/AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex index 141419347af..3e30b0846f3 100644 --- a/AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex +++ b/AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex @@ -77,29 +77,29 @@ Class \ccRefName\ is a static data structure for efficient intersection and dist \ccGlue -\ccMethod{Bounding_box bbox();}{Returns the axis-aligned bounding box of the whole tree. } +\ccMethod{Bounding_box bbox() const;}{Returns the axis-aligned bounding box of the whole tree. } \ccGlue -\ccMethod{size_type size();}{Returns the number of primitives in the tree. } +\ccMethod{size_type size() const;}{Returns the number of primitives in the tree. } \ccGlue -\ccMethod{bool empty();}{Returns \ccc{true}, iff tree contains no primitive. } +\ccMethod{bool empty() const;}{Returns \ccc{true}, iff tree contains no primitive. } % INTERSECTION TESTS \ccHeading{Intersection Tests} \ccMethod{template - bool do_intersect(const Query& query);}{Returns \ccc{true}, iff the query intersects at least one of the input primitives. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} + bool do_intersect(const Query& query) const;}{Returns \ccc{true}, iff the query intersects at least one of the input primitives. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} \ccGlue \ccMethod{template - size_type number_of_intersected_primitives(const Query& query);}{Returns the number of primitives intersected by the query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} + size_type number_of_intersected_primitives(const Query& query) const;}{Returns the number of primitives intersected by the query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} \ccGlue \ccMethod{template OutputIterator all_intersected_primitives(const Query& query, - OutputIterator out);}{Outputs to the iterator the list of all intersected primitives ids. This function does not compute the intersection points and is hence faster than the function \ccc{all_intersections} function below. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} + OutputIterator out) const;}{Outputs to the iterator the list of all intersected primitives ids. This function does not compute the intersection points and is hence faster than the function \ccc{all_intersections} function below. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} \ccGlue \ccMethod{template boost::optional - any_intersected_primitive(const Query& query);}{Returns the first encountered intersected primitive id, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} + any_intersected_primitive(const Query& query) const;}{Returns the first encountered intersected primitive id, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} % INTERSECTIONS @@ -108,11 +108,11 @@ Class \ccRefName\ is a static data structure for efficient intersection and dist \ccMethod{template OutputIterator all_intersections(const Query& query, - OutputIterator out);}{Outputs to the iterator the list of all intersections between the query and input data, as objects of type \ccc{Object_and_primitive_id}. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.} + OutputIterator out) const;}{Outputs to the iterator the list of all intersections between the query and input data, as objects of type \ccc{Object_and_primitive_id}. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.} \ccGlue \ccMethod{template boost::optional - any_intersection(const Query& query);}{Returns the first encountered intersection, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.} + any_intersection(const Query& query) const;}{Returns the first encountered intersection, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.} @@ -120,13 +120,13 @@ Class \ccRefName\ is a static data structure for efficient intersection and dist \ccHeading{Distance Queries} \ccMethod{FT -squared_distance(const Point& query);}{Returns the minimum squared distance between the query point and all input primitives. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} +squared_distance(const Point& query) const;}{Returns the minimum squared distance between the query point and all input primitives. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} \ccGlue \ccMethod{Point -closest_point(const Point& query);}{Returns the point in the union of all input primitives which is closest to the query. In case there are several closest points, one arbitrarily chosen closest point is returned. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} +closest_point(const Point& query) const;}{Returns the point in the union of all input primitives which is closest to the query. In case there are several closest points, one arbitrarily chosen closest point is returned. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} \ccGlue \ccMethod{Point_and_primitive_id -closest_point_and_primitive(const Point& query);}{Returns a \ccc{Point_and_primitive_id} which realizes the smallest distance between the query point and all input primitives. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} +closest_point_and_primitive(const Point& query) const;}{Returns a \ccc{Point_and_primitive_id} which realizes the smallest distance between the query point and all input primitives. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} % ACCELERATING THE DISTANCE QUERIES @@ -162,13 +162,13 @@ Note that, in some cases, the user is not able to provide ids of the primitives As an alternative to using the KD-tree, the user can also provide the hints directly, by using the following methods: \ccMethod{FT -squared_distance(const Point& query, const Point& hint);}{Returns the minimum squared distance between the query point and all input primitives. The internal KD-tree is not used.} +squared_distance(const Point& query, const Point& hint) const;}{Returns the minimum squared distance between the query point and all input primitives. The internal KD-tree is not used.} \ccMethod{Point -closest_point(const Point& query, const Point& hint);}{Returns the point in the union of all input primitives which is closest to the query. In case there are several closest points, one arbitrarily chosen closest point is returned. The internal KD-tree is not used.} +closest_point(const Point& query, const Point& hint) const;}{Returns the point in the union of all input primitives which is closest to the query. In case there are several closest points, one arbitrarily chosen closest point is returned. The internal KD-tree is not used.} \ccMethod{Point_and_primitive_id -closest_point_and_primitive(const Point& query, const Point_and_primitive_id& hint);}{Returns a \ccc{Point_and_primitive_id} which realizes the smallest distance between the query point and all input primitives. The internal KD-tree is not used.} +closest_point_and_primitive(const Point& query, const Point_and_primitive_id& hint) const;}{Returns a \ccc{Point_and_primitive_id} which realizes the smallest distance between the query point and all input primitives. The internal KD-tree is not used.} \end{ccAdvanced} diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 83fa98978ed..e0179404d76 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -1,4 +1,4 @@ -// Copyright (c) 2008 INRIA Sophia-Antipolis (France), ETH Zurich (Switzerland). +// Copyright (c) 2008,2011 INRIA Sophia-Antipolis (France), ETH Zurich (Switzerland). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -121,12 +121,12 @@ namespace CGAL { // returns true iff successful memory allocation template bool accelerate_distance_queries(ConstPointIterator first, - ConstPointIterator beyond) const; + ConstPointIterator beyond); /// Construct internal search tree from /// a point set taken on the internal primitives // returns true iff successful memory allocation - bool accelerate_distance_queries() const; + bool accelerate_distance_queries(); // intersection tests template @@ -165,7 +165,7 @@ namespace CGAL { } // clears internal KD tree - void clear_search_tree() const + void clear_search_tree() { delete m_p_search_tree; m_p_search_tree = NULL; @@ -213,16 +213,22 @@ namespace CGAL { // single root node Node* m_p_root_node; - Node* root_node() const { + const Node* root_node() const { if(m_need_build) - const_cast< AABB_tree* >(this)->build(); + const_cast< AABB_tree* >(this)->build(); //THIS IS NOT THREADSAFE + return m_p_root_node; + } + + Node* root_node() { + if(m_need_build) + build(); return m_p_root_node; } // search KD-tree - mutable Search_tree* m_p_search_tree; - mutable bool m_search_tree_constructed; - mutable bool m_default_search_tree_constructed; + const Search_tree* m_p_search_tree; + bool m_search_tree_constructed; + bool m_default_search_tree_constructed; bool m_need_build; private: @@ -329,7 +335,7 @@ namespace CGAL { template template bool AABB_tree::accelerate_distance_queries(ConstPointIterator first, - ConstPointIterator beyond) const + ConstPointIterator beyond) { // clears current KD tree clear_search_tree(); @@ -349,7 +355,7 @@ namespace CGAL { // constructs the search KD tree from internal primitives template - bool AABB_tree::accelerate_distance_queries() const + bool AABB_tree::accelerate_distance_queries() { CGAL_assertion(!m_primitives.empty()); diff --git a/AABB_tree/include/CGAL/internal/AABB_tree/AABB_search_tree.h b/AABB_tree/include/CGAL/internal/AABB_tree/AABB_search_tree.h index 370154f5339..91743d5e5bb 100644 --- a/AABB_tree/include/CGAL/internal/AABB_tree/AABB_search_tree.h +++ b/AABB_tree/include/CGAL/internal/AABB_tree/AABB_search_tree.h @@ -121,8 +121,8 @@ namespace CGAL delete m_p_tree; } - // TOFIX: make it const - Point_and_primitive_id closest_point(const Point& query) + + Point_and_primitive_id closest_point(const Point& query) const { typedef typename Add_decorated_point::Point_3 Decorated_point; Neighbor_search search(*m_p_tree, query, 1); diff --git a/Installation/changes.html b/Installation/changes.html index 11776392008..08dfd411be6 100644 --- a/Installation/changes.html +++ b/Installation/changes.html @@ -98,6 +98,18 @@ Number of lines of code of CGAL

+

Release 3.10

+
+

Release date: XXX 2011

+ +

+CGAL 3.10 offers the following improvements and new functionality :

+ +

AABB tree

+
    +
  • Fix constness issues in the AABB_tree class.
  • +
+

Release 3.9

Release date: XXX 2011

From 795ab804867d91bd9393d2abacd9b0799190b553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Sep 2011 08:56:16 +0000 Subject: [PATCH 57/64] use a mutex in const function root_node to protect the non const call to build() The class AABB_tree is now read-only thread-safe --- AABB_tree/include/CGAL/AABB_tree.h | 15 +++++++++++++-- Installation/changes.html | 3 ++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index e0179404d76..79db9c4bca3 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -27,6 +27,10 @@ #include #include +#ifdef CGAL_HAS_THREADS +#include +#endif + namespace CGAL { /** @@ -212,10 +216,17 @@ namespace CGAL { Primitives m_primitives; // single root node Node* m_p_root_node; - + #ifdef CGAL_HAS_THREADS + mutable boost::mutex internal_tree_mutex;//mutex used to protect const calls inducing build() + #endif + const Node* root_node() const { + #ifdef CGAL_HAS_THREADS + //this ensure that build() will be called once + boost::mutex::scoped_lock scoped_lock(internal_tree_mutex); + #endif if(m_need_build) - const_cast< AABB_tree* >(this)->build(); //THIS IS NOT THREADSAFE + const_cast< AABB_tree* >(this)->build(); return m_p_root_node; } diff --git a/Installation/changes.html b/Installation/changes.html index 08dfd411be6..a9950278076 100644 --- a/Installation/changes.html +++ b/Installation/changes.html @@ -107,7 +107,8 @@ CGAL 3.10 offers the following improvements and new functionality :

AABB tree

    -
  • Fix constness issues in the AABB_tree class.
  • +
  • Document constness of member functions of the AABB_tree class.
  • +
  • The class AABB_tree is now guarantee to be read-only thread-safe.

Release 3.9

From afe2d565b65383829d51117af4ea94759917e93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Sep 2011 09:58:37 +0000 Subject: [PATCH 58/64] remove commited CMakeLists --- .gitattributes | 1 - .../examples/Combinatorial_map/CMakeLists.txt | 43 ------------------- 2 files changed, 44 deletions(-) delete mode 100644 Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt diff --git a/.gitattributes b/.gitattributes index bfe51e3a5f8..45db58d398a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1376,7 +1376,6 @@ Combinatorial_map/doc_tex/Combinatorial_map_ref/Dart_base.tex -text Combinatorial_map/doc_tex/Combinatorial_map_ref/intro.tex -text Combinatorial_map/doc_tex/Combinatorial_map_ref/main.tex -text Combinatorial_map/dont_submit -text -Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt -text Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp -text Combinatorial_map/examples/Combinatorial_map/map_3_operations.cpp -text Combinatorial_map/examples/Combinatorial_map/map_3_simple_example.cpp -text diff --git a/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt b/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt deleted file mode 100644 index 22ccc13909c..00000000000 --- a/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -# Created by the script cgal_create_cmake_script -# This is the CMake script for compiling a CGAL application. - -# cmake ../ -DCMAKE_BUILD_TYPE=Debug -# ou -# cmake ../ -DCMAKE_BUILD_TYPE=Release - -project( Combinatorial_map_examples ) - -CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5) - -#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) - -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -w -Wall -pedantic") # -Wextra") - -if ( COMMAND cmake_policy ) - cmake_policy( SET CMP0003 NEW ) -endif() - -# For the problem with valgrind -# add_definition(-DCGAL_DISABLE_ROUNDING_MATH_CHECK) - -find_package(CGAL QUIET COMPONENTS Core ) - -if ( CGAL_FOUND ) - - include( ${CGAL_USE_FILE} ) - - include( CGAL_CreateSingleSourceCGALProgram ) - include_directories(BEFORE ../../include) - - create_single_source_cgal_program( "map_3_simple_example.cpp" ) - create_single_source_cgal_program( "map_4_simple_example.cpp" ) - create_single_source_cgal_program( "map_3_with_colored_facets.cpp" ) - create_single_source_cgal_program( "map_3_operations.cpp" ) - create_single_source_cgal_program( "map_3_marks.cpp" ) -else() - - message(STATUS "This program requires the CGAL library, and will not be compiled.") - -endif() - From 1046e461e7df6240cc54e65d697551f58793d4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Sep 2011 10:04:15 +0000 Subject: [PATCH 59/64] thread-safe static Polynomial::get_default_instance() --- .../include/CGAL/Polynomial/Polynomial_type.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h index ea63f428704..c5aed1e00de 100644 --- a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h +++ b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h @@ -44,6 +44,10 @@ typename CGAL::internal::Innermost_coefficient_type::Type , 2>::Type #include #include +#ifdef CGAL_HAS_THREADS +# include +#endif + namespace CGAL { template class Polynomial; @@ -261,8 +265,15 @@ protected: // private: static Self& get_default_instance(){ - static Self x = Self(0); - return x; + #ifdef CGAL_HAS_THREADS + static boost::thread_specific_ptr< Self > safe_x_ptr; + if (safe_x_ptr.get() == NULL) + safe_x_ptr.reset(new Self(0)); + return *safe_x_ptr.get(); + #else + static Self x = Self(0); + return x; + #endif } public: //! \name Constructors From a38b015d15ca11a2fb9fa16334d82bd0b8c19279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Sep 2011 10:24:11 +0000 Subject: [PATCH 60/64] add a comment about deactivating thread-safety code --- Installation/changes.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Installation/changes.html b/Installation/changes.html index a9950278076..4804c9aefac 100644 --- a/Installation/changes.html +++ b/Installation/changes.html @@ -108,7 +108,8 @@ CGAL 3.10 offers the following improvements and new functionality :

AABB tree

  • Document constness of member functions of the AABB_tree class.
  • -
  • The class AABB_tree is now guarantee to be read-only thread-safe.
  • +
  • The class AABB_tree is now guarantee to be read-only thread-safe. As usual in CGAL, + this small overhead introduced for thread-safety can be deactivated by defining CGAL_HAS_NO_THREADS.

Release 3.9

From a09f6640f5611571a0f3fdf2364b829843aafe2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Sep 2011 12:02:06 +0000 Subject: [PATCH 61/64] remove non-const version of root_node added in r65337 for backward compatibility. It is not documented and not used (in a non-const context). --- AABB_tree/include/CGAL/AABB_tree.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 79db9c4bca3..32f26eb43ef 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -230,12 +230,6 @@ namespace CGAL { return m_p_root_node; } - Node* root_node() { - if(m_need_build) - build(); - return m_p_root_node; - } - // search KD-tree const Search_tree* m_p_search_tree; bool m_search_tree_constructed; From f8449dcec4a48873c814300b1012b3ba37de5ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Sep 2011 15:54:44 +0000 Subject: [PATCH 62/64] more efficient usage of mutex. The lock is only done if the build need to be done. We have an extra "if (m_need_build)" but otherwise we would need to use mutex::try_lock() which results in more code and as efficient. --- AABB_tree/include/CGAL/AABB_tree.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 32f26eb43ef..998064153ea 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -28,6 +28,7 @@ #include #ifdef CGAL_HAS_THREADS +#warning USING THEADS #include #endif @@ -221,12 +222,14 @@ namespace CGAL { #endif const Node* root_node() const { - #ifdef CGAL_HAS_THREADS - //this ensure that build() will be called once - boost::mutex::scoped_lock scoped_lock(internal_tree_mutex); - #endif - if(m_need_build) - const_cast< AABB_tree* >(this)->build(); + if(m_need_build){ + #ifdef CGAL_HAS_THREADS + //this ensure that build() will be called once + boost::mutex::scoped_lock scoped_lock(internal_tree_mutex); + if(m_need_build) + #endif + const_cast< AABB_tree* >(this)->build(); + } return m_p_root_node; } From c93ba3a2153d7db47ec1d8a30e6872123717b038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Sep 2011 16:03:23 +0000 Subject: [PATCH 63/64] remove temporary comment --- AABB_tree/include/CGAL/AABB_tree.h | 1 - 1 file changed, 1 deletion(-) diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 998064153ea..95269c99a0b 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -28,7 +28,6 @@ #include #ifdef CGAL_HAS_THREADS -#warning USING THEADS #include #endif From fb696f8e2799a8e8b8acce78087cbf569e39c159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 8 Sep 2011 16:09:35 +0000 Subject: [PATCH 64/64] typo --- Installation/changes.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Installation/changes.html b/Installation/changes.html index 4804c9aefac..d439c815cd8 100644 --- a/Installation/changes.html +++ b/Installation/changes.html @@ -108,7 +108,7 @@ CGAL 3.10 offers the following improvements and new functionality :

AABB tree

  • Document constness of member functions of the AABB_tree class.
  • -
  • The class AABB_tree is now guarantee to be read-only thread-safe. As usual in CGAL, +
  • The class AABB_tree is now guaranteed to be read-only thread-safe. As usual in CGAL, this small overhead introduced for thread-safety can be deactivated by defining CGAL_HAS_NO_THREADS.