diff --git a/.gitattributes b/.gitattributes index 89e804854f6..4bec6dc95e2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -266,8 +266,7 @@ Approximate_min_ellipsoid_d/documentation/boundingbox.mw -text svneol=native#app Arithmetic_kernel/include/CGAL/CORE_arithmetic_kernel.h -text Arithmetic_kernel/include/CGAL/GMP_arithmetic_kernel.h -text Arithmetic_kernel/include/CGAL/LEDA_arithmetic_kernel.h -text -Arithmetic_kernel/include/CGAL/OLD/GMP/Gmpfr_interval_type.h -text -Arithmetic_kernel/include/CGAL/OLD/Gmpfr_interval.h -text +Arithmetic_kernel/include/CGAL/MP_Float_arithmetic_kernel.h -text Arithmetic_kernel/package_info/Arithmetic_kernel/description.txt -text Arithmetic_kernel/package_info/Arithmetic_kernel/maintainer -text Arithmetic_kernel/test/Arithmetic_kernel/Arithmetic_kernel.cpp -text @@ -453,6 +452,7 @@ Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/fig/unb_dcel.gif -text Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/fig/unb_dcel.pdf -text svneol=unset#application/pdf Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_algebraic_segment_traits.tex -text Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_halfedge_direction.tex -text +Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_rational_function_traits.tex -text Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/arr_do_intersect.tex -text Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/arr_zone.tex -text Arrangement_on_surface_2/doc_tex/Sweep_line_2/fig/Curve_intersections_2.png -text @@ -653,10 +653,11 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/vertex.pt -te Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/vertex.xcv -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/conics/xcurves -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/empty.zero -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/boundary_near_x -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/boundary_near_y -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_at_limit -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_near_limit -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_y_at_x -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_y_at_x_left -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_y_near_boundary -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/curves -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/intersect -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/is_vertical -text @@ -734,8 +735,11 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/split.xcv Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/vertex -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/vertex.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/vertex.xcv -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_at_limit -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_near_limit -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_y_at_x -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_y_at_x_left -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_y_near_boundary -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/curves -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/intersect -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/is_vertical -text @@ -767,14 +771,15 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/split.xcv - Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/vertex -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/vertex.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/segments/xcurves -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/boundary_near_x -text -Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/boundary_near_y -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare.xcv -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_x_near_boundary -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_x_on_boundary -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_y_at_x -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_y_at_x.pt -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_y_at_x.xcv -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_y_near_boundary -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/curves -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/intersect -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/is_vertical -text @@ -819,6 +824,7 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_do_equal.cpp -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_do_intersect.cpp -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_observer.cmd -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_observer.cpp -text +Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_rational_function_traits_2.cpp -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_adaptor.cpp -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_adaptor.h -text Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_zone.cpp -text @@ -1235,12 +1241,6 @@ Circular_kernel_2/benchmark/readme.doc -text svneol=unset#application/msword Circular_kernel_2/benchmark/readme.pdf -text svneol=unset#application/pdf Circular_kernel_2/benchmark/readme.sxw -text Circular_kernel_2/changes -text -Circular_kernel_2/demo/Circular_kernel_2/Qt3/README -text -Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/get_arc.jpeg -text svneol=unset#image/jpeg -Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/index.html svneol=native#text/html -Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/planar_map_icon.jpeg -text svneol=unset#image/jpeg -Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/sweeper.jpeg -text svneol=unset#image/jpeg -Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/trash.jpeg -text svneol=unset#image/jpeg Circular_kernel_2/doc_tex/Circular_kernel_2/fig/Boolean_operation.png -text Circular_kernel_2/doc_tex/Circular_kernel_2/fig/Boolean_operation_detail.png -text Circular_kernel_2/doc_tex/Circular_kernel_2_ref/GeomFunctorsCompute.tex -text @@ -1276,6 +1276,131 @@ Circular_kernel_3/test/Circular_kernel_3/test_Lazy_spherical_kernel_basics.cpp - Circular_kernel_3/test/Circular_kernel_3/test_Spherical_kernel_basics.cpp -text Circular_kernel_3/test/Circular_kernel_3/test_Spherical_kernel_with_core.cpp -text Circulator/doc_tex/Circulator/circulator.png -text +Combinatorial_map/doc_tex/Combinatorial_map/Combinatorial_map.tex -text +Combinatorial_map/doc_tex/Combinatorial_map/PkgDescription.tex -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/Diagramme_class.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/exemple-carte-3d-sew.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/exemple-carte-3d-sew2.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/exemple-carte2-3d.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/insert-edge.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/insert-facet.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/insert-vertex.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-map.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-map2d.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-zoom.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-zoom2.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/logo-cmap-small-v2.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/logo-cmap-small.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/logo-cmap.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/map2d-with-attrib.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/object2d-nonmanifold.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/object2d.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/object3d-nonmanifold.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/object3d-nonmanifold2.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/object3d.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/ope1.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/ope2.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/ope3.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pb-carte3D.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pb2-carte3D.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/Diagramme_class.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/exemple-carte-3d-sew.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/exemple-carte-3d-sew2.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/exemple-carte2-3d.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/insert-edge.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/insert-facet.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/insert-vertex.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-map.pdf -text svneol=unset#unset +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-map2d.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-zoom.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-zoom2.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/map2d-with-attrib.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object2d-nonmanifold.pdf -text svneol=unset#unset +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object2d.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object3d-nonmanifold.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object3d-nonmanifold2.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object3d.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/ope1.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/ope2.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/ope3.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/pb-carte3D.pdf -text svneol=unset#unset +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/pb2-carte3D.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/quasivariete.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/quasivarietea.pdf -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/triangulation.pdf -text svneol=unset#unset +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/Diagramme_class.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/exemple-carte-3d-sew.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/exemple-carte-3d-sew2.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/exemple-carte2-3d.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/insert-edge.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/insert-facet.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/insert-vertex.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-map.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-map2d.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-zoom.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-zoom2.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/map2d-with-attrib.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object2d-nonmanifold.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object2d.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object3d-nonmanifold.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object3d-nonmanifold2.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object3d.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/ope1.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/ope2.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/ope3.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/pb-carte3D.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/pb2-carte3D.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/quasivariete.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/quasivarietea.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/png/triangulation.png -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/quasivariete.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/quasivarietea.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/fig/triangulation.fig -text +Combinatorial_map/doc_tex/Combinatorial_map/logo-cmap-small-v2.png -text +Combinatorial_map/doc_tex/Combinatorial_map/logo-combinatorial-map-small.png -text +Combinatorial_map/doc_tex/Combinatorial_map/logo-combinatorial-map.png -text +Combinatorial_map/doc_tex/Combinatorial_map/main.tex -text +Combinatorial_map/doc_tex/Combinatorial_map_ref/CellAttribute.tex -text +Combinatorial_map/doc_tex/Combinatorial_map_ref/Cell_attribute.tex -text +Combinatorial_map/doc_tex/Combinatorial_map_ref/CombinatorialMap.tex -text +Combinatorial_map/doc_tex/Combinatorial_map_ref/CombinatorialMapItems.tex -text +Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map.tex -text +Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map_constructors.tex -text +Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map_min_items.tex -text +Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map_operations.tex -text +Combinatorial_map/doc_tex/Combinatorial_map_ref/Dart.tex -text +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/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 +Combinatorial_map/examples/Combinatorial_map/map_3_with_colored_facets.cpp -text +Combinatorial_map/examples/Combinatorial_map/map_4_simple_example.cpp -text +Combinatorial_map/include/CGAL/Cell_attribute.h -text +Combinatorial_map/include/CGAL/Cell_const_iterators.h -text +Combinatorial_map/include/CGAL/Cell_iterators.h -text +Combinatorial_map/include/CGAL/Combinatorial_map.h -text +Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h -text +Combinatorial_map/include/CGAL/Combinatorial_map_constructors.h -text +Combinatorial_map/include/CGAL/Combinatorial_map_min_items.h -text +Combinatorial_map/include/CGAL/Combinatorial_map_operations.h -text +Combinatorial_map/include/CGAL/Dart.h -text +Combinatorial_map/include/CGAL/Dart_const_iterators.h -text +Combinatorial_map/include/CGAL/Dart_iterators.h -text +Combinatorial_map/include/CGAL/internal/Combinatorial_map_functors.h -text +Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h -text +Combinatorial_map/package_info/Combinatorial_map/description.txt -text +Combinatorial_map/package_info/Combinatorial_map/long_description.txt -text +Combinatorial_map/package_info/Combinatorial_map/maintainer -text +Combinatorial_map/test/Combinatorial_map/CMakeLists.txt -text +Combinatorial_map/test/Combinatorial_map/Combinatorial_map_2_test.h -text +Combinatorial_map/test/Combinatorial_map/Combinatorial_map_3_test.h -text +Combinatorial_map/test/Combinatorial_map/Combinatorial_map_test.cpp -text Convex_decomposition_3/demo/Convex_decomposition_3/star.nef3 -text Convex_decomposition_3/doc_tex/Convex_decomposition_3/PkgDescription.tex -text Convex_decomposition_3/doc_tex/Convex_decomposition_3/fig/teaser.png -text @@ -1293,9 +1418,16 @@ Convex_decomposition_3/test/Convex_decomposition_3/star.nef3 -text Convex_hull_2/demo/Convex_hull_2/help/index.html svneol=native#text/html Convex_hull_2/doc_tex/Convex_hull_2/convex_hull.png -text Convex_hull_2/doc_tex/Convex_hull_2/saarhull.png -text svneol=unset#image/png +Convex_hull_3/benchmark/Convex_hull_3/compare_different_approach.cpp -text +Convex_hull_3/benchmark/Convex_hull_3/is_on_positive_side.cpp -text Convex_hull_3/demo/Convex_hull_3/CMakeLists.txt -text Convex_hull_3/doc_tex/Convex_hull_3/bunny.png -text Convex_hull_3/doc_tex/Convex_hull_3/bunny.wrl.gz -text +Convex_hull_3/doc_tex/Convex_hull_3/chull_bimba.png -text +Convex_hull_3/doc_tex/Convex_hull_3_ref/convex_hull_3_to_polyhedron_3.tex -text +Convex_hull_3/examples/Convex_hull_3/incremental_hull_class_3.cpp -text +Convex_hull_3/include/CGAL/convex_hull_3_to_polyhedron_3.h -text +Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp -text Developers_manual/doc_tex/Developers_manual/fig/Cartesian_ipoint.gif -text svneol=unset#image/gif Developers_manual/doc_tex/Developers_manual/fig/Cartesian_orientation.png -text svneol=unset#image/png Developers_manual/doc_tex/Developers_manual/fig/Object.gif -text svneol=unset#image/gif @@ -1378,6 +1510,8 @@ Envelope_3/test/Envelope_3/data/spheres/stest6.cin -text Envelope_3/test/Envelope_3/data/spheres/stest7.cin -text Envelope_3/test/Envelope_3/data/spheres/stest8.cin -text Envelope_3/test/Envelope_3/data/spheres/stest9.cin -text +Envelope_3/test/Envelope_3/data/triangles/edge_bug.cin -text +Envelope_3/test/Envelope_3/data/triangles/edge_bug_all.cin -text Envelope_3/test/Envelope_3/data/triangles/grid_inter_tri_const_envelope.cin -text Envelope_3/test/Envelope_3/data/triangles/grid_inter_tri_const_envelope_40.cin -text Envelope_3/test/Envelope_3/data/triangles/grid_intersecting_triangles.cin -text @@ -1415,6 +1549,7 @@ Envelope_3/test/Envelope_3/spheres_test.cmd eol=lf Envelope_3/test/Envelope_3/triangles_test.cmd eol=lf Filtered_kernel/developer_scripts/profile_cleanup -text Filtered_kernel/include/CGAL/internal/Static_filters/Compare_squared_radius_3.h -text +Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp -text Generator/demo/Generator/qt3/help/index.html svneol=native#text/html Generator/doc_tex/Generator/Segment_generator_prog1.png -text svneol=unset#image/png Generator/doc_tex/Generator/Segment_generator_prog2.png -text svneol=unset#image/png @@ -1628,13 +1763,17 @@ 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/testfiles/CGAL_CFG_NO_CPP0X_NEXT_PREV.cpp -text Installation/config/version.h.in -text Installation/doc_tex/Installation/cmakelogo.png -text svneol=unset#image/png Installation/doc_tex/Installation/illustration.png -text Installation/html2textrc -text +Installation/include/CGAL/internal/deprecation_warning.h -text Installation/src/CMakeLists.txt -text Installation/test/Installation/CMakeLists.txt -text +Installation/test/Installation/deprecation_warning.cpp -text Installation/test/Installation/link_to_CGAL.cpp -text Installation/test/Installation/link_to_CGAL_Core.cpp -text Installation/test/Installation/link_to_CGAL_ImageIO.cpp -text @@ -1708,8 +1847,11 @@ Kernel_23/examples/Kernel_23/cartesian_converter.cpp -text Kernel_23/include/CGAL/functions_on_enums.h -text Kernel_23/include/CGAL/internal/Projection_traits_3.h -text Kernel_23/test/Kernel_23/CMakeLists.txt -text +Kernel_23/test/Kernel_23/overload_bug.cpp -text Kernel_d/doc_tex/Kernel_d/hypercube.png -text Kernel_d/doc_tex/Kernel_d_ref/Kernel_Compute_coordinate_d.tex -text +Kernel_d/doc_tex/Kernel_d_ref/Kernel_Less_coordinate_d.tex -text +Kernel_d/doc_tex/Kernel_d_ref/Kernel_Point_dimension_d.tex -text Kernel_d/include/CGAL/Kernel_d/Cartesian_const_iterator_d.h -text Kernel_d/test/Kernel_d/Linear_algebra-test.cmd eol=lf Kinetic_data_structures/demo/Kinetic_data_structures/data/after002 -text @@ -1872,6 +2014,7 @@ Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/setup Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-11.0-with-g++-4.5.1_F14/setup -text Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-11.1-with-g++-4.5.1_F14-strict-ansi/setup -text Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-11.1-with-g++-4.5.1_F14/setup -text +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-12.0-with-g++-4.5.1_F14/setup -text Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5-branch_CXX0X-F14/setup -text Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5-branch_Release-F14/setup -text Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5.1_F14-MATCHING-BUG-6/setup -text @@ -1898,6 +2041,9 @@ Maintenance/public_release/announcement/CGAL-3.7 -text Maintenance/public_release/announcement/CGAL-3.7-beta1 -text Maintenance/public_release/announcement/CGAL-3.8 -text Maintenance/public_release/announcement/CGAL-3.8-beta -text +Maintenance/public_release/announcement/CGAL-3.8.1 -text +Maintenance/public_release/announcement/CGAL-3.9 -text +Maintenance/public_release/announcement/CGAL-3.9-beta1 -text Maintenance/public_release/scripts/precompiled_demos_zips -text Maintenance/public_release/scripts/prepare_release -text Maintenance/release_building/BUGFIX_NUMBER -text @@ -1934,6 +2080,7 @@ Maintenance/svn_server/hooks/pre-revprop-change.tmpl -text Maintenance/svn_server/hooks/pre-unlock.tmpl -text Maintenance/svn_server/hooks/start-commit -text Maintenance/svn_server/hooks/start-commit.tmpl -text +Maintenance/test_handling/candidate_branches -text Maintenance/test_handling/testresult.css svneol=native#text/css Manual/doc_html/cgal.css -text Manual/doc_html/cgal.ico -text @@ -2426,6 +2573,8 @@ 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/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 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 @@ -2651,6 +2800,7 @@ Number_types/doc_tex/NumberTypeSupport_ref/CORE_BigFloat.tex -text Number_types/doc_tex/NumberTypeSupport_ref/Gmpfi.tex -text Number_types/doc_tex/NumberTypeSupport_ref/Gmpfr.tex -text Number_types/doc_tex/NumberTypeSupport_ref/fundamental_types.tex -text +Number_types/doc_tex/NumberTypeSupport_ref/make_sqrt.tex -text Number_types/doc_tex/NumberTypeSupport_ref/open.tex -text Number_types/include/CGAL/GMP/Gmpfi_type.h -text Number_types/include/CGAL/GMP/Gmpfi_type_static.h -text @@ -2659,6 +2809,7 @@ Number_types/include/CGAL/GMP/Gmpfr_type_static.h -text Number_types/include/CGAL/Gmpfi.h -text Number_types/include/CGAL/Gmpfr.h -text Number_types/include/CGAL/Quotient_fwd.h -text +Number_types/include/CGAL/Root_of_traits_specializations.h -text Number_types/include/CGAL/Sqrt_extension/Algebraic_extension_traits.h -text Number_types/include/CGAL/Sqrt_extension/Algebraic_structure_traits.h -text Number_types/include/CGAL/Sqrt_extension/Coercion_traits.h -text @@ -2671,12 +2822,15 @@ Number_types/include/CGAL/Sqrt_extension/Sqrt_extension_type.h -text Number_types/include/CGAL/Sqrt_extension/Wang_traits.h -text Number_types/include/CGAL/Sqrt_extension/convert_to_bfi.h -text Number_types/include/CGAL/Sqrt_extension/io.h -text +Number_types/include/CGAL/Sqrt_extension_fwd.h -text +Number_types/include/CGAL/Test/test_root_of_traits.h -text Number_types/include/CGAL/mpfi_coercion_traits.h -text Number_types/include/CGAL/mpfr_coercion_traits.h -text Number_types/test/Number_types/CMakeLists.txt -text Number_types/test/Number_types/Gmpfi.cpp -text Number_types/test/Number_types/Gmpfr.cpp -text Number_types/test/Number_types/Gmpfr_bug.cpp -text +Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h -text Number_types/test/Number_types/include/CGAL/_test_io.h -text Optimisation_doc/doc_tex/Bounding_volumes/annulus.gif -text svneol=unset#image/gif Optimisation_doc/doc_tex/Bounding_volumes/annulus.pdf -text svneol=unset#application/pdf @@ -2841,6 +2995,7 @@ Polygon/doc_tex/Polygon/polygon.png -text Polyhedron/demo/Polyhedron/MainWindow.ui -text Polyhedron/demo/Polyhedron/Polyhedron_3.qrc -text Polyhedron/demo/Polyhedron/Remeshing_dialog.ui -text +Polyhedron/demo/Polyhedron/Show_point_dialog.ui -text Polyhedron/demo/Polyhedron/cgal_test_with_cmake eol=lf Polyhedron/demo/Polyhedron/data/anchor.off -text svneol=unset#application/octet-stream Polyhedron/demo/Polyhedron/data/bones.off -text svneol=unset#application/octet-stream @@ -3169,7 +3324,14 @@ 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/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp -text STL_Extension/doc_tex/STL_Extension/plusplus.png -text +STL_Extension/include/CGAL/internal/boost/array_binary_tree.hpp -text +STL_Extension/include/CGAL/internal/boost/mutable_heap.hpp -text +STL_Extension/include/CGAL/internal/boost/mutable_queue.hpp -text +STL_Extension/test/STL_Extension/test_Modifiable_priority_queue.cpp -text STL_Extension/test/STL_Extension/test_Uncertain.cpp -text STL_Extension/test/STL_Extension/test_type_traits.cpp -text Scripts/cgal_fetchnpush -text @@ -3178,14 +3340,15 @@ Scripts/developer_scripts/autotest_cgal -text Scripts/developer_scripts/autotest_cgal_with_cmake -text Scripts/developer_scripts/cgal_build -text Scripts/developer_scripts/cgal_git_svn_clone -text +Scripts/developer_scripts/cgal_header_clean_up.py -text Scripts/developer_scripts/cgal_test_with_cmake eol=lf Scripts/developer_scripts/check_library_uses_no_qpl_files -text Scripts/developer_scripts/check_library_uses_no_qpl_files.exceptions -text Scripts/developer_scripts/check_macro_names -text Scripts/developer_scripts/check_no_CGAL_USE_without_includes_before -text Scripts/developer_scripts/check_svn_keywords -text +Scripts/developer_scripts/clean_up_branch.sh -text Scripts/developer_scripts/common_impl.rb -text -Scripts/developer_scripts/create_assertions.sh eol=lf Scripts/developer_scripts/create_cgal_test -text Scripts/developer_scripts/create_cgal_test_with_cmake -text Scripts/developer_scripts/create_demos_zip_files.sh -text @@ -3201,6 +3364,7 @@ Scripts/developer_scripts/remove_package_files_from_build_tree_impl.rb -text Scripts/developer_scripts/replace_CGAL_NAMESPACE.py -text Scripts/developer_scripts/test_testsuite_submission -text Scripts/developer_scripts/update_git_svn_clone -text +Scripts/scripts/cgal_create_assertions.sh eol=lf Scripts/scripts/cgal_create_cmake_script -text Scripts/scripts/cgal_create_cmake_script_with_options -text SearchStructures/doc_tex/SearchStructures/d-range.gif -text svneol=unset#image/gif @@ -3223,6 +3387,7 @@ SearchStructures/doc_tex/SearchStructures_ref/segment_ex2.gif -text svneol=unset SearchStructures/doc_tex/SearchStructures_ref/segment_ex2.pdf -text svneol=unset#application/pdf SearchStructures/doc_tex/SearchStructures_ref/segment_ex4.gif -text svneol=unset#image/gif SearchStructures/doc_tex/SearchStructures_ref/segment_ex4.pdf -text svneol=unset#application/pdf +SearchStructures/examples/RangeSegmentTrees/software_design_rgs.cpp -text Segment_Delaunay_graph_2/benchmark/Segment_Delaunay_graph_2/data/norway.cin -text Segment_Delaunay_graph_2/benchmark/Segment_Delaunay_graph_2/double.cpp -text Segment_Delaunay_graph_2/doc_tex/Segment_Delaunay_graph_2/fig/norway.png -text @@ -3291,19 +3456,54 @@ Snap_rounding_2/doc_tex/Snap_rounding_2/sr1.pdf -text svneol=unset#application/p Snap_rounding_2/test/Snap_rounding_2/cgal_test eol=lf Snap_rounding_2/test/Snap_rounding_2/cgal_test_base -text Snap_rounding_2/test/Snap_rounding_2/cgal_test_with_cmake eol=lf +Spatial_searching/TODO.txt -text Spatial_searching/benchmark/Spatial_searching/Compare_ANN_STANN_CGAL.cpp -text Spatial_searching/demo/Spatial_searching/Qt3/help/index.html svneol=native#text/html Spatial_searching/doc_tex/Spatial_searching/Fig1.gif -text svneol=unset#image/gif Spatial_searching/doc_tex/Spatial_searching/windowQuery.png -text +Spatial_searching/doc_tex/Spatial_searching_ref/Distance_adapter.tex -text +Spatial_searching/doc_tex/Spatial_searching_ref/RangeSearchTraits.tex -text +Spatial_searching/doc_tex/Spatial_searching_ref/Search_traits_adapter.tex -text +Spatial_searching/examples/Spatial_searching/searching_with_point_with_info.cpp -text +Spatial_searching/examples/Spatial_searching/searching_with_point_with_info_inplace.cpp -text +Spatial_searching/examples/Spatial_searching/searching_with_point_with_info_pmap.cpp -text +Spatial_searching/include/CGAL/Search_traits_adapter.h -text Spatial_searching/include/CGAL/internal/K_neighbor_search.h -text Spatial_searching/include/CGAL/internal/bounded_priority_queue.h -text Spatial_searching/test/Spatial_searching/Compare_methods.cpp -text +Spatial_searching/test/Spatial_searching/Point_with_info.h -text +Spatial_sorting/doc_tex/Spatial_sorting/fig/Hilbert-median.gif -text +Spatial_sorting/doc_tex/Spatial_sorting/fig/Hilbert-median.pdf -text +Spatial_sorting/doc_tex/Spatial_sorting/fig/Hilbert-middle.gif -text +Spatial_sorting/doc_tex/Spatial_sorting/fig/Hilbert-middle.pdf -text +Spatial_sorting/doc_tex/Spatial_sorting/fig/Hilbert8.gif -text +Spatial_sorting/doc_tex/Spatial_sorting/fig/Hilbert8.pdf -text Spatial_sorting/doc_tex/Spatial_sorting/fig/hilbert.png -text Spatial_sorting/doc_tex/Spatial_sorting/fig/hilbertLarge.jpg -text -Spatial_sorting/dont_submit -text -Spatial_sorting/examples/Spatial_sorting/data/input.cin -text -Spatial_sorting/examples/Spatial_sorting/example_delaunay_2.cmd -text -Spatial_sorting/examples/Spatial_sorting/sort_indices.cmd -text +Spatial_sorting/doc_tex/Spatial_sorting_ref/Hilbert_policy_tags.tex -text +Spatial_sorting/doc_tex/Spatial_sorting_ref/Hilbert_sort_d.tex -text +Spatial_sorting/doc_tex/Spatial_sorting_ref/SpatialSortingTraits_d.tex -text +Spatial_sorting/doc_tex/Spatial_sorting_ref/Spatial_sort_traits_adapter_2.tex -text +Spatial_sorting/doc_tex/Spatial_sorting_ref/Spatial_sort_traits_adapter_3.tex -text +Spatial_sorting/doc_tex/Spatial_sorting_ref/Spatial_sort_traits_adapter_d.tex -text +Spatial_sorting/examples/Spatial_sorting/hilbert.cpp -text +Spatial_sorting/examples/Spatial_sorting/hilbert_policies.cpp -text +Spatial_sorting/examples/Spatial_sorting/small_example_delaunay_2.cpp -text +Spatial_sorting/examples/Spatial_sorting/sp_sort_using_property_map_2.cpp -text +Spatial_sorting/examples/Spatial_sorting/sp_sort_using_property_map_3.cpp -text +Spatial_sorting/examples/Spatial_sorting/sp_sort_using_property_map_d.cpp -text +Spatial_sorting/include/CGAL/Hilbert_policy_tags.h -text +Spatial_sorting/include/CGAL/Hilbert_sort_d.h -text +Spatial_sorting/include/CGAL/Hilbert_sort_median_2.h -text +Spatial_sorting/include/CGAL/Hilbert_sort_median_3.h -text +Spatial_sorting/include/CGAL/Hilbert_sort_median_d.h -text +Spatial_sorting/include/CGAL/Hilbert_sort_middle_2.h -text +Spatial_sorting/include/CGAL/Hilbert_sort_middle_3.h -text +Spatial_sorting/include/CGAL/Hilbert_sort_middle_base.h -text +Spatial_sorting/include/CGAL/Hilbert_sort_middle_d.h -text +Spatial_sorting/include/CGAL/Spatial_sort_traits_adapter_2.h -text +Spatial_sorting/include/CGAL/Spatial_sort_traits_adapter_3.h -text +Spatial_sorting/include/CGAL/Spatial_sort_traits_adapter_d.h -text Straight_skeleton_2/demo/Straight_skeleton_2/data/complex_0.poly -text svneol=unset#application/octet-stream Straight_skeleton_2/demo/Straight_skeleton_2/data/complex_1.poly -text svneol=unset#application/octet-stream Straight_skeleton_2/demo/Straight_skeleton_2/data/complex_2.poly -text svneol=unset#application/octet-stream @@ -4090,7 +4290,7 @@ Triangulation_3/examples/Triangulation_3/info_insert_with_zip_iterator.cpp -text Triangulation_3/include/CGAL/internal/Static_filters/Compare_weighted_squared_radius_3.h -text Triangulation_3/include/CGAL/internal/Static_filters/Power_test_3.h -text Triangulation_3/include/CGAL/internal/Static_filters/Regular_triangulation_static_filters_traits_3.h -text -Triangulation_3/include/CGAL/internal/spatial_sorting_traits_with_indices.h -text +Triangulation_3/include/CGAL/internal/info_check.h -text Triangulation_3/test/Triangulation_3/include/CGAL/_test_remove_cluster.h -text Triangulation_3/test/Triangulation_3/test_regular_insert_range_with_info.cpp -text Triangulation_3/test/Triangulation_3/test_static_filters.cpp -text diff --git a/.gitignore b/.gitignore index 51c12070887..b70a0a183bb 100644 --- a/.gitignore +++ b/.gitignore @@ -150,6 +150,8 @@ Installation/auxiliary/gdb/python/CGAL/__init__.pyc Installation/auxiliary/gdb/python/CGAL/printers.pyc Installation/auxiliary/gdb/test Installation/cmake/modules/*.tmp +Installation/test/Installation/cgal_test +Installation/test/Installation/deprecation_warning Jet_fitting_3/examples/Jet_fitting_3/*.exe Jet_fitting_3/examples/Jet_fitting_3/*.sln Jet_fitting_3/examples/Jet_fitting_3/*.vcproj @@ -309,6 +311,16 @@ Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-6 Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-11.1-with-g++-4.5.1_F14/localtestscript Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-11.1-with-g++-4.5.1_F14/localtestscript-redo-results-collection Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-11.1-with-g++-4.5.1_F14/src +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-12.0-with-g++-4.5.1_F14/CGALConfig.cmake +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-12.0-with-g++-4.5.1_F14/CMakeCache.txt.backup +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-12.0-with-g++-4.5.1_F14/Makefile +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-12.0-with-g++-4.5.1_F14/config +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-12.0-with-g++-4.5.1_F14/include +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-12.0-with-g++-4.5.1_F14/lib +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-12.0-with-g++-4.5.1_F14/localbuildscript +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-12.0-with-g++-4.5.1_F14/localtestscript +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-12.0-with-g++-4.5.1_F14/localtestscript-redo-results-collection +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_IntelCompiler-12.0-with-g++-4.5.1_F14/src Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5-branch_CXX0X-F14/CGALConfig.cmake Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5-branch_CXX0X-F14/CMakeCache.txt.backup Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5-branch_CXX0X-F14/Makefile @@ -349,6 +361,11 @@ Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-6 Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5.1_F14-ansi/localtestscript Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5.1_F14-ansi/localtestscript-redo-results-collection Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5.1_F14-ansi/src +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5.1_F14-m32/CGALConfig.cmake +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5.1_F14-m32/config +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5.1_F14-m32/include +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5.1_F14-m32/lib +Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5.1_F14-m32/src Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5.1_F14/CGALConfig.cmake Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5.1_F14/CMakeCache.txt.backup Maintenance/infrastructure/matisse.geometryfactory.com/reference-platforms/x86-64_Linux-2.6_g++-4.5.1_F14/Makefile diff --git a/AABB_tree/demo/AABB_tree/MainWindow.cpp b/AABB_tree/demo/AABB_tree/MainWindow.cpp index c4ffcc8ae3f..e3282019ab2 100644 --- a/AABB_tree/demo/AABB_tree/MainWindow.cpp +++ b/AABB_tree/demo/AABB_tree/MainWindow.cpp @@ -402,8 +402,10 @@ void MainWindow::on_actionRefine_loop_triggered() void MainWindow::on_actionSave_snapshot_triggered() { + // save snapshot to file QApplication::setOverrideCursor(Qt::WaitCursor); - m_pViewer->saveSnapshot(QString("snapshot.png")); + QString filename = QFileDialog::getSaveFileName(this,tr("Save snapshot to file..."),"snapshot00.png","*.png"); + m_pViewer->saveSnapshot(filename); QApplication::restoreOverrideCursor(); } void MainWindow::on_actionCopy_snapshot_triggered() diff --git a/AABB_tree/doc_tex/AABB_tree/PkgDescription.tex b/AABB_tree/doc_tex/AABB_tree/PkgDescription.tex index a72d726e509..9e00cd64727 100644 --- a/AABB_tree/doc_tex/AABB_tree/PkgDescription.tex +++ b/AABB_tree/doc_tex/AABB_tree/PkgDescription.tex @@ -1,7 +1,7 @@ \begin{ccPkgDescription}{AABB Tree \label{Pkg:AABB_tree}} \ccPkgSummary{The AABB (axis-aligned bounding box) tree component offers a static data structure and algorithms to perform efficient intersection and distance queries on sets of finite 3D geometric objects.} -\ccPkgHowToCiteCgal{cgal:atw-aabb-11} +\ccPkgHowToCiteCgal{cgal:atw-aabb-11b} \ccPkgIntroducedInCGAL{3.5} \ccPkgDemo{AABB Tree}{AABB_demo.zip} \ccPkgIllustration{AABB_tree/figs/teaser-thumb.png}{AABB_tree/figs/teaser.png} diff --git a/AABB_tree/doc_tex/AABB_tree/examples.tex b/AABB_tree/doc_tex/AABB_tree/examples.tex index f302144f425..a0e9fc71438 100644 --- a/AABB_tree/doc_tex/AABB_tree/examples.tex +++ b/AABB_tree/doc_tex/AABB_tree/examples.tex @@ -6,7 +6,7 @@ In the following example a set of 3D triangles is stored in a list. The AABB pri \ccIncludeExampleCode{AABB_tree/AABB_triangle_3_example.cpp} \subsection{Tree of Polyhedron Triangle Facets for Intersection Queries} -In the following example the AABB primitive wraps a facet handle of a triangle polyhedral surface as \ccc{id} and the corresponding 3D triangle as geometric object. From a segment query we test the intersections, then compute the number of intersections, compute the first encountered intersection (generally a point), compute all intersections (where each intersection is a pair of one CGAL object and one primitive id - here a face handle) and compute all intersected primitives. The latter involves only tests and no predicates and is hence faster than computing all intersections. We also compute the first encountered intersection with a plane query, which is generally a segment. +In the following example the AABB primitive wraps a facet handle of a triangle polyhedral surface as \ccc{id} and the corresponding 3D triangle as geometric object. From a segment query we test the intersections, then compute the number of intersections, compute the first encountered intersection (generally a point), compute all intersections (where each intersection is a pair of one \cgal\ object and one primitive id - here a face handle) and compute all intersected primitives. The latter involves only tests and no predicates and is hence faster than computing all intersections. We also compute the first encountered intersection with a plane query, which is generally a segment. \ccIncludeExampleCode{AABB_tree/AABB_polyhedron_facet_intersection_example.cpp} \subsection{Tree of Polyhedron Triangle Facets for Distance Queries} diff --git a/AABB_tree/doc_tex/AABB_tree/performances.tex b/AABB_tree/doc_tex/AABB_tree/performances.tex index b2498bffe7a..b118c086ddf 100644 --- a/AABB_tree/doc_tex/AABB_tree/performances.tex +++ b/AABB_tree/doc_tex/AABB_tree/performances.tex @@ -115,7 +115,7 @@ The experiments described above are neither exhaustive nor conclusive as we have \begin{itemize} -\item Kernel: The type of CGAL kernel turns out to dominate the final execution times, the maximum performances being obtained with the simple Cartesian kernel parameterized with the double precision number type. In applications where the intersection and distance execution times are crucial it is possible to use this kernel for the AABB tree in combination with a more robust kernel for the main data structure. +\item Kernel: The type of \cgal\ kernel turns out to dominate the final execution times, the maximum performances being obtained with the simple Cartesian kernel parameterized with the double precision number type. In applications where the intersection and distance execution times are crucial it is possible to use this kernel for the AABB tree in combination with a more robust kernel for the main data structure. \item Primitives: Although the number of input primitives plays an obvious role in the final performance, their distribution in space is at least equally important in order to obtain a well-balanced AABB tree. Ideally the primitives must be evenly distributed in space and the long primitives spanning the bounding box of the tree root node must be avoided as much as possible. It is often beneficial to split these long primitives into smaller ones before constructing the tree, e.g., through recursive longest edge bisection for triangle surface meshes. diff --git a/AABB_tree/doc_tex/AABB_tree_ref/AABB_traits.tex b/AABB_tree/doc_tex/AABB_tree_ref/AABB_traits.tex index 350c06a51fc..5acde9aa6aa 100644 --- a/AABB_tree/doc_tex/AABB_tree_ref/AABB_traits.tex +++ b/AABB_tree/doc_tex/AABB_tree_ref/AABB_traits.tex @@ -25,7 +25,6 @@ The class \ccRefName\ is a model of the concept \ccc{AABBTraits}. This traits cl The template parameter \ccc{GeomTraits} provides the geometric types as well as the intersection tests and computations required. This type must be a model of the concept \ccc{AABBGeomTraits}. The template parameter \ccc{Primitive} provides the type of primitives stored in the AABB tree. This parameter must be a model of the concept \ccc{AABBPrimitive}. \ccInclude{CGAL/AABB_traits.h} -Note that this file must be included before the kernel so that the compiler parses all intersection functions available in folder \ccc{AABB_intersections}. \ccTypes 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..287980c9305 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,184 @@ -% +------------------------------------------------------------------------+ -% | 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() const;}{Returns the axis-aligned bounding box of the whole tree. } +\ccGlue +\ccMethod{size_type size() const;}{Returns the number of primitives in the tree. } +\ccGlue +\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) 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) 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) 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) 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 +\ccHeading{Intersections} + +\ccMethod{template + OutputIterator + all_intersections(const Query& query, + 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) 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.} + + + +% DISTANCE QUERIES +\ccHeading{Distance Queries} + +\ccMethod{FT +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) 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) 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 + +\ccHeading{Accelerating the Distance Queries} + +\ccMethod{bool accelerate_distance_queries() const;}{ 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) const;}{Constructs an internal KD-tree containing the specified point set, to be used as the set of potential hints for accelerating the distance queries. \ccc{InputIterator} is an iterator with value type \ccc{Point_and_primitive_id}.} + +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) 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) 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) 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} + +\ccSeeAlso + +\ccc{AABBTraits}, \\ +\ccc{AABBPrimitive}. + +\end{ccRefClass} + +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ 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 new file mode 100644 index 00000000000..8505b99ed49 --- /dev/null +++ b/AABB_tree/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp @@ -0,0 +1,138 @@ +#include +#include + +#include +#include +#include + + + +typedef CGAL::Simple_cartesian K; + + +// The points are stored in a flat array of doubles +// The triangles are stored in a flat array of indices +// referring to an array of coordinates: three consecutive +// coordinates represent a point, and three consecutive +// indices represent a triangle. + +typedef size_t* Point_index_iterator; + +// Let us now define the iterator on triangles that the tree needs: +class Triangle_iterator + : public boost::iterator_adaptor< + Triangle_iterator // Derived + , Point_index_iterator // Base + , boost::use_default // Value + , boost::forward_traversal_tag // CategoryOrTraversal + > +{ +public: + Triangle_iterator() + : Triangle_iterator::iterator_adaptor_() {} + + explicit Triangle_iterator(Point_index_iterator p) + : Triangle_iterator::iterator_adaptor_(p) {} + +private: + friend class boost::iterator_core_access; + void increment() { this->base_reference() += 3; } +}; + + +// The following primitive provides the conversion facilities between +// my own triangle and point types and the CGAL ones +struct My_triangle_primitive { +public: + typedef Triangle_iterator Id; + + // the CGAL types returned + typedef K::Point_3 Point; + typedef K::Triangle_3 Datum; + + // a static pointer to the vector containing the points + // is needed to build the triangles on the fly: + static const double* point_container; + +private: + Id m_it; // this is what the AABB tree stores internally + +public: + My_triangle_primitive() {} // default constructor needed + + // the following constructor is the one that receives the iterators from the + // iterator range given as input to the AABB_tree + My_triangle_primitive(Triangle_iterator a) + : m_it(a) {} + + Id id() const { return m_it; } + + // on the fly conversion from the internal data to the CGAL types + Datum datum() const + { + Point_index_iterator p_it = m_it.base(); + Point p(*(point_container + 3 * (*p_it)), + *(point_container + 3 * (*p_it) + 1), + *(point_container + 3 * (*p_it) + 2) ); + ++p_it; + Point q(*(point_container + 3 * (*p_it)), + *(point_container + 3 * (*p_it) + 1), + *(point_container + 3 * (*p_it) + 2)); + ++p_it; + Point r(*(point_container + 3 * (*p_it)), + *(point_container + 3 * (*p_it) + 1), + *(point_container + 3 * (*p_it) + 2)); + + return Datum(p, q, r); // assembles triangle from three points + } + + // one point which must be on the primitive + Point reference_point() const + { + return Point(*(point_container + 3 * (*m_it)), + *(point_container + 3 * (*m_it) + 1), + *(point_container + 3 * (*m_it) + 2)); + } +}; + + +// types +typedef CGAL::AABB_traits My_AABB_traits; +typedef CGAL::AABB_tree Tree; +const double* My_triangle_primitive::point_container = 0; + +int main() +{ + // generates point set + double points[12]; + My_triangle_primitive::point_container = points; + points[0] = 1.0; points[1] = 0.0; points[2] = 0.0; + points[3] = 0.0; points[4] = 1.0; points[5] = 0.0; + points[6] = 0.0; points[7] = 0.0; points[8] = 1.0; + points[9] = 0.0; points[10] = 0.0; points[11] = 0.0; + + + // generates indexed triangle set + size_t triangles[9]; + triangles[0] = 0; triangles[1] = 1; triangles[2] = 2; + triangles[3] = 0; triangles[4] = 1; triangles[5] = 3; + triangles[6] = 0; triangles[7] = 3; triangles[8] = 2; + + // constructs AABB tree + Tree tree(Triangle_iterator(triangles), + Triangle_iterator(triangles+9)); + + // counts #intersections + K::Ray_3 ray_query(K::Point_3(0.2, 0.2, 0.2), K::Point_3(0.0, 1.0, 0.0)); + std::cout << tree.number_of_intersected_primitives(ray_query) + << " intersections(s) with ray query" << std::endl; + + // computes closest point + K::Point_3 point_query(2.0, 2.0, 2.0); + K::Point_3 closest_point = tree.closest_point(point_query); + std::cout << "closest point to " << point_query << " is: " << closest_point.x() << " " << closest_point.y() << " " << closest_point.z() << std::endl; + + return EXIT_SUCCESS; +} + + diff --git a/AABB_tree/examples/AABB_tree/AABB_insertion_example.cpp b/AABB_tree/examples/AABB_tree/AABB_insertion_example.cpp index 8f27fc3c829..6cf6d515192 100644 --- a/AABB_tree/examples/AABB_tree/AABB_insertion_example.cpp +++ b/AABB_tree/examples/AABB_tree/AABB_insertion_example.cpp @@ -1,7 +1,7 @@ #include #include -#include // must be inserted before kernel +#include #include #include #include diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 83fa98978ed..0cfd595c3cc 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 @@ -27,6 +27,10 @@ #include #include +#ifdef CGAL_HAS_THREADS +#include +#endif + namespace CGAL { /** @@ -117,13 +121,32 @@ namespace CGAL { size_type size() const { return m_primitives.size(); } bool empty() const { return m_primitives.empty(); } - /// Construct internal search tree with a given point set - // returns true iff successful memory allocation +private: + template + bool accelerate_distance_queries_impl(ConstPointIterator first, + ConstPointIterator beyond) const; +public: + /// Constructs internal search tree with a given point set + // returns true iff successful memory allocation + // Note: this function simply forward the call to the _impl. + // The need of the _impl version comes from the fact that + // we guarantee this class to be read-only thread-safe and + // that accelerate_distance_queries() also calls the _impl + // version that has no mutex locking strategy. template bool accelerate_distance_queries(ConstPointIterator first, - ConstPointIterator beyond) const; - - /// Construct internal search tree from + ConstPointIterator beyond) const + { + #ifdef CGAL_HAS_THREADS + //this ensures that this is done once at a time + boost::mutex::scoped_lock scoped_lock(kd_tree_mutex); + #endif + clear_search_tree(); + return accelerate_distance_queries_impl(first,beyond); + + } + + /// Constructs internal search tree from /// a point set taken on the internal primitives // returns true iff successful memory allocation bool accelerate_distance_queries() const; @@ -212,15 +235,25 @@ namespace CGAL { Primitives m_primitives; // single root node Node* m_p_root_node; - - Node* root_node() const { - if(m_need_build) - const_cast< AABB_tree* >(this)->build(); + #ifdef CGAL_HAS_THREADS + mutable boost::mutex internal_tree_mutex;//mutex used to protect const calls inducing build() + mutable boost::mutex kd_tree_mutex;//mutex used to protect calls to accelerate_distance_queries + #endif + + const Node* root_node() const { + if(m_need_build){ + #ifdef CGAL_HAS_THREADS + //this ensures 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; } // search KD-tree - mutable Search_tree* m_p_search_tree; + mutable const Search_tree* m_p_search_tree; mutable bool m_search_tree_constructed; mutable bool m_default_search_tree_constructed; bool m_need_build; @@ -314,13 +347,13 @@ namespace CGAL { // constructs the tree m_p_root_node->expand(m_primitives.begin(), m_primitives.end(), m_primitives.size()); - m_need_build = false; - // In case the users has switched on the acceletated distance query // data structure with the default arguments, then it has to be // rebuilt. if(m_default_search_tree_constructed) accelerate_distance_queries(); + + m_need_build = false; } @@ -328,12 +361,9 @@ namespace CGAL { // to accelerate the distance queries template template - bool AABB_tree::accelerate_distance_queries(ConstPointIterator first, + bool AABB_tree::accelerate_distance_queries_impl(ConstPointIterator first, ConstPointIterator beyond) const { - // clears current KD tree - clear_search_tree(); - m_p_search_tree = new Search_tree(first, beyond); if(m_p_search_tree != NULL) { @@ -352,15 +382,25 @@ namespace CGAL { bool AABB_tree::accelerate_distance_queries() const { CGAL_assertion(!m_primitives.empty()); + #ifdef CGAL_HAS_THREADS + //this ensures that this function will be done once + boost::mutex::scoped_lock scoped_lock(kd_tree_mutex); + #endif + //we only redo computation only if needed + if (!m_need_build && m_default_search_tree_constructed) + return m_search_tree_constructed; + // iterate over primitives to get reference points on them std::vector points; typename Primitives::const_iterator it; for(it = m_primitives.begin(); it != m_primitives.end(); ++it) points.push_back(Point_and_primitive_id(it->reference_point(), it->id())); + // clears current KD tree + clear_search_tree(); m_default_search_tree_constructed = true; - return accelerate_distance_queries(points.begin(), points.end()); + return accelerate_distance_queries_impl(points.begin(), points.end()); } template 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/AABB_tree/test/AABB_tree/aabb_correctness_triangle_test.cpp b/AABB_tree/test/AABB_tree/aabb_correctness_triangle_test.cpp index b54f1db980b..79aa0d49b3c 100644 --- a/AABB_tree/test/AABB_tree/aabb_correctness_triangle_test.cpp +++ b/AABB_tree/test/AABB_tree/aabb_correctness_triangle_test.cpp @@ -27,7 +27,6 @@ #include -#include #include #include #include diff --git a/AABB_tree/test/AABB_tree/aabb_distance_edge_test.cpp b/AABB_tree/test/AABB_tree/aabb_distance_edge_test.cpp index 1aa700aac67..3356e0ca30f 100644 --- a/AABB_tree/test/AABB_tree/aabb_distance_edge_test.cpp +++ b/AABB_tree/test/AABB_tree/aabb_distance_edge_test.cpp @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/AABB_tree/test/AABB_tree/aabb_distance_triangle_hint_test.cpp b/AABB_tree/test/AABB_tree/aabb_distance_triangle_hint_test.cpp index 07b9e243fdb..224c4e0a819 100644 --- a/AABB_tree/test/AABB_tree/aabb_distance_triangle_hint_test.cpp +++ b/AABB_tree/test/AABB_tree/aabb_distance_triangle_hint_test.cpp @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/AABB_tree/test/AABB_tree/aabb_distance_triangle_test.cpp b/AABB_tree/test/AABB_tree/aabb_distance_triangle_test.cpp index b7c6c860b6e..75fb421de3f 100644 --- a/AABB_tree/test/AABB_tree/aabb_distance_triangle_test.cpp +++ b/AABB_tree/test/AABB_tree/aabb_distance_triangle_test.cpp @@ -26,8 +26,6 @@ #include #include -#include - #include #include #include diff --git a/AABB_tree/test/AABB_tree/aabb_intersection_triangle_test.cpp b/AABB_tree/test/AABB_tree/aabb_intersection_triangle_test.cpp index 931ec3ef4ee..6fd9ed71d17 100644 --- a/AABB_tree/test/AABB_tree/aabb_intersection_triangle_test.cpp +++ b/AABB_tree/test/AABB_tree/aabb_intersection_triangle_test.cpp @@ -27,7 +27,6 @@ #include -#include #include #include #include diff --git a/AABB_tree/test/AABB_tree/aabb_naive_vs_tree_distance_segment_test.cpp b/AABB_tree/test/AABB_tree/aabb_naive_vs_tree_distance_segment_test.cpp index 448256973d6..9b70e2f1388 100644 --- a/AABB_tree/test/AABB_tree/aabb_naive_vs_tree_distance_segment_test.cpp +++ b/AABB_tree/test/AABB_tree/aabb_naive_vs_tree_distance_segment_test.cpp @@ -27,7 +27,6 @@ #include -#include #include #include #include diff --git a/AABB_tree/test/AABB_tree/aabb_naive_vs_tree_distance_triangle_test.cpp b/AABB_tree/test/AABB_tree/aabb_naive_vs_tree_distance_triangle_test.cpp index 56e70442c4f..f1a458ebfea 100644 --- a/AABB_tree/test/AABB_tree/aabb_naive_vs_tree_distance_triangle_test.cpp +++ b/AABB_tree/test/AABB_tree/aabb_naive_vs_tree_distance_triangle_test.cpp @@ -27,7 +27,6 @@ #include -#include #include #include #include diff --git a/AABB_tree/test/AABB_tree/aabb_naive_vs_tree_triangle_test.cpp b/AABB_tree/test/AABB_tree/aabb_naive_vs_tree_triangle_test.cpp index e7739d583a8..12c5181af10 100644 --- a/AABB_tree/test/AABB_tree/aabb_naive_vs_tree_triangle_test.cpp +++ b/AABB_tree/test/AABB_tree/aabb_naive_vs_tree_triangle_test.cpp @@ -26,8 +26,6 @@ #include #include - -#include #include #include #include diff --git a/Algebraic_foundations/doc_tex/Algebraic_foundations/PkgDescription.tex b/Algebraic_foundations/doc_tex/Algebraic_foundations/PkgDescription.tex index 13354cc92b1..cdca7ffbfad 100644 --- a/Algebraic_foundations/doc_tex/Algebraic_foundations/PkgDescription.tex +++ b/Algebraic_foundations/doc_tex/Algebraic_foundations/PkgDescription.tex @@ -1,5 +1,5 @@ \begin{ccPkgDescription}{Algebraic Foundations\label{Pkg:AlgebraicFoundations}} -\ccPkgHowToCiteCgal{cgal:h-af-11} +\ccPkgHowToCiteCgal{cgal:h-af-11b} \ccPkgSummary{ This package defines what algebra means for \cgal, in terms of concepts, classes and functions. The main features are: diff --git a/Algebraic_foundations/doc_tex/Algebraic_foundations/history.tex b/Algebraic_foundations/doc_tex/Algebraic_foundations/history.tex index 58791662fb3..45047da4c93 100644 --- a/Algebraic_foundations/doc_tex/Algebraic_foundations/history.tex +++ b/Algebraic_foundations/doc_tex/Algebraic_foundations/history.tex @@ -1,6 +1,6 @@ \section{Design and Implementation History} -The package is part of CGAL since release 3.3. Of course the package is based +The package is part of \cgal\ since release 3.3. Of course the package is based on the former Number type support of CGAL. This goes back to Stefan Schirra and Andreas Fabri. But on the other hand the package is to a large extend influenced by the experience with the number type support in \exacus~\cite{beh+-eeeafcs-05}, which in the main goes back to diff --git a/Algebraic_foundations/doc_tex/Algebraic_foundations/interoperability.tex b/Algebraic_foundations/doc_tex/Algebraic_foundations/interoperability.tex index 42328303d22..a94d8a64f3a 100644 --- a/Algebraic_foundations/doc_tex/Algebraic_foundations/interoperability.tex +++ b/Algebraic_foundations/doc_tex/Algebraic_foundations/interoperability.tex @@ -9,7 +9,7 @@ In general mixed operations are provided by overloaded operators and functions or just via implicit constructor calls. This level of interoperability is reflected by the concept \ccc{ImplicitInteroperable}. However, within template code the result type, -or so called coercion type, of an mixed arithmetic operation may be unclear. +or so called coercion type, of a mixed arithmetic operation may be unclear. Therefore, the package introduces \ccc{CGAL::Coercion_traits} giving access to the coercion type via \ccc{CGAL::Coercion_traits::Type} for two interoperable types \ccc{A} and \ccc{B}. @@ -71,7 +71,7 @@ or operator and function overloads. This level of interoperability is reflected by the concept \ccc{ImplicitInteroperable}. For template code, th But in case of template code, the -result type, or so called coercion type, of an mixed operation can be unclear. +result type, or so called coercion type, of a mixed operation can be unclear. For these cases the package provides the class \ccc{CGAL::Coercion_traits}, which gives access to the coercion type via \ccc{CGAL::Coercion_traits::Type} for two \ccc{ImplicitInteroperable} diff --git a/Algebraic_foundations/doc_tex/Algebraic_foundations/real_number_types.tex b/Algebraic_foundations/doc_tex/Algebraic_foundations/real_number_types.tex index 0b8fcb0b6d1..ccbcf368511 100644 --- a/Algebraic_foundations/doc_tex/Algebraic_foundations/real_number_types.tex +++ b/Algebraic_foundations/doc_tex/Algebraic_foundations/real_number_types.tex @@ -1,5 +1,5 @@ \section{Real Number Types} -Every CGAL \ccc{Kernel} comes with two \emph{real number types} +Every \cgal\ \ccc{Kernel} comes with two \emph{real number types} (number types embeddable into the real numbers). One of them is a \ccc{FieldNumberType}, and the other a \ccc{RingNumberType}. The coordinates of the basic kernel objects (points, vectors, etc.) come 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/include/CGAL/number_utils.h b/Algebraic_foundations/include/CGAL/number_utils.h index 09775701734..811de31b3ff 100644 --- a/Algebraic_foundations/include/CGAL/number_utils.h +++ b/Algebraic_foundations/include/CGAL/number_utils.h @@ -1,8 +1,9 @@ -// Copyright (c) 1999 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 1999 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Algebraic_foundations/include/CGAL/number_utils_classes.h b/Algebraic_foundations/include/CGAL/number_utils_classes.h index 790dcf9d5c1..5495a2e30c9 100644 --- a/Algebraic_foundations/include/CGAL/number_utils_classes.h +++ b/Algebraic_foundations/include/CGAL/number_utils_classes.h @@ -1,8 +1,9 @@ -// Copyright (c) 1997 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 1997 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 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/Chinese_remainder_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Chinese_remainder_traits.cpp index 11c967f563c..b3f30e815f4 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Chinese_remainder_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Chinese_remainder_traits.cpp @@ -47,12 +47,12 @@ struct Get_max_coefficient{ } }; -template -struct Get_max_coefficient >{ +template +struct Get_max_coefficient >{ typedef Get_max_coefficient GMC; typedef typename GMC::result_type result_type; - result_type operator () (const CGAL::Sqrt_extension& a) { + result_type operator () (const CGAL::Sqrt_extension& a) { GMC gmc; return std::max(std::max(gmc(a.a0()), gmc(a.a1())), gmc(NT(a.root()))); } 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/doc_tex/Algebraic_kernel_d/PkgDescription.tex b/Algebraic_kernel_d/doc_tex/Algebraic_kernel_d/PkgDescription.tex index 896b21c9aea..0b5636d94e8 100644 --- a/Algebraic_kernel_d/doc_tex/Algebraic_kernel_d/PkgDescription.tex +++ b/Algebraic_kernel_d/doc_tex/Algebraic_kernel_d/PkgDescription.tex @@ -1,5 +1,5 @@ \begin{ccPkgDescription}{Algebraic Kernel \label{Pkg:AlgebraicKerneld}} -\ccPkgHowToCiteCgal{cgal:bht-ak-11} +\ccPkgHowToCiteCgal{cgal:bht-ak-11b} \ccPkgSummary{ Real solving of polynomials is a fundamental problem with a wide application range. This package is targeted to provide black-box implementations of state-of-the-art diff --git a/Algebraic_kernel_d/doc_tex/Algebraic_kernel_d/models.tex b/Algebraic_kernel_d/doc_tex/Algebraic_kernel_d/models.tex index 3cea3d4e7ce..d93791c04ce 100644 --- a/Algebraic_kernel_d/doc_tex/Algebraic_kernel_d/models.tex +++ b/Algebraic_kernel_d/doc_tex/Algebraic_kernel_d/models.tex @@ -79,7 +79,7 @@ interfaces between layers. Specifically, working with only one number type allows to optimize some polynomial operations as well as memory handling. The implementation of these kernels make heavy use of the \mpfr~\cite{cgal:mt-mpfr} and \mpfi~\cite{cgal:r-mpfi} -libraries, and of their CGAL interfaces, \ccc{Gmpfr} and \ccc{Gmpfi}. +libraries, and of their \cgal\ interfaces, \ccc{Gmpfr} and \ccc{Gmpfi}. The algebraic numbers (roots of the polynomials) are represented in the two \rs~kernels by a \ccc{Gmpfi} interval and a pointer to the polynomial of which they are roots. See \cite{cgal:lpt-wea-09} 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_real_rep_bfi.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep_bfi.h index 27b65524111..c02109011da 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep_bfi.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_rep_bfi.h @@ -39,16 +39,15 @@ #include #include #include - +#include +#include namespace CGAL { -template struct Get_arithmetic_kernel; - // it would be nice to remove the explicit use of Sqrt_extension // in this file. However, it is much more efficient to convert the root // only once. see convert_to_bfi -template class Sqrt_extension; +//template class Sqrt_extension; //use forward declaration instead namespace internal { @@ -98,11 +97,11 @@ private: } } - template + template inline void convert_coeffs( - const CGAL::Polynomial< CGAL::Sqrt_extension >& poly, + const CGAL::Polynomial< CGAL::Sqrt_extension >& poly, OI it ) const { BFI root(0); diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel_at_alpha.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel_at_alpha.h index 76fd990692f..ad6b00e0107 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel_at_alpha.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_coefficient_kernel_at_alpha.h @@ -91,24 +91,26 @@ public: typedef typename Algebraic_kernel_d_1::Bound Bound; typedef typename Arithmetic_kernel::Bigfloat_interval Bigfloat_interval; - - typedef CGAL::Handle_with_policy - < CGAL::internal::Bitstream_coefficient_kernel_at_alpha_rep - - > Handle; + typedef CGAL::internal::Bitstream_coefficient_kernel_at_alpha_rep + Rep; + typedef CGAL::Handle_with_policy Base; typedef Bitstream_coefficient_kernel_at_alpha Self; //! @} +public: //! \name Constructors // !@{ - Bitstream_coefficient_kernel_at_alpha() {} + Bitstream_coefficient_kernel_at_alpha() : Base(Rep()) {} + + Bitstream_coefficient_kernel_at_alpha(const Self& traits) + : Base(static_cast(traits)) {} Bitstream_coefficient_kernel_at_alpha(Algebraic_kernel_d_1* kernel, Algebraic_real_1 alpha) - : Handle(kernel,alpha) {} + : Base(kernel,alpha) {} //@} diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h index 6706f8cad19..f51d1dc4a9d 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes.h @@ -1151,8 +1151,12 @@ public: Bound; //! Default constructor - Bitstream_descartes() : Base(new Rep()) {} + Bitstream_descartes() : Base(new Rep()) {} + //! Copy constructor + Bitstream_descartes(const Self& other) : Base(static_cast(other)) + {} + /*! * \brief Constructor for a polynomial \c f * diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h index bcefed7b01e..9657745c326 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_E08_tree.h @@ -57,18 +57,19 @@ Integer caching_binomial(int n, int k) { // TODO flat array with manual index computation should be slightly faster typedef std::vector< Integer > Row; typedef std::vector< Row > Triangle; - static Triangle pascal; + // MSVC uses "pascal" as a keyword or defines it as a macro! + static Triangle my_pascal; - int old_size = int(pascal.size()); + int old_size = int(my_pascal.size()); if (n >= old_size) { - pascal.resize(n+1); + my_pascal.resize(n+1); if (old_size == 0) { - pascal[0].push_back(Integer(1)); + my_pascal[0].push_back(Integer(1)); old_size = 1; } for (int i = old_size; i <= n; ++i) { - Row& prev = pascal[i-1]; - Row& curr = pascal[i]; + Row& prev = my_pascal[i-1]; + Row& curr = my_pascal[i]; curr.reserve(i+1); curr.push_back(Integer(1)); for (int j = 1; j < i; ++j) { @@ -77,7 +78,7 @@ Integer caching_binomial(int n, int k) { curr.push_back(Integer(1)); } } - return pascal[n][k]; + return my_pascal[n][k]; } diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree_traits.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree_traits.h index 2a7c5aa0481..0455d14f0ee 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree_traits.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Bitstream_descartes_rndl_tree_traits.h @@ -122,26 +122,33 @@ public: < Bitstream_coefficient_kernel > Self; typedef CGAL::Handle_with_policy - > - Handle; + > + Base; typedef typename Bitstream_coefficient_kernel::Integer Integer; typedef typename Bitstream_coefficient_kernel::Bound Bound; //! @} +private: + static const Self& get_default_instance(){ + Bitstream_coefficient_kernel kernel; + static Self x = Self(kernel); + return x; + } + public: //! \name Constructors //! @{ - Bitstream_descartes_rndl_tree_traits(Bitstream_coefficient_kernel kernel) - : Handle(kernel) - {} - - Bitstream_descartes_rndl_tree_traits() {} - + Bitstream_descartes_rndl_tree_traits(const Bitstream_coefficient_kernel& kernel) + : Base(kernel){} + + Bitstream_descartes_rndl_tree_traits(const Self& traits = get_default_instance()) + : Base(static_cast(traits)){} + //! @} class Approximator { diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h index f190313cfad..447e2a6390e 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h @@ -883,7 +883,7 @@ private: #endif return ev_line; - } catch(CGAL::internal::Non_generic_position_exception exc) { + } catch(CGAL::internal::Non_generic_position_exception /* exc */) { switch(this->ptr()->degeneracy_strategy) { case(CGAL::EXCEPTION_STRATEGY): { throw CGAL::internal::Non_generic_position_exception(); @@ -957,7 +957,7 @@ private: break; } - catch(CGAL::internal::Non_generic_position_exception err) { + catch(CGAL::internal::Non_generic_position_exception /* err */) { shear_controller.report_failure(s); #if CGAL_ACK_DEBUG_FLAG @@ -1980,7 +1980,7 @@ public: CGAL_assertion(insertion.second); return insertion.first->second; } - catch(CGAL::internal::Non_generic_position_exception err) { + catch(CGAL::internal::Non_generic_position_exception /* err */) { this->ptr()->bad_shears.insert(s); throw CGAL::internal::Non_generic_position_exception(); } diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h index abf103271f0..4537e8782ec 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_pair_analysis_2.h @@ -1160,7 +1160,7 @@ private: = create_event_slice_from_current_intersection_info(i); return slice; - } catch(CGAL::internal::Non_generic_position_exception ex) { + } catch(CGAL::internal::Non_generic_position_exception /* ex */) { // just try the next one Intersection_info_container info_container; new_shear_for_intersection_info(info_container); @@ -2398,7 +2398,7 @@ new_shear_for_intersection_info(Intersection_info_container& info_container) } good_direction_found=true; } - catch(CGAL::internal::Non_generic_position_exception ex) { + catch(CGAL::internal::Non_generic_position_exception /* ex */) { this->ptr()->shear_controller.report_failure(s); } } diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Event_line_builder.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Event_line_builder.h index 68671b43eae..e814ea082ae 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Event_line_builder.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Event_line_builder.h @@ -264,7 +264,7 @@ public: } return vl; } - catch(CGAL::internal::Non_generic_position_exception err) { + catch(CGAL::internal::Non_generic_position_exception /* err */) { #if CGAL_ACK_DEBUG_FLAG CGAL_ACK_DEBUG_PRINT << "Detected non-generic position for alpha=" << CGAL::to_double(alpha) << std::endl; diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Interval_evaluate_1.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Interval_evaluate_1.h index d4e70330969..44565a75470 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Interval_evaluate_1.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Interval_evaluate_1.h @@ -78,7 +78,7 @@ struct Interval_evaluate_1 : public std::binary_function Coefficient_const_iterator_range range = typename PT_1::Construct_coefficient_const_iterator_range()(p); - Coefficient_const_iterator it = CGAL::predecessor(range.second); + Coefficient_const_iterator it = CGAL::cpp0x::prev(range.second); Coercion_interval res(cast(*it)); diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Interval_evaluate_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Interval_evaluate_2.h index c14f395e8d5..b801d1c4d46 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Interval_evaluate_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Interval_evaluate_2.h @@ -86,7 +86,7 @@ public: Coefficient_const_iterator_range range = typename PT_2::Construct_coefficient_const_iterator_range()(p); - Coefficient_const_iterator it = CGAL::predecessor(range.second); + Coefficient_const_iterator it = CGAL::cpp0x::prev(range.second); Interval_result_type initial_pair = interval_evaluate_1(*it,x_pair); Coercion_interval res(initial_pair.first,initial_pair.second); 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/include/CGAL/RS/isole_1.h b/Algebraic_kernel_d/include/CGAL/RS/isole_1.h index f40c5a99da2..407a80f5694 100644 --- a/Algebraic_kernel_d/include/CGAL/RS/isole_1.h +++ b/Algebraic_kernel_d/include/CGAL/RS/isole_1.h @@ -45,7 +45,7 @@ isolator::operator()(const Polynomial_ &p,unsigned int prec){ CGAL_error_msg( "isolator not implemented for this type of polynomials"); return std::vector(); -}; +} template <> inline std::vector @@ -56,7 +56,7 @@ isolator >::operator()(const Polynomial &p, mpz_t *coeffs=(mpz_t*)malloc((degree+1)*sizeof(mpz_t)); mpfi_ptr *intervals_mpfi=(mpfi_ptr*)malloc(degree*sizeof(mpfi_ptr)); std::vector intervals; - for(int i=0;i<=degree;++i) + for(unsigned int i=0;i<=degree;++i) coeffs[i][0]=*(p[i].mpz()); init_solver(); create_rs_upoly(coeffs,degree,rs_get_default_up()); @@ -69,7 +69,7 @@ isolator >::operator()(const Polynomial &p, intervals.push_back(Gmpfi(intervals_mpfi[j])); free(intervals_mpfi); return intervals; -}; +} } // namespace RS diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt b/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt index 99c568e337f..866e4fdf4ba 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/CMakeLists.txt @@ -41,15 +41,19 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "Algebraic_kernel_d_1_CORE.cpp" ) create_single_source_cgal_program( "Algebraic_kernel_d_1_GMP.cpp" ) create_single_source_cgal_program( "Algebraic_kernel_d_2.cpp" ) - create_single_source_cgal_program( "Algebraic_kernel_rs_gmpq_d_1.cpp" ) - create_single_source_cgal_program( "Algebraic_kernel_rs_gmpz_d_1.cpp" ) create_single_source_cgal_program( "Algebraic_real_d_1.cpp" ) create_single_source_cgal_program( "Bitstream_descartes.cpp" ) create_single_source_cgal_program( "Curve_analysis_2.cpp" ) create_single_source_cgal_program( "Curve_pair_analysis_2.cpp" ) create_single_source_cgal_program( "Descartes.cpp" ) create_single_source_cgal_program( "Real_embeddable_traits_extension.cpp" ) - create_single_source_cgal_program( "rs_isolator.cpp" ) + if(RS_FOUND) + create_single_source_cgal_program( "Algebraic_kernel_rs_gmpq_d_1.cpp" ) + create_single_source_cgal_program( "Algebraic_kernel_rs_gmpz_d_1.cpp" ) + create_single_source_cgal_program( "rs_isolator.cpp" ) + else() + message(STATUS "NOTICE: Some tests require the RS library, and will not be compiled.") + endif() else() diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/Curve_analysis_2.cpp b/Algebraic_kernel_d/test/Algebraic_kernel_d/Curve_analysis_2.cpp index dbf9248f1a6..69840d9c32f 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/Curve_analysis_2.cpp +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/Curve_analysis_2.cpp @@ -11,6 +11,7 @@ // // ============================================================================ +#include #include // Switches on/off tests for Sqrt-extension types diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/Curve_pair_analysis_2.cpp b/Algebraic_kernel_d/test/Algebraic_kernel_d/Curve_pair_analysis_2.cpp index 16c1cfcf4cc..bacd597afb7 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/Curve_pair_analysis_2.cpp +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/Curve_pair_analysis_2.cpp @@ -11,6 +11,7 @@ // // ============================================================================ +#include #include // Switches on/off tests for Sqrt-extension types 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/Algebraic_kernel_for_circles/doc_tex/Algebraic_kernel_for_circles_ref/intro.tex b/Algebraic_kernel_for_circles/doc_tex/Algebraic_kernel_for_circles_ref/intro.tex index 1cc73da4619..9dfa385f7fd 100644 --- a/Algebraic_kernel_for_circles/doc_tex/Algebraic_kernel_for_circles_ref/intro.tex +++ b/Algebraic_kernel_for_circles/doc_tex/Algebraic_kernel_for_circles_ref/intro.tex @@ -4,7 +4,7 @@ \begin{ccAdvanced} As in Curved-kernel, I use the ``Advanced'' environment in this -document to distinguish between my current submission to the CGAL +document to distinguish between my current submission to the \cgal\ editorial board and plans for the future, related to ACS. The ``Advanced'' parts will disappear if/when this is released. \end{ccAdvanced} @@ -33,10 +33,10 @@ Polynomial-2-2's gives Root-of-4's...) General remark about the suffix \ccc{_d_v}: \ccc{_d} stands for the degree of the polynomials and the algebraic numbers, and \ccc{_v} stands for the number of variables, which is analogous to the -dimension for CGAL geometric objects. I had already mentioned this in an -earlier version of this document (presented at the CGAL meeting at +dimension for \cgal\ geometric objects. I had already mentioned this in an +earlier version of this document (presented at the \cgal\ meeting at INRIA in march 05), and it is consistent with what Menelaos proposed -later (CGAL meeting in Pisa in june 05) for a hierarchy of algebraic kernels. +later (\cgal\ meeting in Pisa in june 05) for a hierarchy of algebraic kernels. \end{ccAdvanced} \subsubsection*{Functors} diff --git a/Algebraic_kernel_for_circles/include/CGAL/Algebraic_kernel_for_circles_2_2.h b/Algebraic_kernel_for_circles/include/CGAL/Algebraic_kernel_for_circles_2_2.h index 4101a6b896c..b12a0267ae9 100644 --- a/Algebraic_kernel_for_circles/include/CGAL/Algebraic_kernel_for_circles_2_2.h +++ b/Algebraic_kernel_for_circles/include/CGAL/Algebraic_kernel_for_circles_2_2.h @@ -26,7 +26,7 @@ #define CGAL_ALGEBRAIC_KERNEL_FOR_CIRCLES_2_2_H #include -#include +#include #include #include #include diff --git a/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres_2_3.h b/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres_2_3.h index c65b389bfc1..2ea9e8f720e 100644 --- a/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres_2_3.h +++ b/Algebraic_kernel_for_spheres/include/CGAL/Algebraic_kernel_for_spheres_2_3.h @@ -29,7 +29,7 @@ #ifndef CGAL_ALGEBRAIC_KERNEL_FOR_SPHERES_2_3_H #define CGAL_ALGEBRAIC_KERNEL_FOR_SPHERES_2_3_H -#include +#include #include #include #include diff --git a/Alpha_shapes_2/doc_tex/Alpha_shapes_2/PkgDescription.tex b/Alpha_shapes_2/doc_tex/Alpha_shapes_2/PkgDescription.tex index 3ff860d5d1b..88abe472263 100644 --- a/Alpha_shapes_2/doc_tex/Alpha_shapes_2/PkgDescription.tex +++ b/Alpha_shapes_2/doc_tex/Alpha_shapes_2/PkgDescription.tex @@ -1,6 +1,6 @@ \begin{ccPkgDescription}{2D Alpha Shapes\label{Pkg:AlphaShape2}} -\ccPkgHowToCiteCgal{cgal:d-as2-11} +\ccPkgHowToCiteCgal{cgal:d-as2-11b} \ccPkgSummary{ This package offers a data structure encoding the whole family of alpha-complexes related to a given 2D Delaunay or regular triangulation. In particular, the data structure 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/include/CGAL/Alpha_shape_2.h b/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h index c7b3bf80f02..3f591c79e32 100644 --- a/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h +++ b/Alpha_shapes_2/include/CGAL/Alpha_shape_2.h @@ -1406,6 +1406,8 @@ Alpha_shape_2
::find_alpha_solid() const // starting point for searching // takes O(#alpha_shape) time Coord_type alpha_solid = 0; + + if (number_of_vertices()<3) return alpha_solid; Finite_vertices_iterator vertex_it; // only finite vertices 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/Alpha_shapes_3/doc_tex/Alpha_shapes_3/PkgDescription.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/PkgDescription.tex index e0a856756f2..c487ab09f4a 100644 --- a/Alpha_shapes_3/doc_tex/Alpha_shapes_3/PkgDescription.tex +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/PkgDescription.tex @@ -1,6 +1,6 @@ \begin{ccPkgDescription}{3D Alpha Shapes\label{Pkg:AlphaShapes3}} -\ccPkgHowToCiteCgal{cgal:dy-as3-11} +\ccPkgHowToCiteCgal{cgal:dy-as3-11b} \ccPkgSummary{ This package offers a data structure encoding either one alpha-complex or diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3/alpha3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/alpha3.tex index 401aa06ede9..1d08a3c6f62 100644 --- a/Alpha_shapes_3/doc_tex/Alpha_shapes_3/alpha3.tex +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/alpha3.tex @@ -307,7 +307,7 @@ and \ccc{CGAL::Fixed_alpha_shape_cell_base_3}, respectively. -\section{\ccc{Alpha_shape_3} or \ccc{Fixed_alpha_shape_3}} +\section{\texorpdfstring{\ccc{Alpha_shape_3} or \ccc{Fixed_alpha_shape_3}}{Alpha\textunderscore{}shape\textunderscore{}3 or Fixed\textunderscore{}alpha\textunderscore{}shape\textunderscore{}3}} The class \ccc{CGAL::Alpha_shape_3
} represents the whole family of alpha shapes for a given set of points while the class \ccc{CGAL::Fixed_alpha_shape_3
} diff --git a/Apollonius_graph_2/doc_tex/Apollonius_graph_2/PkgDescription.tex b/Apollonius_graph_2/doc_tex/Apollonius_graph_2/PkgDescription.tex index 73c93da9077..c786519e8e5 100644 --- a/Apollonius_graph_2/doc_tex/Apollonius_graph_2/PkgDescription.tex +++ b/Apollonius_graph_2/doc_tex/Apollonius_graph_2/PkgDescription.tex @@ -1,6 +1,6 @@ \begin{ccPkgDescription}{2D Apollonius Graphs (Delaunay Graphs of Disks)\label{Pkg:ApolloniusGraph2}} -\ccPkgHowToCiteCgal{cgal:ky-ag2-11} +\ccPkgHowToCiteCgal{cgal:ky-ag2-11b} \ccPkgSummary{ Algorithms for computing the Apollonius graph in two dimensions. The Apollonius graph is the dual of the diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2.h index bfaaf1f1976..6fa25e9b896 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_2_impl.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_2_impl.h index f6306c31f92..e50f3777832 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_2_impl.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_2_impl.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas #ifndef CGAL_APOLLONIUS_GRAPH_2_IMPL_H diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_hierarchy_2_impl.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_hierarchy_2_impl.h index 18c70f27d17..bcee91c165f 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_hierarchy_2_impl.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Apollonius_graph_hierarchy_2_impl.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas #ifndef CGAL_APOLLONIUS_GRAPH_HIERARCHY_2_IMPL_H #define CGAL_APOLLONIUS_GRAPH_HIERARCHY_2_IMPL_H diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h index 4f91fe57643..53ce876175c 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Bounded_side_of_ccw_circle_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Compare_weight_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Compare_weight_2.h index a3ed45a77a6..6c73d29c505 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Compare_weight_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Compare_weight_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Compare_x_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Compare_x_2.h index ebe2429f03d..b7278070951 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Compare_x_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Compare_x_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Compare_y_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Compare_y_2.h index 26965d5eb14..3ffd57d4c3a 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Compare_y_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Compare_y_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Constructions_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Constructions_C2.h index e1700376ced..fda0b0b99ab 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Constructions_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Constructions_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Constructions_ftC2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Constructions_ftC2.h index 0791248fd85..d15feb7849b 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Constructions_ftC2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Constructions_ftC2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Constructions_rtH2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Constructions_rtH2.h index 32a8ba782b1..cad16f60c20 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Constructions_rtH2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Constructions_rtH2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_mixed_filtered_traits_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_mixed_filtered_traits_2.h index e0e2fb12336..78052a34d2b 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_mixed_filtered_traits_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_mixed_filtered_traits_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_mixed_traits_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_mixed_traits_2.h index de63dcab68b..8246e457105 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_mixed_traits_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_mixed_traits_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas // Christophe Delage // David Millman diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_new_filtered_traits_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_new_filtered_traits_2.h index 9e204547b4a..af7fc9f8b53 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_new_filtered_traits_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_new_filtered_traits_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_new_traits_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_new_traits_2.h index 4de67913414..b9bf3b4d65e 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_new_traits_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Apollonius_graph_new_traits_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas // Christophe Delage // David Millman diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Conflict_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Conflict_2.h index d96eca823c8..09af8cabb03 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Conflict_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Conflict_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas // Christophe Delage // David Millman diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Edge_conflict_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Edge_conflict_2.h index 60bbe4c25d3..6963698ef43 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Edge_conflict_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Edge_conflict_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas // Christophe Delage // David Millman diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Finite_edge_conflict_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Finite_edge_conflict_2.h index a8b445f35f0..6e15eb48843 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Finite_edge_conflict_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Finite_edge_conflict_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas // Christophe Delage // David Millman diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Infinite_edge_conflict_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Infinite_edge_conflict_2.h index 639dd51cd84..53a6f816f3e 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Infinite_edge_conflict_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Infinite_edge_conflict_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas // Christophe Delage // David Millman diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/New_predicates_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/New_predicates_C2.h index 7b4c5191ff4..68a554f6eb1 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/New_predicates_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/New_predicates_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Orientation_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Orientation_2.h index 6445c6aebcc..dc90290b563 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Orientation_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Orientation_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas // Christophe Delage // David Millman diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Vertex_conflict_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Vertex_conflict_2.h index db7dfb0d80b..59771d75284 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Vertex_conflict_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Delage_traits/Vertex_conflict_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas // Christophe Delage // David Millman diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Finite_edge_test8_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Finite_edge_test8_C2.h index e91542ce247..092e29e2044 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Finite_edge_test8_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Finite_edge_test8_C2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007 Foundation for Research and Technology-Hellas (Greece). +// Copyright (c) 2007 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Finite_edge_test_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Finite_edge_test_C2.h index c5736ac4e8c..1752789e19e 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Finite_edge_test_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Finite_edge_test_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Incircle8_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Incircle8_C2.h index f7d57da1457..fbfeb7b119f 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Incircle8_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Incircle8_C2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007 Foundation for Research and Technology-Hellas (Greece). +// Copyright (c) 2007 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Incircle_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Incircle_C2.h index 4e44b631967..f9e2a7d1741 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Incircle_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Incircle_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Infinite_edge_test_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Infinite_edge_test_C2.h index 38700409fc5..ca9302b9ec2 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Infinite_edge_test_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Infinite_edge_test_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Is_degenerate_edge_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Is_degenerate_edge_C2.h index 37fbd5e78a7..6965d6b24d2 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Is_degenerate_edge_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Is_degenerate_edge_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Is_hidden_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Is_hidden_C2.h index 57350931520..66020be1445 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Is_hidden_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Is_hidden_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Kernel_wrapper_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Kernel_wrapper_2.h index bbf5d0875ab..1aaf0eb5bc9 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Kernel_wrapper_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Kernel_wrapper_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Orientation8_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Orientation8_C2.h index 21f1b99ccb6..e7b4599b1bb 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Orientation8_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Orientation8_C2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007 Foundation for Research and Technology-Hellas (Greece). +// Copyright (c) 2007 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Orientation_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Orientation_2.h index 35f257cd661..b0f3d5f33a3 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Orientation_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Orientation_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Oriented_side_of_bisector_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Oriented_side_of_bisector_C2.h index e54eb05b5e1..3059d74993c 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Oriented_side_of_bisector_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Oriented_side_of_bisector_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Predicate_constructions_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Predicate_constructions_C2.h index b3e087255cd..9c9e908c77b 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Predicate_constructions_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Predicate_constructions_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Predicates_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Predicates_C2.h index 08f926de950..67190999f8e 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Predicates_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Predicates_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Traits_wrapper_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Traits_wrapper_2.h index d0d946cbe77..651829c32ba 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Traits_wrapper_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/Traits_wrapper_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/basic.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/basic.h index b4a6ff0471d..c577ad90e6c 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/basic.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/basic.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas #ifndef CGAL_APOLLONIUS_GRAPH_2_BASIC_H #define CGAL_APOLLONIUS_GRAPH_2_BASIC_H 1 diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/check_filter.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/check_filter.h index a52a74dab36..3654fddd46a 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/check_filter.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/check_filter.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/comparator_profiler.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/comparator_profiler.h index 898961721cc..4246e802383 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/comparator_profiler.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/comparator_profiler.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/compare_quadratic.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/compare_quadratic.h index 81325a3011a..a8561b60f62 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/compare_quadratic.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/compare_quadratic.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/predicate_profiler.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/predicate_profiler.h index 057db54b6b7..fcb966f1119 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/predicate_profiler.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/predicate_profiler.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Apollonius_graph_uncertain_filtered_traits_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Apollonius_graph_uncertain_filtered_traits_2.h index d5e0ce69217..7b531258f69 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Apollonius_graph_uncertain_filtered_traits_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Apollonius_graph_uncertain_filtered_traits_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_is_hidden_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_is_hidden_C2.h index ea0c36704d6..1278be7d648 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_is_hidden_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_is_hidden_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_oriented_side_of_bisector_C2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_oriented_side_of_bisector_C2.h index 4c6f26d0df7..1ffef81e6bd 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_oriented_side_of_bisector_C2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_oriented_side_of_bisector_C2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h index 58c0b38b928..34a26a2096a 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/Uncertain_vertex_conflict_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas // Christophe Delage // David Millman diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/uncertain_functions_on_signs.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/uncertain_functions_on_signs.h index 23bce6de9f7..d25747340e8 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/uncertain_functions_on_signs.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_2/uncertain/uncertain_functions_on_signs.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_data_structure_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_data_structure_2.h index 88f3647ca5c..5f6175447b3 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_data_structure_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_data_structure_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_filtered_traits_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_filtered_traits_2.h index a29f7a73402..a922ab4c441 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_filtered_traits_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_filtered_traits_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_hierarchy_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_hierarchy_2.h index 4d06ce76313..5cf75a75ab4 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_hierarchy_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_hierarchy_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas #ifndef CGAL_APOLLONIUS_GRAPH_HIERARCHY_2_H #define CGAL_APOLLONIUS_GRAPH_HIERARCHY_2_H diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_hierarchy_vertex_base_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_hierarchy_vertex_base_2.h index d8de07c78a4..c4858867c44 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_hierarchy_vertex_base_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_hierarchy_vertex_base_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas #ifndef CGAL_APOLLONIUS_GRAPH_HIERARCHY_VERTEX_BASE_2_H #define CGAL_APOLLONIUS_GRAPH_HIERARCHY_VERTEX_BASE_2_H diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_traits_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_traits_2.h index 53876508623..664f4a2f18b 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_traits_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_traits_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas #ifndef CGAL_APOLLONIUS_GRAPH_TRAITS_2_H #define CGAL_APOLLONIUS_GRAPH_TRAITS_2_H diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_graph_vertex_base_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_graph_vertex_base_2.h index 683d6c2091a..56e17c900ce 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_graph_vertex_base_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_graph_vertex_base_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas #ifndef CGAL_APOLLONIUS_GRAPH_VERTEX_BASE_2_H #define CGAL_APOLLONIUS_GRAPH_VERTEX_BASE_2_H diff --git a/Apollonius_graph_2/include/CGAL/Apollonius_site_2.h b/Apollonius_graph_2/include/CGAL/Apollonius_site_2.h index 0042607dcc4..fbae0de359a 100644 --- a/Apollonius_graph_2/include/CGAL/Apollonius_site_2.h +++ b/Apollonius_graph_2/include/CGAL/Apollonius_site_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas #ifndef CGAL_APOLLONIUS_SITE_2_H #define CGAL_APOLLONIUS_SITE_2_H diff --git a/Apollonius_graph_2/include/CGAL/Hyperbola_2.h b/Apollonius_graph_2/include/CGAL/Hyperbola_2.h index 3fa69cb8b0f..7749e5f75b0 100644 --- a/Apollonius_graph_2/include/CGAL/Hyperbola_2.h +++ b/Apollonius_graph_2/include/CGAL/Hyperbola_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Hyperbola_ray_2.h b/Apollonius_graph_2/include/CGAL/Hyperbola_ray_2.h index 2b72ea40e47..b6ddb559483 100644 --- a/Apollonius_graph_2/include/CGAL/Hyperbola_ray_2.h +++ b/Apollonius_graph_2/include/CGAL/Hyperbola_ray_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Hyperbola_segment_2.h b/Apollonius_graph_2/include/CGAL/Hyperbola_segment_2.h index 79cf1dc8a4f..410f0b39f6e 100644 --- a/Apollonius_graph_2/include/CGAL/Hyperbola_segment_2.h +++ b/Apollonius_graph_2/include/CGAL/Hyperbola_segment_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/IO/Qt_widget_Apollonius_site_2.h b/Apollonius_graph_2/include/CGAL/IO/Qt_widget_Apollonius_site_2.h index c3640af1e20..b460963d34a 100644 --- a/Apollonius_graph_2/include/CGAL/IO/Qt_widget_Apollonius_site_2.h +++ b/Apollonius_graph_2/include/CGAL/IO/Qt_widget_Apollonius_site_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas #ifndef CGAL_QT_WIDGET_APOLLONIUS_SITE_2_H diff --git a/Apollonius_graph_2/include/CGAL/IO/Qt_widget_Hyperbola_2.h b/Apollonius_graph_2/include/CGAL/IO/Qt_widget_Hyperbola_2.h index d842c96050d..fba6df4eee6 100644 --- a/Apollonius_graph_2/include/CGAL/IO/Qt_widget_Hyperbola_2.h +++ b/Apollonius_graph_2/include/CGAL/IO/Qt_widget_Hyperbola_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas #ifndef CGAL_QT_WIDGET_HYPERBOLA_2_H #define CGAL_QT_WIDGET_HYPERBOLA_2_H diff --git a/Apollonius_graph_2/include/CGAL/Parabola_2.h b/Apollonius_graph_2/include/CGAL/Parabola_2.h index c89cf16a410..6e06222fc27 100644 --- a/Apollonius_graph_2/include/CGAL/Parabola_2.h +++ b/Apollonius_graph_2/include/CGAL/Parabola_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/Parabola_segment_2.h b/Apollonius_graph_2/include/CGAL/Parabola_segment_2.h index 38f4a10320f..9ee8a94e1f2 100644 --- a/Apollonius_graph_2/include/CGAL/Parabola_segment_2.h +++ b/Apollonius_graph_2/include/CGAL/Parabola_segment_2.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/functions_on_signs.h b/Apollonius_graph_2/include/CGAL/functions_on_signs.h index 34214bccafb..517a6a11cc4 100644 --- a/Apollonius_graph_2/include/CGAL/functions_on_signs.h +++ b/Apollonius_graph_2/include/CGAL/functions_on_signs.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/in_place_edge_list.h b/Apollonius_graph_2/include/CGAL/in_place_edge_list.h index 38af54a0d03..1ac3a6095f3 100644 --- a/Apollonius_graph_2/include/CGAL/in_place_edge_list.h +++ b/Apollonius_graph_2/include/CGAL/in_place_edge_list.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Apollonius_graph_2/include/CGAL/more_functions_on_signs.h b/Apollonius_graph_2/include/CGAL/more_functions_on_signs.h index 97eb4fd9cdb..ab14c193590 100644 --- a/Apollonius_graph_2/include/CGAL/more_functions_on_signs.h +++ b/Apollonius_graph_2/include/CGAL/more_functions_on_signs.h @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s) : Menelaos Karavelas +// Author(s) : Menelaos Karavelas diff --git a/Arithmetic_kernel/include/CGAL/GMP_arithmetic_kernel.h b/Arithmetic_kernel/include/CGAL/GMP_arithmetic_kernel.h index d6fa5452edf..bc0f55af663 100644 --- a/Arithmetic_kernel/include/CGAL/GMP_arithmetic_kernel.h +++ b/Arithmetic_kernel/include/CGAL/GMP_arithmetic_kernel.h @@ -29,20 +29,22 @@ #ifndef CGAL_GMP_ARITHMETIC_KERNEL_H #define CGAL_GMP_ARITHMETIC_KERNEL_H +#ifdef CGAL_USE_GMP + #include #include #include -#ifdef CGAL_USE_GMP -#ifdef CGAL_USE_MPFI - -#define CGAL_HAS_GMP_ARITHMETIC_KERNEL #include #include + +#ifdef CGAL_USE_MPFI +#define CGAL_HAS_GMP_ARITHMETIC_KERNEL #include #include +#endif //CGAL_USE_MPFI namespace CGAL { @@ -53,8 +55,10 @@ class GMP_arithmetic_kernel : public internal::Arithmetic_kernel_base { public: typedef CGAL::Gmpz Integer; typedef CGAL::Gmpq Rational; + #ifdef CGAL_USE_MPFI typedef CGAL::Gmpfr Bigfloat; typedef CGAL::Gmpfi Bigfloat_interval; + #endif //CGAL_USE_MPFI }; template <> @@ -65,6 +69,8 @@ template <> struct Get_arithmetic_kernel{ typedef GMP_arithmetic_kernel Arithmetic_kernel; }; + +#ifdef CGAL_USE_MPFI template <> struct Get_arithmetic_kernel{ typedef GMP_arithmetic_kernel Arithmetic_kernel; @@ -73,10 +79,11 @@ template <> struct Get_arithmetic_kernel{ typedef GMP_arithmetic_kernel Arithmetic_kernel; }; +#endif //CGAL_USE_MPFI } //namespace CGAL -#endif //CGAL_USE_MPFI -#endif //CGAL_USE_GMP +#endif //CGAL_USE_GMP + #endif // CGAL_ARITHMETIC_KERNEL_H // EOF diff --git a/Arithmetic_kernel/include/CGAL/Get_arithmetic_kernel.h b/Arithmetic_kernel/include/CGAL/Get_arithmetic_kernel.h index 699339aa237..275a1c70d9a 100644 --- a/Arithmetic_kernel/include/CGAL/Get_arithmetic_kernel.h +++ b/Arithmetic_kernel/include/CGAL/Get_arithmetic_kernel.h @@ -28,7 +28,7 @@ #include namespace CGAL { -template< class NT > struct Get_arithmetic_kernel; +template< class NT > struct Get_arithmetic_kernel{}; } //namespace CGAL #endif // CGAL_GET_ARITHMETIC_KERNEL_H diff --git a/Arithmetic_kernel/include/CGAL/MP_Float_arithmetic_kernel.h b/Arithmetic_kernel/include/CGAL/MP_Float_arithmetic_kernel.h new file mode 100644 index 00000000000..b8746582e54 --- /dev/null +++ b/Arithmetic_kernel/include/CGAL/MP_Float_arithmetic_kernel.h @@ -0,0 +1,61 @@ +// Copyright (c) 2010 GeometryFactory (France). +// All rights reserved. +// +// 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. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Sebastien Loriot +// +// ============================================================================ +// +// \brief provide class Arithmetic_kernel, a collection of number types. +// + +/*! \file CGAL/Arithmetic_kernel.h + * \brief Declarations pertaining to CGAL::Arithmetic_kernel + */ + +#ifndef CGAL_MP_FLOAT_ARITHMETIC_KERNEL_H +#define CGAL_MP_FLOAT_ARITHMETIC_KERNEL_H + +#include +#include +#include + +#define CGAL_HAS_MP_FLOAT_ARITHMETIC_KERNEL + +#include + +namespace CGAL { + +/*! \ingroup CGAL_Arithmetic_kernel + * \brief The MP_Float set of exact number types + */ +class MP_Float_arithmetic_kernel : public internal::Arithmetic_kernel_base { +public: + typedef MP_Float Integer; + typedef CGAL::Quotient Rational; + typedef MP_Float Bigfloat; + struct Not_implemented{} Bigfloat_interval; +}; + +template <> +struct Get_arithmetic_kernel { + typedef MP_Float_arithmetic_kernel Arithmetic_kernel; +}; + +} //namespace CGAL + +#endif // CGAL_ARITHMETIC_KERNEL_H +// EOF diff --git a/Arithmetic_kernel/include/CGAL/OLD/GMP/Gmpfr_interval_type.h b/Arithmetic_kernel/include/CGAL/OLD/GMP/Gmpfr_interval_type.h deleted file mode 100644 index 83260480752..00000000000 --- a/Arithmetic_kernel/include/CGAL/OLD/GMP/Gmpfr_interval_type.h +++ /dev/null @@ -1,166 +0,0 @@ -// TODO: add sign to RET - - -#ifndef CGAL_GMPFR_INTERVAL_TYPE_H -#define CGAL_GMPFR_INTERVAL_TYPE_H - -#include -#include -#include - -#define OP(o,d) Gmpfr r; \ - mpfr_ ## o (r.fr(), a.fr(), b.fr(), GMP_RND ## d); \ - return r; - -namespace CGAL { - -namespace internal { - -struct Rounding_for_gmpfr { -private: typedef CGAL::Gmpfr T; -public: - Rounding_for_gmpfr(){}; - ~Rounding_for_gmpfr(){}; - - T conv_down(const T& a){ // TODO: fix this - return add_down(T(0),a); - }; - T conv_up (const T& a){ // TODO: fix this - return add_up(T(0),a); - }; - // mathematical operations - T add_down(const T& a, const T& b) { - OP(add,D); - }; - T add_up (const T& a, const T& b){ - OP(add,U); - }; - T sub_down(const T& a, const T& b){ - OP(sub,D); - }; - T sub_up (const T& a, const T& b){ - OP(sub,U); - }; - T mul_down(const T& a, const T& b){ - OP(mul,D); - }; - T mul_up (const T& a, const T& b){ - OP(mul,U); - }; - T div_down(const T& a, const T& b){ - OP(div,D); - }; - T div_up (const T& a, const T& b){ - OP(div,U); - }; - - T sqrt_down(const T& a){ - T b; - mpfr_sqrt(b.fr(), a.fr(), GMP_RNDD); - return b; - }; - T sqrt_up (const T& a){ - T b; - mpfr_sqrt(b.fr(), a.fr(), GMP_RNDU); - return b; - }; - - T median(const T& a, const T& b) { - T result(a + (b-a)/2); - CGAL_postcondition(a <= result); - CGAL_postcondition(result <= b); - return result; - }; - T int_down(const T& a) { - T r; - mpfr_floor(r.fr(), a.fr()); - return r; - }; - T int_up (const T& a) { - T r; - mpfr_ceil(r.fr(), a.fr()); - return r; - }; -}; - -class Checking_for_gmpfr { - - typedef CGAL::Gmpfr T; - -public: - - static T pos_inf() { - T b; - mpfr_set_inf(b.fr(), 1); - return b; - } - - static T neg_inf() { - T b; - mpfr_set_inf(b.fr(), -1); - return b; - } - - static T nan() { - T b; - mpfr_set_nan(b.fr()); - return b; - } - - static bool is_nan(const T& b) { - return mpfr_nan_p(b.fr()); - } - - static T empty_lower() { - return T(1); - } - - static T empty_upper() { - return T(0); - } - - static bool is_empty(const T& a, const T& b) { -// return a==T(1) && b == T(0); -// return false; - return a > b; // TODO: optimize this - } -}; - -} // namespace internal -} //namespace CGAL - -namespace boost { -namespace numeric { -inline -std::ostream& operator << - (std::ostream& os, const boost::numeric::interval& x) -{ - os << "[" - << x.lower() << ", " << x.upper() << "]"; - return os; -} - - -}//namespace numeric -}//namespace boost - -namespace CGAL { - -typedef boost::numeric::interval< - Gmpfr, - boost::numeric::interval_lib::policies - < internal::Rounding_for_gmpfr, internal::Checking_for_gmpfr > > -Gmpfr_interval; - -// I have to redfine these operators, since the test reports an -// ambiguity with operators in CGAL::Polynomial -// However, it seems that this is due to the use of struct interval_holder -// in the definition of the operators in boost. - -inline bool operator == (const Gmpfr_interval& x , const Gmpfr_interval& y) -{return x.operator==(y) ;} - -} //namespace CGAL -//#endif // CGAL_USE_LEDA -#undef OP -#endif // CGAL_GMPFR_INTERVAL_TYPE_H diff --git a/Arithmetic_kernel/include/CGAL/OLD/Gmpfr_interval.h b/Arithmetic_kernel/include/CGAL/OLD/Gmpfr_interval.h deleted file mode 100644 index 403e94ac5a7..00000000000 --- a/Arithmetic_kernel/include/CGAL/OLD/Gmpfr_interval.h +++ /dev/null @@ -1,336 +0,0 @@ -// Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany), -// National University of Athens (Greece). -// Copyright (c) 2009 Max-Planck-Institute Saarbruecken (Germany). -// All rights reserved. -// -// 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. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// 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) : George Tzoumas , -// Michael Hemmer -// -// ============================================================================ -// -// \brief provide CGAL support for class CGAL::Gmpfr_interval. -// - -#ifndef CGAL_GMPFR_INTERVAL_H -#define CGAL_GMPFR_INTERVAL_H - -#include -#include -#include -#include -#include -#include -#include - -namespace CGAL { - -template <> class Algebraic_structure_traits< Gmpfr_interval > - : public Algebraic_structure_traits_base < Gmpfr_interval, - Field_with_sqrt_tag >{ - -public: - typedef Tag_false Is_exact; - typedef Tag_true Is_numerical_sensitive; - - class Sqrt - : public std::unary_function< Type, Type > { - public: - Type operator()( const Type& x ) const { - return ::boost::numeric::sqrt(x); - } - }; -}; - -template <> class Real_embeddable_traits< Gmpfr_interval > - : public INTERN_RET::Real_embeddable_traits_base { -public: - - class Abs - : public std::unary_function< Type, Type > { - public: - Type operator()( const Type& x ) const { - return ::boost::numeric::abs(x); - } - }; - - class To_double - : public std::unary_function< Type, double > { - public: - double operator()( const Type& x ) const { - return ::boost::numeric::median(x).to_double(); - } - }; - - class To_interval - : public std::unary_function< Type, std::pair< double, double > > { - public: - std::pair operator()( const Type& x ) const { - std::pair lower_I(x.lower().to_interval()); - std::pair upper_I(x.upper().to_interval()); - return std::pair< double, double >( - (CGAL::min)(lower_I.first , upper_I.first ), - (CGAL::max)(lower_I.second, upper_I.second)); - } - }; -}; - -template<> -class Interval_traits -{ -public: - typedef Interval_traits Self; - typedef Gmpfr_interval Interval; - typedef CGAL::Gmpfr Bound; - typedef CGAL::Tag_true With_empty_interval; - typedef CGAL::Tag_true Is_interval; - - struct Construct :public std::binary_function{ - Interval operator()( const Bound& l,const Bound& r) const { - CGAL_precondition( l < r ); - return Interval(l,r); - } - }; - - struct Lower :public std::unary_function{ - Bound operator()( const Interval& a ) const { - return a.lower(); - } - }; - - struct Upper :public std::unary_function{ - Bound operator()( const Interval& a ) const { - return a.upper(); - } - }; - - struct Width :public std::unary_function{ - Bound operator()( const Interval& a ) const { - return ::boost::numeric::width(a); - } - }; - - struct Median :public std::unary_function{ - Bound operator()( const Interval& a ) const { - return ::boost::numeric::median(a); - } - }; - - struct Norm :public std::unary_function{ - Bound operator()( const Interval& a ) const { - return ::boost::numeric::norm(a); - } - }; - - struct Empty :public std::unary_function{ - bool operator()( const Interval& a ) const { - return ::boost::numeric::empty(a); - } - }; - - struct Singleton :public std::unary_function{ - bool operator()( const Interval& a ) const { - return ::boost::numeric::singleton(a); - } - }; - - struct Zero_in :public std::unary_function{ - bool operator()( const Interval& a ) const { - return ::boost::numeric::in_zero(a); - } - }; - - struct In :public std::binary_function{ - bool operator()( Bound x, const Interval& a ) const { - return ::boost::numeric::in(x,a); - } - }; - - struct Equal :public std::binary_function{ - bool operator()( const Interval& a, const Interval& b ) const { - return ::boost::numeric::equal(a,b); - } - }; - - struct Overlap :public std::binary_function{ - bool operator()( const Interval& a, const Interval& b ) const { - return ::boost::numeric::overlap(a,b); - } - }; - - struct Subset :public std::binary_function{ - bool operator()( const Interval& a, const Interval& b ) const { - return ::boost::numeric::subset(a,b); - } - }; - - struct Proper_subset :public std::binary_function{ - bool operator()( const Interval& a, const Interval& b ) const { - return ::boost::numeric::proper_subset(a,b); - } - }; - - struct Hull :public std::binary_function{ - Interval operator()( const Interval& a, const Interval& b ) const { - return ::boost::numeric::hull(a,b); - } - }; - - struct Intersection :public std::binary_function{ - Interval operator()( const Interval& a, const Interval& b ) const { - Interval r = ::boost::numeric::intersect(a,b); - return r; - } - }; -}; - -template<> -class Bigfloat_interval_traits: - public Interval_traits -{ -public: - typedef Gmpfr_interval NT; - - typedef CGAL::Gmpfr BF; - - struct Get_significant_bits: public std::unary_function{ - - long operator()( NT x) const { - if(CGAL::zero_in(x)) return -1; - BF labs = CGAL::lower(CGAL::abs(x)) ; - BF w = CGAL::width(x); - BF err; - mpfr_div(err.fr(), w.fr(), labs.fr(), GMP_RNDU); - mpfr_log2(err.fr(), err.fr(), GMP_RNDD); - return -mpfr_get_si(err.fr(), GMP_RNDU); - } - }; - - struct Set_precision { - // type for the \c AdaptableUnaryFunction concept. - typedef long argument_type; - // type for the \c AdaptableUnaryFunction concept. - typedef long result_type; - - long operator()( long prec ) const { - long old_prec = mpfr_get_default_prec(); -// std::cerr << "precision set to " << prec << " from " << old_prec << std::endl; - mpfr_set_default_prec(prec); - return old_prec; - } - }; - - struct Get_precision { - // type for the \c AdaptableGenerator concept. - typedef long result_type; - long operator()() const { - return mpfr_get_default_prec(); - } - }; - -}; - -//Gmp internal coercions: -CGAL_DEFINE_COERCION_TRAITS_FOR_SELF(Gmpfr_interval) - -// The following definitions reflect the interaction of the Gmpfr - -// built in types : - CGAL_DEFINE_COERCION_TRAITS_FROM_TO(short ,Gmpfr_interval) - CGAL_DEFINE_COERCION_TRAITS_FROM_TO(int ,Gmpfr_interval) - CGAL_DEFINE_COERCION_TRAITS_FROM_TO(long ,Gmpfr_interval) - CGAL_DEFINE_COERCION_TRAITS_FROM_TO(float ,Gmpfr_interval) - CGAL_DEFINE_COERCION_TRAITS_FROM_TO(double ,Gmpfr_interval) - - -template <> -struct Coercion_traits{ - typedef Tag_true Are_explicit_interoperable; - typedef Tag_false Are_implicit_interoperable; - typedef CGAL::Gmpfr_interval Type; - - struct Cast{ - typedef Type result_type; - Type operator()(const CGAL::Gmpfr_interval& x) const { return x;} - Type operator()(const CGAL::Gmpz x) const { - CGAL::Gmpfr lower, upper; - mpfr_set_z (lower.fr(), x.mpz(), GMP_RNDD); - mpfr_set_z (upper.fr(), x.mpz(), GMP_RNDU); - Type bfi(lower, upper); - CGAL_postcondition( bfi.lower() <= x ); - CGAL_postcondition( bfi.upper() >= x ); - return bfi; - } - }; -}; - -template <> // mirror -struct Coercion_traits - :public Coercion_traits{}; - -template <> -struct Coercion_traits{ - typedef Tag_true Are_explicit_interoperable; - typedef Tag_false Are_implicit_interoperable; - typedef CGAL::Gmpfr_interval Type; - typedef Coercion_traits CTZ; - - struct Cast{ - typedef Type result_type; - Type operator()(const CGAL::Gmpfr_interval& x) const { return x;} - Type operator()(const CGAL::Gmpq x) const { - // early exits - if (CGAL::is_zero(x)) return Type(0,0); - if (CGAL::is_one(x.denominator())){ - return CTZ::Cast()(x.numerator()); - } - // TODO: ensure that prec is reached for resulting interval ? - Gmpfr lower, upper, nf, df; - CGAL::Gmpz num = x.numerator(); - CGAL::Gmpz den = x.denominator(); - mp_prec_t prec = mpfr_get_default_prec(); - CGAL_assertion( mpfr_get_prec(lower.fr()) == prec); - CGAL_assertion( mpfr_get_prec(upper.fr()) == prec ); - - mpfr_set_z (nf.fr(), num.mpz(), GMP_RNDD); - mpfr_set_z (df.fr(), den.mpz(), - (CGAL::sign(num) == CGAL::NEGATIVE)? GMP_RNDD: GMP_RNDU); - mpfr_div(lower.fr(), nf.fr(), df.fr(), GMP_RNDD); - - mpfr_set_z (nf.fr(), num.mpz(), GMP_RNDU); - mpfr_set_z (df.fr(), den.mpz(), - (CGAL::sign(num) == CGAL::NEGATIVE)? GMP_RNDU: GMP_RNDD); - mpfr_div(upper.fr(), nf.fr(), df.fr(), GMP_RNDU); - - Type bfi(lower, upper); - - CGAL_postcondition( bfi.lower() <= x ); - CGAL_postcondition( bfi.upper() >= x ); - return bfi; - } - }; -}; - -template <> // mirror -struct Coercion_traits - :public Coercion_traits{}; - - -// lower GMP types: -CGAL_DEFINE_COERCION_TRAITS_FROM_TO(Gmpfr,Gmpfr_interval) - -} //namespace CGAL -#endif // CGAL_GMPFR_INTERVAL_H 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/demo/Arrangement_on_surface_2/demo_tab.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/demo_tab.h index 3663ce93aa8..330b84e68e6 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/demo_tab.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/demo_tab.h @@ -288,6 +288,8 @@ private: typedef typename Arrangement_2::Induced_edge_iterator Induced_edge_iterator; typedef typename Arrangement_2::Curve_handle Curve_handle; typedef CGAL::Envelope_diagram_1 Diagram_1; + + typedef typename Traits::Multiplicity Multiplicity; private: // function object - FillFace @@ -513,7 +515,7 @@ public: CGAL::Oneset_iterator oi(res); m_traits.intersect_2_object()(c1, c2, oi); - std::pair p1; + std::pair p1; if (CGAL::assign(p1, res)) { Coord_type y1 = @@ -604,7 +606,7 @@ public: CGAL::Oneset_iterator oi(res); m_traits.intersect_2_object()(c1, c2, oi); - std::pair p1; + std::pair p1; if (CGAL::assign(p1, res)) { Coord_type y1 = @@ -987,7 +989,7 @@ public: p.y() * m_tab_traits.COORD_SCALE); const X_monotone_curve_2 split_curve = m_tab_traits.curve_make_x_monotone(split_point , split_point2); - std::pair p1; + std::pair p1; Point_2 p_right; if (split_point.x() < split_point2.x()) p_right = split_point; @@ -1335,13 +1337,13 @@ public: x_real(first_x, xfirst2); y_real(first_y, yfirst2); - double xmin, xmax, ymin, ymax, distx, disty; - if (x < xfirst2) { xmin = x; xmax = xfirst2; } - else { xmin = xfirst2; xmax = x; } - if (y < yfirst2) { ymin = y; ymax = yfirst2; } - else { ymin = yfirst2; ymax = y; } - distx = xfirst2 - x; - disty = yfirst2 - y; + // double xmin, xmax, ymin, ymax; + // if (x < xfirst2) { xmin = x; xmax = xfirst2; } + // else { xmin = xfirst2; xmax = x; } + // if (y < yfirst2) { ymin = y; ymax = yfirst2; } + // else { ymin = yfirst2; ymax = y; } + double distx = xfirst2 - x; + double disty = yfirst2 - y; move_center(distx, disty); on_first = FALSE; } diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/PkgDescription.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/PkgDescription.tex index d8a54be66e7..67bb6dfd762 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/PkgDescription.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/PkgDescription.tex @@ -1,5 +1,5 @@ \begin{ccPkgDescription}{2D Arrangement\label{Pkg:Arrangement2}} -\ccPkgHowToCiteCgal{cgal:wfzh-a2-11} +\ccPkgHowToCiteCgal{cgal:wfzh-a2-11b} \ccPkgSummary{ This package can be used to construct, maintain, alter, and display arrangements in the plane. Once an arrangement is constructed, the diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_ack.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_ack.tex index 88a436d5f29..fe7306d6b85 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_ack.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_ack.tex @@ -29,3 +29,8 @@ concept related to unbounded curves. Version~3.7 introduced a geometry-traits class that handles planar algebraic curves of arbitrary degree. It was developed by Eric Berberich and Michael Kerber. + +Version~3.9 introduced a new geometry-traits class that handles +rational arcs. It was developed by Oren Salzman and Michael Hemmer. +It replaced an old traits, which handled the same family of +curves, developed by Ron Wein. diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_intro.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_intro.tex index a141dc094a5..c56c9f6e9b9 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_intro.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_intro.tex @@ -87,7 +87,7 @@ on the \dcel\ data structure see~\cite[Chapter~2]{bkos-cgaa-00}. \end{ccTexOnly} \begin{ccHtmlOnly}

- Arrangement of sgements + Arrangement of segments
\end{ccHtmlOnly} \caption{An arrangement of interior-disjoint line segments with some @@ -106,6 +106,22 @@ hole is comprised of two edges. $f_1$ also contains two isolated vertices $u_1$ and $u_2$ in its interior.\label{arr_fig:seg_dcel}} \end{figure} +The $x$-monotone curves of an arrangement are embedded in an +rectangular two-dimensional area called the parameter +space.\footnote{The term parameter space stems from a major + extension the arrangement package is going through to support + arrangements embedded on certain two-dimensional parametric + surfaces in three-dimensions (or higher).} The parameter space is +defined as $X \times Y$, where $X$ and $Y$ are open, half-open, or +closed intervals with endpoints in the compactified real line +$\mathbb{R} \cup \{-\infty,+\infty\}$. Let $b_l$, $b_r$, $b_b$, and +$b_t$ denote the endpoints of $X$ and $Y$, respectively. We +typically refer to these values as the left, right, bottom, and top +sides of the boundary of the parameter space. If the parameter space +is, for example, the entire compactified plane, which is currently +the only option supported by the package, $b_l = b_b = -\infty$ and +$b_r = b_t = +\infty$. + The rest of this chapter is organized as follows: In Section~\ref{arr_sec:arr_class} we review in detail the interface of the \ccc{Arrangement_2} class-template, which is the central diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_io.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_io.tex index 5d92c58a954..f969af9baf8 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_io.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_io.tex @@ -29,7 +29,7 @@ The ability to use the input/output operators, requires that the \ccc{Point_2} type and the \ccc{X_monotone_curve_2} type defined by the traits class both support the \ccc{<<} and \ccc{>>} operators. The \ccc{Arr_conic_traits_2} class (see Section~\ref{arr_ssec:tr_conic}), the -\ccc{Arr_rational_arc_traits_2} class (see Section~\ref{arr_ssec:tr_ratfunc}), +\ccc{Arr_rational_function_traits_2} class (see Section~\ref{arr_ssec:tr_ratfunc}), and the \ccc{Arr_linear_traits_2} class (see Section~\ref{arr_ssec:tr_segs}) currently do not provide these operators for the geometric types they define. Thus, only arrangements of line segments or of polylines can be written or @@ -148,7 +148,7 @@ The ability to use this output operator, requires that the \ccc{Point_2} and \ccc{X_monotone_curve_2} types defined by the traits class both support the \ccc{<<} operator that inserts the respective geometric object into a \ccc{Qt_widget} stream. The -\ccc{Arr_rational_arc_traits_2} class (see +\ccc{Arr_rational_function_traits_2} class (see Section~\ref{arr_ssec:tr_ratfunc}) and the \ccc{Arr_linear_traits_2} class (see Section~\ref{arr_ssec:tr_segs}) currently do not provide this operator for the geometric types they define. Thus, only @@ -180,7 +180,7 @@ respectively into \ccc{Qt_widget} streams. %% traits class both support the \ccc{<<} operator that inserts the %% respective geometric object into a Postscript stream. The %% \ccc{Arr_conic_traits_2} class (see Section~\ref{arr_ssec:tr_conic}), the -%% \ccc{Arr_rational_arc_traits_2} class (see Section~\ref{arr_ssec:tr_ratfunc}), +%% \ccc{Arr_rational_function_traits_2} class (see Section~\ref{arr_ssec:tr_ratfunc}), %% and the \ccc{Arr_linear_traits_2} class (see Section~\ref{arr_ssec:tr_segs}) %% currently do not provide this operator for the geometric types they define. %% Thus, only arrangements of line segments or of polylines can be written. diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_traits.tex index 9002b72b746..be439a64e2e 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_traits.tex @@ -9,6 +9,7 @@ mention throughout the chapter that there are different levels of requirements from the traits class, namely the traits class can model different concept refinement-levels. +%-------------------------------------------------- \subsection{The Hierarchy of Traits-Class Concepts \label{arr_sssec:tr_concepts}} %-------------------------------------------------- @@ -21,93 +22,65 @@ A model of the basic concept, \ccc{ArrangementBasicTraits_2}, needs to define the types \ccc{Point_2} and \ccc{X_monotone_curve_2}, where objects of the first type are the geometric mapping of arrangement vertices, and objects of the -latter type are the geometric mapping of edges. In addition, it has to -support the following set of predicates: -\begin{itemize} -\item Compare the $x$-coordinates of two points $p$ and $q$. -% -\item Compare two points $p$ and $q$ lexicographically, by their -$x$-coordinates and then (in case of equality) by their -$y$-coordinates. -% -\item Return the left endpoint (similarly, the right endpoint) of -an $x$-monotone curve $c$. -% -\item Given an $x$-monotone curve $c$ and a point $p$ that lies in its -$x$-range, determine whether $p$ lies below, above or on $c$. -% -\item Given two $x$-monotone curves $c_1$ and $c_2$ that share a -common left endpoint $p$, determine whether $c_1$ lies above or under -$c_2$ immediately to the right of $p$, or whether the two curves coincide -there. -\item Check two curves for equality (two curves are equal if their -graph is the same). -\end{itemize} +latter type are the geometric mapping of edges. Such a model has to +support in addition the following set of operations: +\begin{description} +\item[\ccc{Compare_x_2}:] Compares the $x$-coordinates of two points. + % +\item[\ccc{Compare_xy_2}:] Compares two points lexicographically, by + their $x$-coordinates and then (in case of equality) by their + $y$-coordinates. + % +\item[\ccc{Construct_min_vertex_2},\ccc{Construct_max_vertex_2}:] + Returns the left endpoint (similarly, the right endpoint) of + an $x$-monotone curve. + % +\item[\ccc{Compare_y_at_x_2}:] Given an $x$-monotone curve $c$ and a + point $p$ that lies in its $x$-range, this predicate determines + whether $p$ lies below, above or on $c$. + % +\item[\ccc{Compare_y_at_x_right_2}:] + Given two $x$-monotone curves $c_1$ and $c_2$ that share a common + left endpoint $p$, this predicate determines whether $c_1$ lies + above or under $c_2$ immediately to the right of $p$, or whether the + two curves coincide there. +\item[\ccc{Equal_2}:] Checks two points and two curves for equality + (two curves are equal if their graph is the same). + % +\item[\ccc{Is_vertical_2}:] + Determines whether an $x$-monotone curve is vertical. +\end{description} -This basic set of predicates is sufficient for constructing -arrangements of bounded $x$-monotone curves and points that -are pairwise disjoint in their interiors and for answering -point-location queries and vertical ray-shooting queries. -In order to support unbounded curves we add the following -predicates, involving curve-ends that coincide with the imaginary -boundaries of the arrangement. We say that such curves have -{\em boundary conditions} in $x$ or in $y$: -\begin{itemize} -\item -Determine if the left end (similarly, the right end) of an -$x$-monotone curve $c$ has a boundary condition in $x$. Namely, -we say that its boundary condition is \ccc{MINUS_INFINITY} if -it lies at $x = -\infty$, \ccc{PLUS_INFINITY} if it lies at -$x = +\infty$, and \ccc{NO_BOUNDARY} otherwise. - -Similarly, we need a predicate for determining whether a given -curve-end (the left end or the right end of a given $x$-monotone -curve) has a boundary condition in $y$, namely whether it lies -at $y = \pm\infty$. Note that we can construct the left endpoint -(or the right endpoint) of $c$ only if the corresponding curve-end -is bounded (i.e., has no boundary conditions in $x$ or in $y$). -% -\item -Given two $x$-monotone curve $c_1$ and $c_2$, both defined at $x = --\infty$, determine whether $c_1$ lies above or under $c_2$ at $x = --\infty$ (similarly, at $x = \infty$). -% -\item -Compare the $x$-position of an unbounded curve-end with a -finite $x$-coordinate and an infinite $y$-coordinate with a -vertical line that passes through a given query point. -% -\item -Compare the $x$-position of two unbounded curve-ends with finite -$x$-coordinates and infinite $y$-coordinates. -\end{itemize} Each model of the concept \ccc{ArrangementBasicTraits_2} -needs to define a tag named \ccc{Has_boundary_category}, -which should be either \ccc{Tag_true} or \ccc{Tag_false}. -In the latter case, the tag marks the fact that the traits -class does not support unbounded curves (for example, the -\ccc{Arr_segment_traits_2} class we have encountered in the -previous sections), and it does not have to provide the -predicates listed above. - -An additional tag, named \ccc{Has_left_category}, determines +needs to define a tag named \ccc{Has_left_category}. It determines whether the traits class supports the following predicate: -\begin{itemize} -\item -Given two $x$-monotone curves $c_1$ and $c_2$ that share a common -right endpoint $p$, determine whether $c_1$ lies above or under -$c_2$ immediately to the left of $p$, or whether the two curves -coincide there. -\end{itemize} +\begin{description} +\item[\ccc{Compare_y_at_x_left_2}:] + Given two $x$-monotone curves $c_1$ and $c_2$ that share a common + right endpoint $p$, this predicate determines whether $c_1$ lies + above or under $c_2$ immediately to the left of $p$, or whether the + two curves coincide there. +\end{description} This predicate is optional, as it can be answered using the other traits-class primitives, and we wish to alleviate the need to implement an extra method that is not absolutely necessary. However, as implementing the predicate directly may prove to be more efficient, the traits-class -implementer may choose to provide it. As we will see, the -usage of tags makes it easier to implement new traits -classes and allows for more flexibility in their design. +implementer may choose to provide it. +The basic set of predicates is sufficient for constructing +arrangements of $x$-monotone curves that do not reach or approach the +boundary of the parameter space. The nature of the input curves, i.e., +whether some of them are expected to reach or approach the left, right, +bottom, or top side of the boundary of the parameter space, must be +conveyed by the traits class. This is done through the definition of +four additional nested types, namely \ccc{Left_side_category}, +\ccc{Right_side_category}, \ccc{Bottom_side_category}, and +\ccc{Top_side_category}. Each of those types must be convertible to +the type \ccc{Arr_oblivious_side_tag} for the class to be a model of +the concept \ccc{ArrangementBasicTraits_2}. + +%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \subsubsection{The Landmarks Concept \label{arr_sssec:tr_lanmarks_concept}} %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -118,49 +91,54 @@ instantiated with a model of the refined \ccc{ArrangementLandmarkTraits_2} traits concept. A model of this concept must define a fixed precision number type (typically \ccc{double}) and support the additional operations: -\begin{itemize} -\item Given a point \ccc{p}, approximate the $x$ and $y$-coordinates -of \ccc{p} using the fixed precision number type. We use this operation -for approximate computations --- there are certain operations in the -search for the location of the point that need not be exact and we can -perform them faster than other operations. +\begin{description} +\item[\ccc{Approximate_2}:] + Given a point \ccc{p}, approximate the $x$ and $y$-coordinates + of \ccc{p} using the fixed precision number type. We use this + operation for approximate computations---there are certain + operations in the search for the location of the point that need not + be exact and we can perform them faster than other operations. % -\item Given two points $p_1$ and $p_2$, construct an $x$-monotone -curve connecting $p_1$ and $p_2$. -\end{itemize} +\item[\ccc{Construct_x_monotone_curve_2}:] Given two points $p_1$ and + $p_2$, this predicate constructs an $x$-monotone curve connecting + $p_1$ and $p_2$. +\end{description} -\subsubsection{Supporting Interesecting $x$-Monotone Curves +%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +\subsubsection{Supporting Intersecting $x$-Monotone Curves \label{arr_sssec:tr_xmon_concept}} %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A traits class that models the \ccc{ArrangementXMonotoneTraits_2} concept, which refines the \ccc{ArrangementBasicTraits_2} concept, has to support the following functions: -\begin{itemize} -\item Compute all intersection points and overlapping sections of -two given $x$-monotone curves. If possible, compute also the -multiplicity of each intersection point.\footnote{If the two -curves intersect at a point $p$ but have different tangents, $p$ -is of multiplicity 1. If the tangents are also equal but the their -curvatures are not the same, $p$ is of multiplicity 2, etc.} -Knowing the multiplicity of an intersection point is not required, -but it can speed up the arrangement construction. +\begin{description} +\item[\ccc{Intersection_2}:] + Computes all intersection points and overlapping sections of + two given $x$-monotone curves. If possible, computes also the + multiplicity of each intersection point.\footnote{If the two + curves intersect at a point $p$ but have different tangents, $p$ + is of multiplicity 1. If the tangents are also equal but the their + curvatures are not the same, $p$ is of multiplicity 2, etc.} + Knowing the multiplicity of an intersection point is not required, + but it can speed up the arrangement construction. % -\item Split an $x$-monotone curve $c$ into two subcurves at a point -$p$ lying in the interior of $c$. +\item[\ccc{Split_2}:] Splits an $x$-monotone curve $c$ into two subcurves + at a point $p$ lying in the interior of $c$. % -\item Given two $x$-monotone curve $c_1$ and $c_2$ that share a -common endpoint, determine whether $c_1$ and $c_2$ are {\em -mergeable}, that is, whether they can be merged to form a -single continuous $x$-monotone curve of the type supported by the -traits class. +\item[\ccc{Are_mergeable_2}:] Given two $x$-monotone curve $c_1$ and + $c_2$ that share a common endpoint, this predicate determines + whether $c_1$ and $c_2$ are \emph{mergeable}, that is, whether they + can be merged to form a single continuous $x$-monotone curve of the + type supported by the traits class. % -\item Merge two mergeable $x$-monotone curve $c_1$ and $c_2$. -\end{itemize} +\item[\ccc{Merge_2}:] Merges two mergeable $x$-monotone curves. +\end{description} Using a model of the \ccc{ArrangementXMonotoneTraits_2}, it is possible to construct arrangements of sets of $x$-monotone curves (and points) that may intersect one another. +%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \subsubsection{Supporting Arbitrary Curves \label{arr_sssec:tr_full_concept}} %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -168,37 +146,215 @@ possible to construct arrangements of sets of $x$-monotone curves The concept \ccc{ArrangementTraits_2} refines the \ccc{ArrangementXMonotoneTraits_2} concept by adding the notion of a general, not necessarily $x$-monotone (and not necessarily -connected) curve. A model of this concept must define the -\ccc{Curve_2} type and support the division of a curve into a -set of continuous $x$-monotone curves and isolated points. For -example, the curve $C:\ (x^2 + y^2)(x^2 + y^2 - 1) = 0$ is the -unit circle (the loci of all points for which $x^2 + y^2 = 1$) -with the origin $(0,0)$ as a singular point in its interior. $C$ -should therefore be divided into two circular arcs (the upper -part and the lower part of the unit circle) and a single isolated -point. +continuous) curve. A model of this concept must define the +\ccc{Curve_2} type and support the subdivision of a curve into a +set of continuous $x$-monotone curves and isolated points using +the predicate \ccc{Make_x_monotone_2}. For example, the curve +$C:\ (x^2 + y^2)(x^2 + y^2 - 1) = 0$ is the unit circle (the loci +of all points for which $x^2 + y^2 = 1$) with the origin $(0,0)$ +as a singular point in its interior. $C$ should therefore be +divided into two circular arcs (the upper part and the lower part +of the unit circle) and a single isolated point. Note that the refined model \ccc{ArrangementTraits_2} is required -only when using the free \ccc{insert()} and -\ccc{insert()} functions (see Section~\ref{arr_sec:gl_funcs}), -which accept a \ccc{Curve_2} object in the incremental version, -or a range of \ccc{Curve_2} objects in the aggregated version. -In all other cases it is sufficient to use a model of the -\ccc{ArrangementXMonotoneTraits_2} concept. +only when using the free \ccc{insert()} functions (see +Section~\ref{arr_sec:gl_funcs}), which accept a \ccc{Curve_2} object +in the incremental version, or a range of \ccc{Curve_2} objects in the +aggregated version. In all other cases it is sufficient to use a model +of the \ccc{ArrangementXMonotoneTraits_2} concept. + +%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +\subsubsection{Supporting Unbounded Curves} +%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +% +An arrangement that supports unbounded $x$-monotone curves maintains +an implicit bounding rectangle in the \dcel{} structure; see +Section~\ref{arr_ssec:unb_rep}. The unbounded ends of vertical rays, +vertical lines, and curves with vertical asymptotes are represented +by vertices that lie on the bottom or top sides of this bounding +rectangle. These vertices are not associated with points, but are +associated with (finite) $x$-coordinates. The unbounded ends of all +other curves are represented by vertices that lie on the left or +right sides of this bounding rectangle. These vertices are not +associated with points either. Edges connect these vertices and the +four vertices that represents the corners of this bounding rectangle +to form the rectangle. + +Several predicates are required to handle $x$-monotone curves that +approach infinity and thus approach the boundary of the parameter +space. These predicates are sufficient to handle not only curves +embedded in an unbounded parameter space, but also curves embedded +in a bounded parameter space with open boundaries. Let $b_l$ and +$b_r$ denote the $x$-coordinates of the left and right boundaries of +the parameter space, respectively. Let $b_b$ and $b_t$ denote the +$y$-coordinates of the bottom and top boundaries of the parameter +space, respectively. Recall that currently the general code of the +arrangement only supports the case where the parameter space is the +entire compactified plane, thus $b_l = b_b = -\infty$ and +$b_r = b_t = +\infty$. Nonetheless, when the parameter space is +bounded, it is the exact geometric embedding of the implicit bounding +rectangle. In the following we assume that an $x$ monotone +curve $C$ can be considered as a parametric curve $C(t) = (X(t),Y(t))$ +defined over a closed, open, or half open interval with endpoints~$0$ +and~$1$. + +%% The additional requirements are organized in four different concepts, +%% one for each side. Models of the concept associated with the bottom +%% and top sides can only handle curves with finite $x$-coordinates. +%% Curves with negative infinite and positive infinite $x$-coordinates +%% are handled by models of concepts associated with the left and right +%% sides, respectively. We defer the introducing of the four individual +%% concepts to a later release to avoid clutter. Instead, we introduce +%% the single concept \ccc{ArrangementOpenBoundaryTraits_2}, which +%% combines all the four concepts. The combined concept refines the +%% concept \ccc{ArrangementBasicTraits_2}. The arrangement template +%% instantiated with a traits class that models this combined concept +%% can handle curves that are unbounded in any direction. +Models of the concept \ccc{ArrangementOpenBoundaryTraits_2} handle +curves that approach the boundary of the parameter space. This concept +refines the concept \ccc{ArrangementBasicTraits_2}. The arrangement +template instantiated with a traits class that models this concept +can handle curves that are unbounded in any direction. If some curves +inserted into an arrangement object are expected to be unbounded, namely, +there exists $d \in \{0,1\}$ such that +$\lim_{t \rightarrow d}X(t) = \pm\infty$ or +$\lim_{t \rightarrow d}y(t) = \pm\infty$ +holds for at least one input curve $C(t) = (X(t),Y(t))$, the arrangement +template must be instantiated with a model of the +\ccc{ArrangementOpenBoundaryTraits} concept.\footnote{We + intend to enhance the arrangement template to handle curves confined + to a bounded yet open parameter space. A curve that reaches the + boundary of the parameter space in this case is bounded and open.} + +All the four types \ccc{Left_side_category}, +\ccc{Right_side_category}, \ccc{Bottom_side_category}, and +\ccc{Top_side_category} nested in a model of the concept +\ccc{ArrangementOpenBoundaryTraits} must be convertible to +\ccc{Arr_open_side_tag}.\footnote{The tags + \ccc{Arr_oblivious_side_tag} and \ccc{Arr_open_side_tag} are only + two out of a larger number of options for the side categories + included in major extension the code is going through.} +For example, the \ccc{Arr_rational_function_traits_2} traits-model supports +unbounded curves; see Section~\ref{arr_ssec:tr_ratfunc}. Thus, all +four nested types are defined as \ccc{Arr_open_side_tag}. +Adversely, all four types nested in the \ccc{Arr_segment_traits_2} +traits-model (see Section~\ref{arr_ssec:tr_segs}) are defined as +\ccc{Arr_oblivious_side_tag}, as segments are always +bounded.\footnote{We intend to introduce more concepts that require + only a subset of the categories to be convertible to + \ccc{Arr_open_side_tag}.} + +A model of the concept \ccc{ArrangementOpenBoundaryTraits_2} must provide +the additional predicates listed below. +$x$-coordinates and $y$-coordinates are differently handled. This +asymmetry is brought on by the various algorithms applied to +arrangements, the input and output arguments of which are $x$-monotone +curves. Indeed, all curves maintained by any arrangement are +continuous weakly $x$-monotone curves. A non $x$-monotone curve is +divided into $x$-monotone sub curves (and perhaps points) before it +is inserted into an arrangement. This asymmetry is also reflected in +the additional predicates listed below. +%% Notice that curves that reach +%% the left or right boundary sides are handled by the two predicates +%% \ccc{Parameter_space_in_x_2} and \ccc{Compare_y_near_boundary_2}, +%% while the handling of curves that reach the bottom or top boundary +%% sides is performed by the three predicates +%% \ccc{Parameter_space_in_y_2}, \ccc{Compare_x_at_limit_2}, and +%% \ccc{Compare_x_near_limit_2}. + +\begin{description} +\item[\ccc{Parameter_space_in_x_2}:] + Given a parametric $x$-monotone curve $C(t) = (X(t),Y(t))$ and an + enumerator that specifies either the minimum end or the maximum end + of the curve, and thus maps to a parameter value $d \in \{0,1\}$, + this predicate determines the location of the curve end along the + $x$-dimension. Formally, the predicate determines whether + $\lim_{t \rightarrow d} X(t)$ evaluates to $b_l$, $b_r$, or a value + in between. + % +\item[\ccc{Compare_y_near_boundary_2}:] + Given two $x$-monotone curves $C_1$ and $C_2$ and an enumerator $i$ + that specifies either the minimum ends or the maximum ends of the + two curves, this predicate compares the $y$-coordinates of the + curves near their respective ends. That is, the predicate compares + the $y$-coordinates of the vertical projection of a point $p$ onto + $C_1$ and onto $C_2$. If the enumerator $i$ specifies the minimum + ends, the curves must approach the left boundary-side. In this case + $p$ is located far to the left, such that the result is invariant + under a translation of $p$ farther to the left. If $i$ specifies the + maximum ends, the curves must approach the right boundary-side. In + that case $p$ is located far to the right in a similar manner. + % +\item[\ccc{Parameter_space_in_y_2}:] + Given a parametric $x$-monotone curve $C(t) = (X(t),Y(t))$ and an + enumerator that specifies either the minimum end or the maximum end + of the curve, and thus maps to a parameter value $d \in \{0,1\}$, + this predicate determines the location of the curve end along the + $y$-dimension. Formally, the predicate determines whether + $\lim_{t \rightarrow d} Y(t)$ evaluates to $b_b$, $b_t$, or a value + in between. + % +\item[\ccc{Compare_x_at_limit_2}:] + Two versions of this predicate are provided: + (i) Given a point $p$, a parametric $x$-monotone curve + $C(t) = (X(t),Y(t))$, and an enumerator that specifies either the + minimum end or the maximum end of the curve, and thus maps to a + parameter value $d \in \{0,1\}$, this predicate compares the + $x$-coordinate of $p$ and $\lim_{t \rightarrow d} X(t)$. If the + parameter space is unbounded, a precondition assures that $C$ + has a vertical asymptote at its $d$-end; that is + $\lim_{t \rightarrow d} X(t)$ is finite. + (ii) Given two parametric $x$-monotone curves + $C_1(t) = (X_1(t),Y_1(t))$ and $C_2(t) = (X_2(t),Y_2(t))$ and two + enumerators that specify either the minimum end or the maximum + end of each curve, and thus map to parameter values + $d_1\in \{0,1\}$ and $d_2 \in \{0,1\}$ for $C_1$ and for $C_2$, + respectively, this predicate compares + $\lim_{t \rightarrow d_1} X_1(t)$ and $\lim_{t \rightarrow d_2} X_2(t)$. + If the parameter space is unbounded, a precondition assures that + $C_1$ and $C_2$ have vertical asymptote at their respective ends; + that is $\lim_{t \rightarrow d_1} X_1(t)$ and + $\lim_{t \rightarrow d_2} X_2(t)$ are finite. +% +\item[\ccc{Compare_x_near_limit_2}:] + Given two $x$-monotone curves $C_1$ and $C_2$ and an enumerator $i$ + that specifies either the minimum ends or the maximum ends of the + two curves, this predicate compares the $x$-coordinates of the + curves near their respective ends. That is, the predicate compares + the $x$-coordinates of the horizontal projection of a point $p$ + onto $C_1$ and onto $C_2$. If the parameter space is unbounded, a + precondition assures that $C_1$ and $C_2$ have vertical asymptote + at their respective ends. Furthermore, both curves approach the + same boundary-side, either the bottom or the top, at their + respective ends. If both curves approach the bottom boundary-side, + $p$ is located far to the bottom, such that the result is invariant + under a translation of $p$ farther to the bottom. If both curves + approach the top boundary-side, $p$ is located far to the top in a + similar manner. Another precondition assures that the + $x$-coordinates of the limits of the curves at their respective + ends are equal. That is, the predicate \ccc{Compare_x_at_limit_2} + applied to $C_1$, $C_2$, and $i$ evaluates to \ccc{EQUAL}. +\end{description} In the rest of this section we review the traits classes included in the public distribution of \cgal, that handle line -segments, polylines and conic arcs. The last subsection overviews +segments, polylines, conic arcs, rational functions, and arcs of +B\'{e}zier and algebraic curves. +The last subsection overviews decorators for geometric traits classes distributed with \cgal, which extend other geometric traits-class by attaching auxiliary data with the geometric objects. +%-------------------------------------------------------------- \subsection{Traits Classes for Line Segments and Linear Objects \label{arr_ssec:tr_segs}} %-------------------------------------------------------------- -The \ccc{Arr_segment_traits_2} class used so far -in most example programs in this chapter is parameterized by a +The \ccc{Arr_segment_traits_2} class used so far in most +example programs in this chapter is a model of the concepts +\ccc{ArrangementTraits_2}, \ccc{ArrangementLandmarkTraits_2}, +and \ccc{ArrangementDirectionalXMonotoneTraits_2}; the later +enables Boolean set operations. It is parameterized by a geometric kernel and uses the \ccc{Kernel::Point_2} type as it point type. However, neither the \ccc{Curve_2} nor the \ccc{X_monotone_curve_2} types are identical to the @@ -304,11 +460,13 @@ data is stored with the line segments. The class \ccc{Arr_non_caching_segment_traits_2} inherits from \ccc{Arr_non_caching_segment_basic_traits_2} and -extends it to be a model of the \ccc{ArrangementTraits_2} concept. -It may thus be used to construct arrangement of intersecting line -segments, but as explained above, for efficiency reasons it is -recommended to use it only when the arrangement is very sparse and -contains hardly any intersection points. +extends it to be a model of the concepts \ccc{ArrangementTraits_2}, +\ccc{ArrangementLandmarkTraits_2},and +\ccc{ArrangementDirectionalXMonotoneTraits_2}. It may thus be used to +construct arrangement of intersecting line segments, but as explained +above, for efficiency reasons it is recommended to use it only when +the arrangement is very sparse and contains hardly any intersection +points. In the following example we read an input file containing a set of line segments that are pairwise disjoint in their interior. As the @@ -336,8 +494,9 @@ from a \ccc{Kernel::Segment_2} object. Just like the default segment-traits class, the linear-traits class also use caching techniques to speed up its predicates and constructions. +%------------------------------------------------------------------ \subsection{The Polyline-Traits Class\label{arr_ssec:tr_polylines}} -%------------------------------------- +%------------------------------------------------------------------ The \ccc{Arr_polyline_traits_2} class can be used to maintain arrangements of polylines (a.k.a. poly-segments), @@ -398,7 +557,9 @@ polylines: \ccIncludeExampleCode{Arrangement_on_surface_2/polylines.cpp} -\subsection{A Traits Class for Circular Arcs and Line Segments\label{arr_ssec:tr_circ_seg}} +%-------------------------------------------------------------- +\subsection{A Traits Class for Circular Arcs and Line Segments + \label{arr_ssec:tr_circ_seg}} %-------------------------------------------------------------- Circles and circular arcs are the simplest form of non-linear curves. @@ -424,9 +585,14 @@ of dilated polygons. The \ccc{Arr_circle_segment_traits_2} class-template is designed for efficient handling of arrangements of circular arcs and line segments. -It is parameterized by a geometric kernel, and can handle arrangements of +It is a model of the concepts \ccc{ArrangementTraits_2} and +\ccc{ArrangementDirectionalXMonotoneTraits_2}; the later enables +Boolean set operations. Note that it is not a model of +\ccc{ArrangementLandmarkTraits_2} concept, so it is impossible to +use the landmark point-location strategy. The traits class template +is parameterized by a geometric kernel, and can handle arrangements of segments of \ccc{Kernel::Circle_2} objects (full circles are also supported) -or of \ccc{Kernel::Line_2} objects --- namely circular arcs and line segments. +or of \ccc{Kernel::Line_2} objects---namely circular arcs and line segments. It is important to observe that the nested \ccc{Point_2} type defined by the traits class, whose coordinates are typically algebraic numbers of degree 2, is {\em not} the same as the \ccc{Kernel::Point_2} type, which is capable of @@ -502,8 +668,9 @@ purposes, are based on different concepts, and posses different characteristics. You are encouraged to experiment with both, compare their performance, and use the most suitable for your case. +%------------------------------------------------------------------ \subsection{A Traits Class for Conic Arcs\label{arr_ssec:tr_conic}} -%----------------------------------------- +%------------------------------------------------------------------ A {\em conic curve} is an algebraic curve of degree 2. Namely, it is the locus of all points $(x,y)$ satisfying the equation $C:\ r @@ -592,7 +759,7 @@ computations on the number types it defines. \end{itemize} The \ccc{Arr_conic_traits_2} models the \ccc{ArrangementTraits_2} and -the \ccc{ArrangementLandmarkTraits_2} concepts. (It supports +\ccc{ArrangementLandmarkTraits_2} concepts. (It supports the landmark point-location strategy). Its \ccc{Point_2} type is derived from \ccc{AlgKernel::Point_2}, while the \ccc{Curve_2} type represents a bounded, not necessarily $x$-monotone, conic arc. @@ -610,6 +777,7 @@ special cases, such as circular arcs or line segments. The also support basic access functions such as \ccc{source()}, \ccc{target()} and \ccc{orientation()}. +%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \subsubsection{Examples for Arrangements of Conics} %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -658,53 +826,91 @@ multiplicity $1$: \ccIncludeExampleCode{Arrangement_on_surface_2/conic_multiplicities.cpp} +%--------------------------------------------------------- \subsection{A Traits Class for Arcs of Rational Functions\label{arr_ssec:tr_ratfunc}} %--------------------------------------------------------- -A {\em rational function} is given by the equation $y = -\frac{P(x)}{Q(x)}$, where $P$ and $Q$ are polynomials of arbitrary -degrees. In particular, if $Q(x) = 1$, then the function is a -simple polynomial function. A bounded {\em rational arc} is -defined by the graph of a rational function over some interval -$[x_{\rm min}, x_{\rm max}]$, where $Q$ does not have any real -roots in this interval (Thus, the arc does not contain any poles). -Rational functions, and polynomial functions in particular, are -not only interesting in their own right, they are also very useful -for approximating or interpolating more complicated curves; see, +The traits class +\ccc{Arr_rational_function_traits_2} handles +bounded and unbounded arcs of rational functions, referred to as +\emph{rational arcs} (in particular, such an arc may correspond to the +entire graph of a rational function), and enables the construction and +maintenance of arrangements of such arcs. Rational functions, and +polynomial functions in particular, are not only interesting in their +own right, they are also very useful for approximating or +interpolating more complicated curves; see, e.g.,~\cite[Chapter~3]{cgal:ptvf-nrcpp-02}. -The computations with rational arcs are guaranteed to be robust and -exact, assuming that the coefficient of the polynomials $P$ and $Q$ -are rational numbers. The $x$-values that determine the interval -over which the arc is defined can however be arbitrary algebraic -numbers. +\ccc{Arr_rational_function_traits_2} is a model +of the concepts \ccc{ArrangementTraits_2}, +\ccc{ArrangementOpenBoundaryTraits_2}, and +\ccc{ArrangementDirectionalXMonotoneTraits_2}; the later enables +Boolean set operations. Note that it is not a model of +\ccc{ArrangementLandmarkTraits_2} concept, so it is impossible to use +the landmark point-location strategy with this traits class. +%\footnote{This requires a relaxation of \ccc{ArrangementLandmarkTraits_2}, +%which will be submitted separately.} -Using the \ccc{Arr_rational_arc_traits_2} class -template it is possible to construct and maintain arrangement of -rational arcs. The template parameters are very similar to the -ones used by the \ccc{Arr_conic_traits_2} class template; see -the previous section. However, no rational kernel is needed. Also -in this case it is recommended to use the -\ccc{CORE_algebraic_number_traits} class, with a kernel instantiated -with the \ccc{Algebraic} type defined by this class. +A rational function $y = \frac{P(x)}{Q(x)}$ is defined by two +polynomials $P$ and $Q$ of arbitrary degrees. If $Q(x) = 1$ then +the function is a simple polynomial function. Usually the domain is +$\R$ but the function may also be restricted to a bounded interval +$[x_{\rm min}, x_{\rm max}]$ or defined over a ray +$(-\infty, x_{\rm max}]$ or $[x_{\rm min}, \infty)$. Rational +functions are represented by the nested type \ccc{Curve_2}. +A rational arc is always $x$-monotone in the mathematical +sense. However, it is not necessarily continuous, as it may have +singularities. An arc that has singularities must +be split into continuous portions before being inserted into the +arrangement. Arbitrary rational functions are represented by the +nested type \ccc{Curve_2} and continuous portions of rational +functions are represented by the nested type +\ccc{X_monotone_curve_2}. Constructors for both types are provided by +the traits. A \ccc{Curve_2} may be split up into several +\ccc{X_monotone_curve_2} using \ccc{Make_x_monotone_2}. -The \ccc{Arr_rational_arc_traits_2} is a model of the -\ccc{ArrangementTraits_2} concept (but not of the -\ccc{ArrangementLandmarkTraits_2} concept, so it is not possible -to use the landmark point-location strategy for arrangements of -rational arcs). Its \ccc{Point_2} type is derived from -\ccc{AlgKernel::Point_2}, while the \ccc{Curve_2} and -\ccc{X_monotone_curve_2} types refer to the same class (note that -a rational arc is always $x$-monotone). The traits class also -defines the \ccc{Rat_vector} type, representing a vector of -rational coefficients, (whose type is \ccc{NtTraits::Rational}). A -rational arc can be constructed from a single vector of -coefficients, specifying the polynomial $P$ alone (and $Q(x) = -1$), or from two vectors of coefficients, specifying both $P$ and -$Q$. +Using the \ccc{Arr_rational_function_traits_2} +class template it is possible to construct and maintain arrangement +of rational arcs. The template parameter of the traits must be a model +of the concept \ccc{AlgebraicKernel_d_1}. A rational function is +represented as the quotient of two polynomials $P$ and $Q$ of type +\ccc{AlgebraicKernel_d_1::Polynomial_1} and an $x$-interval over which +the polynomials are defined. The type of the polynomial coefficients, +namely \ccc{AlgebraicKernel_d_1::Coefficient}, cannot be algebraic. +Moreover, it is recommended that this type is not made rational either, +since using rational, as opposed to integral, coefficients does not +extend the range of the rational arcs and is typically less efficient. +The type of the interval bounds, namely +\ccc{AlgebraicKernel_d_1::Bound}, however, can be algebraic. A point is +represented by a rational function and its $x$-coordinate, which is of +type \ccc{AlgebraicKernel_d_1::Algebraic_real_1}. Note that an explicit +representation of the $y$-coordinate is only computed upon request, as +it can be a rather costly operation. -\begin{figure}[t] -\begin{ccTexOnly} +The constructed rational functions are cached by the traits class. The +cache is local to each traits class object. It is therefore necessary +to construct curves using only the constructor objects provided by +member functions of the traits class. +%This is also the reason why IO is not handled via the usual stream operators. +Moreover, a curve must only be used by the traits class object that +was used to construct it. The cache is automatically cleaned up from +time to time. The amortized clean up costs are constant. In addition, +there is also a separate member function that cleans up the cache on +demand. + +The curve constructors have an additional advantage. They conveniently +enable the provision of two polynomials that define a rational arc +using rational coefficients. For example, let $P$ and $Q$ denote two +polynomials with integral coefficients that define a rational arc at +interest, and let $P'$ and $Q'$ denote two polynomials with rational +coefficients that define the same rational arc; that is, the quotients +$P/Q$ and $P'/Q'$ are identical. You can construct the rational arc +providing the coefficients of $P'$ and $Q'$ to the constructor. In this +case the constructor normalizes the coefficients and stores the desired +polynomials $P$ and $Q$. + +\begin{figure}[h] +\begin{ccTexOnly} \begin{center} \includegraphics{Arrangement_on_surface_2/fig/ex_16} \end{center} @@ -723,9 +929,11 @@ arrangement of rational arcs depicted in Figure~\ref{arr_fig:ex_16}. Note the usage of the two constructors, for polynomial arcs and for rational arcs: +\pagebreak[3] + \ccIncludeExampleCode{Arrangement_on_surface_2/rational_functions.cpp} -\begin{figure}[t] +\begin{figure}[h] \begin{ccTexOnly} \begin{center} \includegraphics{Arrangement_on_surface_2/fig/ex_unb_rat} @@ -742,8 +950,8 @@ constructed in \end{figure} The following example demonstrates the construction of an -arrangement of six rational arcs --- four unbounded arcs and two -bounded ones --- as depicted in Figure~\ref{arr_fig:ex_unb1}. Note +arrangement of six rational arcs---four unbounded arcs and two +bounded ones---as depicted in Figure~\ref{arr_fig:ex_unb_rat}. Note the usage of the constructors of an entire rational function and of an infinite ``ray'' of such a function. Also observe that the hyperbolas $y = \pm\frac{1}{x}$ and $y = \pm\frac{1}{2x}$ never intersect, although @@ -752,8 +960,9 @@ unbounded faces are created between them: \ccIncludeExampleCode{Arrangement_on_surface_2/unbounded_rational_functions.cpp} +%---------------------------------------------------------------------------- \subsection{A Traits Class for Planar B\'ezier Curves\label{arr_ssec:tr_bez}} -%--------------------------------------------------------- +%---------------------------------------------------------------------------- A planar {\em B\'ezier curve} $B$ is a parametric curve defined by a sequence of {\em control points} $p_0, \ldots, p_n$ as follows: @@ -795,7 +1004,7 @@ See the Reference Manual for the exact interface of the \ccc{Point_2}, The \ccc{Arr_Bezier_curve_traits_2} is a model of the \ccc{ArrangementTraits_2} concept (but not of the -\ccc{ArrangementLandmarkTraits_2} concept, so it is not possible +\ccc{ArrangementLandmarkTraits_2} concept, so it is impossible to use the landmark point-location strategy for arrangements of rational arcs). @@ -824,9 +1033,10 @@ Figure~\ref{arr_fig:ex_bez}. \ccIncludeExampleCode{Arrangement_on_surface_2/Bezier_curves.cpp} -\subsection{A Traits Class for Planar Algebraic Curves -of Arbitrary Degree\label{arr_ssec:tr_alg}} -%--------------------------------------------------------- +%------------------------------------------------------------------------- +\subsection{A Traits Class for Planar Algebraic Curves of Arbitrary Degree + \label{arr_ssec:tr_alg}} +%------------------------------------------------------------------------- An algebraic curve $C$ in the plane is defined as the (real) zero locus of a polynomial $f(x,y)$ in two variables. The curve is uniquely defined @@ -851,7 +1061,7 @@ we support unbounded curves, vertical curves or segments, and isolated points. The \ccc{Arr_algebraic_segment_traits_2} class template is a model of the \ccc{ArrangementTraits_2} concept (but not of the -\ccc{ArrangementLandmarkTraits_2} concept, so it is not possible +\ccc{ArrangementLandmarkTraits_2} concept, so it is impossible to use the landmark point-location strategy for arrangements of algebraic curves). The template argument \ccc{Coefficient} determines @@ -947,7 +1157,7 @@ its $x$-range contains no critical point in its interior. \end{ccTexOnly} \begin{ccHtmlOnly}

- The braic curves + The algebraic curves
\end{ccHtmlOnly} \caption{The critical $x$-coordinates of an algebraic curve (dashed lines), @@ -1002,8 +1212,9 @@ Figure~\ref{arr_fig:ex_alg_segments}. \ccIncludeExampleCode{Arrangement_on_surface_2/algebraic_segments.cpp} +%----------------------------------------------------------- \subsection{Traits-Class Decorators\label{arr_ssec:meta_tr}} -%----------------------------------- +%----------------------------------------------------------- Geometric traits-class decorators allow you to attach auxiliary data to curves and to points. The data is automatically manipulated @@ -1080,6 +1291,7 @@ between two $x$-monotone curves $c_1$ and $c_2$ with associated data sets $S_1$ and $S_2$, respectively, the overlapping subcurve is associated with the consolidated set $S_1 \cup S_2$. +%~~~~~~~~~~~~~~~~~~~~~~~ \subsubsection{Examples} %~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_unbounded.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_unbounded.tex index d4ef0d03deb..fc7cbcfc1c8 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_unbounded.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/arr_unbounded.tex @@ -11,7 +11,7 @@ lines and rays. %-------------------------------------------- Consider the arrangement induced by the two lines $y = x$ and -$y = -x$. These two line intersect at the origin, such that the +$y = -x$. These two lines intersect at the origin, such that the arrangement contains a single vertex $v = (0,0)$, with four infinite rays emanating from it. Each ray corresponds to an arrangement edge, and these edges subdivide the plane into four unbounded faces. @@ -151,11 +151,11 @@ Halfedges are drawn as thin arrows. The vertices $v_1, \ldots, v_8$ lie at infinity, and are not associated with valid points. The halfedges that connect them are fictitious, and are not associated with concrete curves. The face denoted $f_0$ (lightly shaded) -is the fictitious ``unbounded face'' which lies outside the imaginary +is the fictitious ``unbounded face'' which lies outside the bounding rectangle (dashed) that bounds the actual arrangement. The four fictitious vertices $v_{\rm bl}, v_{\rm tl}, v_{\rm br}$ and -$v_{\rm tr}$ represent the four corners of the imaginary bounding -rectangle..\label{arr_fig:unb_dcel}} +$v_{\rm tr}$ represent the four corners of the bounding +rectangle.\label{arr_fig:unb_dcel}} \end{figure} Given a set $\calC$ of unbounded curves, a simple approach for @@ -167,7 +167,7 @@ $\calC$. This process would result in a set $\calC$ of bounded curves straightforward to compute the arrangement induced by this set. However, we would like to operate directly on the unbounded curves without having to preprocess them. Therefore, we use an implicit -bounding rectangle embedded in the \dcel\ structure. +bounding rectangle embedded in the \dcel{} structure. Figure~\ref{arr_fig:unb_dcel} shows the arrangement of four lines that subdivide the plane into eight unbounded faces and two bounded ones. Notice that in this case the unbounded faces have outer @@ -179,57 +179,57 @@ infinity, and the halfedges connecting them are \emph{fictitious}, and represent portions of the bounding rectangle. Note that the outer CCBs of the unbounded faces contain fictitious halfedges. The twins of these halfedges form together one connected component that corresponds to -the entire imaginary rectangle, which forms a single hole in a face -$\tilde{f}$. We say that $\tilde{f}$ is \emph{fictitious}, as it does -not corresponds to a real two-dimensional cell of the arrangement. +the entire bounding rectangle, which forms a single hole in a face +$f_0$. We say that $f_0$ is \emph{fictitious}, as it does +not correspond to a real two-dimensional cell of the arrangement. Observe that there are four extra vertices at infinity that do not lie on any curve; they are denoted as $v_{\rm bl}, v_{\rm tl}, v_{\rm br}$, and $v_{\rm tr}$, and represent the bottom-left, top-left, bottom-right, and top-right corners of the bounding rectangle, respectively. Similarly, there are fictitious halfedges that lie on -the top, the bottom, the left, or the right edge of the imaginary -bounding rectangle. When the arrangement is empty, there are exactly +the top, the bottom, the left, or the right edge of the bounding +rectangle. When the arrangement is empty, there are exactly four pairs of fictitious halfedges, that divide the plane into two -faces, namely a fictitious face lying outside of the imaginary bounding -rectangle and a single unbounded face bounded by the imaginary -bounding rectangle. +faces, namely a fictitious face lying outside of the bounding +rectangle and a single unbounded face bounded by the bounding rectangle. Summarizing the above, there are four types of arrangement vertices, -which differ from one another by their location on the imaginary -bounding rectangle: +which differ from one another by their location with respect to the +bounding bounding rectangle: \begin{enumerate} -\item -A ``normal'' vertex, associated with a point in $\real^2$ whose -coordinates are bounded. Such a vertex always lies inside the -bounding rectangle. -\item -A vertex that represent an unbounded end of an $x$-monotone curve -that is defined at $x = -\infty$ or at $x = \infty$. In case of -a horizontal line or a curve with a horizontal asymptote, the -$y$-coordinate of the curve end may be finite (see for example the -vertices $v_2$ and $v_7$ in Figure~\ref{arr_fig:unb_dcel}), but in -general the curve end also goes to $y = \pm\infty$ (see for instance -the vertices $v_1$, $v_3$, $v_6$ and $v_8$ in -Figure~\ref{arr_fig:unb_dcel}). For our convenience, we will always -take a ``tall'' enough bounding rectangle and treat such vertices as -lying on either the left or right rectangle edges (that is, if a curve -is defined at $x = -\infty$, its left end will be represented by -a vertex on the left edge of the bounding rectangle, and if it is -defined at $x = \infty$, its right end will be represented by a -vertex of the right edge). -\item -A vertex that represent the unbounded end of a vertical line or of a -curve with a vertical asymptote (finite $x$-coordinate and an -unbounded $y$-coordinate). Such a vertex always lies on one of the -horizontal edges of the bounding rectangle (either the bottom one if -$y = -\infty$, or the top one if $y = \infty$). The vertices $v_4$ -and $v_5$ in Figure~\ref{arr_fig:unb_dcel} are of this type. -\item -The fictitious vertices that represent the four corners of the -imaginary bounding rectangle. +\item\label{type-normal} + A vertex, associated with a point in $\real^2$ whose + coordinates are bounded. Such a vertex always lies inside the + bounding rectangle. +\item\label{type-unbounded} + A vertex that represents an unbounded end of an $x$-monotone curve + that is defined at $x = -\infty$ or at $x = \infty$. In case of + a horizontal line or a curve with a horizontal asymptote, the + $y$-coordinate of the curve end may be finite (see for example the + vertices $v_2$ and $v_7$ in Figure~\ref{arr_fig:unb_dcel}), but in + general the curve end also goes to $y = \pm\infty$ (see for instance + the vertices $v_1$, $v_3$, $v_6$ and $v_8$ in + Figure~\ref{arr_fig:unb_dcel}). For our convenience, we will always + take a ``tall'' enough bounding rectangle and treat such vertices as + lying on either the left or right rectangle edges (that is, if a curve + is defined at $x = -\infty$, its left end will be represented by + a vertex on the left edge of the bounding rectangle, and if it is + defined at $x = \infty$, its right end will be represented by a + vertex of the right edge). +\item\label{type-unbounded-vertical} + A vertex that represent the unbounded end of a vertical line or of a + curve with a vertical asymptote (finite $x$-coordinate and an + unbounded $y$-coordinate). Such a vertex always lies on one of the + horizontal edges of the bounding rectangle (either the bottom one if + $y = -\infty$, or the top one if $y = \infty$). The vertices $v_4$ + and $v_5$ in Figure~\ref{arr_fig:unb_dcel} are of this type. +\item\label{type-fictitious} + The fictitious vertices that represent the four corners of the + bounding bounding rectangle. \end{enumerate} -A vertex at infinity of types 1--3 above always has +A vertex (at infinity) of Type~\ref{type-unbounded} or +Type~\ref{type-unbounded-vertical} above always has three incident edges: one concrete edge that is associated with an unbounded portion of an $x$-monotone curve, and two fictitious edges connecting the vertex to its neighboring vertices at infinity. @@ -243,44 +243,48 @@ following methods, in addition to the ones listed in Section~\ref{arr_ssec:traverse}: \begin{itemize} \item -The \ccc{Vertex} type provides the three-valued predicates -\ccc{parameter_space_in_x()} and \ccc{parameter_space_in_y()}. -The former returns \ccc{ARR_INTERIOR} if the point associated with the -vertex has a finite $x$-coordinate, \ccc{ARR_LEFT_BOUNDARY} -if the vertex lies on the left boundary of the parameter space, and -\ccc{ARR_RIGHT_BOUNDARY} if the vertex lies on the right boundary of -the parameter space. Similarly, \ccc{parameter_space_in_y()} returns -\ccc{ARR_INTERIOR}, \ccc{ARR_BOTTOM_BOUNDARY}, or -\ccc{ARR_TOP_BOUNDARY} depending on whether the point associated with -the vertex has a finite $y$-coordinate, lies on the bottom boundary of -the parameter space, or lies on the top boundary. The Boolean predicate -\ccc{is_at_open_boundary()} is also supported. It checks whether the -vertex lies at infinity. You can access the point associated with a -vertex only if it does not lie at infinity (recall that a vertex at -infinity is not associated with a \ccc{Point_2} object). + The \ccc{Vertex} class provides three-valued predicates + \ccc{parameter_space_in_x()} and \ccc{parameter_space_in_y()}, which + return the location of the geometric embedding of the vertex in the + parameter space. In particular, the former returns + \ccc{ARR_LEFT_BOUNDARY}, \ccc{ARR_INTERIOR}, or + \ccc{ARR_RIGHT_BOUNDARY}, and the latter returns + \ccc{ARR_BOTTOM_BOUNDARY}, \ccc{ARR_INTERIOR}, or + \ccc{ARR_TOP_BOUNDARY}. As the package currently supports only the + case where the parameter space is the compactified plane, the former + returns \ccc{ARR_INTERIOR} if the $x$-coordinate associated with the + vertex is finite, \ccc{ARR_LEFT_BOUNDARY} if it is $-\infty$, and + \ccc{ARR_RIGHT_BOUNDARY} if it is $\infty$. The latter returns + \ccc{ARR_INTERIOR} if the $y$-coordinate associated with the vertex + is finite, \ccc{ARR_BOTTOM_BOUNDARY} if it is $-\infty$, and + \ccc{ARR_TOP_BOUNDARY} if it is $\infty$. The Boolean predicate + \ccc{is_at_open_boundary()} is also provided. You can access the + point associated with a vertex only if it is not a vertex at an open + boundary (recall that a vertex at an open boundary is not associated + with a \ccc{Point_2} object). % \item -The nested \ccc{Halfedge} class provides the Boolean predicate -\ccc{is_fictitious()}. The $x$-monotone curve associated with -a halfedge can be accessed by the \ccc{curve()} method only if the -halfedge is not fictitious. + The nested \ccc{Halfedge} class provides the Boolean predicate + \ccc{is_fictitious()}. The $x$-monotone curve associated with + a halfedge can be accessed by the \ccc{curve()} method only if the + halfedge is not fictitious. % \item -The nested \ccc{Face} class provides the Boolean predicate -\ccc{f.is_fictitious()}. The method \ccc{outer_ccb()} has the -precondition that the face is not fictitious. Note that valid -unbounded faces always have valid CCBs (although this CCB may -comprise only fictitious halfedge in case the arrangement contains -only bounded curves). + The nested \ccc{Face} class provides the Boolean predicate + \ccc{f.is_fictitious()}. The method \ccc{outer_ccb()} has the + precondition that the face is not fictitious. Note that non-fictitious + unbounded faces always have valid CCBs (although this CCB may + comprise only fictitious halfedge in case the arrangement contains + only bounded curves). \end{itemize} The method \ccc{arr.number_of_edges()} does not count the number of fictitious edges, (which is always \ccc{arr.number_of_vertices_at_infinity() + 4}), and the iterators returned by \ccc{arr.edges_begin()} and \ccc{arr.edges_end()} specify -a range of valid edges. Similarly, \ccc{arr.number_of_faces()} does not -count the fictitious face. -However, the \ccc{Ccb_halfedge_circulator} of the outer boundary of an +a range of non-fictitious edges. Similarly, \ccc{arr.number_of_faces()} +does not count the fictitious face. However, the +\ccc{Ccb_halfedge_circulator} of the outer boundary of an unbounded face or the \ccc{Halfegde_around_vertex_circulator} of a vertex at infinity do traverse fictitious halfedges. For example, it is possible to traverse the outer boundaries of the unbounded arrangement edges diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/main.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/main.tex index bf385621cf7..39889031e40 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/main.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2/main.tex @@ -9,7 +9,7 @@ \label{chapterArrangement_on_surface_2} \ccChapterRelease{\ArrangementOnSurfaceRev. \ \ArrangementOnSurfaceDate} -\ccChapterAuthor{Ron Wein, Efi Fogel, Baruch Zukerman, Dan Halperin, and Eric Berberich} +\ccChapterAuthor{Ron Wein, Efi Fogel, Baruch Zukerman, Dan Halperin, Eric Berberich, and Oren Zalzman} \input{Arrangement_on_surface_2/PkgDescription.tex} 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_basic_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_basic_traits.tex index 6bbbdfc8ac9..6bdcacc404a 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_basic_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_basic_traits.tex @@ -18,23 +18,18 @@ continuous $x$-monotone curves (a vertical segment is also considered to be to be pairwise disjoint in their interiors, so they do not intersect except at their endpoints. -The $x$-monotone curves may be {\em unbounded}, namely they may have unbounded -ends that lie at infinity, or {\em bounded}, in which case their have finite -endpoints are representable as \ccc{Point_2} objects. An $x$-monotone curve -may also have one unbounded end and one finite endpoint (e.g. a ray). -If unbounded curves are supported, the requirements from the traits class -are extended a bit, as described below. In particular, the traits class needs -to support comparisons at infinity, where we interpret comparisons at infinity -as follows: Suppose we wish to compare the $y$-position of the hyperbolas -$y_1 = \frac{1}{x}$ and $y_2 = \frac{2}{x}$ at $x = \infty$; than since there -exists $x_0$ such that for each finite $x > x_0$ we have $y_2(x) > y_1(x)$ -(in our case we can take $x_0 = 0$), we say that $y_2$ is {\em above} $y_1$ at -infinity. Similarly, when comparing the $x$-positions of the vertical line -$x = 0$ and the $xy$-minimal end of parabola $y = \frac{1}{x}$ for $x > 0$ -(which has a vertical asymptote at $x = 0$), we define that the line lies to -the {\em left} of the hyperbola. Namely, comparing curves at their unbounded -ends should return the comparison result \ccc{EQUAL} only if the curves -overlap. +The \ccc{X_monotone_curve_2} curves of an arrangement are confined to an +iso-rectangular area called the parameter space. The iso-rectangule can +be unbounded, open, or closed. The set of predicates provided by a model +the concept \ccRefName{} is sufficient for constructing arrangements of +$x$-monotone curves that do not reach or approach the boundary of the +parameter space. The nature of the input curves, whether they are +expected to reach or approach the left, right, bottom, or top side of the +boundary of the parameter space, are conveyed through the definition of +four additional nested types, namely \ccc{Left_side_category}, +\ccc{Right_side_category}, \ccc{Bottom_side_category}, and +\ccc{Top_side_category}. Each such type must be convertible to the type +\ccc{Arr_oblivious_side_tag}. \ccRefines{DefaultConstructible, CopyConstructible, Assignable} @@ -51,18 +46,14 @@ overlap. {indicates whether the nested functor \ccc{Compare_at_x_left_2} is provided.} -\ccNestedType{Arr_left_side_category} - {indicates the type of the left boundary-side. Must be either - \ccc{Arr_oblivious_side_tag} or \ccc{Arr_open_side_tag}.} -\ccNestedType{Arr_bottom_side_category} - {indicates the type of the bottom boundary-side. Must be either - \ccc{Arr_oblivious_side_tag} or \ccc{Arr_open_side_tag}.} -\ccNestedType{Arr_top_side_category} - {indicates the type of the top boundary-side. Must be either - \ccc{Arr_oblivious_side_tag} or \ccc{Arr_open_side_tag}.} -\ccNestedType{Arr_right_side_category} - {indicates the type of the right boundary-side. Must be either - \ccc{Arr_oblivious_side_tag} or \ccc{Arr_open_side_tag}.} +\ccNestedType{Left_side_category} + {Must be convertible to \ccc{Arr_oblivious_side_tag}.} +\ccNestedType{Bottom_side_category} + {Must be convertible to \ccc{Arr_oblivious_side_tag}.} +\ccNestedType{Top_side_category} + {Must be convertible to \ccc{Arr_oblivious_side_tag}.} +\ccNestedType{Right_side_category} + {Must be convertible to \ccc{Arr_oblivious_side_tag}.} \ccHeading{Functor Types} % ======================= @@ -72,16 +63,6 @@ overlap. \ccGlue \ccNestedType{Compare_xy_2}{models the concept \ccc{ArrTraits::CompareXy_2}.} \ccGlue -\ccNestedType{Parameter_space_in_x_2} - {models the concept \ccc{ArrTraits::ParameterSpaceInX_2}. - Required only if the traits class supports unbounded curves - (the \ccc{Has_boundary_category} category is defined as \ccc{Tag_true}).} -\ccGlue -\ccNestedType{Parameter_space_in_y_2} - {models the concept \ccc{ArrTraits::ParameterSpaceInY_2}. - Required only if the traits class supports unbounded curves - (the \ccc{Has_boundary_category} category is defined as \ccc{Tag_true}).} -\ccGlue \ccNestedType{Construct_min_vertex_2} {models the concept \ccc{ArrTraits::ConstructMinVertex_2}.} \ccGlue @@ -91,30 +72,17 @@ overlap. \ccNestedType{Is_vertical_2}{models the concept \ccc{ArrTraits::IsVertical_2}.} \ccGlue \ccNestedType{Compare_y_at_x_2} - {models the concept \ccc{ArrTraits::CompareYAtX_2}. - If the traits class supports unbounded curves (i.e., the - \ccc{Has_boundary_category} category is defined as \ccc{Tag_true}), then - the type models the concept \ccc{ArrTraits::CompareYNearBoundary_2}.} + {models the concept \ccc{ArrTraits::CompareYAtX_2}.} \ccGlue \ccNestedType{Compare_y_at_x_left_2} {models the concept \ccc{ArrTraits::CompareYAtXLeft_2}. - Required only if the \ccc{Has_left_category} category is defined as + Required only if the \ccc{Has_left_category} category is convertible to \ccc{Tag_true}.} \ccGlue \ccNestedType{Compare_y_at_x_right_2} {models the concept \ccc{ArrTraits::CompareYAtXRight_2}.} \ccGlue \ccNestedType{Equal_2}{models the concept \ccc{ArrTraits::Equal_2}.} -\ccGlue -\ccNestedType{compare_x_near_boundary_2} - {models the concept \ccc{ArrTraits::CompareXNearBoundary_2}. - Required only if the traits class supports unbounded curves - (the \ccc{Has_boundary_category} category is defined as \ccc{Tag_true}).} -\ccGlue -\ccNestedType{compare_y_near_boundary_2} - {models the concept \ccc{ArrTraits::CompareYNearBoundary_2}. - Required only if the traits class supports unbounded curves - (the \ccc{Has_boundary_category} category is defined as \ccc{Tag_true}).} % \ccCreation \ccCreationVariable{traits} @@ -141,14 +109,6 @@ overlap. \ccMethod{Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const;} {} \ccGlue \ccMethod{Equal_2 equal_2_object() const;} {} -\ccGlue -\ccMethod{Parameter_space_in_x_2 parameter_space_in_x_2_object() const;} {} -\ccGlue -\ccMethod{Parameter_space_in_y_2 parameter_space_in_y_2_object() const;} {} -\ccGlue -\ccMethod{Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const;} {} -\ccGlue -\ccMethod{Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const;} {} \ccHasModels % ========== @@ -162,7 +122,7 @@ overlap. \ccc{CGAL::Arr_circular_arc_traits_2}\\ \ccc{CGAL::Arr_circular_line_arc_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}\\ \ccc{CGAL::Arr_curve_data_traits_2}\\ @@ -207,7 +167,7 @@ Represents a planar (weakly) $x$-monotone curve. % ================= \ccRefPageBegin \begin{ccRefConcept}{ArrTraits::CompareX_2} -\ccRefines{Functor} +\ccRefines{AdaptableBinaryFunction} \ccHasModels\ccc{ArrangementBasicTraits_2::Compare_x_2} @@ -223,7 +183,7 @@ Represents a planar (weakly) $x$-monotone curve. % ================== \ccRefPageBegin \begin{ccRefConcept}{ArrTraits::CompareXy_2} -\ccRefines{Functor} +\ccRefines{AdaptableBinaryFunction} \ccHasModels\ccc{ArrangementBasicTraits_2::Compare_xy_2} @@ -239,7 +199,7 @@ Represents a planar (weakly) $x$-monotone curve. % =========================== \ccRefPageBegin \begin{ccRefConcept}{ArrTraits::ConstructMinVertex_2} -\ccRefines{Functor} +\ccRefines{AdaptableUnaryFunction} \ccHasModels\ccc{ArrangementBasicTraits_2::Construct_min_vertex_2} @@ -253,7 +213,7 @@ Represents a planar (weakly) $x$-monotone curve. % =========================== \ccRefPageBegin \begin{ccRefConcept}{ArrTraits::ConstructMaxVertex_2} -\ccRefines{Functor} +\ccRefines{AdaptableUnaryFunction} \ccHasModels\ccc{ArrangementBasicTraits_2::Construct_max_vertex_2} @@ -267,7 +227,7 @@ Represents a planar (weakly) $x$-monotone curve. % =================== \ccRefPageBegin \begin{ccRefConcept}{ArrTraits::IsVertical_2} -\ccRefines{Functor} +\ccRefines{AdaptableUnaryFunction} \ccHasModels\ccc{ArrangementBasicTraits_2::Is_vertical_2} @@ -281,7 +241,7 @@ Represents a planar (weakly) $x$-monotone curve. % ==================== \ccRefPageBegin \begin{ccRefConcept}{ArrTraits::CompareYAtX_2} -\ccRefines{Functor} +\ccRefines{AdaptableBinaryFunction} \ccHasModels\ccc{ArrangementBasicTraits_2::Compare_y_at_x_2} @@ -298,7 +258,7 @@ Represents a planar (weakly) $x$-monotone curve. % ======================== \ccRefPageBegin \begin{ccRefConcept}{ArrTraits::CompareYAtXLeft_2} -\ccRefines{Functor} +\ccRefines{AdaptableTernaryFunction} \ccHasModels\ccc{ArrangementBasicTraits_2::Compare_y_at_x_left_2} @@ -319,7 +279,7 @@ Represents a planar (weakly) $x$-monotone curve. % ========================= \ccRefPageBegin \begin{ccRefConcept}{ArrTraits::CompareYAtXRight_2} -\ccRefines{Functor} +\ccRefines{AdaptableTernaryFunction} \ccHasModels\ccc{ArrangementBasicTraits_2::Compare_y_at_x_right_2} @@ -340,7 +300,7 @@ Represents a planar (weakly) $x$-monotone curve. % ============== \ccRefPageBegin \begin{ccRefConcept}{ArrTraits::Equal_2} -\ccRefines{Functor} +\ccRefines{AdaptableBinaryFunction} \ccHasModels\ccc{ArrangementBasicTraits_2::Equal_2} @@ -355,91 +315,3 @@ Represents a planar (weakly) $x$-monotone curve. geometrically equivalent (have the same graph).} \end{ccRefConcept} \ccRefPageEnd - -%%%%%%%% ParameterSpaceInX_2 -% ========================== -\ccRefPageBegin -\begin{ccRefConcept}{ArrTraits::ParameterSpaceInX_2} -\ccRefines{Functor} - -\ccHasModels\ccc{ArrangementBasicTraits_2::Parameter_space_in_x_2} - -\ccCreationVariable{fo} -\ccMethod{Arr_parameter_space operator()(ArrTraits::X_monotone_curve_2 xc, - Arr_curve_end ce);} - {determines the placement of the $x$-coordinate of the minimal end or - maximal end of \ccc{xc} in the parameter space, that is, - \ccc{ARR_LEFT_BOUNDARY}, \ccc{ARR_INTERIOR}, or \ccc{ARR_RIGHT_BOUNDARY}.} -\end{ccRefConcept} -\ccRefPageEnd - -%%%%%%%% ParameterSpaceInY_2 -% ========================== -\ccRefPageBegin -\begin{ccRefConcept}{ArrTraits::ParameterSpaceInY_2} -\ccRefines{Functor} - -\ccHasModels\ccc{ArrangementBasicTraits_2::Parameter_space_in_y_2} - -\ccCreationVariable{fo} -\ccMethod{Arr_parameter_space operator()(ArrTraits::X_monotone_curve_2 xc, - Arr_curve_end ce);} - {determines the placement of the $y$-coordinate of the minimal end or - maximal end of \ccc{xc} in the parameter space, that is, - \ccc{ARR_BOTTOM_BOUNDARY}, \ccc{ARR_INTERIOR}, or \ccc{ARR_TOP_BOUNDARY}.} -\end{ccRefConcept} -\ccRefPageEnd - -%%%%%%%% CompareXNearBoundary_2 -% ============================= -\ccRefPageBegin -\begin{ccRefConcept}{ArrTraits::CompareXNearBoundary_2} -\ccRefines\ccc{ArrTraits::CompareX_2} - -\ccHasModels\ccc{ArrangementBasicTraits_2::Compare_x_near_boundary_2} - -\ccCreationVariable{fo} -\ccMethod{Comparison_result operator()(ArrTraits::Point_2 p, - ArrTraits::X_monotone_curve_2 xc, - Arr_curve_end ce);} - {returns \ccc{SMALLER}, \ccc{EQUAL}, or \ccc{LARGER} according - to the $x$-ordering of a vertical line passing through the point - \ccc{p} and an unbounded end of the curve \ccc{xc}. The relevant end - is the minimal end, if \ccc{ce} is \ccc{MIN_END} and the maximal - end if \ccc{ce} is \ccc{MAX_END}. - \ccPrecond{the curve end has a bounded $x$-coordinate and an - unbounded $y$-coordinate. Namely \ccc{xc} is vertical or has a - vertical asymptote.}} -\ccGlue -\ccMethod{Comparison_result operator()(ArrTraits::X_monotone_curve_2 xc1, - Arr_curve_end ce1, - ArrTraits::X_monotone_curve_2 xc2, - Arr_curve_end ce2);} - {returns \ccc{SMALLER}, \ccc{EQUAL}, or \ccc{LARGER} - according to the $x$-ordering of the unbounded curve ends of - \ccc{xc1} and \ccc{xc2}. - \ccPrecond{the curve ends have a bounded $x$-coordinate and an - unbounded $y$-coordinate. Namely each of \ccc{xc1} and \ccc{xc2} is - vertical or has a vertical asymptote.}} -\end{ccRefConcept} -\ccRefPageEnd - -%%%%%%%% CompareYNearBoundary_2 -% ============================= -\ccRefPageBegin -\begin{ccRefConcept}{ArrTraits::CompareYNearBoundary_2} -\ccRefines\ccc{CompareYAtX_2} - -\ccHasModels\ccc{ArrangementBasicTraits_2::Compare_y_near_boundary_2} - -\ccCreationVariable{fo} -\ccMethod{Comparison_result operator()(ArrTraits::X_monotone_curve_2 xc1, - ArrTraits::X_monotone_curve_2 xc2, - Arr_curve_end ce);} - {returns \ccc{SMALLER, EQUAL} or \ccc{LARGER} according to the - $y$-ordering of the two curves \ccc{xc1} and \ccc{xc2} at $x = -\infty$ - (if \ccc{ce} is \ccc{MIN_END}) or at $x = \infty$ (if \ccc{ce} is - \ccc{MAX_END}), with the precondition that both curves have unbounded - minimal (or maximal) ends that lie at $x = \pm\infty$.} -\end{ccRefConcept} -\ccRefPageEnd 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 95697e33b4d..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 @@ -29,80 +29,25 @@ and segments to have rational coordinates. The nested \ccc{Point_2} type defined by the traits class is therefore {\em different} than the \ccc{Kernel::Point_2} type. Its coordinates are -of type \ccc{CoordNT}, and represent real numbers obtained from solving -quadratic equations with rational coordinates. A number of type -\ccc{CoordNT} can therefore be expressed as $\alpha + \beta\sqrt{\gamma}$, -where $\alpha$, $\beta$ and $\gamma$ are all rational numbers. -The definition of the curve and $x$-monotone curve types nested in the -traits class are detailed below. +of type \ccc{CoordNT}, which an instantiation of +\ccc{CGAL::Sqrt_extension} where \ccc{NT = ROOT = Kernel::FT}. +Moreover, the third and fourth (hidden) template parameters of +\ccc{CGAL::Sqrt_extension} are set to \ccc{CGAL::Tag_true}, which +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} - -\subsection*{Class -Arr\_circle\_segment\_traits\_2$<$Kernel$>$::CoordNT} -%============================================================================== - -The \ccc{CoordNT} number-type nested within the traits class represents -an algebraic number of degree 2; it can be represented as -$\alpha + \beta\sqrt{\gamma}$, where $\alpha$, $\beta$ and $\gamma$ are -all rational numbers of type \ccc{Kernel::FT}. - -\begin{ccClass}{Arr_circle_segment_traits_2::CoordNT} - -\ccTypes -%------- - -\ccNestedType{Rational}{the \ccc{Kernel::FT} type.} - -\ccCreation -\ccCreationVariable{x} -%--------------------- - -\ccConstructor{CoordNT ();} - {creates a variable whose value is $0$.} - -\ccConstructor{CoordNT (const Rational& alpha);} - {creates a variable whose value is the rational number $\alpha$.} - -\ccConstructor{CoordNT (const Rational& alpha, - const Rational& beta, - const Rational& gamma);} - {creates a variable whose value is the algebraic number - $\alpha + \beta\sqrt{\gamma}$.} - -\ccAccessFunctions -%----------------- - -\ccMethod{bool is_rational () const;} - {determines whether \ccVar\ is rational.} - -\ccMethod{Rational alpha () const;} - {returns $\alpha$.} -\ccGlue -\ccMethod{Rational beta () const;} - {returns $\beta$ (0 if \ccVar\ is rational).} -\ccGlue -\ccMethod{Rational gamma () const;} - {returns $\gamma$ (0 if \ccVar\ is rational).} - -\ccHeading{Operators} -%-------------------- - -The \ccc{CoordNT} number-type supports all arithmetic operations with -rational numbers of type \ccc{Kernel::FT}. For example, it is possible to -compute \ccc{x + q}, \ccc{q - x}, \ccc{x += q}, etc. where \ccc{q} is rational. - -The global functions \ccc{CGAL::sign(x)}, \ccc{CGAL::square(x)}, -\ccc{CGAL::to_double(x)} and \ccc{CGAL::compare(x,y)}, where \ccc{x} and -\ccc{y} are of type \ccc{CoordNT}, are also supported. - -It is also possible to call \ccc{CGAL::to_double(x)} to convert \ccc{x} to -a rational number, with the precondition that it is indeed rational. - -\end{ccClass} + \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 ed14e1ccaa1..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 @@ -12,7 +12,7 @@ \ccDefinition %============ -The class \ccRefName\ is a model of the \ccc{ArrangementTraits_2} concept +The class \ccRefName{} is a model of the \ccc{ArrangementTraits_2} concept and can be used to construct and maintain arrangements of bounded segments of algebraic curves of degree $2$ at most, also known as {\sl conic curves}. @@ -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_curve_end.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_curve_end.tex index 6a5c9bdb814..7ce721d103d 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_curve_end.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_curve_end.tex @@ -1,10 +1,17 @@ \begin{ccRefEnum}{Arr_curve_end} -\ccInclude{CGAL/Arr_enums.h} + \ccDefinition + The enumeration \ccRefName{} is used to indicate one of the two ends + of an $x$-monotone curve. It is used by models of the + \ccc{ArrangementOpenBoundaryTraits_2} concept. + + \ccInclude{CGAL/Arr_enums.h} -\ccGlobalEnum{enum Arr_curve_end { ARR_MIN_END, ARR_MAX_END }; } -\ccRefLabel{ARR_MIN_END} -\ccRefLabel{ARR_MAX_END} -\ccHtmlCrossLink{ARR_MIN_END} -\ccHtmlCrossLink{ARR_MAX_END} + \ccGlobalEnum{enum Arr_curve_end { ARR_MIN_END, ARR_MAX_END }; } + \ccRefLabel{ARR_MIN_END} + \ccRefLabel{ARR_MAX_END} + \ccHtmlCrossLink{ARR_MIN_END} + \ccHtmlCrossLink{ARR_MAX_END} + \ccSeeAlso + \ccc{ArrangementOpenBoundaryTraits_2} \end{ccRefEnum} diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_halfedge_direction.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_halfedge_direction.tex index be263ed0fa4..cfd70f1e9d6 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_halfedge_direction.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_halfedge_direction.tex @@ -1,13 +1,19 @@ \begin{ccRefEnum}{Arr_halfedge_direction} -\ccInclude{CGAL/Arr_enums.h} + \ccDefinition + The enumeration \ccRefName{} is defined by + \ccc{CGAL::Arrangement_2::Halfedge} to specify + the direction of the halfedge. -\ccGlobalEnum{ -enum Arr_halfedge_direction { ARR_LEFT_TO_RIGHT = -1, - ARR_RIGHT_TO_LEFT = 1 }; } + \ccInclude{CGAL/Arr_enums.h} -\ccRefLabel{ARR_LEFT_TO_RIGHT} -\ccRefLabel{ARR_RIGHT_TO_LEFT} -\ccHtmlCrossLink{ARR_LEFT_TO_RIGHT} -\ccHtmlCrossLink{ARR_RIGHT_TO_LEFT} + \ccGlobalEnum{ + enum Arr_halfedge_direction { ARR_LEFT_TO_RIGHT, ARR_RIGHT_TO_LEFT }; } + \ccRefLabel{ARR_LEFT_TO_RIGHT} + \ccRefLabel{ARR_RIGHT_TO_LEFT} + \ccHtmlCrossLink{ARR_LEFT_TO_RIGHT} + \ccHtmlCrossLink{ARR_RIGHT_TO_LEFT} + + \ccSeeAlso + \ccc{CGAL::Arrangement_2::Halfedge} \end{ccRefEnum} diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_non_caching_segment_basic_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_non_caching_segment_basic_traits.tex index 465c889e8fe..036edd11dbe 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_non_caching_segment_basic_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_non_caching_segment_basic_traits.tex @@ -12,7 +12,7 @@ \ccDefinition -The traits class \ccRefName\ is a model of the \ccc{ArrangementTraits_2} +The traits class \ccRefName{} is a model of the \ccc{ArrangementTraits_2} concept that allow the construction and maintenance of arrangements of sets of pairwise interior-disjoint line segments. It is templated with a \cgal-Kernel model, and it is derived from it. This traits class is a 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_oblivious_side_tag.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_oblivious_side_tag.tex index 3b6232b2616..db7c14bdc93 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_oblivious_side_tag.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_oblivious_side_tag.tex @@ -13,18 +13,17 @@ \ccDefinition %============ -\ccRefName{} is an empty construct used for dispatching functions based on -type of curves that induce the arrangement. If all curves are expected not -to approach the left, right, bottom, or top sides of the boundary of the -parameter space, the categories \ccc{Arr_left_side_category}, -\ccc{Arr_right_side_category}, \ccc{Arr_bottom_side_category}, and -\ccc{Arr_top_side_category}, nested in any model of the -\ccc{ArrangementBasicTraits_2}, must be defined as \ccRefName{}, respectively. +The categories \ccc{Left_side_category}, \ccc{Right_side_category}, +\ccc{Bottom_side_category}, and \ccc{Top_side_category}, +nested in any model of the \ccc{ArrangementBasicTraits_2}, must be +convertible to \ccRefName. \ccRefName{} is an empty construct used +for dispatching functions based on type of curves that induce the +arrangement. \ccInclude{CGAL/Arr_tags.h} \ccSeeAlso - \ccc{Arr_open_side_tag}\lcTex{(\ccRefPage{Arr_open_side_tag})}\\ + \ccc{Arr_open_side_tag}\lcTex{(\ccRefPage{CGAL::Arr_open_side_tag})}\\ \ccc{ArrangementBasicTraits_2}\lcTex{(\ccRefPage{ArrangementBasicTraits_2})} \end{ccRefClass} diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_open_boundary_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_open_boundary_traits.tex new file mode 100644 index 00000000000..dda781e6dfa --- /dev/null +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_open_boundary_traits.tex @@ -0,0 +1,366 @@ +% Reference manual page: ArrangementTraits.tex +% Package: Arrangement_2 + +\ccRefPageBegin +\begin{ccRefConcept}{ArrangementOpenBoundaryTraits_2} + +\ccDefinition +% =========== +Several predicates are required to handle $x$-monotone curves that +approach infinity and thus approach the boundary of the parameter +space. These predicates are sufficient to handle not only curves +embedded in an unbounded parameter space, but also curves embedded +in a bounded parameter space with open boundaries. Models of the +concept \ccRefName{} handle curves that approach the boundary of a +parameter space. This concept refines the concept +\ccc{ArrangementBasicTraits_2}. The arrangement template +instantiated with a traits class that models this concept can handle +$x$-monotone curves that are unbounded in any direction. The concept +\ccRefName{}, nontheless, also supports planar $x$-monotone curves +that reach the boundary of an open yet bounded parameter space. + +An $x$-monotone curve may be \emph{closed}, in which case its endpoints +are representable as \ccc{Point_2} objects, or \emph{open} at the +boundary of the parameter space. It can have one open end and one +closed end (e.g., a ray). The nature of the $x$-monotone curves, +whether they are expected to be closed or not at any one of the four +boundary-sides, is conveyed through the definition of the four nested +types \ccc{Left_side_category}, \ccc{Right_side_category}, +\ccc{Bottom_side_category}, and \ccc{Top_side_category}. If some curves +handled by a model of the concept \ccRefName{} are expected to be open +on the left, the nested type \ccc{Left_side_category} must be convertible +to \ccc{Arr_open_side_tag}. Similarly, if some curves handled by the +concept are expected to be open on the right, open at the bottom, or +open at the top, the corresponding nested type must be convertible to +\ccc{Arr_open_side_tag}. A model of the concept \ccRefName{} must have +all the four categories convertible to +\ccc{Arr_open_side_tag}.\footnote{We intend to introduce more concepts +that require only a subset of the categories to be convertible to +\ccc{Arr_open_side_tag}.} In this case the \dcel{} of the arrangement +instantiated with the model is initialized with an implicit bounding +rectangle. When the parameter space is bounded, it is the exact +geometric embedding of the implicit bounding rectangle. + +%% An arrangement that supports unbounded $x$-monotone curves maintains +%% an implicit bounding rectangle embedded in the \dcel{} structure. + +\ccRefines +\ccc{ArrangementBasicTraits_2} + +%% \ccTypes +%% % ====== +%% \ccNestedType{Curve_2}{models the concept \ccc{ArrTraits::Curve_2}.} + +\ccHeading{Categories} +% ============== +\ccNestedType{Left_side_category} + {Must be convertible to either \ccc{Arr_oblivious_side_tag} or + \ccc{Arr_open_side_tag}.} +\ccNestedType{Bottom_side_category} + {Must be convertible to either \ccc{Arr_oblivious_side_tag} or + \ccc{Arr_open_side_tag}.} +\ccNestedType{Top_side_category} + {Must be convertible to either \ccc{Arr_oblivious_side_tag} or + \ccc{Arr_open_side_tag}.} +\ccNestedType{Right_side_category} + {Must be convertible to either \ccc{Arr_oblivious_side_tag} or + \ccc{Arr_open_side_tag}.} + +\ccHeading{Functor Types} +% ======================= +\ccThree{Parameter_space_in_x_2}{}{\hspace*{14cm}} +\ccThreeToTwo +\ccNestedType{Parameter_space_in_x_2}% + {models the concept \ccc{ArrTraits::ParameterSpaceInX_2}. + Required only if the traits class supports unbounded curves that + approach the left or the right sides (the \ccc{Left_side_category} + or the \ccc{Right_side_category} categories are convertible to + \ccc{Arr_open_side_tag}).} + +\ccThree{Compare_y_near_boundary_2}{}{\hspace*{14cm}} +\ccThreeToTwo +\ccNestedType{Compare_y_near_boundary_2}% + {models the concept \ccc{ArrTraits::CompareYNearBoundary_2}. + Required only if the traits class supports unbounded curves that + approach the left or the right sides (the \ccc{Left_side_category} + or the \ccc{Right_side_category} categories are convertible to + \ccc{Arr_open_side_tag}).} + +\ccThree{Parameter_space_in_y_2}{}{\hspace*{14cm}} +\ccThreeToTwo +\ccNestedType{Parameter_space_in_y_2}% + {models the concept \ccc{ArrTraits::ParameterSpaceInY_2}. + Required only if the traits class supports unbounded curves that + approach the bottom or the top sides (the \ccc{Bottom_side_category} + or the \ccc{Top_side_category} categories are convertible to + \ccc{Arr_open_side_tag}).} + +\ccThree{Compare_x_at_limit_2}{}{\hspace*{14cm}} +\ccThreeToTwo +\ccNestedType{Compare_x_at_limit_2}% + {models the concept \ccc{ArrTraits::CompareXAtLimit_2}. + Required only if the traits class supports unbounded curves that + approach the bottom or the top sides (the \ccc{Bottom_side_category} + or the \ccc{Top_side_category} categories are convertible to + \ccc{Arr_open_side_tag}).} + +\ccThree{Compare_x_near_limit_2}{}{\hspace*{14cm}} +\ccThreeToTwo +\ccNestedType{Compare_x_near_limit_2}% + {models the concept \ccc{ArrTraits::CompareXNearLimit_2}. + Required only if the traits class supports unbounded curves that + approach the bottom or the top sides (the \ccc{Bottom_side_category} + or the \ccc{Top_side_category} categories are convertible to + \ccc{Arr_open_side_tag}).} + +\ccCreationVariable{traits} +% \ccCreation +% =========== + +\ccHeading{Accessing Functor Objects} +% =================================== +\ccMethod{Parameter_space_in_x_2 parameter_space_in_x_2_object() const;} {} +\ccMethod{Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const;} {} +\ccMethod{Parameter_space_in_y_2 parameter_space_in_y_2_object() const;} {} +\ccMethod{Compare_x_at_limit_2 compare_x_at_limit_2_object() const;} {} +\ccMethod{Compare_x_near_limit_2 compare_x_near_limit_2_object() const;} {} + +\ccHasModels +% ========== +\ccc{CGAL::Arr_linear_traits_2}\\ +\ccc{CGAL::Arr_rational_function_traits_2}\\ +\ccc{CGAL::Arr_algebraic_segment_traits_2}\\ +\ccc{CGAL::Arr_curve_data_traits_2}\\ +\ccc{CGAL::Arr_consolidated_curve_data_traits_2} + +\ccSeeAlso +% ======== +\ccc{ArrangementBasicTraits_2}\lcTex{ + (\ccRefPage{ArrangementBasicTraits_2})}\\ +\ccc{ArrangementXMonotoneTraits_2}\lcTex{ + (\ccRefPage{ArrangementXMonotoneTraits_2})}\\ +\ccc{ArrangementLandmarkTraits_2}\lcTex{ + (\ccRefPage{ArrangementLandmarkTraits_2})}\\ +\ccc{ArrangementTraits_2}\lcTex{ + (\ccRefPage{ArrangementTraits_2})} + +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% Functors %%%%%%%% +% ======================== + +%%%%%%%% ParameterSpaceInX_2 +% ========================== +\ccRefPageBegin +\begin{ccRefConcept}{ArrTraits::ParameterSpaceInX_2} +\ccRefines{AdaptableBinaryFunction} + +\ccHasModels\ccc{ArrangementOpenBoundaryTraits_2::Parameter_space_in_x_2} + +\ccCreationVariable{fo} + +\ccMethod{Arr_parameter_space operator()(const ArrTraits::X_monotone_curve_2& xcv, + Arr_curve_end ce);}{% + + Given an $x$-monotone curve \ccc{xcv} and an enumeration \ccc{ce} + that specifies either the minimum or the maximum end of the curve, + determines the location of the curve end along the $x$-dimension. + The variable \ccc{xcv} identifies the parametric curve + $C(t) = (X(t),Y(t))$ defined over an open or half-open interval with + endpoints~$0$ and~$1$. The enumeration \ccc{ce} identifies an open + end $d \in \{0,1\}$ of $C$. Formally, determines whether + $\lim_{t \rightarrow d} X(t)$ evaluates to $b_l$, $b_r$, or a value + in between, where $b_l$ and $b_r$ are the $x$-coordinates of the + left and right boundaries of the parameter space, respectively. + Returns \ccc{ARR_LEFT_BOUNDARY}, \ccc{ARR_RIGHT_BOUNDARY}, or + \ccc{ARR_INTERIOR}, accordingly. + \ccPrecond{If \ccc{ArrTraits::Left_side_category} is not convertible to + \ccc{Arr_open_side_tag} then \ccc{ce} $\neq$ \ccc{ARR_MIN_END}.} + \ccPrecond{If \ccc{ArrTraits::Right_side_category} is not convertible to + \ccc{Arr_open_side_tag} then \ccc{ce} $\neq$ \ccc{ARR_MAX_END}.} + \ccPostcond{If \ccc{ce} = \ccc{ARR_MIN_END} then the result is either + \ccc{ARR_LEFT_BOUNDARY} or \ccc{ARR_INTERIOR}.} + \ccPostcond{If \ccc{ce} = \ccc{ARR_MAX_END} then the result is either + \ccc{ARR_RIGHT_BOUNDARY} or \ccc{ARR_INTERIOR}.}} +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% CompareYNearBoundary_2 +% ============================= +\ccRefPageBegin +\begin{ccRefConcept}{ArrTraits::CompareYNearBoundary_2} + +\ccRefines{AdaptableTernaryFunction} + +\ccHasModels\ccc{ArrangementOpenBoundaryTraits_2::Compare_y_near_boundary_2} + +\ccCreationVariable{fo} + +\ccMethod{Comparison_result operator()(const ArrTraits::X_monotone_curve_2& xcv1, + const ArrTraits::X_monotone_curve_2& xcv2, + Arr_curve_end ce);}{% + Given two $x$-monotone curves \ccc{xcv1} and \ccc{xcv2} and an + enumeration \ccc{ce} that specifies either the minimum or the maximum + ends of the curves, compares the $y$-coordinate of the curves near + their respective ends. Returns \ccc{SMALLER}, \ccc{EQUAL}, or + \ccc{LARGER} accordingly. More precisely, compares the + $y$-coordinates of the vertical projection of a point $p$ onto + \ccc{xcv1} and \ccc{xcv2}. If \ccc{ce} is \ccc{ARR_MIN_END}, the + predicate \ccc{Parameter_space_in_x_2} evaluates to + \ccc{ARR_LEFT_BOUNDARY} when applied to \ccc{xcv1} and \ccc{ce} and + when applied to \ccc{xcv2} and \ccc{ce}. In this case $p$ is + located far to the left, such that the result is invariant under + a translation of $p$ farther to the left. If \ccc{ce} is + \ccc{ARR_MAX_END}, the predicate \ccc{Parameter_space_in_x_2} + evaluates to \ccc{ARR_RIGHT_BOUNDARY} when applied to \ccc{xcv1} and + \ccc{ce} and when applied to \ccc{xcv2} and \ccc{ce}. In that case + $p$ is located far to the right in a similar manner. + \ccPrecond{If \ccc{ArrTraits::Left_side_category} is not convertible to + \ccc{Arr_open_side_tag} then \ccc{ce} $\neq$ \ccc{ARR_MIN_END}.} + \ccPrecond{If \ccc{ArrTraits::Right_side_category} is not convertible to + \ccc{Arr_open_side_tag} then \ccc{ce} $\neq$ \ccc{ARR_MAX_END}.} + \ccPrecond{% + \ccc{parameter_space_in_x_2}(\ccc{xcv2}, \ccc{ce}) = + \ccc{parameter_space_in_x_2}(\ccc{xcv1}, \ccc{ce}).} + \ccPrecond{\ccc{parameter_space_in_x_2}(\ccc{xcv1}, \ccc{ce}) $\neq$ + \ccc{ARR_INTERIOR}.} + \ccPrecond{If \ccc{parameter_space_in_x_2}(\ccc{xcv1}, \ccc{ce}) = + \ccc{ARR_LEFT_BOUNDARY} then \ccc{ce} = \ccc{ARR_MIN_END}.} + \ccPrecond{If \ccc{parameter_space_in_x_2}(\ccc{xcv1}, \ccc{ce}) = + \ccc{ARR_RIGHT_BOUNDARY} then \ccc{ce} = \ccc{ARR_MAX_END}.}} +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% ParameterSpaceInY_2 +% ========================== +\ccRefPageBegin +\begin{ccRefConcept}{ArrTraits::ParameterSpaceInY_2} +\ccRefines{AdaptableBinaryFunction} + +\ccHasModels\ccc{ArrangementOpenBoundaryTraits_2::Parameter_space_in_y_2} + +\ccCreationVariable{fo} + +\ccMethod{Arr_parameter_space operator()(const ArrTraits::X_monotone_curve_2& xcv, + Arr_curve_end ce);}{% + Given an $x$-monotone curve \ccc{xcv} and an enumeration \ccc{ce} + that specifies either the minimum or the maximum end of the curve, + determines the location of the curve end along the $y$-dimension. + The variable \ccc{xcv} identifies the parametric curve + $C(t) = (X(t),Y(t))$ defined over an open or half-open interval with + endpoints~$0$ and~$1$. The enumeration \ccc{ce} identifies an open + end $d \in \{0,1\}$ of $C$. Formally, determines whether + $\lim_{t \rightarrow d} Y(t)$ evaluates to $b_b$, $b_t$, or a value + in between, where $b_b$ and $b_t$ are the $y$-coordinates of the + bottom and top boundaries of the parameter space, respectively. + Returns \ccc{ARR_BOTTOM_BOUNDARY}, \ccc{ARR_TOP_BOUNDARY}, or + \ccc{ARR_INTERIOR}, accordingly. + \ccPostcond{If \ccc{ArrTraits::Bottom_side_category} is not convertible to + \ccc{Arr_open_side_tag} then the result is not \ccc{ARR_BOTTOM_BOUNDARY}.} + \ccPostcond{If \ccc{ArrTraits::Top_side_category} is not convertible to + \ccc{Arr_open_side_tag} then the result is not \ccc{ARR_TOP_BOUNDARY}.}} +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% CompareXAtLimit_2 +% ================================ +\ccRefPageBegin +\begin{ccRefConcept}{ArrTraits::CompareXAtLimit_2} +\ccRefines{AdaptableFunctor} + +\ccHasModels\ccc{ArrangementOpenBoundaryTraits_2::Compare_x_at_limit_2} + +\ccCreationVariable{fo} + +\ccMethod{Comparison_result operator()(const ArrTraits::Point_2& p, + const ArrTraits::X_monotone_curve_2& xcv, + Arr_curve_end ce);}{% + Given a point \ccc{p}, an $x$-monotone curve \ccc{xcv}, and an + enumeration \ccc{ce} that specifies either the minimum or the + maximum end of the curve where the curve has a vertical asymptote, + compares the $x$-coordinate of \ccc{p} and the $x$-coordinate of the + limit of the curve at its specificed end. The variable \ccc{xcv} + identifies the parametric curve $C(t) = (X(t),Y(t))$ defined over an + open or half-open interval with endpoints~$0$ and~$1$. The + enumeration \ccc{ce} identifies an open end $d \in \{0,1\}$ of $C$. + Formally, compares the $x$-coordinate of \ccc{p} and + $\lim_{t \rightarrow d} X(t)$. Returns \ccc{SMALLER}, \ccc{EQUAL}, or + \ccc{LARGER} accordingly. + \ccPrecond{\ccc{parameter_space_in_y_2}(\ccc{xcv}, \ccc{ce}) $\neq$ + \ccc{ARR_INTERIOR}.} + \ccPrecond{If the parameter space is unbounded, $C$ has a vertical + asymptote at its $d$-end; that is, + \ccc{parameter_space_in_x_2}(\ccc{xcv}, \ccc{ce}) = \ccc{ARR_INTERIOR}.}} +% +\ccMethod{Comparison_result operator()(const ArrTraits::X_monotone_curve_2& xcv1, + Arr_curve_end ce1, + const ArrTraits::X_monotone_curve_2& xcv2, + Arr_curve_end ce2);}{% + Given two $x$-monotone curves \ccc{xcv1} and \ccc{xcv2} and two + indices \ccc{ce1} and \ccc{ce2} that specify either the minimum + or the maximum ends of \ccc{xcv1} and \ccc{xcv2}, respectively, + where the curves have vertical asymptotes, compares the + $x$-coordinates of the limits of the curves at their specificed + ends. The variables \ccc{xcv1} and \ccc{xcv2} identify the + parametric curves $C_1(t) = (X_1(t),Y_1(t))$ and + $C_2(t) = (X_2(t),Y_2(t))$, respectively, defined over open or + half-open intervals with endpoints~$0$ and~$1$. The indices + \ccc{ce1} and \ccc{ce2} identify open ends $d_1 \in \{0,1\}$ and + $d_2 \in \{0,1\}$ of $C_1$ and $C_2$, respectively. Formally, + compares $\lim_{t \rightarrow d_1} X_1(t)$ and + $\lim_{t \rightarrow d_2} X_2(t)$. Returns \ccc{SMALLER}, \ccc{EQUAL}, + or \ccc{LARGER} accordingly. + \ccPrecond{% + \ccc{parameter_space_in_y_2}(\ccc{xcv1}, \ccc{ce1}) $\neq$ + \ccc{ARR_INTERIOR}.} + \ccPrecond{% + \ccc{parameter_space_in_y_2}(\ccc{xcv2}, \ccc{ce2}) $\neq$ + \ccc{ARR_INTERIOR}.} + \ccPrecond{If the parameter space is unbounded, $C_1$ has a vertical + asymptote at its respective end; that is,\\ + \ccc{parameter_space_in_x_2}(\ccc{xcv1}, \ccc{ce1}) = + \ccc{ARR_INTERIOR}.} + \ccPrecond{If the parameter space is unbounded, $C_2$ has a vertical + asymptote at its respective end; that is,\\ + \ccc{parameter_space_in_x_2}(\ccc{xcv2}, \ccc{ce2}) = + \ccc{ARR_INTERIOR}.}} +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% CompareXNearLimit_2 +% ============================= +\ccRefPageBegin +\begin{ccRefConcept}{ArrTraits::CompareXNearLimit_2} +\ccRefines{AdaptableTernaryFunction} + +\ccHasModels\ccc{ArrangementOpenBoundaryTraits_2::Compare_x_near_limit_2} + +\ccCreationVariable{fo} + +\ccMethod{Comparison_result operator()(const ArrTraits::X_monotone_curve_2& xcv1, + const ArrTraits::X_monotone_curve_2& xcv2, + Arr_curve_end ce);}{% + Given two $x$-monotone curves \ccc{xcv1} and \ccc{xcv2} and an + enumeration \ccc{ce} that specifies either the minimum ends or the + maximum ends of the curves where the curves have a vertical + asymptote, compares the $x$-coordinate of the curves near their + respective ends. Returns \ccc{SMALLER}, \ccc{EQUAL}, or \ccc{LARGER} + accordingly. More precisely, compares the $x$-coordinates of the + horizontal projection of a point $p$ onto \ccc{xcv1} and \ccc{xcv2}. + If \ccc{xcv1} and \ccc{xcv2} approach the bottom boundary-side, $p$ + is located far to the bottom, such that the result is invariant + under a translation of $p$ farther to the bottom. If \ccc{xcv1} + and \ccc{xcv2} approach the top boundary-side, $p$ is located far + to the top in a similar manner. + \ccPrecond{The $x$-coordinates of the limits of the curves at their + respective ends are equal. That is,\\ + \ccc{compare_x_at_limit_2}(\ccc{xcv1}, \ccc{xcv2}, \ccc{ce}) = + \ccc{EQUAL}.} + \ccPrecond{% + \ccc{parameter_space_in_y_2}(\ccc{xcv1}, \ccc{ce}) = + \ccc{parameter_space_in_y_2}(\ccc{xcv2}, \ccc{ce}).} + \ccPrecond{\ccc{parameter_space_in_y_2}(\ccc{xcv1}, \ccc{ce}) $\neq$ + \ccc{ARR_INTERIOR}.}} +\end{ccRefConcept} +\ccRefPageEnd diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_open_side_tag.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_open_side_tag.tex index 18482493cd2..f0846cec200 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_open_side_tag.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_open_side_tag.tex @@ -13,20 +13,23 @@ \ccDefinition %============ -\ccRefName{} is an empty construct used for dispatching functions based on -type of curves that induce the arrangement. If some curves are expected to -approach the left, right, bottom, or top sides of the boundary of the -parameter space, the categories \ccc{Arr_left_side_category}, -\ccc{Arr_right_side_category}, \ccc{Arr_bottom_side_category}, and -\ccc{Arr_top_side_category}, nested in any model of the -\ccc{ArrangementBasicTraits_2}, must be defined as \ccRefName{}, respectively. +All the four types \ccc{Left_side_category}, +\ccc{Right_side_category}, \ccc{Bottom_side_category}, +and \ccc{Top_side_category} nested in any model of the +concept \ccc{ArrangementOpenBoundaryTraits} must be convertible +to \ccRefName, which derives from \ccc{Arr_oblivious_side_tag}. It +implies that some curves are expected to approach the left, right, +bottom, or top sides of the open boundary of the parameter +space. \ccRefName{} is an empty construct used for dispatching +functions based on type of curves that induce the arrangement. \ccInclude{CGAL/Arr_tags.h} \ccSeeAlso - \ccc{Arr_oblivious_side_tag}\lcTex{(\ccRefPage{Arr_oblivious_side_tag})}\\ - \ccc{ArrangementBasicTraits_2}\lcTex{(\ccRefPage{ArrangementBasicTraits_2})} - + \ccc{Arr_oblivious_side_tag}\lcTex{(\ccRefPage{CGAL::Arr_oblivious_side_tag})}\\ + \ccc{ArrangementOpenBoundaryTraits_2}% + \lcTex{(\ccRefPage{ArrangementOpenBoundaryTraits_2})} + \end{ccRefClass} \ccRefPageEnd diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_rational_arc_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_rational_arc_traits.tex deleted file mode 100644 index f640674d7de..00000000000 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_rational_arc_traits.tex +++ /dev/null @@ -1,232 +0,0 @@ -% +------------------------------------------------------------------------+ -% | Reference manual page: Arr_rational_arc_traits.tex -% +------------------------------------------------------------------------+ -% | -% | Package: Arrangement_2 -% | -% +------------------------------------------------------------------------+ - -\ccRefPageBegin -\begin{ccRefClass}{Arr_rational_arc_traits_2} - -\ccDefinition -%============ - -The traits class \ccRefName\ is a model of the \ccc{ArrangementTraits_2} -concept. It handles bounded or unbounded segments of rational functions, -referred to as {\sl rational arcs} (in particular, a rational arc may -correspond to the entire graph of a rational function), and enables the -construction and maintenance of arrangements of such arcs. Rational -functions, and polynomial functions in particular, are not only interesting -in their own right, they are also very useful for approximating or -interpolating more complicated curves. - -A rational function $y = \frac{P(x)}{Q(x)}$ -is defined by two polynomials $P$ and $Q$ of arbitrary degrees. In -particular, if $Q(x) = 1$ then the function is a simple polynomial -function. A bounded rational arc is defined by the graph of a rational -function over some internal $[x_{\rm min}, x_{\rm max}]$, where $Q$ -does not have any real roots in this interval (thus the arc does not -contain any poles). However, our traits class is also capable of -representing functions defined over an unbounded $x$-range, namely -a ``ray'' defined on $(-\infty, x_{\rm max}]$ or on $[x_{\rm min}, \infty)$, -or an entire function defined for all real $x$ values. Note that a -rational arc is unbounded even if it is defined over some bounded interval, -yet $Q$ has zeros in this interval. - -In our representation, all polynomial coefficients (the coefficients of $P$ -and $Q$) must be rational numbers. This guarantees that the -$x$-coordinates of all arrangement vertices (in particular, those -representing intersection points) can be represented as roots of -polynomials with integer coefficients --- namely, algebraic numbers. -The $y$-coordinates can be obtained by simple arithmetic operations on -the $x$-coordinates, hence they are also algebraic numbers. - -We therefore require separate representations of the curve coefficients and -the point coordinates. The \ccc{NtTraits} should be instantiated with a class -that defines nested \ccc{Integer}, \ccc{Rational} and \ccc{Algebraic} number -types and supports various operations on them, yielding certified computation -results (for example, in can convert rational numbers to algebraic numbers -and can compute roots of polynomials with integer coefficients). -The \ccc{AlgKernel} template-parameter should be a geometric kernel templated -with the \ccc{NtTraits::Algebraic} number-type. It is recommended to -instantiate the \ccc{CORE_algebraic_number_traits} class as the \ccc{NtTraits} -parameter, with \ccc{Cartesian} instantiating the kernel. -The number types in this case are provided by the {\sc core} library, with its -ability to exactly represent simple algebraic numbers. - -The traits class defined its point type to be \ccc{AlgKernel::Point_2}, -and defines a curve type (and an identical $x$-monotone curve type, as -a rational arc is always $x$-monotone by definition) as detailed below. - -\ccInclude{CGAL/Arr_rational_arc_traits_2.h} - -\ccIsModel - \ccc{ArrangementTraits_2} - -\subsection*{Class - Arr\_rational\_arc\_traits\_2$<$AlgKernel,NtTraits$>$::Curve\_2} -%======================================================================== - -The \ccc{Curve_2} class nested within the rational-arc traits is used -to represent rational arcs and support their construction from a -single polynomial and an $x$-definition range or from a pair of polynomials -and an $x$-definition range. The copy and default constructor as well as the -assignment operator are provided for rational arcs. In addition, an -\ccc{operator<<} for the arcs is defined for standard output streams. - -\begin{ccClass}{Arr_rational_arc_traits_2::Curve_2} -%====================================================================== - -\ccTypes -%------- - -\ccNestedType{Rat_vector}{A vector of rational numbers (equivalent to - \ccc{std::vector} +\ccCreationVariable{traits} + +\ccDefinition +%============ + +The traits class \ccRefName{} is a model of the \ccc{ArrangementTraits_2} +concept. It handles bounded and unbounded arcs of rational functions, +referred to as {\sl rational arcs} (in particular, such an arc may +correspond to the entire graph of a rational function), and enables the +construction and maintenance of arrangements of such arcs. +%Rational functions, and polynomial functions in particular, are not only +%interesting in their own right, they are also very useful for approximating or +%interpolating more complex curves. + +A rational function $y = \frac{P(x)}{Q(x)}$ is defined by two polynomials +$P$ and $Q$ of arbitrary degrees. +If $Q(x) = 1$ then the function is a simple polynomial function. +Usually the domain is $\R$ but the function may also be +restricted to a bounded interval $[x_{\rm min}, x_{\rm max}]$ +or defined over a ray $(-\infty, x_{\rm max}]$ or over $[x_{\rm min}, \infty)$. +Rational functions are represented by the nested type \ccc{Curve_2}. +Note that a rational function may be not continuous since roots of $Q$ induce +vertical asymptotes, which would contradict the notion of an $x$-monotone curve +as it is introduced by the \ccc{ArrangementTraits_2} concept. +Thus, continuous portions of rational functions are represented by the nested +type \ccc{X_monotone_curve_2}, which is different from \ccc{Curve_2}. +Constructors for both classes are provided by the traits. +A \ccc{Curve_2} may be split up into several \ccc{X_monotone_curve_2} +using \ccc{Make_x_monotone_2}. + +%If $Q(x) = 1$ then the function is a simple polynomial +%function. A bounded rational arc is defined by the graph of a rational +%function over some internal $[x_{\rm min}, x_{\rm max}]$, where $Q$ +%does not have any real roots in this interval (thus the arc does not +%contain any vertical asymptotes). Our traits class is also capable of +%representing functions defined over an unbounded $x$-range, namely +%a ``ray'' defined over $(-\infty, x_{\rm max}]$ or over $[x_{\rm min}, \infty)$, +%or a function defined over the entire real $x$-range. Note that a +%rational arc may be unbounded even if it is defined over some bounded interval. +%In these cases $Q$ has zeros in this interval. That is, the user is able to construct +%rational arcs of type \ccc{Curve_2}, which may contain vertical asymptotes. +%These may be split up further into \ccc{X_monotone_curve_2} using +%\ccc{Make_x_monotone_2}. + +The template parameter of the traits must be a model of the +concept \ccc{AlgebraicKernel_d_1}. +A rational function is then represented by two polynomials $P$ and $Q$ of type +\ccc{AlgebraicKernel_d_1::Polynomial_1}. +A point is represented by a rational function and its $x$-coordinate, which is +of type \ccc{AlgebraicKernel_d_1::Algebraic_real_1}. +Note that an explicit representation of the $y$-coordinate is only computed upon +request, which can be a rather costly operation. + + +The constructed rational functions are cached by the traits class. +The cache is local to each traits class object. +It is therefore necessary to construct the curves using the constructor +objects provided by member functions of the traits class. +%This is also the reason why IO is not handled via the usual stream operators. +Moreover, a curve must only be used with its own traits. +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 + \ccc{ArrangementTraits_2}\\ +% \ccc{ArrangementLandmarkTraits_2}\\ %% not a model of this concept since construction of segment is not easy + \ccc{ArrangementDirectionalXMonotoneTraits_2}\\ + \ccc{ArrangementOpenBoundaryTraits_2} + +\ccTypes +\ccThree{}{xxxxxxxxxxxxxxxxxxxxxx}{x} +\ccTypedef{typedef AlgebraicKernel_d_1 Algebraic_kernel_d_1;}{}\ccGlue +\ccTypedef{typedef AlgebraicKernel_d_1::Coefficient Coefficient;}{}\ccGlue +\ccTypedef{typedef AlgebraicKernel_d_1::Polynomial_1 Polynomial_1;}{}\ccGlue +\ccTypedef{typedef AlgebraicKernel_d_1::Algebraic_real_1 Algebraic_real_1;}{}\ccGlue +\ccTypedef{typedef AlgebraicKernel_d_1::Bound Bound;}{} + +%\ccTypedef{typedef AlgebraicKernel_d_1::Bound Approximate_number_type;}{}\ccGlue +%\ccNestedType{Approximate_2}{ +%A model of \ccc{ArrangementLandmarkTraits_2::Approximate_2}}\ccGlue +%\ccMethod{Approximate_2 approximate_2_object() const;}{Returns an instance of \ccc{Construct_curve_2}.} + +\ccCreation +% ========= +\ccConstructor{Arr_rational_function_traits_2(const Algebraic_kernel_d_1* kernel);} + {constructs an empty traits that uses the kernel pointed by \ccc{kernel} + for performing algebraic operations.} + +\ccOperations +% =========== +\ccThree{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}{xxxxxxx}{} +\ccMethod{Construct_curve_2 construct_curve_2_object() const;} + {Returns an instance of \ccc{Construct_curve_2}.}\ccGlue +%\ccMethod{Curve_importer_2 curve_importer_2_object() const;}{Returns an instance of \ccc{Curve_importer_2}.}\ccGlue +%\ccMethod{Curve_exporter_2 curve_exporter_2_object() const;}{Returns an instance of \ccc{Curve_exporter_2}.}\ccGlue +\ccMethod{Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const;} + {Returns an instance of \ccc{Construct_x_monotone_curve_2}.}\ccGlue +%\ccMethod{X_monotone_curve_importer_2 x_monotone_curve_importer_2_object() const;}{Returns an instance of \ccc{X_monotone_curve_importer_2}.}\ccGlue +%\ccMethod{X_monotone_curve_exporter_2 x_monotone_curve_exporter_2_object() const;}{Returns an instance of \ccc{X_monotone_curve_exporter_2}.}\ccGlue + +\ccMethod{void cleanup_cache() const;} + {Deletes all curves from the cache that exist only there.} +\ccMethod{const Algebraic_kernel_d_1* algebraic_kernel_d_1() const;} + {Returns a pointer to the used algerbaic kernel object.} + +\subsection*{Class Arr\_rational\_function\_traits\_2$<$AlgebraicKernel\_d\_1$>$::Curve\_2} +\begin{ccClass}{Arr_rational_function_traits_2::Curve_2} +\ccCreationVariable{curve} + +The \ccc{Curve_2} class nested within the traits is used +to represent rational functions which may be restricted to a certain x-range. + +\ccIsModel + +\ccc{ArrTraits::Curve_2} + +\ccTypes \ccThree{}{xxxxxxxxxxxxxxxxxxxxxx}{x} +\ccTypedef{typedef AlgebraicKernel_d_1::Polynomial_1 Polynomial_1;}{}\ccGlue +\ccTypedef{typedef AlgebraicKernel_d_1::Algebraic_real_1 Algebraic_real_1;}{} + +\ccOperations +\ccThree{xxxxxxxxxxxxxxxxxxxx}{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}{} +\ccTwo {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}{} + + +\ccMethod{const Polynomial_1& numerator () const;} + {returns the numerator of the supporting rational function.} + +\ccMethod{const Polynomial_1& denominator () const;} + {returns the denominator of the supporting rational function.} + +\ccMethod{bool is_continuous() const;} + {returns whether \ccVar\ is continuous, namely whether it does not + contains any vertical asymptotes in its interior.} + +\ccMethod{Arr_parameter_space left_parameter_space_in_x () const;} + {returns whether the $x$-coordinate of \ccVar's left end is finite or + whether it is $\pm\infty$.} +\ccGlue +\ccMethod{Arr_parameter_space right_parameter_space_in_x () const;} + {returns whether the $x$-coordinate of \ccVar's right end is finite or + whether it is $\pm\infty$.} +\ccGlue +\ccMethod{Algebraic_real_1 left_x() const;} + {returns the $x$-coordinate of the left end. + \ccPrecond{left\_boundary\_in\_x()==ARR\_INTERIOR}} +\ccGlue +\ccMethod{Algebraic_real_1 right_x() const;} + {returns the $x$-coordinate of the right end. + \ccPrecond{right\_boundary\_in\_x()==ARR\_INTERIOR}} +\end{ccClass} + +\subsection*{Class Arr\_rational\_function\_traits\_2$<$AlgebraicKernel\_d\_1$>$::X\_monotone\_curve\_2} + +The \ccc{X_monotone_curve_2} class nested within the traits is used +to represent $x$-monotone parts of rational functions. In particular, such an $x$-monotone curve +may not contain a vertical asymptote in its interior $x$-range. + +\begin{ccClass}{Arr_rational_function_traits_2::X_monotone_curve_2} +\ccCreationVariable{xcurve} + +\ccIsModel +\ccc{ArrTraits::XMonotoneCurve_2} + +\ccTypes \ccThree{}{xxxxxxxxxxxxxxxxxxxxxx}{x} +\ccTypedef{typedef AlgebraicKernel_d_1::Polynomial_1 Polynomial_1;}{}\ccGlue +\ccTypedef{typedef AlgebraicKernel_d_1::Algebraic_real_1 Algebraic_real_1;}{}\ccGlue +\ccTypedef{typedef Arr_rational_function_traits_2::Point_2 Point_2;}{} + +\ccOperations +\ccThree{xxxxxxxxxxxxxxxxxxxx}{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}{} +\ccTwo {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}{} + + +\ccMethod{const Polynomial_1& numerator () const;} + {returns the numerator of the supporting rational function.} + +\ccMethod{const Polynomial_1& denominator () const;} + {returns the denominator of the supporting rational function.} + + +% ======== source +\ccMethod{Arr_parameter_space source_parameter_space_in_x () const;} + {returns whether the $x$-coordinate of the source is finite or + whether it is $\pm\infty$.} +\ccGlue +\ccMethod{Arr_parameter_space source_parameter_space_in_y () const;} + {returns whether the $y$-coordinate of the source is finite or + whether it is $\pm\infty$.} +\ccGlue +\ccMethod{const Point_2& source() const;} + {returns the source point of the arc. + \ccPrecond{Both the $x$- and $y$-coordinates of the source point is + finite.}} +\ccGlue +\ccMethod{Algebraic_real_1 source_x() const;} + {returns the $x$-coordinate of the source point. + \ccPrecond{The $x$-coordinate of the source point is finite.}} +%\ccGlue +%\ccMethod{Algebraic_real_1 source_y() const;} +% {returns the $y$-coordinate of the source point. +% \ccPrecond{The $y$-coordinate of the source point is finite.}} + + +% ======== target +\ccMethod{Arr_parameter_space target_parameter_space_in_x () const;} + {returns whether the $x$-coordinate of the target is finite or + whether it is $\pm\infty$.} +\ccGlue +\ccMethod{Arr_parameter_space target_parameter_space_in_y () const;} + {returns whether the $y$-coordinate of the target is finite or + whether it is $\pm\infty$.} +\ccGlue +\ccMethod{const Point_2& target() const;} + {returns the target point of the arc. + \ccPrecond{Both the $x$- and $y$-coordinates of the target point is + finite.}} +\ccGlue +\ccMethod{Algebraic_real_1 target_x() const;} + {returns the $x$-coordinate of the target point. + \ccPrecond{The $x$-coordinate of the target point is finite.}} +%\ccGlue +%\ccMethod{Algebraic_real_1 target_y() const;} +% {returns the $y$-coordinate of the target point. +% \ccPrecond{The $y$-coordinate of the target point is finite.}} + + +% ======== left +\ccMethod{Arr_parameter_space left_parameter_space_in_x () const;} + {returns whether the $x$-coordinate of the left curve end is finite or + whether it is $\pm\infty$.} +\ccGlue +\ccMethod{Arr_parameter_space left_parameter_space_in_y () const;} + {returns whether the $y$-coordinate of the left curve end is finite or + whether it is $\pm\infty$.} +\ccGlue +\ccMethod{const Point_2& left() const;} + {returns the left point of the arc. + \ccPrecond{Both the $x$- and $y$-coordinates of the left point is finite.}} +\ccGlue +\ccMethod{Algebraic_real_1 left_x() const;} + {returns the $x$-coordinate of the left point. + \ccPrecond{The $x$-coordinate of the left point is finite.}} +%\ccGlue +%\ccMethod{Algebraic_real_1 left_y() const;} +% {returns the $y$-coordinate of the left point. +% \ccPrecond{The $y$-coordinate of the left point is finite.}} + + +% ======== right +\ccMethod{Arr_parameter_space right_parameter_space_in_x () const;} + {returns whether the $x$-coordinate of the right curve end is finite or + whether it is $\pm\infty$.} +\ccGlue +\ccMethod{Arr_parameter_space right_parameter_space_in_y () const;} + {returns whether the $y$-coordinate of the right curve end is finite or + whether it is $\pm\infty$.} +\ccGlue +\ccMethod{const Point_2& right() const;} + {returns the right point of the arc. + \ccPrecond{Both the $x$- and $y$-coordinates of The right point is + finite.}} +\ccGlue +\ccMethod{Algebraic_real_1 right_x() const;} + {returns the $x$-coordinate of the right point. + \ccPrecond{The $x$-coordinate of the right point is finite.}} +%\ccGlue +%\ccMethod{Algebraic_real_1 right_y() const;} +% {returns the $y$-coordinate of the right point. +% \ccPrecond{The right point is finite in $y$.}} + +\ccMethod{bool is_left_to_right () const;} + {returns whether the curve is oriented from left to right.} +\end{ccClass} + +\subsection*{Class Arr\_rational\_function\_traits\_2$<$AlgebraicKernel\_d\_1$>$::Point\_2} +\begin{ccClass}{Arr_rational_function_traits_2::Point_2} +\ccCreationVariable{point} + +\ccIsModel +\ccc{ArrTraits::Point_2} + +\ccTypes \ccThree{}{xxxxxxxxxxxxxxxxxxxxxx}{x} +\ccTypedef{typedef AlgebraicKernel_d_1::Polynomial_1 Polynomial_1;}{}\ccGlue +\ccTypedef{typedef AlgebraicKernel_d_1::Algebraic_real_1 Algebraic_real_1;}{}\ccGlue +\ccTypedef{typedef AlgebraicKernel_d_1::Bound Bound;}{} + +\ccOperations +\ccThree{xxxxxxxxxxxxxxxxxxxxxxxxx}{xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}{} +\ccTwo {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}{} + +\ccMethod{Polynomial_1 numerator () const;} + {returns the numerator of the supporting rational function.} + +\ccMethod{Polynomial_1 denominator () const;} + {returns the denominator of the supporting rational function.} + +\ccMethod{std::pair to_double() const;} + {returns double-approximations of the x- and y-coordinates.} + +\ccMethod{Algebraic_real_1 x() const;} + {returns the $x$-coordinate of the point.} +\ccThree{xxxxxxxxxxxxxxxxxxxxxxxx}{xxxxx}{} + +\ccMethod{Algebraic_real_1 y() const;} + {obtains the y-coordinates of the point. {\bf Attention:} As described above, + points are not stored by their y-coordinate in \ccc{Algebraic_real_1} + representation. In fact, this representation must be computed on demand, and + might become quite costly for points defined by high-degree polynomials. + Therefore, it is recommended to avoid calls to this function as much as + possible.} + +\ccMethod{std::pair approximate_absolute_x(int a) const;} + {Computes a pair $p$ approximating the $x$-coordinate with + respect to the given absolute precision $a$. + \ccPostcond{$p.first \leq x \leq p.second $} + \ccPostcond{$p.second - p.first \leq 2^{-a} $}} + +\ccMethod{std::pair approximate_absolute_y(int a) const;} + {Computes a pair $p$ approximating the $y$-coordinate with + respect to the given absolute precision $a$. + \ccPostcond{$p.first \leq y \leq p.second $} + \ccPostcond{$p.second - p.first \leq 2^{-a} $}} + +\ccMethod{std::pair approximate_relative_x(int r) const;} + {Computes a pair $p$ approximating the $x$-coordinate with + respect to the given relative precision $r$. + \ccPostcond{$p.first \leq x \leq p.second $} + \ccPostcond{$p.second - p.first \leq 2^{-r}|x| $}} + +\ccMethod{std::pair approximate_relative_y(int r) const;} + {Computes a pair $p$ approximating the $y$-coordinate with + respect to the given relative precision $r$. + \ccPostcond{$p.first \leq y \leq p.second $} + \ccPostcond{$p.second - p.first \leq 2^{-r}|y| $}} + +\end{ccClass} +\subsection*{Class Arr\_rational\_function\_traits\_2$<$AlgebraicKernel\_d\_1$>$::Construct\_curve\_2} +\begin{ccClass}{Arr_rational_function_traits_2::Construct_curve_2} +\ccCreationVariable{construct} + +Functor to construct a \ccc{Curve_2}. To enable caching the class is not +default constructible and must be obtained via the function +\ccc{construct_curve_2_object()}, which is a member of the traits. + +\ccIsModel +\ccc{Assignable}\\ +\ccc{CopyConstructible}\\ +\ccc{AdaptableBinaryFunction}\\ +\ccc{AdaptableUnaryFunction} + +\ccTypes \ccThree{}{xxxxxxxxxxxxxxxxxxxxxx}{x} +\ccTypedef{typedef AlgebraicKernel_d_1::Polynomial_1 Polynomial_1;}{}\ccGlue +\ccTypedef{typedef AlgebraicKernel_d_1::Algebraic_real_1 Algebraic_real_1;}{}\ccGlue +\ccTypedef{typedef Arr_rational_function_traits_2::Curve_2 result_type;}{} + +\ccTypedef{typedef Polynomial_1 argument_type;}{}\ccGlue +\ccTypedef{typedef Polynomial_1 first_argument_type;}{}\ccGlue +\ccTypedef{typedef Polynomial_1 second_argument_type;}{} + +\ccOperations +\ccThree{xxxxxxxxxxx}{xxxxx}{} +\ccTwo {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}{} + +% Operators that accept polynomials: +\ccMethod{Curve_2 operator()(Polynomial_1 P) const;} + {Constructs a curve representing the polynomial function $y = P(x)$.}\ccGlue +\ccMethod{Curve_2 operator()(Polynomial_1 P, const Algebraic_real_1& x, bool right) const;} + {Constructs a curve representing the polynomial function $y = P(x)$. + The function is defined over the interval $[x,+\infty)$ if $right$ is true + and $(-\infty,x]$ otherwise.}\ccGlue +\ccMethod{Curve_2 operator()(Polynomial_1 P, const Algebraic_real_1& lower, const Algebraic_real_1& upper) const;} + {Constructs a curve representing the polynomial function $y = P(x)$. + The function is defined over the interval $[lower,upper]$.}\ccGlue +\ccMethod{Curve_2 operator()(Polynomial_1 P, Polynomial_1 Q) const;} + {Constructs a curve representing the rational function $y = P(x)/Q(x)$.}\ccGlue +\ccMethod{Curve_2 operator()(Polynomial_1 P, Polynomial_1 Q, const Algebraic_real_1& x, bool right) const;} + {Constructs a curve representing the rational function $y = P(x)/Q(x)$. + The function is defined over the interval $I=[x,+\infty)$ if $right$ is + true and $I=(-\infty,x]$ otherwise.}\ccGlue +\ccMethod{Curve_2 operator()(Polynomial_1 P, Polynomial_1 Q, const Algebraic_real_1& lower, const Algebraic_real_1& upper) const;} + {Constructs a curve representing the rational function $y = P(x)/Q(x)$. + The function is defined over the interval $I=[lower,upper]$.} + +% Operators that accept polynomial coefficients: +\ccMethod{template +Curve_2 operator()(InputIterator begin, InputIterator end) const;} + {Constructs a curve representing the polynomial function $y = P(x)$, where + the coefficients of $P$ are given in the range \ccc{[begin,end)}.}\ccGlue +\ccMethod{template +Curve_2 operator()(InputIterator begin, InputIterator end, + const Algebraic_real_1& x, bool right) const;} + {Constructs a curve representing the polynomial function $y = P(x)$, where + the coefficients of $P$ are given in the range \ccc{[begin,end)}. The + function is defined over the interval $[x,+\infty)$ if $right$ is true + and $(-\infty,x]$ otherwise.}\ccGlue +\ccMethod{template +Curve_2 operator()(InputIterator begin, InputIterator end, + const Algebraic_real_1& lower, + const Algebraic_real_1& upper) const;} + {Constructs a curve representing the polynomial function $y = P(x)$, where + the coefficients of $P$ are given in the range \ccc{[begin,end)}. The + function is defined over the interval $[lower,upper]$.}\ccGlue +\ccMethod{template +Curve_2 operator()(InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom) const;} + {Constructs a curve representing the rational function $y = P(x)/Q(x)$, + where the coefficients of $P$ and $Q$ are given in the ranges + \ccc{[begin_numer,end_numer)} and \ccc{[begin_denom,end_denom)}, + respectively.}\ccGlue +\ccMethod{template +Curve_2 operator()(InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom, + const Algebraic_real_1& x, bool right) const;} + {Constructs a curve representing the rational function $y = P(x)/Q(x)$, + where the coefficients of $P$ and $Q$ are given in the ranges + \ccc{[begin_numer,end_numer)} and \ccc{[begin_denom,end_denom)}, + respectively. The function is defined over the interval $I=[x,+\infty)$ + if $right$ is true and $I=(-\infty,x]$ otherwise.}\ccGlue +\ccMethod{template +Curve_2 operator()(InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom, + const Algebraic_real_1& lower, + const Algebraic_real_1& upper) const;} + {Constructs a curve representing the rational function $y = P(x)/Q(x)$, + where the coefficients of $P$ and $Q$ are given in the ranges + \ccc{[begin_numer,end_numer)} and \ccc{[begin_denom,end_denom)}, + respectively. The function is defined over the interval $I=[lower,upper]$.} + +\end{ccClass} + +\subsection*{Class Arr\_rational\_function\_traits\_2$<$AlgebraicKernel\_d\_1$>$::Construct\_x\_monotone\_curve\_2} +\begin{ccClass}{Arr_rational_function_traits_2::Construct_x_monotone_curve_2} + +Functor to construct a \ccc{X_monotone_curve_2}. To enable caching the class +is not default constructible and must be obtained via the function +\ccc{construct_x_monotone_curve_2_object()}, which is a member of the traits. + +\ccCreationVariable{construct} +\ccIsModel +\ccc{Assignable}\\ +\ccc{CopyConstructible}\\ +\ccc{AdaptableBinaryFunction}\\ +\ccc{AdaptableUnaryFunction} + +\ccTypes \ccThree{}{xxxxxxxxxxxxxxxxxxxxxx}{x} +\ccTypedef{typedef AlgebraicKernel_d_1::Polynomial_1 Polynomial_1;}{}\ccGlue +\ccTypedef{typedef AlgebraicKernel_d_1::Algebraic_real_1 Algebraic_real_1;}{}\ccGlue +\ccTypedef{typedef Arr_rational_function_traits_2::X_monotone_curve_2 result_type;}{}\ccGlue +\ccTypedef{typedef Polynomial_1 argument_type;}{}\ccGlue +\ccTypedef{typedef Polynomial_1 first_argument_type;}{}\ccGlue +\ccTypedef{typedef Polynomial_1 second_argument_type;}{} + +\ccOperations +\ccThree{xxxxxxxxxxxxxxxxxxxx}{xx}{} +\ccTwo {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}{} + +% Operators that accept polynomials: +\ccMethod{X_monotone_curve_2 operator()(Polynomial_1 P) const;} + {Constructs an $x$-monotone curve supported by the polynomial function + $y = P(x)$.}\ccGlue +\ccMethod{X_monotone_curve_2 operator()(Polynomial_1 P, + const Algebraic_real_1& x, + bool right) const;} + {Constructs an $x$-monotone curve supported by the polynomial function + $y = P(x)$. The function is defined over the interval $[x,+\infty)$ if + $right$ is true and $(-\infty,x]$ otherwise.}\ccGlue +\ccMethod{X_monotone_curve_2 operator()(Polynomial_1 P, + const Algebraic_real_1& lower, + const Algebraic_real_1& upper); const} + {Constructs an $x$-monotone curve supported by the polynomial function + $y = P(x)$. The function is defined over the interval $[lower,upper]$.}\ccGlue +\ccMethod{X_monotone_curve_2 operator()(Polynomial_1 P, Polynomial_1 Q); const} + {Constructs an $x$-monotone curve supported by the rational function + $y = P(x)/Q(x)$. + \ccPrecond{$Q$ has no real roots.}}\ccGlue +\ccMethod{X_monotone_curve_2 operator()(Polynomial_1 P, Polynomial_1 Q, + const Algebraic_real_1& x, + bool right); const} + {Constructs an $x$-monotone curve supported by the rational function + $y = P(x)/Q(x)$. The function is defined over the interval $I=[x,+\infty)$ + if $right$ is true and $I=(-\infty,x]$ otherwise. + \ccPrecond{$Q$ has no real roots in the interior of $I$.}}\ccGlue +\ccMethod{X_monotone_curve_2 operator()(Polynomial_1 P, Polynomial_1 Q, + const Algebraic_real_1& lower, + const Algebraic_real_1& upper); const +} + {Constructs an $x$-monotone curve supported by the rational function + $y = P(x)/Q(x)$. The function is defined over the interval $I=[lower,upper]$. + \ccPrecond{$Q$ has no real roots in the interior of $I$.}} + +% Operators that accept polynomial coefficients: +\ccMethod{template +X_monotone_curve_2 operator()(InputIterator begin, InputIterator end) const;} + {Constructs an $x$-monotone curve supported by the polynomial function + $y = P(x)$, where the coefficients of $P$ are given in the range + \ccc{[begin,end)}.}\ccGlue +\ccMethod{template +X_monotone_curve_2 operator()(InputIterator begin, InputIterator end, + const Algebraic_real_1& x, bool right) const;} + {Constructs an $x$-monotone curve supported by the polynomial function + $y = P(x)$, where the coefficients of $P$ are given in the range + \ccc{[begin,end)}. The function is defined over the interval $[x,+\infty)$ + if $right$ is true and $(-\infty,x]$ otherwise.}\ccGlue +\ccMethod{template +X_monotone_curve_2 operator()(InputIterator begin, InputIterator end + const Algebraic_real_1& lower, + const Algebraic_real_1& upper); const} + {Constructs an $x$-monotone curve supported by the polynomial function + $y = P(x)$, where the coefficients of $P$ are given in the range + \ccc{[begin,end)}. The function is defined over the interval + $[lower,upper]$.}\ccGlue +\ccMethod{template +X_monotone_curve_2 operator()(InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom); const} + {Constructs an $x$-monotone curve supported by the rational function + $y = P(x)/Q(x)$, where the coefficients of $P$ and $Q$ are given in the + ranges \ccc{[begin_numer,end_numer)} and \ccc{[begin_denom,end_denom)}, + respectively. + \ccPrecond{$Q$ has no real roots.}}\ccGlue +\ccMethod{template +X_monotone_curve_2 operator()(InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom, + const Algebraic_real_1& x, bool right); const} + {Constructs an $x$-monotone curve supported by the rational function + $y = P(x)/Q(x)$, where the coefficients of $P$ and $Q$ are given in the + ranges \ccc{[begin_numer,end_numer)} and \ccc{[begin_denom,end_denom)}, + respectively. The function is defined over the interval $I=[x,+\infty)$ + if $right$ is true and $I=(-\infty,x]$ otherwise. + \ccPrecond{$Q$ has no real roots in the interior of $I$.}}\ccGlue +\ccMethod{template +X_monotone_curve_2 operator()(InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom, + const Algebraic_real_1& lower, const Algebraic_real_1& upper); const +} + {Constructs an $x$-monotone curve supported by the rational function + $y = P(x)/Q(x)$, where the coefficients of $P$ and $Q$ are given in the + ranges \ccc{[begin_numer,end_numer)} and \ccc{[begin_denom,end_denom)}, + respectively. The function is defined over the interval $I=[lower,upper]$. + \ccPrecond{$Q$ has no real roots in the interior of $I$.}} + +\end{ccClass} + +%\subsection*{Class Arr\_rational\_function\_traits\_2$<$AlgebraicKernel\_d\_1$>$::Importer} +%\begin{ccClass}{Arr_rational_function_traits_2::Importer} +%\ccCreationVariable{import} + +%Functor to import a \ccc{Curve_2} or \ccc{X_monotone_curve_2} from a stream. +%To enable caching the class is not default constructible and must be obtained +%via the function \ccc{Importer_object()}, which is a member of the traits. + +%\ccIsModel +%\ccc{Assignable}\\ +%\ccc{CopyConstructible} + +%\ccTypes +%\ccThree{}{xxxxxxxxxxxxxxxx}{x} +%\ccTypedef{typedef Arr_rational_function_traits_2::Curve_2 Curve_2;}{}\ccGlue +%\ccTypedef{typedef Arr_rational_function_traits_2::X_monotone_curve_2 X_monotone_curve_2;}{} + +%\ccOperations +%\ccThree{xxxxxxxxxxxxx}{}{xxxxxxxxxxxxxxxxxxxxxxxxxxx} +%\ccMethod{ +% std::istream& operator() ( +% std::istream& is, const Curve_2& curve);} +%{ +% Imports a \ccc{Curve_2} from the given input stream. +%} +%\ccMethod{ +% std::istream& operator() ( +% std::istream& is, const X_monotone_curve_2& curve);} +%{ +% Imports an \ccc{X_monotone_curve_2} from the given input stream. +%} + +%\end{ccClass} + +%\subsection*{Class Arr\_rational\_function\_traits\_2$<$AlgebraicKernel\_d\_1$>$::Exporter} +%\begin{ccClass}{Arr_rational_function_traits_2::Exporter} +%\ccCreationVariable{export} + +%Functor to export a \ccc{Curve_2} or \ccc{X_monotone_curve_2} to a stream. + +%\ccIsModel +%\ccc{Assignable}\\ +%\ccc{CopyConstructible} + +%\ccTypes +%\ccThree{}{xxxxxxxxxxxxxxxx}{x} +%\ccTypedef{typedef Arr_rational_function_traits_2::Curve_2 Curve_2;}{}\ccGlue +%\ccTypedef{typedef Arr_rational_function_traits_2::X_monotone_curve_2 X_monotone_curve_2;}{} + +%\ccOperations +%\ccThree{xxxxxxxxxxxxx}{}{xxxxxxxxxxxxxxxxxxxxxxxxxxx} +%\ccMethod{ +% std::ostream& operator() ( +% std::ostream& os, +% const Curve_2& curve);} +%{ +% Exports a \ccc{Curve_2} +% into the given output stream. +%} + +%\ccMethod{ +% std::ostream& operator() ( +% std::ostream& os, +% const X_monotone_curve_2& curve);} +%{ +% Exports an \ccc{X_monotone_curve_2} +% into the given output stream. +%} +% +%\end{ccClass} + +\end{ccRefClass} +\ccRefPageEnd + + 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} diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_traits.tex index 3cd4b88162a..18a6af1ff54 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_traits.tex @@ -64,7 +64,7 @@ that accept such curves, such as \ccc{intsert()}. \ccc{CGAL::Arr_circular_arc_traits_2}\\ \ccc{CGAL::Arr_circular_line_arc_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}\\ \ccc{CGAL::Arr_curve_data_traits_2}\\ 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 632795e4498..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} % =================================== @@ -84,7 +84,7 @@ the \ccc{Has_merge_category} tag should be defined as \ccc{Tag_true} (and \ccc{CGAL::Arr_circular_arc_traits_2}\\ \ccc{CGAL::Arr_circular_line_arc_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}\\ \ccc{CGAL::Arr_curve_data_traits_2}\\ @@ -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/doc_tex/Arrangement_on_surface_2_ref/intro.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/intro.tex index 5ae61071158..fbdfe854b97 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/intro.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/intro.tex @@ -2,7 +2,7 @@ \RCSdefDate{\ArrangementOnSurfaceRefDate}{$Date$} \ccRefChapter{2D Arrangements\label{chapterArrangement_on_surface_2_ref}} \ccChapterRelease{\ArrangementOnSurfaceRefRev. \ \ArrangementOnSurfaceRefDate} -\ccChapterAuthor{Ron Wein, Efi Fogel, Baruch Zukerman, Dan Halperin, and Eric Berberich} +\ccChapterAuthor{Ron Wein, Efi Fogel, Baruch Zukerman, Dan Halperin, Eric Berberich, and Oren Zalzman} % =============================================================== %\section*{Introduction} @@ -25,7 +25,6 @@ implemented as peripheral classes or as free (global) functions. \subsection*{Enumerations} \ccRefIdfierPage{CGAL::Arr_parameter_space}\\ -\ccRefIdfierPage{CGAL::Arr_boundary_type}\\ \ccRefIdfierPage{CGAL::Arr_curve_end}\\ \ccRefIdfierPage{CGAL::Arr_halfedge_direction} @@ -48,6 +47,7 @@ implemented as peripheral classes or as free (global) functions. \ccRefConceptPage{ArrangementLandmarkTraits_2}\\ \ccRefConceptPage{ArrangementXMonotoneTraits_2}\\ \ccRefConceptPage{ArrangementTraits_2}\\ +\ccRefConceptPage{ArrangementOpenBoundaryTraits_2}\\ ~\\ \ccRefConceptPage{ArrangementInputFormatter}\\ \ccRefConceptPage{ArrangementOutputFormatter} \\ @@ -76,7 +76,8 @@ implemented as peripheral classes or as free (global) functions. \ccRefConceptPage{ArrTraits::Equal_2}\\ \ccRefConceptPage{ArrTraits::ParameterSpaceInX_2}\\ \ccRefConceptPage{ArrTraits::ParameterSpaceInY_2}\\ -\ccRefConceptPage{ArrTraits::CompareXNearBoundary_2}\\ +\ccRefConceptPage{ArrTraits::CompareXAtLimit_2}\\ +\ccRefConceptPage{ArrTraits::CompareXNearLimit_2}\\ \ccRefConceptPage{ArrTraits::CompareYNearBoundary_2}\\ % \ccRefConceptPage{ArrTraits::IsOnXIdentification_2}\\ % \ccRefConceptPage{ArrTraits::IsOnYIdentification_2}\\ @@ -115,7 +116,7 @@ implemented as peripheral classes or as free (global) functions. \ccRefIdfierPage{CGAL::Arr_circular_arc_traits_2}\\ \ccRefIdfierPage{CGAL::Arr_circular_line_arc_traits_2}\\ \ccRefIdfierPage{CGAL::Arr_conic_traits_2}\\ -\ccRefIdfierPage{CGAL::Arr_rational_arc_traits_2}\\ +\ccRefIdfierPage{CGAL::Arr_rational_function_traits_2}\\ \ccRefIdfierPage{CGAL::Arr_Bezier_curve_traits_2}\\ \ccRefIdfierPage{CGAL::Arr_algebraic_segment_traits_2}\\ \ccRefIdfierPage{CGAL::Arr_curve_data_traits_2}\\ @@ -131,6 +132,14 @@ implemented as peripheral classes or as free (global) functions. \ccRefIdfierPage{CGAL::Arr_trapezoid_ric_point_location}\\ \ccRefIdfierPage{CGAL::Arr_landmarks_point_location} +\subsection*{Tags} + +\ccRefIdfierPage{CGAL::Arr_oblivious_side_tag}\\ +\ccRefIdfierPage{CGAL::Arr_open_side_tag} +% \ccRefIdfierPage{CGAL::Arr_closed_side_tag}\\ +% \ccRefIdfierPage{CGAL::Arr_contracted_side_tag}\\ +% \ccRefIdfierPage{CGAL::Arr_identified_side_tag} + \subsection*{Functions} \ccRefIdfierPage{CGAL::is_valid}\\ diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/main.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/main.tex index f9cd1e8124d..5b46db53339 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/main.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/main.tex @@ -43,7 +43,6 @@ \input{Arrangement_on_surface_2_ref/Arr_extended_vertex.tex} \input{Arrangement_on_surface_2_ref/Arr_extended_halfedge.tex} \input{Arrangement_on_surface_2_ref/Arr_extended_face.tex} -\input{Arrangement_on_surface_2_ref/Arr_boundary_type.tex} \input{Arrangement_on_surface_2_ref/Arr_curve_end.tex} \input{Arrangement_on_surface_2_ref/Arr_halfedge_direction.tex} \input{Arrangement_on_surface_2_ref/Arr_basic_traits.tex} @@ -58,7 +57,7 @@ \input{Arrangement_on_surface_2_ref/Arr_circle_segment_traits.tex} \input{Arrangement_on_surface_2_ref/Arr_circular_arc_traits.tex} \input{Arrangement_on_surface_2_ref/Arr_conic_traits.tex} -\input{Arrangement_on_surface_2_ref/Arr_rational_arc_traits.tex} +\input{Arrangement_on_surface_2_ref/Arr_rational_function_traits.tex} \input{Arrangement_on_surface_2_ref/Arr_Bezier_traits.tex} \input{Arrangement_on_surface_2_ref/Arr_algebraic_segment_traits.tex} \input{Arrangement_on_surface_2_ref/Arr_mrg_data_traits.tex} @@ -77,6 +76,7 @@ \input{Arrangement_on_surface_2_ref/arr_locate.tex} \input{Arrangement_on_surface_2_ref/arr_vert_decomp.tex} \input{Arrangement_on_surface_2_ref/Arr_observer.tex} +\input{Arrangement_on_surface_2_ref/Arr_open_boundary_traits.tex} \input{Arrangement_on_surface_2_ref/Arr_with_history_2.tex} \input{Arrangement_on_surface_2_ref/Arr_parameter_space.tex} \input{Arrangement_on_surface_2_ref/arr_with_hist_remove.tex} diff --git a/Arrangement_on_surface_2/doc_tex/Sweep_line_2/PkgDescription.tex b/Arrangement_on_surface_2/doc_tex/Sweep_line_2/PkgDescription.tex index fcb79d656f2..24c01f93a1c 100644 --- a/Arrangement_on_surface_2/doc_tex/Sweep_line_2/PkgDescription.tex +++ b/Arrangement_on_surface_2/doc_tex/Sweep_line_2/PkgDescription.tex @@ -1,5 +1,5 @@ \begin{ccPkgDescription}{2D Intersection of Curves\label{Pkg:IntersectionOfCurves2}} -\ccPkgHowToCiteCgal{cgal:wfz-ic2-11} +\ccPkgHowToCiteCgal{cgal:wfz-ic2-11b} \ccPkgSummary{This package provides three free functions implemented based on the sweep-line paradigm: given a collection of input curves, compute all intersection points, compute the set of subcurves that are diff --git a/Arrangement_on_surface_2/dont_submit b/Arrangement_on_surface_2/dont_submit index ec50ad06712..0f4735f3625 100644 --- a/Arrangement_on_surface_2/dont_submit +++ b/Arrangement_on_surface_2/dont_submit @@ -4,3 +4,4 @@ include/CGAL/Arr_great_circular_arc_on_cylinder_traits_2.h include/CGAL/Arr_polycurve_traits_2.h include/CGAL/Arr_geometry_traits/Polycurve_2.h demo/Arr_algebraic_segment_traits_2 +include/CGAL/Arr_geometry_traits/One_root_number.h diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_arcs.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_arcs.cpp index a14bead73a0..05de4715004 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_arcs.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/circular_arcs.cpp @@ -63,7 +63,7 @@ int main () // (-1/2, sqrt(3)/2) to (1/2, sqrt(3)/2). Note that we orient the // supporting circle accordingly. Kernel::Point_2 c6 = Kernel::Point_2 (0, 0); - CoordNT sqrt_3_div_2 = CoordNT (0, Number_type(1,2), 3); + CoordNT sqrt_3_div_2 = CoordNT (Number_type(0), Number_type(1,2), Number_type(3)); Point_2 s6 = Point_2 (Number_type (-1, 2), sqrt_3_div_2); Point_2 t6 = Point_2 (Number_type (1, 2), sqrt_3_div_2); diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp index 1f0812047f9..f254838bd5b 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/predefined_kernel.cpp @@ -9,11 +9,7 @@ #include #include -// instead of -//typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; -// workaround for VC++ -struct Kernel : public CGAL::Exact_predicates_exact_constructions_kernel {}; - +typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; typedef Kernel::FT Number_type; typedef CGAL::Arr_segment_traits_2 Traits_2; typedef Traits_2::Point_2 Point_2; diff --git a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/rational_functions.cpp b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/rational_functions.cpp index addb05debad..8257f8036d7 100644 --- a/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/rational_functions.cpp +++ b/Arrangement_on_surface_2/examples/Arrangement_on_surface_2/rational_functions.cpp @@ -1,75 +1,80 @@ //! \file examples/Arrangement_2/ex_rational_functions.cpp // Constructing an arrangement of arcs of rational functions. + #include #ifndef CGAL_USE_CORE #include int main () { - std::cout << "Sorry, this example needs CORE ..." << std::endl; - return (0); + std::cout << "Sorry, this example needs CORE ..." << std::endl; + return 0; } + #else -#include -#include -#include -#include +#include // NT +#include // Algebraic Kernel +#include // Traits +#include // Arrangement -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Cartesian Alg_kernel; -typedef CGAL::Arr_rational_arc_traits_2 Traits_2; -typedef Traits_2::Point_2 Point_2; -typedef Traits_2::Curve_2 Rational_arc_2; -typedef Traits_2::Rat_vector Rat_vector; -typedef std::list Rat_arcs_list; -typedef CGAL::Arrangement_2 Arrangement_2; +typedef CORE::BigInt Number_type; +typedef CGAL::Algebraic_kernel_d_1 AK1; +typedef CGAL::Arr_rational_function_traits_2 Traits_2; + +typedef Traits_2::Polynomial_1 Polynomial_1; +typedef Traits_2::Algebraic_real_1 Alg_real_1; + +typedef CGAL::Arrangement_2 Arrangement_2; int main () { + CGAL::set_pretty_mode(std::cout); // for nice printouts. + + // create a polynomial representing x .-) + Polynomial_1 x = CGAL::shift(Polynomial_1(1),1); + + // Traits class object + Traits_2 traits; + Traits_2::Construct_x_monotone_curve_2 construct_arc + = traits.construct_x_monotone_curve_2_object(); + + // container storing all arcs + std::vector arcs; + // Create an arc supported by the polynomial y = x^4 - 6x^2 + 8, // defined over the interval [-2.1, 2.1]: - Rat_vector P1(5); - P1[4] = 1; P1[3] = 0; P1[2] = -6; P1[1] = 0; P1[0] = 8; - - Rational_arc_2 a1 (P1, Algebraic(-2.1), Algebraic(2.1)); + Polynomial_1 P1 = x*x*x*x - 6*x*x + 8; + Alg_real_1 l(Traits_2::Algebraic_kernel_d_1::Bound(-2.1)); + Alg_real_1 r(Traits_2::Algebraic_kernel_d_1::Bound(2.1)); + arcs.push_back(construct_arc(P1, l, r)); // Create an arc supported by the function y = x / (1 + x^2), // defined over the interval [-3, 3]: - Rat_vector P2(2); - P2[1] = 1; P2[0] = 0; - - Rat_vector Q2(3); - Q2[2] = 1; Q2[1] = 0; Q2[0] = 1; - - Rational_arc_2 a2 (P2, Q2, Algebraic(-3), Algebraic(3)); - + Polynomial_1 P2 = x; + Polynomial_1 Q2 = 1+x*x; + + arcs.push_back(construct_arc(P2, Q2, Alg_real_1(-3), Alg_real_1(3))); + // Create an arc supported by the parbola y = 8 - x^2, // defined over the interval [-2, 3]: - Rat_vector P3(5); - P3[2] = -1; P3[1] = 0; P3[0] = 8; - - Rational_arc_2 a3 (P3, Algebraic(-2), Algebraic(3)); - + Polynomial_1 P3 = 8 - x*x; + arcs.push_back(construct_arc(P3, Alg_real_1(-2), Alg_real_1(3))); + // Create an arc supported by the line y = -2x, // defined over the interval [-3, 0]: - Rat_vector P4(2); - P4[1] = -2; P4[0] = 0; - - Rational_arc_2 a4 (P4, Algebraic(-3), Algebraic(0)); - + Polynomial_1 P4 = -2*x; + arcs.push_back(construct_arc(P4, Alg_real_1(-3), Alg_real_1(0))); + // Construct the arrangement of the four arcs. - Arrangement_2 arr; - std::list arcs; - arcs.push_back (a1); - arcs.push_back (a2); - arcs.push_back (a3); - arcs.push_back (a4); - insert (arr, arcs.begin(), arcs.end()); + // Print the arcs. + for (unsigned int i(0); i < arcs.size(); ++i) + std::cout << arcs[i]< + +#ifndef CGAL_USE_CORE +#include +int main () +{ + std::cout << "Sorry, this example needs CORE ..." << std::endl; + return 0; +} + +#else + +#include // Integer +#include // Rational +#include // Algebraic Kernel +#include // Traits +#include // Arrangement + +typedef CORE::BigInt Integer; +typedef CORE::BigRat Rational; +typedef CGAL::Algebraic_kernel_d_1 AK1; +typedef CGAL::Arr_rational_function_traits_2 Traits_2; + +typedef std::vector Rat_vec; +typedef Traits_2::Algebraic_real_1 Alg_real_1; + +typedef CGAL::Arrangement_2 Arrangement_2; + +int main () +{ + CGAL::set_pretty_mode(std::cout); // for nice printouts. + + // Traits class object + Traits_2 traits; + Traits_2::Construct_x_monotone_curve_2 construct_arc + = traits.construct_x_monotone_curve_2_object(); + + // container storing all arcs + std::vector arcs; + + // Create an arc supported by the function y = 0.1x^4 - 0.6x^2 + 0.8 / 0.1, + // defined over the interval [-2.1, 2.1]: + Rat_vec P1,Q1; + P1.push_back(Rational(8,10)); + P1.push_back(Rational(0)); + P1.push_back(Rational(-6,10)); + P1.push_back(Rational(0)); + P1.push_back(Rational(1,10)); + + Q1.push_back(Rational(1,10)); + + Alg_real_1 l(Traits_2::Algebraic_kernel_d_1::Bound(-2.1)); + Alg_real_1 r(Traits_2::Algebraic_kernel_d_1::Bound(2.1)); + arcs.push_back(construct_arc(P1.begin(), P1.end(), Q1.begin(), Q1.end(), l, r)); + + // Create an arc supported by the function y = 0.1x / (0.1 + 0.1x^2), + // defined over the interval [-3, 3]: + Rat_vec P2,Q2; + P2.push_back(Rational(0)); + P2.push_back(Rational(1,10)); + + Q2.push_back(Rational(1,10)); + Q2.push_back(Rational(0)); + Q2.push_back(Rational(1,10)); + + arcs.push_back(construct_arc(P2.begin(), P2.end(), Q2.begin(), Q2.end(), + Alg_real_1(-3), Alg_real_1(3))); + + // Create an arc supported by the parbola y = 0.8 - 0.1x^2 / 0.1, + // defined over the interval [-2, 3]: + Rat_vec P3,Q3; + P3.push_back(Rational(4,5)); + P3.push_back(Rational(0)); + P3.push_back(Rational(-1,10)); + + Q3.push_back(Rational(1,10)); + + arcs.push_back(construct_arc(P3.begin(), P3.end(), Q3.begin(), Q3.end(), + Alg_real_1(-2), Alg_real_1(3))); + + // Create an arc supported by the line y = -0.2x / 0.1, + // defined over the interval [-3, 0]: + Rat_vec P4,Q4; + P4.push_back(Rational(0)); + P4.push_back(Rational(-1,5)); + Q4.push_back(Rational(1,10)); + arcs.push_back(construct_arc(P4.begin(), P4.end(), Q4.begin(), Q4.end(), + Alg_real_1(-3), Alg_real_1(0))); + + // Print the arcs. + for (unsigned int i(0); i < arcs.size(); ++i) + std::cout << arcs[i]< -#include -#include -#include +#include // NT +#include // Algebraic Kernel +#include // Traits +#include // Arrangement -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Cartesian Alg_kernel; -typedef CGAL::Arr_rational_arc_traits_2 Traits_2; -typedef Traits_2::Point_2 Point_2; -typedef Traits_2::Curve_2 Rational_arc_2; -typedef Traits_2::Rat_vector Rat_vector; -typedef std::list Rat_arcs_list; -typedef CGAL::Arrangement_2 Arrangement_2; +typedef CORE::BigInt Number_type; +typedef CGAL::Algebraic_kernel_d_1 AK1; +typedef CGAL::Arr_rational_function_traits_2 Traits_2; + +typedef Traits_2::Polynomial_1 Polynomial_1; +typedef Traits_2::Algebraic_real_1 Alg_real_1; + +typedef CGAL::Arrangement_2 Arrangement_2; int main () { - std::list arcs; + CGAL::set_pretty_mode(std::cout); // for nice printouts. + + // Traits class object + AK1 ak1; + Traits_2 traits(&ak1); + + // constructor for rational functions + Traits_2::Construct_curve_2 construct = traits.construct_curve_2_object(); + + // a polynomial representing x .-) + Polynomial_1 x = CGAL::shift(Polynomial_1(1),1); + + // container storing all arcs + std::vector arcs; + // Create the rational functions (y = 1 / x), and (y = -1 / x). - Rat_vector P1(1); - P1[0] = 1; - - Rat_vector Q1(2); - Q1[1] = 1; Q1[0] = 0; - - arcs.push_back (Rational_arc_2 (P1, Q1)); - - P1[0] = -1; - arcs.push_back (Rational_arc_2 (P1, Q1)); + Polynomial_1 P1(1); + Polynomial_1 minusP1(-P1); + Polynomial_1 Q1 = x; + arcs.push_back(construct(P1, Q1)); + arcs.push_back(construct(minusP1, Q1)); // Create a bounded segments of the parabolas (y = -4*x^2 + 3) and // (y = 4*x^2 - 3), defined over [-sqrt(3)/2, sqrt(3)/2]. - const Algebraic half_sqrt3 = CORE::sqrt(Algebraic(3)) / 2; - Rat_vector P2(3); - P2[2] = -4; P2[1] = 0; P2[0] = 3; + Polynomial_1 P2 = -4*x*x+3; + Polynomial_1 minusP2 = -P2; + std::vector > roots; - arcs.push_back (Rational_arc_2 (P2, -half_sqrt3, half_sqrt3)); - - P2[2] = 4; P2[0] = -3; - arcs.push_back (Rational_arc_2 (P2, -half_sqrt3, half_sqrt3)); + // [-sqrt(3)/2, sqrt(3)/2] + traits.algebraic_kernel_d_1()->solve_1_object()(P2, std::back_inserter(roots)); + arcs.push_back(construct(P2, roots[0].first, roots[1].first)); + arcs.push_back(construct(minusP2, roots[0].first, roots[1].first)); // Create the rational function (y = 1 / 2*x) for x > 0, and the // rational function (y = -1 / 2*x) for x < 0. - Rat_vector P3(1); - P3[0] = 1; - - Rat_vector Q3(2); - Q3[1] = 2; Q3[0] = 0; - - arcs.push_back (Rational_arc_2 (P3, Q3, Algebraic(0), true)); - - P3[0] = -1; - arcs.push_back (Rational_arc_2 (P3, Q3, Algebraic(0), false)); + Polynomial_1 P3(1); + Polynomial_1 minusP3(-P3); + Polynomial_1 Q3 = 2*x; + arcs.push_back(construct(P3, Q3, Alg_real_1(0), true)); + arcs.push_back(construct(minusP3, Q3, Alg_real_1(0), false)); // Construct the arrangement of the six arcs. - Arrangement_2 arr; - - insert (arr, arcs.begin(), arcs.end()); + //Arrangement_2 arr(&traits); + Arrangement_2 arr; + insert(arr, arcs.begin(), arcs.end()); // Print the arrangement size. std::cout << "The arrangement size:" << std::endl - << " V = " << arr.number_of_vertices() - << " (plus " << arr.number_of_vertices_at_infinity() - << " at infinity)" - << ", E = " << arr.number_of_edges() - << ", F = " << arr.number_of_faces() - << " (" << arr.number_of_unbounded_faces() << " unbounded)" - << std::endl << std::endl; + << " V = " << arr.number_of_vertices() + << " (plus " << arr.number_of_vertices_at_infinity() + << " at infinity)" + << ", E = " << arr.number_of_edges() + << ", F = " << arr.number_of_faces() + << " (" << arr.number_of_unbounded_faces() << " unbounded)" + << std::endl << std::endl; return 0; } 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 a3715104974..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -78,10 +78,10 @@ public: typedef Tag_true Has_merge_category; typedef Tag_false Has_do_intersect_category; - typedef Arr_oblivious_side_tag Arr_left_side_category; - typedef Arr_oblivious_side_tag Arr_bottom_side_category; - typedef Arr_oblivious_side_tag Arr_top_side_category; - typedef Arr_oblivious_side_tag Arr_right_side_category; + typedef Arr_oblivious_side_tag Left_side_category; + typedef Arr_oblivious_side_tag Bottom_side_category; + typedef Arr_oblivious_side_tag Top_side_category; + typedef Arr_oblivious_side_tag Right_side_category; // Traits-class types: typedef _Bezier_curve_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_accessor.h b/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h index 067abf457d0..1ab0aa6c5a3 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_accessor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h index 4fbc6378c69..087d007d1b0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 Max-Planck-Institute Saarbruecken (Germany). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or @@ -92,10 +92,10 @@ public: typedef typename CKvA_2::Has_do_intersect_category Has_do_intersect_category; - typedef typename CKvA_2::Arr_left_side_category Arr_left_side_category; - typedef typename CKvA_2::Arr_bottom_side_category Arr_bottom_side_category; - typedef typename CKvA_2::Arr_top_side_category Arr_top_side_category; - typedef typename CKvA_2::Arr_right_side_category Arr_right_side_category; + typedef typename CKvA_2::Left_side_category Left_side_category; + typedef typename CKvA_2::Bottom_side_category Bottom_side_category; + typedef typename CKvA_2::Top_side_category Top_side_category; + typedef typename CKvA_2::Right_side_category Right_side_category; typedef typename CKvA_2::Multiplicity Multiplicity; @@ -119,31 +119,31 @@ public: return CKvA_2::instance().equal_2_object(); } - - - typedef typename CKvA_2::Parameter_space_in_x_2 Parameter_space_in_x_2; - Parameter_space_in_x_2 parameter_space_in_x_2_object() const { - return CKvA_2::instance().parameter_space_in_x_2_object(); - } - typedef typename CKvA_2::Parameter_space_in_y_2 Parameter_space_in_y_2; Parameter_space_in_y_2 parameter_space_in_y_2_object() const { return CKvA_2::instance().parameter_space_in_y_2_object(); } - - typedef typename CKvA_2::Compare_x_near_boundary_2 - Compare_x_near_boundary_2; - Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const { - return CKvA_2::instance().compare_x_near_boundary_2_object(); - } - typedef typename CKvA_2::Compare_y_near_boundary_2 Compare_y_near_boundary_2; Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const { return CKvA_2::instance().compare_y_near_boundary_2_object(); } + typedef typename CKvA_2::Parameter_space_in_x_2 Parameter_space_in_x_2; + Parameter_space_in_x_2 parameter_space_in_x_2_object() const { + return CKvA_2::instance().parameter_space_in_x_2_object(); + } + + typedef typename CKvA_2::Compare_x_at_limit_2 Compare_x_at_limit_2; + Compare_x_at_limit_2 compare_x_at_limit_2_object() const { + return CKvA_2::instance().compare_x_at_limit_2_object(); + } + + typedef typename CKvA_2::Compare_x_near_limit_2 Compare_x_near_limit_2; + Compare_x_near_limit_2 compare_x_near_limit_2_object() const { + return CKvA_2::instance().compare_x_near_limit_2_object(); + } typedef typename CKvA_2::Construct_min_vertex_2 Construct_min_vertex_2; Construct_min_vertex_2 construct_min_vertex_2_object() const { @@ -200,13 +200,7 @@ public: return CKvA_2::instance().merge_2_object(); } - // TODO typedef ArrangementDirectionalXMonotoneTraits_2 functors + - /// check Intersect_2 & Split return order - - - typedef typename CKvA_2::Make_x_monotone_2 Make_x_monotone_2; - - + typedef typename CKvA_2::Make_x_monotone_2 Make_x_monotone_2; Make_x_monotone_2 make_x_monotone_2_object() const { return Make_x_monotone_2(&CKvA_2::instance()); } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h index 7181a14d0b3..95105fa231f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_batched_point_location.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h index 1a0db635c11..b0eb0bcde20 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_bounded_planar_topology_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -75,32 +75,27 @@ public: typedef typename Base::Isolated_vertex Isolated_vertex; //@} - // TODO remove adaptor as top-traits might be instantiated by Aos_2 itself + //! \name Arrangement types + //!@{ + typedef Arr_bounded_planar_topology_traits_2 Self; typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; - - typedef Arr_bounded_planar_topology_traits_2 - Self; + //!@} ///! \name The side tags //@{ - // are inherited from the geometry traits - typedef typename Traits_adaptor_2::Arr_left_side_category - Arr_left_side_category; - typedef typename Traits_adaptor_2::Arr_bottom_side_category - Arr_bottom_side_category; - typedef typename Traits_adaptor_2::Arr_top_side_category - Arr_top_side_category; - typedef typename Traits_adaptor_2::Arr_right_side_category - Arr_right_side_category; + typedef typename Traits_adaptor_2::Left_side_category Left_side_category; + typedef typename Traits_adaptor_2::Bottom_side_category Bottom_side_category; + typedef typename Traits_adaptor_2::Top_side_category Top_side_category; + typedef typename Traits_adaptor_2::Right_side_category Right_side_category; BOOST_MPL_ASSERT - ((boost::is_same< Arr_left_side_category, Arr_oblivious_side_tag >)); + ((boost::is_same< Left_side_category, Arr_oblivious_side_tag >)); BOOST_MPL_ASSERT - ((boost::is_same< Arr_bottom_side_category, Arr_oblivious_side_tag >)); + ((boost::is_same< Bottom_side_category, Arr_oblivious_side_tag >)); BOOST_MPL_ASSERT - ((boost::is_same< Arr_top_side_category, Arr_oblivious_side_tag >)); + ((boost::is_same< Top_side_category, Arr_oblivious_side_tag >)); BOOST_MPL_ASSERT - ((boost::is_same< Arr_right_side_category, Arr_oblivious_side_tag >)); + ((boost::is_same< Right_side_category, Arr_oblivious_side_tag >)); //@} /*! \struct @@ -211,7 +206,7 @@ private: /// \name Auxiliary type definitions. //@{ - typedef Arrangement_on_surface_2 Arr; + typedef Arrangement_on_surface_2 Arr; // Type definition for the constuction sweep-line visitor. typedef Arr_construction_subcurve CSubcurve; 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 0163b8c09bd..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -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,22 +46,22 @@ 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; typedef Tag_true Has_merge_category; typedef Tag_false Has_do_intersect_category; - typedef Arr_oblivious_side_tag Arr_left_side_category; - typedef Arr_oblivious_side_tag Arr_bottom_side_category; - typedef Arr_oblivious_side_tag Arr_top_side_category; - typedef Arr_oblivious_side_tag Arr_right_side_category; + typedef Arr_oblivious_side_tag Left_side_category; + typedef Arr_oblivious_side_tag Bottom_side_category; + typedef Arr_oblivious_side_tag Top_side_category; + typedef Arr_oblivious_side_tag Right_side_category; protected: @@ -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_circular_arc_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circular_arc_traits_2.h index 1a73bba0c26..c530a49919a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_circular_arc_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_circular_arc_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France). +// Copyright (c) 2003,2004,2005,2006,2007,2008,2009,2010,2011 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -109,14 +109,16 @@ public: typedef typename CircularKernel::Circular_arc_point_2 Point; typedef typename CircularKernel::Circular_arc_point_2 Point_2; + typedef unsigned int Multiplicity; + typedef CGAL::Tag_false Has_left_category; typedef CGAL::Tag_false Has_merge_category; typedef CGAL::Tag_false Has_do_intersect_category; - typedef Arr_oblivious_side_tag Arr_left_side_category; - typedef Arr_oblivious_side_tag Arr_bottom_side_category; - typedef Arr_oblivious_side_tag Arr_top_side_category; - typedef Arr_oblivious_side_tag Arr_right_side_category; + typedef Arr_oblivious_side_tag Left_side_category; + typedef Arr_oblivious_side_tag Bottom_side_category; + typedef Arr_oblivious_side_tag Top_side_category; + typedef Arr_oblivious_side_tag Right_side_category; Arr_circular_arc_traits_2(const CircularKernel &k = CircularKernel()) : ck(k) {} diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_circular_line_arc_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circular_line_arc_traits_2.h index 0403278487b..10007c0d5a7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_circular_line_arc_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_circular_line_arc_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France). +// Copyright (c) 2003,2004,2005,2006,2007,2008,2009,2010,2011 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -528,15 +528,17 @@ namespace CGAL { typedef typename CircularKernel::Circular_arc_point_2 Point; typedef typename CircularKernel::Circular_arc_point_2 Point_2; + + typedef unsigned int Multiplicity; typedef CGAL::Tag_false Has_left_category; typedef CGAL::Tag_false Has_merge_category; typedef CGAL::Tag_false Has_do_intersect_category; - typedef Arr_oblivious_side_tag Arr_left_side_category; - typedef Arr_oblivious_side_tag Arr_bottom_side_category; - typedef Arr_oblivious_side_tag Arr_top_side_category; - typedef Arr_oblivious_side_tag Arr_right_side_category; + typedef Arr_oblivious_side_tag Left_side_category; + typedef Arr_oblivious_side_tag Bottom_side_category; + typedef Arr_oblivious_side_tag Top_side_category; + typedef Arr_oblivious_side_tag Right_side_category; typedef internal_Argt_traits::Not_X_Monotone Not_X_Monotone; 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 7a49edcb062..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -73,10 +73,10 @@ public: typedef Tag_true Has_merge_category; typedef Tag_false Has_do_intersect_category; - typedef Arr_oblivious_side_tag Arr_left_side_category; - typedef Arr_oblivious_side_tag Arr_bottom_side_category; - typedef Arr_oblivious_side_tag Arr_top_side_category; - typedef Arr_oblivious_side_tag Arr_right_side_category; + typedef Arr_oblivious_side_tag Left_side_category; + typedef Arr_oblivious_side_tag Bottom_side_category; + typedef Arr_oblivious_side_tag Top_side_category; + typedef Arr_oblivious_side_tag Right_side_category; // Traits objects: typedef _Conic_arc_2 Curve_2; @@ -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_consolidated_curve_data_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_consolidated_curve_data_traits_2.h index c51f6be662c..b49b33056d7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_consolidated_curve_data_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_consolidated_curve_data_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005, 2009 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -82,14 +82,14 @@ public: // Base_traits_2 is Arr_curve_data_traits that already completes // incomplete tags - typedef typename Base_traits_2::Arr_left_side_category - Arr_left_side_category; - typedef typename Base_traits_2::Arr_bottom_side_category - Arr_bottom_side_category; - typedef typename Base_traits_2::Arr_top_side_category - Arr_top_side_category; - typedef typename Base_traits_2::Arr_right_side_category - Arr_right_side_category; + typedef typename Base_traits_2::Left_side_category + Left_side_category; + typedef typename Base_traits_2::Bottom_side_category + Bottom_side_category; + typedef typename Base_traits_2::Top_side_category + Top_side_category; + typedef typename Base_traits_2::Right_side_category + Right_side_category; }; } //namespace CGAL diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h index 2ee3f5dcc4c..36b1078a051 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_counting_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -14,7 +14,8 @@ // $URL$ // $Id$ // -// Author(s) : Efi Fogel +// Author(s): Efi Fogel +// Eric Berberich #ifndef CGAL_ARR_COUNTING_TRAITS_H #define CGAL_ARR_COUNTING_TRAITS_H @@ -31,6 +32,7 @@ #include #include +#include namespace CGAL { @@ -62,19 +64,23 @@ public: PARAMETER_SPACE_IN_X_CURVE_END_OP, PARAMETER_SPACE_IN_X_POINT_OP, PARAMETER_SPACE_IN_X_CURVE_OP, - COMPARE_Y_NEAR_BOUNDARY_OP, - COMPARE_Y_ON_BOUNDARY_OP, IS_ON_X_IDENTIFICATION_POINT_OP, IS_ON_X_IDENTIFICATION_CURVE_OP, + COMPARE_Y_ON_BOUNDARY_OP, + COMPARE_Y_NEAR_BOUNDARY_OP, PARAMETER_SPACE_IN_Y_CURVE_END_OP, PARAMETER_SPACE_IN_Y_POINT_OP, PARAMETER_SPACE_IN_Y_CURVE_OP, - COMPARE_X_NEAR_BOUNDARY_POINT_CURVE_END_OP, - COMPARE_X_NEAR_BOUNDARY_CURVE_ENDS_OP, - COMPARE_X_ON_BOUNDARY_OP, IS_ON_Y_IDENTIFICATION_POINT_OP, IS_ON_Y_IDENTIFICATION_CURVE_OP, + COMPARE_X_AT_LIMIT_POINT_CURVE_END_OP, + COMPARE_X_AT_LIMIT_CURVE_ENDS_OP, + COMPARE_X_NEAR_LIMIT_OP, + COMPARE_X_ON_BOUNDARY_POINTS_OP, + COMPARE_X_ON_BOUNDARY_POINT_CURVE_END_OP, + COMPARE_X_ON_BOUNDARY_CURVE_ENDS_OP, + COMPARE_X_NEAR_BOUNDARY_OP, NUMBER_OF_OPERATIONS }; @@ -90,7 +96,7 @@ public: } /*! Construct copy */ - Arr_counting_traits_2(Arr_counting_traits_2 & other) : Base(other) + Arr_counting_traits_2(Arr_counting_traits_2& other) : Base(other) { clear_counters(); increment(); @@ -162,11 +168,18 @@ public: unsigned int count_parameter_space_in_x_point() const { return m_counters[PARAMETER_SPACE_IN_X_POINT_OP]; } + unsigned int count_is_on_x_identification_point() const + { return m_counters[IS_ON_X_IDENTIFICATION_POINT_OP]; } + + unsigned int count_is_on_x_identification_curve() const + { return m_counters[IS_ON_X_IDENTIFICATION_CURVE_OP]; } + + unsigned int count_compare_y_on_boundary() const + { return m_counters[COMPARE_Y_ON_BOUNDARY_OP]; } + unsigned int count_compare_y_near_boundary() const { return m_counters[COMPARE_Y_NEAR_BOUNDARY_OP]; } - unsigned int count_compare_y_on_boundary() const - { return m_counters[COMPARE_Y_ON_BOUNDARY_OP]; } // bottom-top @@ -179,14 +192,32 @@ public: unsigned int count_parameter_space_in_y_point() const { return m_counters[PARAMETER_SPACE_IN_Y_POINT_OP]; } - unsigned int count_compare_x_near_boundary_point_curve_end() const - { return m_counters[COMPARE_X_NEAR_BOUNDARY_POINT_CURVE_END_OP]; } + unsigned int count_is_on_y_identification_point() const + { return m_counters[IS_ON_Y_IDENTIFICATION_POINT_OP]; } - unsigned int count_compare_x_near_boundary_curve_ends() const - { return m_counters[COMPARE_X_NEAR_BOUNDARY_CURVE_ENDS_OP]; } - - unsigned int count_compare_x_on_boundary() const - { return m_counters[COMPARE_X_ON_BOUNDARY_OP]; } + unsigned int count_is_on_y_identification_curve() const + { return m_counters[IS_ON_Y_IDENTIFICATION_CURVE_OP]; } + + unsigned int count_compare_x_at_limit_point_curve_end() const + { return m_counters[COMPARE_X_AT_LIMIT_POINT_CURVE_END_OP]; } + + unsigned int count_compare_x_at_limit_curve_ends() const + { return m_counters[COMPARE_X_AT_LIMIT_CURVE_ENDS_OP]; } + + unsigned int count_compare_x_near_limit() const + { return m_counters[COMPARE_X_NEAR_LIMIT_OP]; } + + unsigned int count_compare_x_on_boundary_points() const + { return m_counters[COMPARE_X_ON_BOUNDARY_POINTS_OP]; } + + unsigned int count_compare_x_on_boundary_point_curve_end() const + { return m_counters[COMPARE_X_ON_BOUNDARY_POINT_CURVE_END_OP]; } + + unsigned int count_compare_x_on_boundary_curve_ends() const + { return m_counters[COMPARE_X_ON_BOUNDARY_CURVE_ENDS_OP]; } + + unsigned int count_compare_x_near_boundary() const + { return m_counters[COMPARE_X_NEAR_BOUNDARY_OP]; } /// \name Types and functors inherited from the base //@{ @@ -196,14 +227,14 @@ public: typedef typename Base::Has_merge_category Has_merge_category; typedef typename Base::Has_do_intersect_category Has_do_intersect_category; - typedef typename internal::Arr_complete_left_side_tag< Base >::Tag - Arr_left_side_category; - typedef typename internal::Arr_complete_bottom_side_tag< Base >::Tag - Arr_bottom_side_category; - typedef typename internal::Arr_complete_top_side_tag< Base >::Tag - Arr_top_side_category; - typedef typename internal::Arr_complete_right_side_tag< Base >::Tag - Arr_right_side_category; + typedef typename internal::Arr_complete_left_side_category< Base >::Category + Left_side_category; + typedef typename internal::Arr_complete_bottom_side_category< Base >::Category + Bottom_side_category; + typedef typename internal::Arr_complete_top_side_category< Base >::Category + Top_side_category; + typedef typename internal::Arr_complete_right_side_category< Base >::Category + Right_side_category; typedef typename Base::Point_2 Point_2; typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; @@ -213,15 +244,15 @@ public: class Compare_x_2 { private: typename Base::Compare_x_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Compare_x_2(const Base * base, unsigned int & counter) : + Compare_x_2(const Base* base, unsigned int& counter) : m_object(base->compare_x_2_object()), m_counter(counter) {} /*! Operate */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { ++m_counter; return m_object(p1, p2); } }; @@ -229,15 +260,15 @@ public: class Compare_xy_2 { private: typename Base::Compare_xy_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Compare_xy_2(const Base * base, unsigned int & counter) : + Compare_xy_2(const Base* base, unsigned int& counter) : m_object(base->compare_xy_2_object()), m_counter(counter) {} /*! Operate */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { ++m_counter; return m_object(p1, p2); } }; @@ -245,15 +276,15 @@ public: class Construct_min_vertex_2 { private: typename Base::Construct_min_vertex_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Construct_min_vertex_2(const Base * base, unsigned int & counter) : + Construct_min_vertex_2(const Base* base, unsigned int& counter) : m_object(base->construct_min_vertex_2_object()), m_counter(counter) {} /*! Operate */ - const Point_2 operator()(const X_monotone_curve_2 & xc) const + const Point_2 operator()(const X_monotone_curve_2& xc) const { ++m_counter; return m_object(xc); } }; @@ -261,15 +292,15 @@ public: class Construct_max_vertex_2 { private: typename Base::Construct_max_vertex_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Construct_max_vertex_2(const Base * base, unsigned int & counter) : + Construct_max_vertex_2(const Base* base, unsigned int& counter) : m_object(base->construct_max_vertex_2_object()), m_counter(counter) {} /*! Operate */ - const Point_2 operator()(const X_monotone_curve_2 & xc) const + const Point_2 operator()(const X_monotone_curve_2& xc) const { ++m_counter; return m_object(xc); } }; @@ -277,15 +308,15 @@ public: class Is_vertical_2 { private: typename Base::Is_vertical_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Is_vertical_2(const Base * base, unsigned int & counter) : + Is_vertical_2(const Base* base, unsigned int& counter) : m_object(base->is_vertical_2_object()), m_counter(counter) {} /*! Operate */ - bool operator()(const X_monotone_curve_2 & xc) const + bool operator()(const X_monotone_curve_2& xc) const { ++m_counter; return m_object(xc); } }; @@ -295,16 +326,16 @@ public: class Compare_y_at_x_2 { private: typename Base::Compare_y_at_x_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Compare_y_at_x_2(const Base * base, unsigned int & counter) : + Compare_y_at_x_2(const Base* base, unsigned int& counter) : m_object(base->compare_y_at_x_2_object()), m_counter(counter) {} /*! Operate */ - Comparison_result operator()(const Point_2 & p, - const X_monotone_curve_2 & xc) const + Comparison_result operator()(const Point_2& p, + const X_monotone_curve_2& xc) const { ++m_counter; return m_object(p, xc); } }; @@ -314,24 +345,23 @@ public: class Equal_2 { private: typename Base::Equal_2 m_object; - unsigned int & m_counter1; - unsigned int & m_counter2; + unsigned int& m_counter1; + unsigned int& m_counter2; public: /*! Construct */ - Equal_2(const Base * base, - unsigned int & counter1, unsigned int & counter2) : + Equal_2(const Base* base, unsigned int& counter1, unsigned int& counter2) : m_object(base->equal_2_object()), m_counter1(counter1), m_counter2(counter2) {} /*! Operate */ - bool operator()(const X_monotone_curve_2 & xc1, - const X_monotone_curve_2 & xc2) const + bool operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2) const { ++m_counter1; return m_object(xc1, xc2); } /*! Operate */ - bool operator()(const Point_2 & p1, const Point_2 & p2) const + bool operator()(const Point_2& p1, const Point_2& p2) const { ++m_counter2; return m_object(p1, p2); } }; @@ -341,17 +371,17 @@ public: class Compare_y_at_x_left_2 { private: typename Base::Compare_y_at_x_left_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Compare_y_at_x_left_2(const Base * base, unsigned int & counter) : + Compare_y_at_x_left_2(const Base* base, unsigned int& counter) : m_object(base->compare_y_at_x_left_2_object()), m_counter(counter) {} /*! Operate */ - Comparison_result operator()(const X_monotone_curve_2 & xc1, - const X_monotone_curve_2 & xc2, - const Point_2 & p) const + Comparison_result operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2, + const Point_2& p) const { ++m_counter; return m_object(xc1, xc2, p); } }; @@ -361,17 +391,17 @@ public: class Compare_y_at_x_right_2 { private: typename Base::Compare_y_at_x_right_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Compare_y_at_x_right_2(const Base * base, unsigned int & counter) : + Compare_y_at_x_right_2(const Base* base, unsigned int& counter) : m_object(base->compare_y_at_x_right_2_object()), m_counter(counter) {} /*! Operate */ - Comparison_result operator()(const X_monotone_curve_2 & xc1, - const X_monotone_curve_2 & xc2, - const Point_2 & p) const + Comparison_result operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2, + const Point_2& p) const { ++m_counter; return m_object(xc1, xc2, p); } }; @@ -379,16 +409,16 @@ public: class Make_x_monotone_2 { private: typename Base::Make_x_monotone_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Make_x_monotone_2(const Base * base, unsigned int & counter) : + Make_x_monotone_2(const Base* base, unsigned int& counter) : m_object(base->make_x_monotone_2_object()), m_counter(counter) {} /*! Operate */ template - OutputIterator operator()(const Curve_2 & cv, OutputIterator oi) const + OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const { ++m_counter; return m_object(cv, oi); } }; @@ -396,16 +426,16 @@ public: class Split_2 { private: typename Base::Split_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Split_2(const Base * base, unsigned int & counter) : + Split_2(const Base* base, unsigned int& counter) : m_object(base->split_2_object()), m_counter(counter) {} /*! Operate */ - void operator()(const X_monotone_curve_2 & xc, const Point_2 & p, - X_monotone_curve_2 & xc1, X_monotone_curve_2 & xc2) const + void operator()(const X_monotone_curve_2& xc, const Point_2& p, + X_monotone_curve_2& xc1, X_monotone_curve_2& xc2) const { ++m_counter; m_object(xc, p, xc1, xc2); } }; @@ -413,17 +443,17 @@ public: class Intersect_2 { private: typename Base::Intersect_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Intersect_2(const Base * base, unsigned int & counter) : + Intersect_2(const Base* base, unsigned int& counter) : m_object(base->intersect_2_object()), m_counter(counter) {} /*! Operate */ template - OutputIterator operator()(const X_monotone_curve_2 & xc1, - const X_monotone_curve_2 & xc2, + OutputIterator operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2, OutputIterator oi) const { ++m_counter; return m_object(xc1, xc2, oi); } }; @@ -432,16 +462,16 @@ public: class Are_mergeable_2 { private: typename Base::Are_mergeable_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Are_mergeable_2(const Base * base, unsigned int & counter) : + Are_mergeable_2(const Base* base, unsigned int& counter) : m_object(base->are_mergeable_2_object()), m_counter(counter) {} /*! Operate */ - bool operator()(const X_monotone_curve_2 & xc1, - const X_monotone_curve_2 & xc2) const + bool operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2) const { ++m_counter; return m_object(xc1, xc2); } }; @@ -449,17 +479,17 @@ public: class Merge_2 { private: typename Base::Merge_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Merge_2(const Base * base, unsigned int & counter) : + Merge_2(const Base* base, unsigned int& counter) : m_object(base->merge_2_object()), m_counter(counter) {} /*! Operate */ - void operator()(const X_monotone_curve_2 & xc1, - const X_monotone_curve_2 & xc2, - X_monotone_curve_2 & xc) const + void operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2, + X_monotone_curve_2& xc) const { ++m_counter; m_object(xc1, xc2, xc); } }; @@ -467,15 +497,15 @@ public: class Construct_opposite_2 { private: typename Base::Construct_opposite_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Construct_opposite_2(const Base * base, unsigned int & counter) : + Construct_opposite_2(const Base* base, unsigned int& counter) : m_object(base->construct_opposite_2_object()), m_counter(counter) {} /*! Operate */ - X_monotone_curve_2 operator()(const X_monotone_curve_2 & xc) + X_monotone_curve_2 operator()(const X_monotone_curve_2& xc) { ++m_counter; return m_object(xc); } }; @@ -485,15 +515,15 @@ public: class Compare_endpoints_xy_2 { private: typename Base::Compare_endpoints_xy_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Compare_endpoints_xy_2(const Base * base, unsigned int & counter) : + Compare_endpoints_xy_2(const Base* base, unsigned int& counter) : m_object(base->compare_endpoints_xy_2_object()), m_counter(counter) {} /*! Operate */ - Comparison_result operator()(const X_monotone_curve_2 & xc) + Comparison_result operator()(const X_monotone_curve_2& xc) { ++m_counter; return m_object(xc); } }; @@ -505,56 +535,62 @@ public: class Parameter_space_in_x_2 { private: typename Base::Parameter_space_in_x_2 m_object; - unsigned int & m_counter1; - unsigned int & m_counter2; - unsigned int & m_counter3; + unsigned int& m_counter1; + unsigned int& m_counter2; + unsigned int& m_counter3; public: /*! Construct */ - Parameter_space_in_x_2(const Base * base, - unsigned int & counter1, - unsigned int & counter2, - unsigned int & counter3) : + Parameter_space_in_x_2(const Base* base, unsigned int& counter1, + unsigned int& counter2, unsigned int& counter3) : m_object(base->parameter_space_in_x_2_object()), m_counter1(counter1), m_counter2(counter2), m_counter3(counter3) {} /*! Operate */ - Arr_parameter_space operator()(const X_monotone_curve_2 & xc, + Arr_parameter_space operator()(const X_monotone_curve_2& xc, Arr_curve_end ce) const { ++m_counter1; return m_object(xc, ce); } /*! Operate */ - Arr_parameter_space operator()(const Point_2 & p) const + Arr_parameter_space operator()(const Point_2& p) const { ++m_counter2; return m_object(p); } /*! Operate */ - Arr_parameter_space operator()(const X_monotone_curve_2 & xc) const + Arr_parameter_space operator()(const X_monotone_curve_2& xc) const { ++m_counter3; return m_object(xc); } }; - /*! A functor that compares the y-coordinates of curve ends near the - * boundary of the parameter space. + /*! A functor that determines whether a point or a curve lies on an + * identification in x. */ - class Compare_y_near_boundary_2 { + class Is_on_x_identification_2 { private: - typename Base::Compare_y_near_boundary_2 m_object; - unsigned int & m_counter; + typename Base::Is_on_x_identificiation_2 m_object; + unsigned int& m_counter1; + unsigned int& m_counter2; public: /*! Construct */ - Compare_y_near_boundary_2(const Base * base, unsigned int & counter) : - m_object(base->compare_y_near_boundary_2_object()), m_counter(counter) {} + Is_on_x_identification_2(const Base* base, + unsigned int& counter1, unsigned int& counter2) : + m_object(base->is_on_x_identificiation_2_object()), + m_counter1(counter1), + m_counter2(counter2) {} /*! Operate */ - Comparison_result operator()(const X_monotone_curve_2 & xc1, - const X_monotone_curve_2 & xc2, - Arr_curve_end ce) const - { ++m_counter; return m_object(xc1, xc2, ce); } + Arr_parameter_space operator()(const Point_2& p) const + { ++m_counter1; return m_object(p); } + + + /*! Operate */ + Arr_parameter_space operator()(const X_monotone_curve_2& xc) const + { ++m_counter2; return m_object(xc); } + }; /*! A functor that compares the y-coordinate of two given points @@ -563,25 +599,41 @@ public: class Compare_y_on_boundary_2 { private: typename Base::Compare_y_on_boundary_2 m_object; - unsigned int & m_counter; + unsigned int& m_counter; public: /*! Construct */ - Compare_y_on_boundary_2(const Base * base, unsigned int & counter) : + Compare_y_on_boundary_2(const Base* base, unsigned int& counter) : m_object(base->compare_y_on_boundary_2_object()), m_counter(counter) {} /*! Operate */ - Comparison_result operator()(const Point_2 & p1, - const Point_2 & p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { ++m_counter; return m_object(p1, p2); } }; - // TODO Is_on_x_identification_2 - - // bottom-top + /*! A functor that compares the y-coordinates of curve ends near the + * boundary of the parameter space. + */ + class Compare_y_near_boundary_2 { + private: + typename Base::Compare_y_near_boundary_2 m_object; + unsigned int& m_counter; + public: + /*! Construct */ + Compare_y_near_boundary_2(const Base* base, unsigned int& counter) : + m_object(base->compare_y_near_boundary_2_object()), m_counter(counter) {} + + /*! Operate */ + Comparison_result operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2, + Arr_curve_end ce) const + { ++m_counter; return m_object(xc1, xc2, ce); } + }; + + // bottom-top /*! A functor that determines whether an endpoint of an x-monotone arc lies * on a boundary of the parameter space along the y axis. @@ -589,92 +641,177 @@ public: class Parameter_space_in_y_2 { private: typename Base::Parameter_space_in_y_2 m_object; - unsigned int & m_counter1; - unsigned int & m_counter2; - unsigned int & m_counter3; + unsigned int& m_counter1; + unsigned int& m_counter2; + unsigned int& m_counter3; public: /*! Construct */ - Parameter_space_in_y_2(const Base * base, - unsigned int & counter1, - unsigned int & counter2, - unsigned int & counter3) : + Parameter_space_in_y_2(const Base* base, unsigned int& counter1, + unsigned int& counter2, unsigned int& counter3) : m_object(base->parameter_space_in_y_2_object()), m_counter1(counter1), m_counter2(counter2), m_counter3(counter3) {} /*! Operate */ - Arr_parameter_space operator()(const X_monotone_curve_2 & xc, + Arr_parameter_space operator()(const X_monotone_curve_2& xc, Arr_curve_end ce) const { ++m_counter1; return m_object(xc, ce); } /*! Operate */ - Arr_parameter_space operator()(const Point_2 & p) const + Arr_parameter_space operator()(const Point_2& p) const { ++m_counter2; return m_object(p); } /*! Operate */ - Arr_parameter_space operator()(const X_monotone_curve_2 & xc) const + Arr_parameter_space operator()(const X_monotone_curve_2& xc) const { ++m_counter3; return m_object(xc); } }; + /*! A functor that determines whether a point or a curve lies on an + * identification in x. + */ + class Is_on_y_identification_2 { + private: + typename Base::Is_on_y_identificiation_2 m_object; + unsigned int& m_counter1; + unsigned int& m_counter2; + + public: + /*! Construct */ + Is_on_y_identification_2(const Base* base, + unsigned int& counter1, unsigned int& counter2) : + m_object(base->is_on_y_identificiation_2_object()), + m_counter1(counter1), + m_counter2(counter2) {} + + /*! Operate */ + Arr_parameter_space operator()(const Point_2& p) const + { ++m_counter1; return m_object(p); } + + + /*! Operate */ + Arr_parameter_space operator()(const X_monotone_curve_2& xc) const + { ++m_counter2; return m_object(xc); } + + }; + + /*! A functor that compares the x-limits of curve ends on the + * boundary of the parameter space. + */ + class Compare_x_at_limit_2 { + private: + typename Base::Compare_x_at_limit_2 m_object; + unsigned int& m_counter1; + unsigned int& m_counter2; + + public: + /*! Construct */ + Compare_x_at_limit_2(const Base* base, + unsigned int& counter1, unsigned int& counter2) : + m_object(base->compare_x_at_limit_2_object()), + m_counter1(counter1), + m_counter2(counter2) {} + + /*! Operate */ + Comparison_result operator()(const Point_2& p, + const X_monotone_curve_2& xc, + Arr_curve_end ce) const + { ++m_counter1; return m_object(p, xc, ce); } + + /*! Operate */ + Comparison_result operator()(const X_monotone_curve_2& xc1, + Arr_curve_end ce1, + const X_monotone_curve_2& xc2, + Arr_curve_end ce2) const + { ++m_counter2; return m_object(xc1, ce1, xc2, ce2); } + }; + + + /*! A functor that compares the x-coordinates of curve ends near the + * boundary of the parameter space. + */ + class Compare_x_near_limit_2 { + private: + typename Base::Compare_x_near_limit_2 m_object; + unsigned int& m_counter; + + public: + /*! Construct */ + Compare_x_near_limit_2(const Base* base, unsigned int& counter) : + m_object(base->compare_x_near_limit_2_object()), + m_counter(counter) {} + + + /*! Operate */ + Comparison_result operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2, + Arr_curve_end ce) const + { ++m_counter; return m_object(xc1, xc2, ce); } + }; + + /*! A functor that compares the x-coordinate of two given points + * that lie on horizontal boundaries. + */ + class Compare_x_on_boundary_2 { + private: + typename Base::Compare_x_on_boundary_2 m_object; + unsigned int& m_counter1; + unsigned int& m_counter2; + unsigned int& m_counter3; + + public: + /*! Construct */ + Compare_x_on_boundary_2(const Base* base, unsigned int& counter1, + unsigned int& counter2, unsigned int& counter3 ) : + m_object(base->compare_x_on_boundary_2_object()), + m_counter1(counter1), + m_counter2(counter2), + m_counter3(counter3) + {} + + /*! Operate */ + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const + { ++m_counter1; return m_object(p1, p2); } + + /*! Operate */ + Comparison_result operator()(const Point_2& pt, + const X_monotone_curve_2& xcv, + Arr_curve_end ce) const + { ++m_counter2; return m_object(pt, xcv, ce); } + + /*! Operate */ + Comparison_result operator()(const X_monotone_curve_2& xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2& xcv2, + Arr_curve_end ce2) const + { ++m_counter3; return m_object(xcv1, ce1, xcv2, ce2); } + + }; + /*! A functor that compares the x-coordinates of curve ends near the * boundary of the parameter space. */ class Compare_x_near_boundary_2 { private: typename Base::Compare_x_near_boundary_2 m_object; - unsigned int & m_counter1; - unsigned int & m_counter2; - - public: - /*! Construct */ - Compare_x_near_boundary_2(const Base * base, - unsigned int & counter1, - unsigned int & counter2) : - m_object(base->compare_x_near_boundary_2_object()), - m_counter1(counter1), - m_counter2(counter2) {} - - /*! Operate */ - Comparison_result operator()(const Point_2 & p, - const X_monotone_curve_2 & xc, - Arr_curve_end ce) const - { ++m_counter1; return m_object(p, xc, ce); } - - /*! Operate */ - Comparison_result operator()(const X_monotone_curve_2 & xc1, - Arr_curve_end ce1, - const X_monotone_curve_2 & xc2, - Arr_curve_end ce2) const - { ++m_counter2; return m_object(xc1, ce1, xc2, ce2); } - }; - - - /*! A functor that compares the x-coordinate of two given points - * that lie on horizontal boundaries. - */ - class Compare_x_on_boundary_2 { - private: - typename Base::Compare_x_on_boundary_2 m_object; - unsigned int & m_counter; - - public: - /*! Construct */ - Compare_x_on_boundary_2(const Base * base, unsigned int & counter) : - m_object(base->compare_x_on_boundary_2_object()), - m_counter(counter) - {} - - /*! Operate */ - Comparison_result operator()(const Point_2 & p1, - const Point_2 & p2) const - { ++m_counter; return m_object(p1, p2); } - }; - + unsigned int& m_counter; - // TODO Is_on_y_identification_2 + public: + /*! Construct */ + Compare_x_near_boundary_2(const Base* base, + unsigned int& counter) : + m_object(base->compare_x_near_boundary_2_object()), + m_counter(counter) {} + + + /*! Operate */ + Comparison_result operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2, + Arr_curve_end ce) const + { ++m_counter; return m_object(xc1, xc2, ce); } + }; //@} @@ -744,6 +881,22 @@ public: ); } + Is_on_x_identification_2 is_on_x_identification_2_object() const + { + return Is_on_x_identification_2(this, + m_counters[IS_ON_X_IDENTIFICATION_POINT_OP], + m_counters[IS_ON_X_IDENTIFICATION_CURVE_OP]); + } + + Compare_y_on_boundary_2 compare_on_boundary_2_object() const + { return Compare_y_on_boundary_2(this, m_counters[COMPARE_Y_ON_BOUNDARY_OP]); } + + Compare_y_near_boundary_2 compare_near_boundary_2_object() const + { + return Compare_y_near_boundary_2(this, + m_counters[COMPARE_Y_NEAR_BOUNDARY_OP]); + } + // bottom-top Parameter_space_in_y_2 parameter_space_in_y_2_object() const { return Parameter_space_in_y_2( @@ -754,6 +907,39 @@ public: ); } + Is_on_y_identification_2 is_on_y_identification_2_object() const + { return Is_on_y_identification_2( + this, + m_counters[IS_ON_Y_IDENTIFICATION_POINT_OP], + m_counters[IS_ON_Y_IDENTIFICATION_CURVE_OP] + ); + } + + Compare_x_at_limit_2 compare_x_at_limit_2_object() const + { + return + Compare_x_at_limit_2(this, + m_counters[COMPARE_X_AT_LIMIT_POINT_CURVE_END_OP], + m_counters[COMPARE_X_AT_LIMIT_CURVE_ENDS_OP]); + } + + Compare_x_near_limit_2 compare_x_near_limit_2_object() const + { return Compare_x_near_limit_2(this, m_counters[COMPARE_X_NEAR_LIMIT_OP]); } + + Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const + { + return + Compare_x_on_boundary_2(this, + m_counters[COMPARE_X_ON_BOUNDARY_POINTS_OP], + m_counters[COMPARE_X_ON_BOUNDARY_POINT_CURVE_END_OP], + m_counters[COMPARE_X_ON_BOUNDARY_CURVE_ENDS_OP]); + } + + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const + { + return Compare_x_near_boundary_2(this, + m_counters[COMPARE_X_NEAR_BOUNDARY_OP]); + } //@} @@ -779,8 +965,8 @@ private: template inline -Out_stream & operator<<(Out_stream & os, - const Arr_counting_traits_2 & traits) +Out_stream& operator<<(Out_stream& os, + const Arr_counting_traits_2& traits) { typedef Arr_counting_traits_2 Traits; unsigned int sum = 0; @@ -828,10 +1014,14 @@ Out_stream & operator<<(Out_stream & os, << traits.count_parameter_space_in_x_point() << std::endl << "# of PARAMETER_SPACE_IN_X curve operation = " << traits.count_parameter_space_in_x_curve() << std::endl - << "# of COMPARE_Y_NEAR_BOUNDARY operation = " - << traits.count_compare_y_near_boundary() << std::endl + << "# of IS_ON_X_IDENTIFICIATION point operation = " + << traits.count_is_on_x_identification_point() << std::endl + << "# of IS_ON_X_IDENTIFICATION curve operation = " + << traits.count_is_on_x_identification_curve() << std::endl << "# of COMPARE_Y_ON_BOUNDARY operation = " << traits.count_compare_y_on_boundary() << std::endl + << "# of COMPARE_Y_NEAR_BOUNDARY operation = " + << traits.count_compare_y_near_boundary() << std::endl // bottom-top << "# of PARAMETER_SPACE_IN_Y curve-end operation = " << traits.count_parameter_space_in_y_curve_end() << std::endl @@ -839,12 +1029,24 @@ Out_stream & operator<<(Out_stream & os, << traits.count_parameter_space_in_y_point() << std::endl << "# of PARAMETER_SPACE_IN_Y curve operation = " << traits.count_parameter_space_in_y_curve() << std::endl - << "# of COMPARE_X_NEAR_BOUNDARY point/curve-end operation = " - << traits.count_compare_x_near_boundary_point_curve_end() << std::endl - << "# of COMPARE_X_NEAR_BOUNDARY curve-ends operation = " - << traits.count_compare_x_near_boundary_curve_ends() << std::endl - << "# of COMPARE_X_ON_BOUNDARY operation = " - << traits.count_compare_x_on_boundary() << std::endl + << "# of IS_ON_Y_IDENTIFICIATION point operation = " + << traits.count_is_on_y_identification_point() << std::endl + << "# of IS_ON_Y_IDENTIFICATION curve operation = " + << traits.count_is_on_y_identification_curve() << std::endl + << "# of COMPARE_X_AT_LIMIT point/curve-end operation = " + << traits.count_compare_x_at_limit_point_curve_end() << std::endl + << "# of COMPARE_X_AT_LIMIT curve-ends operation = " + << traits.count_compare_x_at_limit_curve_ends() << std::endl + << "# of COMPARE_X_NEAR_LIMIT operation = " + << traits.count_compare_x_near_limit() << std::endl + << "# of COMPARE_X_ON_BOUNDARY points operation = " + << traits.count_compare_x_on_boundary_points() << std::endl + << "# of COMPARE_X_ON_BOUNDARY point/curve-end operation = " + << traits.count_compare_x_on_boundary_point_curve_end() << std::endl + << "# of COMPARE_X_ON_BOUNDARY curve-ends operation = " + << traits.count_compare_x_on_boundary_curve_ends() << std::endl + << "# of COMPARE_X_NEAR_BOUNDARY operation = " + << traits.count_compare_x_near_boundary() << std::endl << "total # = " << sum << std::endl << "# of traits constructed = " << Traits::increment(false) 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 6528997ca64..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -68,14 +68,14 @@ public: typedef typename Base_traits_2::Has_do_intersect_category Has_do_intersect_category; - typedef typename internal::Arr_complete_left_side_tag< Base_traits_2 >::Tag - Arr_left_side_category; - typedef typename internal::Arr_complete_bottom_side_tag< Base_traits_2 >::Tag - Arr_bottom_side_category; - typedef typename internal::Arr_complete_top_side_tag< Base_traits_2 >::Tag - Arr_top_side_category; - typedef typename internal::Arr_complete_right_side_tag< Base_traits_2 >::Tag - Arr_right_side_category; + typedef typename internal::Arr_complete_left_side_category< Base_traits_2 >::Category + Left_side_category; + typedef typename internal::Arr_complete_bottom_side_category< Base_traits_2 >::Category + Bottom_side_category; + typedef typename internal::Arr_complete_top_side_category< Base_traits_2 >::Category + Top_side_category; + typedef typename internal::Arr_complete_right_side_category< Base_traits_2 >::Category + Right_side_category; // Representation of a curve with an addtional data field: typedef _Curve_data_ex Curve_2; @@ -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_dcel_base.h b/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h index d6b50db7c00..fb5a27c1383 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -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_default_dcel.h b/Arrangement_on_surface_2/include/CGAL/Arr_default_dcel.h index 394c78605b8..111080acda5 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_default_dcel.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_default_dcel.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_default_overlay_traits.h b/Arrangement_on_surface_2/include/CGAL/Arr_default_overlay_traits.h index 56df7f2d817..7d7198b0b57 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_default_overlay_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_default_overlay_traits.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_enums.h b/Arrangement_on_surface_2/include/CGAL/Arr_enums.h index 662df268ac4..03ac8462027 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_enums.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_enums.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_extended_dcel.h b/Arrangement_on_surface_2/include/CGAL/Arr_extended_dcel.h index 516ab738b8e..75e9374a29c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_extended_dcel.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_extended_dcel.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_extended_rational_arc_traits_d_1.h b/Arrangement_on_surface_2/include/CGAL/Arr_extended_rational_arc_traits_d_1.h new file mode 100644 index 00000000000..9d87b07b9ab --- /dev/null +++ b/Arrangement_on_surface_2/include/CGAL/Arr_extended_rational_arc_traits_d_1.h @@ -0,0 +1,1791 @@ +// Copyright (c) 2011 Tel-Aviv University (Israel), INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Oren Salzman +// Michael Hemmer + +//TODO: somehow use the fact the the x-value is the same in all comparisons + +#ifndef CGAL_ARR_VERTICAL_SEGMENT_TRAITS +#define CGAL_ARR_VERTICAL_SEGMENT_TRAITS + +#include +#include +#include +#include + +#include +#include "boost/variant.hpp" + +#include + +namespace CGAL { + +# define Is_line(ver) \ + (((((ver)).max_parameter_space() == ARR_TOP_BOUNDARY ) && ((ver).min_parameter_space() == ARR_BOTTOM_BOUNDARY) )) + +# define Is_ray(ver) \ + ((((ver).max_parameter_space() == ARR_TOP_BOUNDARY) && ((ver).min_parameter_space() == ARR_INTERIOR ))|| \ + (((ver).max_parameter_space() == ARR_INTERIOR ) && ((ver).min_parameter_space() == ARR_BOTTOM_BOUNDARY )) ) + +# define Is_segment(ver) \ + ( ((ver).max_parameter_space() == ARR_INTERIOR ) && ((ver).min_parameter_space() == ARR_INTERIOR) ) + +# define Max_bounded(ver) \ + ( ((ver).max_parameter_space() == ARR_TOP_BOUNDARY ) ? false : true ) + +# define Min_bounded(ver) \ + ( ((ver).min_parameter_space() == ARR_BOTTOM_BOUNDARY ) ? false : true ) + + +template +class Arr_traits_with_vertical_segments +{ +public: + typedef Traits_ Traits; + typedef Arr_traits_with_vertical_segments Self; + + typedef typename Traits::Algebraic_kernel_d_1 Algebraic_kernel_d_1; + + typedef typename Traits::Point_2 Point_2; + typedef typename Traits::Multiplicity Multiplicity; + typedef typename Traits::Algebraic_real_1 Algebraic_real_1; + typedef typename Traits::Rat_vector Rat_vector; + typedef typename Traits::Coefficient Coefficient; + + typedef typename Traits::Integer Integer; + typedef typename Traits::Rational Rational; + typedef typename Traits::Polynomial_1 Polynomial_1; + typedef typename Traits::Rational_function Rational_function; + + + typedef typename Traits::X_monotone_curve_2 Non_vertical_x_curve_2; + typedef typename Traits::Curve_2 Non_vertical_curve_2; + typedef typename Traits::Vertical_segment Vertical_segment; + + typedef Arr_vertical_rational_arc::Rational_arc_with_ver_d_1 + X_monotone_curve_2; + typedef Arr_vertical_rational_arc::Rational_arc_with_ver_d_1 + Curve_2; + + //Category tags: + typedef Tag_true Has_left_category; + typedef Tag_true Has_merge_category; + typedef Tag_true Has_do_intersect_category; + + typedef Arr_open_side_tag Left_side_category; + typedef Arr_open_side_tag Top_side_category; + typedef Arr_open_side_tag Bottom_side_category; + typedef Arr_open_side_tag Right_side_category; +public: + typedef std::vector Object_vector; +private: + mutable Traits _traits; +public: + const Algebraic_kernel_d_1* algebraic_kernel_d_1() const {return _traits.algebraic_kernel_d_1();} + +public: + //------------ + //Constructors + //------------ + + //--------------------- + // Default constructor. + Arr_traits_with_vertical_segments () + {} + + class Construct_point_2 + { + private: + Traits& _traits; + public: + Construct_point_2 (Traits& traits) :_traits(traits) {} + Point_2 operator() (const Rational_function& rational_function, + const Algebraic_real_1& x_coordinate) + { + return _traits.construct_point_2_object()(rational_function,x_coordinate); + } + Point_2 operator() (const Rational& x,const Rational& y) + { + return _traits.construct_point_2_object()(x,y); + } + Point_2 operator() (const Algebraic_real_1& x,const Rational& y) + { + return _traits.construct_point_2_object()(x,y); + } + }; //Construct_point_2 + + Construct_point_2 construct_point_2_object() const {return Construct_point_2(_traits);} + + class Construct_vertical_x_curve_2 + { + private: + Traits& _traits; + public: + Construct_vertical_x_curve_2(Traits& traits) + :_traits(traits) + {} + + X_monotone_curve_2 operator() (const Point_2& p1,const Point_2& p2) const + { + return _traits.construct_vertical_segment_object() (p1,p2); + } + X_monotone_curve_2 operator() (const Point_2& p) const + { + return _traits.construct_vertical_segment_object() (p); + } + X_monotone_curve_2 operator() (const Point_2& p, bool is_directed_up) const + { + return _traits.construct_vertical_segment_object() (p,is_directed_up); + } + }; //Construct_vertical_x_curve_2 + + Construct_vertical_x_curve_2 construct_vertical_x_curve_2_object () const + { + return Construct_vertical_x_curve_2(_traits); + } + + class Construct_vertical_curve_2 + { + private: + Traits& _traits; + public: + Construct_vertical_curve_2 (Traits& traits) + :_traits(traits) + {} + Curve_2 operator() (const Point_2& p1,const Point_2& p2) const + { + return _traits.construct_vertical_segment_object()(p1,p2); + } + Curve_2 operator() (const Point_2& p) const + { + return _traits.construct_vertical_segment_object()(p); + } + Curve_2 operator() (const Point_2& p, bool is_directed_up) const + { + return _traits.construct_vertical_segment_object()(p,is_directed_up); + } + + }; //Construct_vertical_curve_2 + + Construct_vertical_curve_2 construct_vertical_curve_2_object () const + { + return Construct_vertical_curve_2(_traits); + } + + class Construct_curve_2 + { + private: + typedef typename Traits::Algebraic_real_1 Algebraic_real_1; + Traits& _traits; + public: + Construct_curve_2 (Traits& traits) + :_traits(traits) + {} + template + Curve_2 operator() (InputIterator begin, InputIterator end) const + { + return _traits.construct_curve_2_object()(begin,end); + } + template + Curve_2 operator() (InputIterator begin, InputIterator end,const Algebraic_real_1& x_s, bool dir_right) const + { + return _traits.construct_curve_2_object()(begin,end,x_s,dir_right); + } + template + Curve_2 operator() (InputIterator begin, InputIterator end, + const Algebraic_real_1& x_s, const Algebraic_real_1& x_t) const + { + return _traits.construct_curve_2_object()(begin,end,x_s,x_t); + } + template + Curve_2 operator() (InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom) const + { + return _traits.construct_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom); + } + template + Curve_2 operator() (InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom, + const Algebraic_real_1& x_s, bool dir_right) const + { + return _traits.construct_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom,x_s,dir_right); + } + template + Curve_2 operator() (InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom, + const Algebraic_real_1& x_s, const Algebraic_real_1& x_t) const + { + return _traits.construct_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom,x_s,x_t); + } + }; //Construct_rational_curve_2 + + Construct_curve_2 construct_curve_2_object () const + { + return Construct_curve_2(_traits); + } + class Construct_x_monotone_curve_2 + { + private: + typedef typename Traits::Algebraic_real_1 Algebraic_real_1; + Traits& _traits; + public: + Construct_x_monotone_curve_2 (Traits& traits) + :_traits(traits) + {} + template + X_monotone_curve_2 operator() (InputIterator begin, InputIterator end) const + { + return _traits.construct_x_monotone_curve_2_object()(begin,end); + } + template + X_monotone_curve_2 operator() ( InputIterator begin, InputIterator end, + const Algebraic_real_1& x_s, bool dir_right) const + { + return _traits.construct_x_monotone_curve_2_object()(begin,end,x_s,dir_right); + } + template + X_monotone_curve_2 operator() (InputIterator begin, InputIterator end, + const Algebraic_real_1& x_s, const Algebraic_real_1& x_t) const + { + return _traits.construct_x_monotone_curve_2_object()(begin,end,x_s,x_t); + } + template + X_monotone_curve_2 operator() ( InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom) const + { + return _traits.construct_x_monotone_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom); + } + template + X_monotone_curve_2 operator() ( InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom, + const Algebraic_real_1& x_s, bool dir_right) const + { + return _traits.construct_x_monotone_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom,x_s,dir_right); + } + template + X_monotone_curve_2 operator() ( InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom, + const Algebraic_real_1& x_s, const Algebraic_real_1& x_t) const + { + return _traits.construct_x_monotone_curve_2_object()(begin_numer, end_numer,begin_denom,end_denom,x_s,x_t); + } + }; //Construct_rational_x_curve_2 + + Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object () const + { + return Construct_x_monotone_curve_2(_traits); + } + //------------------------ + //Functor definitions. + //------------------------ + + //--------------------------------------------------------------- + //A functor that compares the x-coordinates of two points + class Compare_x_2 + { + private: + Traits& _traits; + public: + Compare_x_2(Traits& traits) : _traits(traits) {} + /*! + * Compare the x-coordinates of two points. + * \param p1 The first point. + * \param p2 The second point. + * \return LARGER if x(p1) > x(p2); + * SMALLER if x(p1) < x(p2); + * EQUAL if x(p1) = x(p2). + */ + Comparison_result operator() (const Point_2 & p1, const Point_2 & p2) const + { + return _traits.compare_x_2_object()(p1,p2); + } + }; + + /*! Obtain a Compare_x_2 functor object. */ + Compare_x_2 compare_x_2_object () const + { + return Compare_x_2(_traits); + } + + /*! A functor that compares two points lexigoraphically: by x, then by y. */ + class Compare_xy_2 + { + private: + Traits& _traits; + public: + Compare_xy_2 (Traits& traits) : _traits(traits) {} + Comparison_result operator() (const Point_2& p1, const Point_2& p2) const + { + return _traits.compare_xy_2_object() (p1,p2); + } + }; + + /*! Obtain a Compare_xy_2 functor object. */ + Compare_xy_2 compare_xy_2_object () const + { + return Compare_xy_2(_traits); + } + + /*! A functor that obtains the left endpoint of a curve. */ + class Construct_min_vertex_2 + { + private: + Traits& _traits; + public: + Construct_min_vertex_2(Traits& traits) : _traits(traits) {} + /*! + * Get the left endpoint of the x-monotone curve (segment). + * \param cv The curve. + * \return The left endpoint. + */ + const Point_2& operator() (const X_monotone_curve_2 & cv) const + { + return (boost::apply_visitor(Construct_min_vertex_2_visitor(_traits),cv.variant())); + } + private: + class Construct_min_vertex_2_visitor + : public boost::static_visitor + { + private: + Traits& _traits; + public: + Construct_min_vertex_2_visitor(Traits& traits) :_traits(traits) {} + const Point_2& operator() (const Non_vertical_x_curve_2 & cv) const + { + return _traits.construct_min_vertex_2_object()(cv); + } + const Point_2& operator() (const Vertical_segment & cv) const + { + return (cv.min()); + } + }; //Construct_min_vertex_2_visitor + }; //Construct_min_vertex_2 + + /*! Obtain a Construct_min_vertex_2 functor object. */ + Construct_min_vertex_2 construct_min_vertex_2_object () const + { + return Construct_min_vertex_2(_traits); + } + + /*! A functor that obtains the right endpoint of a curve. */ + class Construct_max_vertex_2 + { + private: + Traits& _traits; + public: + Construct_max_vertex_2 (Traits& traits) : _traits(traits) {} + const Point_2& operator() (const X_monotone_curve_2 & cv) const + { + return (boost::apply_visitor(Construct_max_vertex_2_visitor(_traits),cv.variant())); + } + private: + class Construct_max_vertex_2_visitor + : public boost::static_visitor + { + private: + Traits& _traits; + public: + Construct_max_vertex_2_visitor(Traits& traits) : _traits(traits) {} + const Point_2& operator() (const Non_vertical_x_curve_2 & cv) const + { + return _traits.construct_max_vertex_2_object()(cv); + } + const Point_2& operator() (const Vertical_segment & cv) const + { + return (cv.max()); + } + }; //Construct_max_vertex_2_visitor + }; //Construct_max_vertex_2 + + /*! Obtain a Construct_max_vertex_2 functor object. */ + Construct_max_vertex_2 construct_max_vertex_2_object () const + { + return Construct_max_vertex_2(_traits); + } + + /*! A functor that checks whether a given curve is vertical. */ + class Is_vertical_2 + { + private: + Traits& _traits; + public: + Is_vertical_2(Traits& traits) : _traits(traits) {} + bool operator() (const X_monotone_curve_2& cv) const + { + return (boost::apply_visitor(Is_vertical_2_visitor(_traits),cv.variant())); + } + private: + class Is_vertical_2_visitor + : public boost::static_visitor + { + private: + Traits& _traits; + public: + Is_vertical_2_visitor(Traits& traits) : _traits(traits) {} + bool operator() (const Non_vertical_x_curve_2 & cv) const + { + return _traits.is_vertical_2_object()(cv); + } + bool operator() (const Vertical_segment & cv) const + { + return true; + } + }; //Is_vertical_2_visitor + + }; //Is_vertical_2 + + /*! Obtain an Is_vertical_2 functor object. */ + Is_vertical_2 is_vertical_2_object () const + { + return Is_vertical_2(_traits); + } + + /*! A functor that compares the y-coordinates of a point and a curve at + * the point x-coordinate. + */ + class Compare_y_at_x_2 + { + private: + Traits& _traits; + public: + Compare_y_at_x_2(Traits& traits) : _traits(traits) {} + /*! + * Return the location of the given point with respect to the input curve. + * \param cv The curve. + * \param p The point. + * \pre p is in the x-range of cv. + * \return SMALLER if y(p) < cv(x(p)), i.e. the point is below the curve; + * LARGER if y(p) > cv(x(p)), i.e. the point is above the curve; + * EQUAL if p lies on the curve. + */ + //Compare_y_at_x_2() {} + Comparison_result operator() (const Point_2& p, + const X_monotone_curve_2& cv) const + { + return (boost::apply_visitor(Compare_y_at_x_2_visitor(_traits,p),cv.variant())); + } + private: + class Compare_y_at_x_2_visitor + : public boost::static_visitor + { + public: + typedef boost::static_visitor Base; + Compare_y_at_x_2_visitor(Traits& traits,const Point_2& p) : _traits(traits),_p(p), Base() {} + Comparison_result operator() (const Non_vertical_x_curve_2 & cv) const + { + return _traits.compare_y_at_x_2_object() (_p,cv); + } + Comparison_result operator() (const Vertical_segment & cv) const + { + CGAL_precondition(_traits.compare_x_2_object()(_p,cv.max()) == CGAL::EQUAL); + + typename Traits::Compare_xy_2 compare_xy_2 = _traits.compare_xy_2_object(); + + if (Is_line(cv)) + return CGAL::EQUAL; + if ((Max_bounded(cv)) && (!Min_bounded(cv)) ) + return (compare_xy_2 (_p,cv.max()) == LARGER) ? LARGER : EQUAL; + if ((!Max_bounded(cv)) && (Min_bounded(cv)) ) + return (compare_xy_2 (_p,cv.min()) == SMALLER) ? SMALLER : EQUAL; + //line is a segment + Comparison_result cr_t = compare_xy_2(_p,cv.max()); + Comparison_result cr_b = compare_xy_2(_p,cv.min()); + return (cr_t == LARGER) ? LARGER : + (cr_b == SMALLER) ? SMALLER : + EQUAL; + } + private: + Traits& _traits; + Point_2 _p; + + }; //Compare_y_at_x_2_visitor + }; //Compare_y_at_x_2 + + //*! Obtain a Compare_y_at_x_2 functor object. */ + Compare_y_at_x_2 compare_y_at_x_2_object () const + { + return Compare_y_at_x_2(_traits); + } + + class Compare_y_at_x_left_2 + { + private: + Traits& _traits; + public: + Compare_y_at_x_left_2(Traits& traits) : _traits(traits) {} + Comparison_result operator() (const X_monotone_curve_2& cv1,const X_monotone_curve_2& cv2, + const Point_2& p) const + { + return (boost::apply_visitor(Compare_y_at_x_left_2_visitor(_traits,p),cv1.variant(),cv2.variant())); + } + private: + class Compare_y_at_x_left_2_visitor + : public boost::static_visitor + { + public: + typedef boost::static_visitor Base; + Compare_y_at_x_left_2_visitor(Traits& traits,const Point_2& p) + : _traits(traits), _p(p), Base() {} + Comparison_result operator() (const Non_vertical_x_curve_2 & cv1, + const Non_vertical_x_curve_2 & cv2) const + { + return _traits.compare_y_at_x_left_2_object() (cv1,cv2,_p); + } + Comparison_result operator() (const Vertical_segment & cv1, + const Non_vertical_x_curve_2 & cv2) const + { + assert(false); + return CGAL::SMALLER; + } + Comparison_result operator() (const Non_vertical_x_curve_2& cv1, + const Vertical_segment & cv2) const + { + assert(false); + return CGAL::LARGER; + } + Comparison_result operator() (const Vertical_segment & cv1, + const Vertical_segment & cv2) const + { + return CGAL::EQUAL; + } + private: + Traits& _traits; + Point_2 _p; + + }; //Compare_y_at_x_left_2_visitor + }; //Compare_y_at_x_left_2 + + Compare_y_at_x_left_2 compare_y_at_x_left_2_object() const {return Compare_y_at_x_left_2(_traits);} + /*! A functor that compares compares the y-coordinates of two curves + * immediately to the left of their intersection point. + */ + + /*! A functor that checks whether two points and two curves are identical. */ + class Equal_2 + { + private: + Traits& _traits; + public: + /*! + * Check if the two x-monotone curves are the same (have the same graph). + * \param cv1 The first curve. + * \param cv2 The second curve. + * \return (true) if the two curves are the same; (false) otherwise. + */ + Equal_2 (Traits& traits) :_traits(traits) {} + bool operator() ( const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2) const + { + return (boost::apply_visitor(Equal_2_visitor(_traits),cv1.variant(),cv2.variant())); + } + + /*! + * Check if the two points are the same. + * \param p1 The first point. + * \param p2 The second point. + * \return (true) if the two point are the same; (false) otherwise. + */ + bool operator() (const Point_2& p1, const Point_2& p2) const + { + if (&p1 == &p2) + return (true); + return _traits.equal_2_object() (p1,p2); + + } + private: + class Equal_2_visitor + : public boost::static_visitor + { + private: + typedef boost::static_visitor Base; + Traits& _traits; + public: + Equal_2_visitor(Traits& traits) : _traits(traits), Base() {} + bool operator() (const Non_vertical_x_curve_2& cv1, + const Non_vertical_x_curve_2& cv2) const + { + return _traits.equal_2_object() (cv1,cv2); + } + bool operator() (const Non_vertical_x_curve_2& cv1, + const Vertical_segment & cv2) const + { + return false; + } + bool operator() (const Vertical_segment & cv1, + const Non_vertical_x_curve_2& cv2) const + { + return false; + } + bool operator() (const Vertical_segment & cv1, + const Vertical_segment & cv2) const + { + if (&cv1 == &cv2) + return (true); + + if (CGAL::compare(cv1.x(),cv2.x()) != CGAL::EQUAL) + return false; + + if (Is_line(cv1) && Is_line(cv2)) + return true; + + if (Is_segment(cv1) && Is_segment(cv2)) + return (_traits.equal_2_object() (cv1.min(),cv2.min()) && + _traits.equal_2_object() (cv1.max(),cv2.max()) ); + + if (Max_bounded(cv1) && Max_bounded(cv2)) + return (_traits.equal_2_object() (cv1.max(),cv2.max() )); + + if (Min_bounded(cv1) && Min_bounded(cv2)) + return (_traits.equal_2_object() (cv1.min(),cv2.min() )); + + return false; + } + }; //Equal_2_visitor + }; //Equal_2 + + /*! Obtain an Equal_2 functor object. */ + Equal_2 equal_2_object () const + { + return Equal_2(_traits); + } + + /*! A functor that divides a curve into continues (x-monotone) curves. */ + class Make_x_monotone_2 + { + private: + Traits& _traits; + public: + Make_x_monotone_2(Traits& traits) : _traits(traits) {} + template + OutputIterator operator() (const Curve_2& cv, OutputIterator oi) const + { + Object_vector res (boost::apply_visitor(Make_x_monotone_2_visitor(_traits),cv.variant())); + re_cast_object_vector(res,oi); + return (oi); + } + private: + class Make_x_monotone_2_visitor + : public boost::static_visitor < Object_vector > + { + private: + typedef boost::static_visitor Base; + Traits& _traits; + public: + Make_x_monotone_2_visitor(Traits& traits) : _traits(traits), Base() {} + Object_vector operator() (const Non_vertical_curve_2& cv) const + { + Object_vector vec; + _traits.make_x_monotone_2_object() (cv,std::back_inserter(vec)); + return vec; + } + Object_vector operator() (const Vertical_segment & cv) const + { + Object_vector vec; + vec.push_back(make_object (Vertical_segment(cv))); + return vec; + } + }; //Make_x_monotone_2_visitor + + }; //Make_x_monotone_2 + + /*! Obtain a Make_x_monotone_2 functor object. */ + Make_x_monotone_2 make_x_monotone_2_object () const + { + return Make_x_monotone_2(_traits); + } + + /*! A functor that splits a curve at a point. */ + class Split_2 + { + private: + typedef std::pair Res_type; + Traits& _traits; + public: + Split_2 (Traits& traits) : _traits(traits) {} + /*! + * Split a given x-monotone curve at a given point into two sub-curves. + * \param cv The curve to split + * \param p The split point. + * \param c1 Output: The left resulting subcurve (p is its right endpoint). + * \param c2 Output: The right resulting subcurve (p is its left endpoint). + * \pre p lies on cv but is not one of its end-points. + */ + void operator() ( const X_monotone_curve_2& cv, const Point_2 & p, + X_monotone_curve_2& c1, X_monotone_curve_2& c2) const + { + Res_type res = boost::apply_visitor(Split_2_visitor(_traits,p),cv.variant()); + c1 = res.first; + c2 = res.second; + } + private: + class Split_2_visitor + : public boost::static_visitor + { + public: + typedef boost::static_visitor Base; + Split_2_visitor(Traits& traits,const Point_2 & p) + : _traits(traits),_p(p), Base() {} + Res_type operator() (const Non_vertical_x_curve_2& cv) const + { + Non_vertical_x_curve_2 _c1,_c2; + _traits.split_2_object() (cv,_p,_c1,_c2); + return Res_type(_c1,_c2); + } + Res_type operator() (const Vertical_segment & cv) const + { + typename Traits::Construct_vertical_segment + construct_vertical_segment = _traits.construct_vertical_segment_object(); + Vertical_segment _c1,_c2; + if (Is_line(cv)) + { + _c1 = construct_vertical_segment(_p,false); + _c2 = construct_vertical_segment(_p,true); + } + else if (Is_segment(cv)) + { + _c1 = construct_vertical_segment(cv.min(),_p); + _c2 = construct_vertical_segment(_p,cv.max()); + } + else if (Max_bounded(cv)) //min unbounded + { + _c1 = construct_vertical_segment(_p,false); + _c2 = construct_vertical_segment(_p,cv.max()); + } + else //min_bounded && max unbounded + { + _c1 = construct_vertical_segment(cv.min(),_p); + _c2 = construct_vertical_segment(_p,true); + } + return Res_type(_c1,_c2); + } + private: + Traits& _traits; + Point_2 _p; + }; //Split_2_visitor + }; //Split_2 + + /*! Obtain a Split_2 functor object. */ + Split_2 split_2_object () const + { + return Split_2(_traits); + } + + /*! A functor that computes intersections between two curves. */ + class Intersect_2 + { + private: + Traits& _traits; + public: + /*! + * Find the intersections of the two given curves and insert them to the + * given output iterator. As two segments may itersect only once, only a + * single will be contained in the iterator. + * \param cv1 The first curve. + * \param cv2 The second curve. + * \param oi The output iterator. + * \return The past-the-end iterator. + */ + Intersect_2 (Traits& traits) : _traits(traits) {} + template + OutputIterator operator() ( const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2, + OutputIterator oi) const + { + Object_vector res (boost::apply_visitor(Intersect_2_visitor(_traits),cv1.variant(),cv2.variant())); + re_cast_object_vector(res,oi); + return (oi); + } + private: + class Intersect_2_visitor + : public boost::static_visitor + { + private: + typedef boost::static_visitor Base; + Traits& _traits; + public: + Intersect_2_visitor(Traits& traits) + : _traits(traits), Base() {} + + //intersection of two Non_vertical_x_curve_2 + Object_vector operator() (const Non_vertical_x_curve_2& cv1, + const Non_vertical_x_curve_2& cv2) const + { + Object_vector vec; + _traits.intersect_2_object() (cv1,cv2,std::back_inserter(vec)); + return vec; + } + //intersection of a Non_vertical_x_curve_2 and a Vertical_segment + Object_vector operator() (const Vertical_segment& cv1, + const Non_vertical_x_curve_2& cv2) const + { + Object_vector vec; + _traits.intersect_2_object() (cv2,cv1,std::back_inserter(vec)); + return vec; + } + //intersection of a Non_vertical_x_curve_2 and a Vertical_segment + Object_vector operator() (const Non_vertical_x_curve_2& cv1, + const Vertical_segment& cv2) const + { + Object_vector vec; + _traits.intersect_2_object() (cv1,cv2,std::back_inserter(vec)); + return vec; + } + //intersection of two Vertical_segment + Object_vector operator() (const Vertical_segment& cv1, + const Vertical_segment& cv2) const + { + Object_vector vec; + CGAL::Object object; + if (cv1.has_same_x(cv2) == false) + return vec; + if (Is_line(cv1)) + object = make_object(Vertical_segment(cv2)); + else if (Is_line(cv2)) + object = make_object(Vertical_segment(cv1)); + + if (object.empty() == false) + { + vec.push_back(object); + return vec; + } + + if (Is_ray(cv1)) + { + if (Is_ray(cv2)) + vec = intersect_ray_ray (cv1,cv2); + else //cv2 is a segment + vec = intersect_ray_segment(cv1,cv2); + } + //cv1 is a segment + else if (Is_ray(cv2)) + { + vec = intersect_ray_segment(cv2,cv1); + } + //cv1 & cv2 are segments + else + vec = intersect_segment_segment(cv1,cv2); + + return vec; + } + private: + //returns the intersection of a curve with a vertical line defined at p + //CGAL::Object wraps a pair + //post return_value.second = 1 + Object_vector intersect_ray_ray ( const Vertical_segment& ray1, + const Vertical_segment& ray2) const + { + typename Traits::Compare_xy_2 + compare_xy_2 = _traits.compare_xy_2_object(); + typename Traits::Construct_vertical_segment + construct_vertical_segment = _traits.construct_vertical_segment_object(); + + CGAL_precondition (Is_ray(ray1)); + CGAL_precondition (Is_ray(ray2)); + + Object_vector vec; + CGAL::Object object; + + + if (Min_bounded(ray1) && Min_bounded(ray2)) + { + //both are directed up, take the larger minimum vertex + Comparison_result cr = compare_xy_2(ray1.min(),ray2.min()); + object = (cr == LARGER) ? make_object (construct_vertical_segment(ray1.min(),true)): + make_object (construct_vertical_segment(ray2.min(),true)) ; + } + else if (Min_bounded(ray1) && Max_bounded(ray2)) + { + //ray1 is directed up, ray2 is directed down + //either theu have no intersection or an intersecting segment or an intersection point + Comparison_result cr = compare_xy_2 (ray1.min(),ray2.max()); + if (cr == CGAL::LARGER) + return vec; + else if (cr == CGAL::EQUAL) + object = make_object (std::pair (ray1.min(),0)); + else //(cr == CGAL::SMALLER) + object = make_object (construct_vertical_segment(ray1.min(),ray2.max())); + } + else if (Max_bounded(ray1) && Min_bounded(ray2)) + { + //ray1 is directed down, ray2 is directed up + //either theu have no intersection or an intersecting segment + Comparison_result cr = compare_xy_2 (ray1.min(),ray2.max()); + if (cr == CGAL::SMALLER) + return vec; + else if (cr == CGAL::EQUAL) + object = make_object (std::pair (ray1.min(),0)); + else + object = make_object (construct_vertical_segment(ray1.max(),ray2.min())); + } + else + { + //both are directed down, take the smaller maximum vertex + Comparison_result cr = compare_xy_2 (ray1.max(),ray2.max()); + object = (cr == SMALLER) ? make_object (construct_vertical_segment(ray1.max(),false)): + make_object (construct_vertical_segment(ray2.max(),false)) ; + } + vec.push_back(object); + return vec; + } + Object_vector intersect_ray_segment(const Vertical_segment& ray, + const Vertical_segment& seg) const + { + CGAL_precondition (Is_ray(ray)); + CGAL_precondition (Is_segment(seg)); + + typename Traits::Compare_xy_2 + compare_xy_2 = _traits.compare_xy_2_object(); + typename Traits::Construct_vertical_segment + construct_vertical_segment = _traits.construct_vertical_segment_object(); + + Object_vector vec; + CGAL::Object object; + + if (Min_bounded(ray)) + { + //ray is directed up + Comparison_result cr = compare_xy_2 (ray.min(),seg.min()); + if (cr != LARGER) + object = make_object (seg); + else + { + cr = compare_xy_2 (ray.min(),seg.max()); + if (cr == LARGER) + return vec; + else if (cr == CGAL::EQUAL) + object = make_object (std::pair (ray.min(),0)); + else + object = make_object (construct_vertical_segment(ray.min(),seg.max())); + } + } + else + { + //ray is directed down + Comparison_result cr = compare_xy_2 (ray.max(),seg.max()); + if (cr != SMALLER) + object = make_object (seg); + else + { + cr = compare_xy_2 (ray.max(),seg.min()); + if (cr == SMALLER) + return vec; + else if (cr == CGAL::EQUAL) + object = make_object (std::pair (ray.max(),0)); + else + object = make_object (construct_vertical_segment(ray.min(),seg.max())); + } + } + vec.push_back(object); + return vec; + } + + Object_vector intersect_segment_segment(const Vertical_segment& seg1, + const Vertical_segment& seg2) const + { + CGAL_precondition (Is_segment(seg1)); + CGAL_precondition (Is_segment(seg2)); + + typename Traits::Compare_xy_2 + compare_xy_2 = _traits.compare_xy_2_object(); + typename Traits::Construct_vertical_segment + construct_vertical_segment = _traits.construct_vertical_segment_object(); + + Object_vector vec; + CGAL::Object object; + + Comparison_result cr = compare_xy_2 (seg1.max(),seg2.min()); + if (cr == CGAL::SMALLER) + return vec; + + cr = typename compare_xy_2 (seg1.min(),seg2.max()); + if (cr == CGAL::LARGER) + return vec; + + Comparison_result cr1 = compare_xy_2 (seg1.min(),seg2.min()); + Comparison_result cr2 = compare_xy_2 (seg1.max(),seg2.max()); + + if ( (cr1 == CGAL::LARGER ) && + (cr2 == CGAL::LARGER ) ) + object = make_object (construct_vertical_segment(seg1.min(),seg2.max())); + else if ( (cr1 == CGAL::LARGER ) && + (cr2 == CGAL::SMALLER ) ) + object = make_object (construct_vertical_segment(seg1.min(),seg1.max())); + else if ( (cr1 == CGAL::SMALLER) && + (cr2 == CGAL::LARGER ) ) + object = make_object (construct_vertical_segment(seg2.min(),seg2.max())); + else //SMALLER,SMALLER + object = make_object (construct_vertical_segment(seg2.min(),seg1.max())); + + vec.push_back(object); + return vec; + } + }; //Intersect_2_visitor + }; //Intersect_2 + + /*! Obtain an Intersect_2 functor object. */ + Intersect_2 intersect_2_object () const + { + return Intersect_2(_traits); + } + + /*! A functor that tests whether two curves can be merged. */ + class Are_mergeable_2 + { + private: + Traits& _traits; + 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. + */ + Are_mergeable_2 (Traits& traits) : _traits(traits) {} + bool operator() ( const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2) const + { + return (boost::apply_visitor(Are_mergeable_2_visitor(_traits),cv1.variant(),cv2.variant())); + } + private: + class Are_mergeable_2_visitor + : public boost::static_visitor + { + private: + typedef boost::static_visitor Base; + Traits& _traits; + public: + Are_mergeable_2_visitor(Traits& traits) + : _traits(traits), Base() {} + bool operator() ( const Non_vertical_x_curve_2& cv1, + const Non_vertical_x_curve_2& cv2) const + { + return _traits.are_mergeable_2_object() (cv1,cv2); + } + bool operator() ( const Vertical_segment& cv1, + const Non_vertical_x_curve_2& cv2) const + { + return false; + } + bool operator() ( const Non_vertical_x_curve_2& cv1, + const Vertical_segment& cv2) const + { + return false; + } + bool operator() ( const Vertical_segment& cv1, + const Vertical_segment& cv2) const + { + bool res = false; + //try to merge at common maximum + if ((Max_bounded(cv1)) && (Max_bounded(cv2))) + { + if (_traits.equal_2_object()(cv1.max(),cv2.max())) + return true; + } + //try to merge at common minimum + if ((Min_bounded(cv1)) && (Min_bounded(cv2))) + { + if (_traits.equal_2_object()(cv1.min(),cv2.min())) + return true; + } + //try to merge at minimum and maximum + if ((Max_bounded(cv1)) && (Min_bounded(cv2))) + { + res = (_traits.equal_2_object()(cv1.max(),cv2.min())); + } + if ((Min_bounded(cv1)) && (Max_bounded(cv2))) + { + res = (res || (_traits.equal_2_object()(cv1.min(),cv2.max()))); + } + return res; + } + }; //Are_mergeable_2_visitor + }; //Are_mergeable_2 + + /*! Obtain an Are_mergeable_2 functor object. */ + Are_mergeable_2 are_mergeable_2_object () const + { + return Are_mergeable_2(_traits); + } + + /*! A functor that merges two curves into one. */ + class Merge_2 + { + private: + Traits& _traits; + 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. + */ + Merge_2 (Traits& traits) : _traits(traits) {} + void operator() ( const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2, + X_monotone_curve_2& c) const + { + c = boost::apply_visitor(Merge_2_visitor(_traits),cv1.variant(),cv2.variant()); + return; + } + private: + class Merge_2_visitor + : public boost::static_visitor + { + private: + typedef boost::static_visitor Base; + Traits& _traits; + public: + Merge_2_visitor(Traits& traits) : _traits(traits), Base() {} + X_monotone_curve_2 operator() (const Non_vertical_x_curve_2& cv1,const Non_vertical_x_curve_2& cv2) const + { + CGAL_precondition(_traits.are_mergeable_2_object()(cv1,cv2)); + Non_vertical_x_curve_2 _c; + _traits.merge_2_object()(cv1,cv2,_c); + return _c; + } + X_monotone_curve_2 operator() (const Non_vertical_x_curve_2& cv1,const Vertical_segment& cv2) const + { + CGAL_precondition(false); + return X_monotone_curve_2(); + } + X_monotone_curve_2 operator() (const Vertical_segment& cv1,const Non_vertical_x_curve_2& cv2) const + { + CGAL_precondition(false); + return X_monotone_curve_2(); + } + X_monotone_curve_2 operator() (const Vertical_segment& cv1,const Vertical_segment& cv2) const + { + typename Traits::Construct_vertical_segment + construct_vertical_segment = _traits.construct_vertical_segment_object(); + + typename Traits::Compare_xy_2 + compare_xy_2 = _traits.compare_xy_2_object(); + + Vertical_segment _c; + if ((Max_bounded(cv1)) && + (Max_bounded(cv2)) && + (compare_xy_2(cv1.max() , cv2.max()) == CGAL::EQUAL)) + { + //merge at cv1.max() and cv2.max() + if ((Min_bounded(cv1) == false) || (Min_bounded(cv2) == false)) + _c = construct_vertical_segment(cv1.max(),false); //vertical ray towards -oo from common max + //construct vertical ray with common max and minimal min + bool get_cv1_min = (compare_xy_2(cv1.min(),cv2.min()) == CGAL::SMALLER); + _c = construct_vertical_segment(cv1.max(), get_cv1_min ? cv1.min() : cv2.min()); + return _c; + } + + if ((Min_bounded(cv1)) && + (Min_bounded(cv2)) && + (compare_xy_2(cv1.min() , cv2.min()) == CGAL::EQUAL)) + { + //merge at cv1.min() and cv2.min() + if ((Max_bounded(cv1) == false) || (Max_bounded(cv2) == false)) + _c = construct_vertical_segment(cv1.min(),true); //vertical ray towards oo from common min + //construct vertical ray with common min and maximal max + bool get_cv1_max = (compare_xy_2(cv1.max(),cv2.max()) == CGAL::LARGER); + _c = construct_vertical_segment(cv1.min(), get_cv1_max ? cv1.max() : cv2.max()); + return _c; + } + + if ((Max_bounded(cv1)) && + (Min_bounded(cv2)) && + (compare_xy_2(cv1.max() , cv2.min()) == CGAL::EQUAL)) + { + //merge at cv1.max() and cv2.min + if ((Min_bounded(cv1) == false) && (Max_bounded(cv2) == false)) + _c = construct_vertical_segment(cv1.max()); //vertical line at max.x + else if ((Min_bounded(cv1) == true) && (Max_bounded(cv2) == false)) + _c = construct_vertical_segment(cv1.min(),true); //vertical ray towards +oo from cv1.min + else if ((Min_bounded(cv1) == false) && (Max_bounded(cv2) == true)) + _c = construct_vertical_segment(cv2.max(),false); //vertical ray towards -oo from cv2.max + else + _c = construct_vertical_segment(cv1.min(), cv2.max()); + return _c; + } + else + { + //merge at cv1.min() and cv2.max + if ((Max_bounded(cv1) == false) && (Min_bounded(cv2) == false)) + _c = construct_vertical_segment(cv1.max()); //vertical line at max.x + else if ((Max_bounded(cv1) == true) && (Min_bounded(cv2) == false)) + _c = construct_vertical_segment(cv1.max(),false); //vertical ray towards -oo from cv1.max + else if ((Max_bounded(cv1) == false) && (Min_bounded(cv2) == true)) + _c = construct_vertical_segment(cv2.min(),true); //vertical ray towards +oo from cv2.min + else _c = construct_vertical_segment(cv2.min(), cv1.max()); + return _c; + } + CGAL_postcondition(false); + return X_monotone_curve_2(); + } + }; //Merge_2_visitor + }; //Merge_2 + + /*! Obtain a Merge_2 functor object. */ + Merge_2 merge_2_object () const + { + return Merge_2(_traits); + } + + //@} + + /// \name Functor definitions to handle boundaries + //@{ + + /*! A function object that obtains the parameter space of a geometric + * entity along the x-axis + */ + class Parameter_space_in_x_2 + { + private: + Traits& _traits; + public: + Parameter_space_in_x_2(Traits& traits) :_traits(traits) {}; + /*! Obtains the parameter space at the end of a line along the x-axis */ + Arr_parameter_space operator()( const X_monotone_curve_2 & xcv, + Arr_curve_end ce) const + { + return (boost::apply_visitor(Parameter_space_in_x_2_visitor(_traits,ce),xcv.variant())); + } + + /*! Obtains the parameter space at a point along the x-axis. + * \param p the point. + * \return the parameter space at p. + */ + /*Arr_parameter_space operator()(const Point_2 p) const + { + return Traits_2::Parameter_space_in_x_2(p); + }*/ + private: + class Parameter_space_in_x_2_visitor + : public boost::static_visitor + { + public: + typedef boost::static_visitor Base; + Parameter_space_in_x_2_visitor(Traits& traits,Arr_curve_end ce) + :_traits(traits), _ce(ce), Base() {} + Arr_parameter_space operator()(const Non_vertical_x_curve_2& xcv ) const + { + return _traits.parameter_space_in_x_2_object()(xcv,_ce); + } + Arr_parameter_space operator()(const Vertical_segment& xcv) const + { + return ARR_INTERIOR; + } + + private: + Traits& _traits; + Arr_curve_end _ce; + }; //Parameter_space_in_x_2_visitor + }; //Parameter_space_in_x_2 + + /*! Obtain a Parameter_space_in_x_2 function object */ + Parameter_space_in_x_2 parameter_space_in_x_2_object() const + { + return Parameter_space_in_x_2(_traits); + } + + /*! A function object that obtains the parameter space of a geometric + * entity along the y-axis + */ + class Parameter_space_in_y_2 + { + private: + Traits& _traits; + public: + Parameter_space_in_y_2 (Traits& traits) :_traits(traits) {}; + /*! Obtains the parameter space at the end of a line along the y-axis . + * Note that if the line end coincides with a pole, then unless the line + * coincides with the identification arc, the line end is considered to + * be approaching the boundary, but not on the boundary. + * If the line coincides with the identification arc, it is assumed to + * be smaller than any other object. + * \param xcv the line + * \param ce the line end indicator: + * ARR_MIN_END - the minimal end of xc or + * ARR_MAX_END - the maximal end of xc + * \return the parameter space at the ce end of the line xcv. + * ARR_BOTTOM_BOUNDARY - the line approaches the south pole at the line + * left end. + * ARR_INTERIOR - the line does not approache a contraction point. + * ARR_TOP_BOUNDARY - the line approaches the north pole at the line + * right end. + */ + Arr_parameter_space operator()( const X_monotone_curve_2 & xcv, + Arr_curve_end ce) const + { + return (boost::apply_visitor(Parameter_space_in_y_2_visitor(_traits,ce),xcv.variant())); + } + + /*! Obtains the parameter space at a point along the y-axis. + * \param p the point. + * \return the parameter space at p. + */ + //Arr_parameter_space operator()(const Point_2 ) const + //{ + // return ARR_INTERIOR; + //} + + private: + class Parameter_space_in_y_2_visitor + : public boost::static_visitor + { + public: + typedef boost::static_visitor Base; + Parameter_space_in_y_2_visitor(Traits& traits,Arr_curve_end ce) + :_traits(traits),_ce(ce), Base() {} + Arr_parameter_space operator()(const Non_vertical_x_curve_2& xcv ) const + { + return _traits.parameter_space_in_y_2_object()(xcv,_ce); + } + Arr_parameter_space operator()(const Vertical_segment& xcv) const + { + if (_ce == ARR_MIN_END) + return xcv.min_parameter_space(); + else //ce == ARR_MAX_END + return xcv.max_parameter_space(); + } + private: + Traits& _traits; + Arr_curve_end _ce; + }; //Parameter_space_in_x_2_visitor + + }; //Parameter_space_in_y_2 + + /*! Obtain a Parameter_space_in_y_2 function object */ + Parameter_space_in_y_2 parameter_space_in_y_2_object() const + { return Parameter_space_in_y_2(_traits); } + + class Compare_y_at_x_right_2 + { + private: + Traits& _traits; + public: + /* Compares the y value of two x-monotone curves immediately to the right + * of their intersection point. + * \param cv1 The first curve. + * \param cv2 The second curve. + * \param p The intersection point. + * \pre The point p lies on both curves, and both of them must be also be + * defined (lexicographically) to its right. + * \return The relative position of cv1 with respect to cv2 immdiately to + * the right of p: SMALLER, LARGER or EQUAL. + */ + Compare_y_at_x_right_2 (Traits& traits) : _traits(traits) {} + Comparison_result operator() (const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2, + const Point_2& p) const + { + return (boost::apply_visitor(Compare_y_at_x_right_2_visitor(_traits,p),cv1.variant(),cv2.variant())); + } + private: + class Compare_y_at_x_right_2_visitor + : public boost::static_visitor + { + public: + typedef boost::static_visitor Base; + Compare_y_at_x_right_2_visitor(Traits& traits,const Point_2& p) + : _traits(traits), _p(p), Base() {} + Comparison_result operator() (const Non_vertical_x_curve_2& cv1, + const Non_vertical_x_curve_2& cv2) const + { + return _traits.compare_y_at_x_right_2_object() (cv1,cv2,_p); + } + Comparison_result operator() (const Non_vertical_x_curve_2& cv1, + const Vertical_segment & cv2) const + { + return CGAL::SMALLER; + } + Comparison_result operator() (const Vertical_segment & cv1, + const Non_vertical_x_curve_2& cv2) const + { + return CGAL::LARGER; + } + Comparison_result operator() (const Vertical_segment & cv1, + const Vertical_segment & cv2) const + { + return CGAL::EQUAL; //test bug fix + } + private: + Traits& _traits; + Point_2 _p; + + }; //Compare_y_at_x_right_2_visitor + }; //Compare_y_at_x_right_2 + + /*! Obtain a Compare_y_at_x_right_2functor object. */ + Compare_y_at_x_right_2 compare_y_at_x_right_2_object () const + { + return Compare_y_at_x_right_2(_traits); + } + class Compare_x_near_limit_2 + { + private: + Traits& _traits; + public: + Compare_x_near_limit_2 (Traits& traits) : _traits(traits) {} + Comparison_result operator()( const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, + Arr_curve_end ce) const + { + return (boost::apply_visitor(Compare_x_near_limit_2_visitor(_traits,ce),xcv1.variant(),xcv2.variant())); + } + private: + class Compare_x_near_limit_2_visitor + : public boost::static_visitor + { + public: + typedef boost::static_visitor Base; + Compare_x_near_limit_2_visitor(Traits& traits,Arr_curve_end ce) + :_traits(traits), _ce(ce), Base() {} + Comparison_result operator()(const Non_vertical_x_curve_2& xcv1,const Non_vertical_x_curve_2& xcv2 ) const + { + return _traits.compare_x_near_limit_2_object()(xcv1,xcv2,_ce); + } + Comparison_result operator()(const Non_vertical_x_curve_2& xcv1,const Vertical_segment& xcv2 ) const + { + if (_ce == ARR_MIN_END) + { + CGAL_precondition (xcv2.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); + return CGAL::LARGER; + } + else //_ce2 == ARR_MAX_END + { + CGAL_precondition (xcv2.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); + return CGAL::SMALLER; + } + + return _traits.compare_x_at_limit_2_object()(xcv2.max(),xcv1,_ce); + } + Comparison_result operator()(const Vertical_segment& xcv1,const Non_vertical_x_curve_2& xcv2 ) const + { + if (_ce == ARR_MIN_END) + { + CGAL_precondition (xcv1.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); + return CGAL::SMALLER; + } + else //_ce1 == ARR_MAX_END + { + CGAL_precondition (xcv1.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); + return CGAL::LARGER; + } + } + Comparison_result operator()(const Vertical_segment& xcv1,const Vertical_segment& xcv2 ) const + { + if (_ce == ARR_MIN_END) + CGAL_precondition (xcv1.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); + else //_ce1 == ARR_MAX_END + CGAL_precondition (xcv1.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); + + if (_ce == ARR_MIN_END) + CGAL_precondition (xcv2.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); + else //_ce2 == ARR_MAX_END + CGAL_precondition (xcv2.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); + + return _traits.compare_x_2_object() (xcv1.min(),xcv2.min()); + } + + private: + Traits& _traits; + Arr_curve_end _ce; + }; //Compare_x_near_limit_2_visitor + }; //Compare_x_near_limit_2 + + Compare_x_near_limit_2 compare_x_near_limit_2_object() const + { + return Compare_x_near_limit_2(_traits); + } + + class Compare_x_at_limit_2 + { + private: + Traits& _traits; + public: + Compare_x_at_limit_2 (Traits& traits) :_traits(traits) {} + Comparison_result operator()( const Point_2 & p, + const X_monotone_curve_2 & xcv, + Arr_curve_end ce) const + { + return (boost::apply_visitor(Compare_x_at_limit_2_visitor_1(_traits,ce,p),xcv.variant())); + } + Comparison_result operator()( const X_monotone_curve_2 & xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce2) const + { + return (boost::apply_visitor(Compare_x_at_limit_2_visitor_2(_traits,ce1,ce2),xcv1.variant(),xcv2.variant())); + } + private: + class Compare_x_at_limit_2_visitor_1 + : public boost::static_visitor + { + public: + typedef boost::static_visitor Base; + Compare_x_at_limit_2_visitor_1(Traits& traits,Arr_curve_end ce,const Point_2 & p) + :_traits(traits), _ce(ce), _p(p), Base() {} + Comparison_result operator()(const Non_vertical_x_curve_2& xcv ) const + { + return _traits.compare_x_at_limit_2_object()(_p,xcv,_ce); + } + Comparison_result operator()(const Vertical_segment& xcv) const + { + if (_ce == ARR_MIN_END) + CGAL_precondition (xcv.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); + else //_ce == ARR_MAX_END + CGAL_precondition (xcv.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); + return _traits.compare_x_2_object()(_p,xcv.min()); + } + private: + Traits& _traits; + Point_2 _p; + Arr_curve_end _ce; + }; //Compare_x_at_limit_2_visitor_1 + + class Compare_x_at_limit_2_visitor_2 + : public boost::static_visitor + { + public: + typedef boost::static_visitor Base; + Compare_x_at_limit_2_visitor_2(Traits& traits,Arr_curve_end ce1,Arr_curve_end ce2) + :_traits(traits), _ce1(ce1), _ce2(ce2), Base() {} + Comparison_result operator()(const Non_vertical_x_curve_2& xcv1,const Non_vertical_x_curve_2& xcv2 ) const + { + return _traits.compare_x_at_limit_2_object()(xcv1,_ce1,xcv2,_ce2); + } + Comparison_result operator()(const Non_vertical_x_curve_2& xcv1,const Vertical_segment& xcv2 ) const + { + if (_ce2 == ARR_MIN_END) + CGAL_precondition (xcv2.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); + else //_ce2 == ARR_MAX_END + CGAL_precondition (xcv2.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); + + return _traits.compare_x_at_limit_2_object()(xcv2.max(),xcv1,_ce1); + } + Comparison_result operator()(const Vertical_segment& xcv1,const Non_vertical_x_curve_2& xcv2 ) const + { + if (_ce1 == ARR_MIN_END) + CGAL_precondition (xcv1.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); + else //_ce1 == ARR_MAX_END + CGAL_precondition (xcv1.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); + + return _traits.compare_x_at_limit_2_object()(xcv1.max(),xcv2,_ce2); + } + Comparison_result operator()(const Vertical_segment& xcv1,const Vertical_segment& xcv2 ) const + { + if (_ce1 == ARR_MIN_END) + CGAL_precondition (xcv1.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); + else //_ce1 == ARR_MAX_END + CGAL_precondition (xcv1.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); + + if (_ce2 == ARR_MIN_END) + CGAL_precondition (xcv2.min_parameter_space() == CGAL::ARR_BOTTOM_BOUNDARY); + else //_ce2 == ARR_MAX_END + CGAL_precondition (xcv2.max_parameter_space() == CGAL::ARR_TOP_BOUNDARY); + + return _traits.compare_x_2_object() (xcv1.min(),xcv2.min()); + } + private: + Traits& _traits; + Arr_curve_end _ce1,_ce2; + }; //Compare_x_at_limit_2_visitor_2 + }; //Compare_x_at_limit_2 + + /*! Obtain a Compare_x_at_limit_2 function object */ + Compare_x_at_limit_2 compare_x_at_limit_2_object() const + { return Compare_x_at_limit_2(_traits); } + /*! A function object that compares the y-coordinates of arc ends near the + * boundary of the parameter space. + */ + class Compare_y_near_boundary_2 + { + private: + Traits& _traits; + public: + /*! Compare the y-coordinates of 2 lines at their ends near the boundary + * of the parameter space at x = +/- oo. + * \param xcv1 the first arc. + * \param xcv2 the second arc. + * \param ce the line end indicator. + * \return the second comparison result. + * \pre the ce ends of the lines xcv1 and xcv2 lie either on the left + * boundary or on the right boundary of the parameter space. + */ + Compare_y_near_boundary_2 (Traits& traits) :_traits(traits) {} + Comparison_result operator()( const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + return (boost::apply_visitor(Compare_y_near_boundary_2_visitor(_traits,ce),xcv1.variant(),xcv2.variant())); + } + private: + class Compare_y_near_boundary_2_visitor + : public boost::static_visitor + { + public: + typedef boost::static_visitor Base; + Compare_y_near_boundary_2_visitor(Traits& traits,Arr_curve_end ce) + :_traits(traits), _ce(ce), Base() {} + Comparison_result operator()(const Non_vertical_x_curve_2& xcv1,const Non_vertical_x_curve_2& xcv2 ) const + { + return _traits.compare_y_near_boundary_2_object()(xcv1,xcv2,_ce); + } + Comparison_result operator()(const Non_vertical_x_curve_2& xcv1,const Vertical_segment& xcv2 ) const + { + //a vertical curve is not on the boundary at x = +-oo + CGAL_precondition (false); + return Comparison_result(); + } + Comparison_result operator()(const Vertical_segment& xcv1,const Non_vertical_x_curve_2& xcv2 ) const + { + //a vertical curve is not on the boundary at x = +-oo + CGAL_precondition (false); + return Comparison_result(); + } + Comparison_result operator()(const Vertical_segment& xcv1,const Vertical_segment& xcv2 ) const + { + //a vertical curve is not on the boundary at x = +-oo + CGAL_precondition (false); + return Comparison_result(); + } + private: + Traits& _traits; + Arr_curve_end _ce; + }; //Compare_y_near_boundary_2_visitor + }; + + /*! Obtain a Compare_y_near_boundary_2 function object */ + Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const + { return Compare_y_near_boundary_2(_traits); } + //@} + + /// \name Functor definitions for the Boolean set-operation traits. + //@{ + class Compare_endpoints_xy_2 + { + public: + + /*! + * Compare the endpoints of an $x$-monotone curve lexicographically. + * (assuming the curve has a designated source and target points). + * \param cv The curve. + * \return SMALLER if the curve is directed right; + * LARGER if the curve is directed left. + */ + Comparison_result operator() (const X_monotone_curve_2& cv) + { + return (boost::apply_visitor(Compare_endpoints_xy_2_visitor(),cv.variant())); + } + private: + class Compare_endpoints_xy_2_visitor + : public boost::static_visitor + { + public: + Comparison_result operator()(const Non_vertical_x_curve_2& xcv ) const + { + return _traits.construct_opposite_2_object()(xcv); + } + Comparison_result operator()(const Vertical_segment& xcv) const + { + return (SMALLER); + } + }; //Compare_endpoints_xy_2_visitor + }; //Compare_endpoints_xy_2 + + /*! Obtain a Compare_endpoints_xy_2 functor object. */ + Compare_endpoints_xy_2 compare_endpoints_xy_2_object() const + { + return Compare_endpoints_xy_2(); + } + + class Construct_opposite_2 + { + public: + X_monotone_curve_2 operator() (const X_monotone_curve_2& cv) const + { + return (boost::apply_visitor(Construct_opposite_2_visitor(),cv.variant())); + } + private: + class Construct_opposite_2_visitor + : public boost::static_visitor + { + public: + X_monotone_curve_2 operator()(const Non_vertical_x_curve_2& xcv ) const + { + return _traits.construct_opposite_2_object()(xcv); + } + X_monotone_curve_2 operator()(const Vertical_segment& xcv) const + { + CGAL_precondition (false); + return Vertical_segment(); + } + }; //Construct_opposite_2_visitor + + }; // Construct_opposite_2 + + Construct_opposite_2 construct_opposite_2_object() const + { + return Construct_opposite_2(); + } +public: + template + static void re_cast_object_vector(const Object_vector& vec,OutputIterator& oi) + { + for (Object_vector::const_iterator it = vec.begin() ; it != vec.end(); ++it) + { + X_monotone_curve_2 curr; + CGAL::Object obj = *it; + + Point_2 p; + std::pair ip; + Non_vertical_x_curve_2 xc; + Vertical_segment xv; + + if (assign(p, obj)) + { + curr = p; + *oi = make_object (curr); + } + else if (assign (xc,obj)) + { + curr = xc; + *oi = make_object (curr); + } + else if (assign (xv,obj)) + { + curr = xv; + *oi = make_object (curr); + } + else if (assign(ip, obj)) + { + *oi = make_object (ip); + } + else + CGAL_precondition(false); + + ++oi; + } + return; + } +}; + +} //namespace CGAL { + + +#endif //CGAL_ARR_RATIONAL_ARC_TRAITS_D_1_H diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_face_index_map.h b/Arrangement_on_surface_2/include/CGAL/Arr_face_index_map.h index 151d3bd1194..00cd53d8cb1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_face_index_map.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_face_index_map.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_face_map.h b/Arrangement_on_surface_2/include/CGAL/Arr_face_map.h index da394d194c3..686f5290358 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_face_map.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_face_map.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_partition_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_partition_traits_2.h index 97c1431a1c9..1d7b030d8f4 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_partition_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_partition_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -312,7 +312,7 @@ public: #endif // CGAL_ARR_GEODESIC_ARC_ON_SPHERE_PARTITION_TRAITS_2_H -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under 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 bc433c102fa..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -67,10 +67,10 @@ public: typedef Tag_true Has_merge_category; typedef Tag_false Has_do_intersect_category; - typedef Arr_identified_side_tag Arr_left_side_category; - typedef Arr_contracted_side_tag Arr_bottom_side_category; - typedef Arr_contracted_side_tag Arr_top_side_category; - typedef Arr_identified_side_tag Arr_right_side_category; + typedef Arr_identified_side_tag Left_side_category; + typedef Arr_contracted_side_tag Bottom_side_category; + typedef Arr_contracted_side_tag Top_side_category; + typedef Arr_identified_side_tag Right_side_category; /*! Default constructor */ Arr_geodesic_arc_on_sphere_traits_2(){} @@ -86,7 +86,7 @@ protected: /*! Obtain the possitive (north) pole * \return the possitive (north) pole */ - inline static const Direction_3 & pos_pole() + inline static const Direction_3& pos_pole() { static const Direction_3 d(0, 0, 1); return d; @@ -95,7 +95,7 @@ protected: /*! Obtain the negative (south) pole * \return the negative (south) pole */ - inline static const Direction_3 & neg_pole() + inline static const Direction_3& neg_pole() { static const Direction_3 d(0, 0, -1); return d; @@ -106,7 +106,7 @@ protected: * (x = -infinity). * \return the intersection of the identification arc and the xy plane. */ - inline static const Direction_2 & identification_xy() + inline static const Direction_2& identification_xy() { #if (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_1_Y_0) static const Direction_2 d(-1, 0); @@ -125,7 +125,7 @@ protected: * (y = infinity). * \return the normal of the plane that contains the identification arc. */ - inline static const Direction_3 & identification_normal() + inline static const Direction_3& identification_normal() { #if (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_1_Y_0) static const Direction_3 d(0, 1, 0); @@ -142,7 +142,7 @@ protected: /*! Obtain the 2D direction directed along the negative x axis * \return the direction directed at x = -infinity */ - inline static const Direction_2 & neg_x_2() + inline static const Direction_2& neg_x_2() { static const Direction_2 d(-1, 0); return d; @@ -151,7 +151,7 @@ protected: /*! Obtain the 2D direction directed along the negative y axis * \return the direction directed at y = -infinity */ - inline static const Direction_2 & neg_y_2() + inline static const Direction_2& neg_y_2() { static const Direction_2 d(0, -1); return d; @@ -175,27 +175,27 @@ protected: */ inline static Sign z_sign(Direction_3 d) { return CGAL::sign(d.dz()); } - typedef Direction_2 (*Project)(const Direction_3 & d) ; + typedef Direction_2 (*Project)(const Direction_3& d) ; /*! Project a 3D direction onto the xy-plane * \param d the 3D direction * \return the projection onto the xy-plane */ - inline static Direction_2 project_xy(const Direction_3 & d) + inline static Direction_2 project_xy(const Direction_3& d) { return Direction_2(d.dx(), d.dy()); } /*! Project a 3D direction onto the yz-plane * \param d the 3D direction * \return the projection onto the yz-plane */ - inline static Direction_2 project_yz(const Direction_3 & d) + inline static Direction_2 project_yz(const Direction_3& d) { return Direction_2(d.dy(), d.dz()); } /*! Project a 3D direction onto the zx-plane * \param d the 3D direction * \return the projection onto the xz-plane */ - inline static Direction_2 project_xz(const Direction_3 & d) + inline static Direction_2 project_xz(const Direction_3& d) { return Direction_2(d.dx(), d.dz()); } /*! Compare the relative position of a direction and a plane given by its @@ -203,7 +203,7 @@ protected: * \param normal the direction of the plane. * \param dir the direction. */ - inline Oriented_side oriented_side(const Direction_3 & normal, + inline Oriented_side oriented_side(const Direction_3& normal, const Direction_3 dir) const { FT dot = normal.vector() * dir.vector(); @@ -215,8 +215,8 @@ protected: * \param d2 the second direction. * \return the relative orientation of d1 and d2. */ - static inline Orientation orientation(const Direction_2 & d1, - const Direction_2 & d2) + static inline Orientation orientation(const Direction_2& d1, + const Direction_2& d2) { Kernel kernel; return kernel.orientation_2_object()(d1.vector(), d2.vector()); @@ -229,7 +229,7 @@ protected: * \return true if dir is contained in plane; false otherwise. * \pre the plane contains the origin. */ - inline bool has_on(const Direction_3 & normal, const Direction_3 & dir) const + inline bool has_on(const Direction_3& normal, const Direction_3& dir) const { FT dot = normal.vector() * dir.vector(); return CGAL::sign(dot) == ZERO; @@ -243,8 +243,8 @@ public: * EQUAL - v(d1) = v(d2); * LARGER - v(d1) > v(d2). */ - inline Comparison_result compare_y(const Direction_3 & d1, - const Direction_3 & d2) const + inline Comparison_result compare_y(const Direction_3& d1, + const Direction_3& d2) const { Vector_3 v1 = d1.vector(); Vector_3 v2 = d2.vector(); @@ -278,12 +278,12 @@ public: * EQUAL - u(d1) = u(d2); * LARGER - u(d1) > u(d2). */ - inline Comparison_result compare_x(const Direction_2 & d1, - const Direction_2 & d2) const + inline Comparison_result compare_x(const Direction_2& d1, + const Direction_2& d2) const { - const Kernel * kernel = this; + const Kernel* kernel = this; if (kernel->equal_2_object()(d1, d2)) return EQUAL; - const Direction_2 & d = identification_xy(); + const Direction_2& d = identification_xy(); return (kernel->counterclockwise_in_between_2_object()(d, d1, d2)) ? LARGER : SMALLER; } @@ -297,8 +297,8 @@ public: * \pre d1 does not coincide with any pole. * \pre d2 does not coincide with any pole. */ - inline Comparison_result compare_x(const Direction_3 & d1, - const Direction_3 & d2) const + inline Comparison_result compare_x(const Direction_3& d1, + const Direction_3& d2) const { // Compare the projections onto the xy plane: Direction_2 d1_2 = project_xy(d1); @@ -317,8 +317,8 @@ public: * \pre d1 does not lie on the discontinuity arc. * \pre d2 does not lie on the discontinuity arc. */ - inline Comparison_result compare_xy(const Direction_3 & d1, - const Direction_3 & d2) const + inline Comparison_result compare_xy(const Direction_3& d1, + const Direction_3& d2) const { Comparison_result res = compare_x(d1, d2); if (res == EQUAL) return compare_y(d1, d2); @@ -342,12 +342,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_x_2(const Traits * traits) : m_traits(traits) {} + Compare_x_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -361,7 +361,7 @@ public: * \pre p1 does not lie on the boundary. * \pre p2 does not lie on the boundary. */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { CGAL_precondition(p1.is_no_boundary()); CGAL_precondition(p2.is_no_boundary()); @@ -381,12 +381,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_xy_2(const Traits * traits) : m_traits(traits) {} + Compare_xy_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -402,7 +402,7 @@ public: * \pre p1 does not lie on the boundary. * \pre p2 does not lie on the boundary. */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { CGAL_precondition(p1.is_no_boundary()); CGAL_precondition(p2.is_no_boundary()); @@ -421,7 +421,7 @@ public: * \param xc the arc. * \return the left endpoint. */ - const Point_2 & operator()(const X_monotone_curve_2 & xc) const + const Point_2& operator()(const X_monotone_curve_2& xc) const { return xc.left(); } }; @@ -436,7 +436,7 @@ public: * \param xc the arc. * \return the right endpoint. */ - const Point_2 & operator()(const X_monotone_curve_2 & xc) const + const Point_2& operator()(const X_monotone_curve_2& xc) const { return xc.right(); } }; @@ -452,7 +452,7 @@ public: * \return true if the curve is a vertical spherical_arc; false otherwise. * \pre the arc is not degenerate (consists of a single point) */ - bool operator()(const X_monotone_curve_2 & xc) const + bool operator()(const X_monotone_curve_2& xc) const { CGAL_precondition(!xc.is_degenerate()); return xc.is_vertical(); @@ -470,12 +470,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_y_at_x_2(const Traits * traits) : m_traits(traits) {} + Compare_y_at_x_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -489,8 +489,8 @@ public: * \pre p is not a construction point. * \pre p is in the x-range of xc. */ - Comparison_result operator()(const Point_2 & p, - const X_monotone_curve_2 & xc) const + Comparison_result operator()(const Point_2& p, + const X_monotone_curve_2& xc) const { CGAL_precondition(!p.is_min_boundary() && !p.is_max_boundary()); CGAL_precondition(xc.is_in_x_range(p)); @@ -530,12 +530,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_y_at_x_left_2(const Traits * traits) : m_traits(traits) {} + Compare_y_at_x_left_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -551,9 +551,9 @@ public: * defined (lexicographically) to its left. * \pre the arcs are not degenerate */ - Comparison_result operator()(const X_monotone_curve_2 & xc1, - const X_monotone_curve_2 & xc2, - const Point_2 & p) const + Comparison_result operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2, + const Point_2& p) const { CGAL_precondition(!xc1.is_degenerate()); CGAL_precondition(!xc2.is_degenerate()); @@ -568,8 +568,8 @@ public: // Non of the arc is verticel. Thus, non of the endpoints coincide with // a pole. // Compare the y-coord. at the x-coord of the most right left-endpoint. - const Point_2 & l1 = xc1.left(); - const Point_2 & l2 = xc2.left(); + const Point_2& l1 = xc1.left(); + const Point_2& l2 = xc2.left(); if (!l1.is_no_boundary()) { // use l2 and xc1: Oriented_side os = m_traits->oriented_side(xc1.normal(), l2); @@ -616,12 +616,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_y_at_x_right_2(const Traits * traits) : m_traits(traits) {} + Compare_y_at_x_right_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -637,8 +637,8 @@ public: * defined to its right (lexicographically). * \pre the arcs are not degenerate */ - Comparison_result operator()(const X_monotone_curve_2 & xc1, - const X_monotone_curve_2 & xc2, + Comparison_result operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2, const Point_2 &) const { CGAL_precondition(!xc1.is_degenerate()); @@ -655,8 +655,8 @@ public: // Non of the arcs is verticel. Thus, non of the endpoints coincide with // a pole. // Compare the y-coord. at the x-coord of the most left right-endpoint. - const Point_2 & r1 = xc1.right(); - const Point_2 & r2 = xc2.right(); + const Point_2& r1 = xc1.right(); + const Point_2& r2 = xc2.right(); if (!r1.is_no_boundary()) { // use r2 and xc1: Oriented_side os = m_traits->oriented_side(xc1.normal(), r2); @@ -702,12 +702,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Equal_2(const Traits * traits) : m_traits(traits) {} + Equal_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -718,10 +718,10 @@ public: * \param xc2 the second curve. * \return true if the two curves are the same; false otherwise. */ - bool operator()(const X_monotone_curve_2 & xc1, - const X_monotone_curve_2 & xc2) const + bool operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2) const { - const Kernel * kernel = m_traits; + const Kernel* kernel = m_traits; typename Kernel::Equal_3 equal_3 = kernel->equal_3_object(); if (xc1.is_full() || xc2.is_full()) { return (xc1.is_full() && xc2.is_full() && @@ -737,9 +737,9 @@ public: * \param p2 the second point. * \return true if the two point are the same; false otherwise. */ - bool operator()(const Point_2 & p1, const Point_2 & p2) const + bool operator()(const Point_2& p1, const Point_2& p2) const { - const Kernel * kernel = m_traits; + const Kernel* kernel = m_traits; return kernel->equal_3_object()(p1, p2); } }; @@ -774,7 +774,7 @@ public: * the left at the arc right end. * \pre xcv does not coincide with the vertical identification arc. */ - Arr_parameter_space operator()(const X_monotone_curve_2 & xcv, + Arr_parameter_space operator()(const X_monotone_curve_2& xcv, Arr_curve_end ce) const { if (xcv.is_vertical()) { @@ -830,7 +830,7 @@ public: * right end. * There are no horizontal identification arcs! */ - Arr_parameter_space operator()(const X_monotone_curve_2 & xcv, + Arr_parameter_space operator()(const X_monotone_curve_2& xcv, Arr_curve_end ce) const { return (ce == ARR_MIN_END) ? @@ -856,27 +856,28 @@ public: Parameter_space_in_y_2 parameter_space_in_y_2_object() const { return Parameter_space_in_y_2(); } - /*! A functor that compares the x-coordinates of arc ends near the + + /*! A functor that compares the x-coordinate of arc ends and points on the * boundary of the parameter space. */ - class Compare_x_near_boundary_2 { + class Compare_x_on_boundary_2 { protected: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_x_near_boundary_2(const Traits * traits) : m_traits(traits) {} + Compare_x_on_boundary_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; public: - /*! Compare the x-coordinate of a direction with the x-coordinate of an - * arc end near the boundary. - * \param p the point direction. + /*! Compare the x-limit of a direction with the x-coordinate of an + * arc end on the boundary. + * \param point the point direction. * \param xcv the arc, the endpoint of which is compared. * \param ce the arc-end indicator - * ARR_MIN_END - the minimal end of xc or @@ -886,40 +887,30 @@ public: * EQUAL - x(p) = x(xc, ce); * LARGER - x(p) > x(xc, ce). * \pre p lies in the interior of the parameter space. - * \pre the ce end of the arc xcv lies on a boundary. + * \pre the ce end of the arc xcv lies on a pole (implying ce is vertical). * \pre xcv does not coincide with the vertical identification curve. */ - Comparison_result operator()(const Point_2 & point, - const X_monotone_curve_2 & xcv, + Comparison_result operator()(const Point_2& point, + const X_monotone_curve_2& xcv, Arr_curve_end ce) const { CGAL_precondition(point.is_no_boundary()); CGAL_precondition_code - (const Point_2 & p2 = (ce == ARR_MIN_END) ? xcv.left() : xcv.right();); + (const Point_2& p2 = (ce == ARR_MIN_END) ? xcv.left() : xcv.right();); CGAL_precondition(!p2.is_no_boundary()); + CGAL_precondition(xcv.is_vertical()); - if (xcv.is_vertical()) { - CGAL_precondition(!xcv.is_on_boundary()); + CGAL_precondition(!xcv.is_on_boundary()); - /* The following is replaced by the precondition above. - * If xc coincides with the discontinuity arc, all its points are - * assumed to be smaller than non-boundary points: - * if (xcv.is_on_boundary()) return LARGER; - */ - - // xcv is vertical, but does not coincide with the discontinuity arc. - // Obtain the direction contained in the underlying plane, which is - // also on the xy-plane: - Direction_3 normal = xcv.normal(); - Direction_2 q = (xcv.is_directed_right()) ? - Direction_2(-(normal.dy()), normal.dx()) : - Direction_2(normal.dy(), -(normal.dx())); - Direction_2 p = Traits::project_xy(point); - return m_traits->compare_x(p, q); - } - - // xcv is not a vertical sphercial_arc: - return (ce == ARR_MIN_END) ? LARGER : SMALLER; + // xcv is vertical, but does not coincide with the discontinuity arc. + // Obtain the direction contained in the underlying plane, which is + // also on the xy-plane: + Direction_3 normal = xcv.normal(); + Direction_2 q = (xcv.is_directed_right()) ? + Direction_2(-(normal.dy()), normal.dx()) : + Direction_2(normal.dy(), -(normal.dx())); + Direction_2 p = Traits::project_xy(point); + return m_traits->compare_x(p, q); } /*! Compare the x-coordinates of 2 arc ends near the boundary of the @@ -936,64 +927,117 @@ public: * SMALLER - x(xcv1, ce1) < x(xcv2, ce2); * EQUAL - x(xcv1, ce1) = x(xcv2, ce2); * LARGER - x(xcv1, ce1) > x(xcv2, ce2). - * \pre the ce1 end of the arc xcv1 lies on a boundary. - * \pre the ce2 end of the arc xcv2 lies on a boundary. + * \pre the ce1 end of the arc xcv1 lies on a pole (implying ce1 is + * vertical). + * \pre the ce2 end of the arc xcv2 lies on a pole (implying ce2 is + * vertical). * \pre xcv1 does not coincide with the vertical identification curve. * \pre xcv2 does not coincide with the vertical identification curve. */ - Comparison_result operator()(const X_monotone_curve_2 & xcv1, + Comparison_result operator()(const X_monotone_curve_2& xcv1, Arr_curve_end ce1, - const X_monotone_curve_2 & xcv2, + const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const { CGAL_precondition_code - (const Point_2 & p1 = (ce1 == ARR_MIN_END) ? xcv1.left() : xcv1.right();); + (const Point_2& p1 = (ce1 == ARR_MIN_END) ? xcv1.left() : xcv1.right();); CGAL_precondition(!p1.is_no_boundary()); CGAL_precondition_code - (const Point_2 & p2 = (ce2 == ARR_MIN_END) ? xcv2.left() : xcv2.right();); + (const Point_2& p2 = (ce2 == ARR_MIN_END) ? xcv2.left() : xcv2.right();); CGAL_precondition(!p2.is_no_boundary()); - if (xcv1.is_vertical() && xcv2.is_vertical()) { - CGAL_precondition(!xcv1.is_on_boundary()); - CGAL_precondition(!xcv2.is_on_boundary()); + CGAL_precondition(xcv1.is_vertical()); + CGAL_precondition(xcv2.is_vertical()); - /* The following is replaced by the code above - * if (xcv1.is_on_boundary() && xcv2.is_on_boundary()) return EQUAL; - * if (xcv1.is_on_boundary()) return SMALLER; - * if (xcv2.is_on_boundary()) return LARGER; - */ - - // Non of the arcs coincide with the discontinuity arc: - // Obtain the directions contained in the underlying planes, which are - // also on the xy-plane: - Direction_3 normal1 = xcv1.normal(); - Direction_2 p = (xcv1.is_directed_right()) ? - Direction_2(-(normal1.dy()), normal1.dx()) : - Direction_2(normal1.dy(), -(normal1.dx())); - Direction_3 normal2 = xcv2.normal(); - Direction_2 q = (xcv2.is_directed_right()) ? - Direction_2(-(normal2.dy()), normal2.dx()) : - Direction_2(normal2.dy(), -(normal2.dx())); - return m_traits->compare_x(p, q); - } - if (xcv1.is_vertical()) { - CGAL_precondition(!xcv1.is_on_boundary()); - /* The following is replaced by the code above - * if (xcv1.is_on_boundary()) return SMALLER; - */ - return (ce2 == ARR_MAX_END) ? SMALLER : LARGER; - } - if (xcv2.is_vertical()) { - CGAL_precondition(!xcv2.is_on_boundary()); - /* The following is replaced by the code above - * if (xcv2.is_on_boundary()) return LARGER; - */ - return (ce1 == ARR_MAX_END) ? LARGER : SMALLER; - } - // Non of the arcs are vertical: - if (ce1 == ce2) return EQUAL; - if (ce1 == ARR_MIN_END) return SMALLER; - return LARGER; + CGAL_precondition(!xcv1.is_on_boundary()); + CGAL_precondition(!xcv2.is_on_boundary()); + + // Non of the arcs coincide with the discontinuity arc: + // Obtain the directions contained in the underlying planes, which are + // also on the xy-plane: + Direction_3 normal1 = xcv1.normal(); + Direction_2 p = (xcv1.is_directed_right()) ? + Direction_2(-(normal1.dy()), normal1.dx()) : + Direction_2(normal1.dy(), -(normal1.dx())); + Direction_3 normal2 = xcv2.normal(); + Direction_2 q = (xcv2.is_directed_right()) ? + Direction_2(-(normal2.dy()), normal2.dx()) : + Direction_2(normal2.dy(), -(normal2.dx())); + return m_traits->compare_x(p, q); + } + + /*! Compare the x-coordinate of two given points that lie on the + * horizontal identification arc. + * \param p1 the first point. + * \param p2 the second point. + * There is no horizontal identification arc! + */ + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const + { + CGAL_error_msg("There is no horizontal identification arc!"); + return SMALLER; + } + }; + + /*! Obtain a Compare_x_on_boundary_2 function object */ + Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const + { return Compare_x_on_boundary_2(this); } + + + /*! A functor that compares the x-coordinates of arc ends near the + * boundary of the parameter space. + */ + class Compare_x_near_boundary_2 { + protected: + typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Compare_x_near_boundary_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_geodesic_arc_on_sphere_traits_2; + + public: + + /*! Compare the x-coordinates of 2 arc ends near the boundary of the + * parameter space. + * \param xcv1 the first arc. + * \param xcv2 the second arc. + * \param ce the curve end indicator - + * ARR_MIN_END - the minimal end of curves or + * ARR_MAX_END - the maximal end of curves. + * \return the second comparison result: + * SMALLER - x(xcv1, ce) < x(xcv2, ce); + * EQUAL - x(xcv1, ce) = x(xcv2, ce); + * LARGER - x(xcv1, ce) > x(xcv2, ce). + * \pre the ce end of the arc xcv1 lies on a pole. + * \pre the ce end of the arc xcv2 lies on a pole. + * \pre the the $x$-coordinates of xcv1 and xcv2 at their ce end are + * equal (implying that the curves overlap). + * \pre xcv1 does not coincide with the vertical identification curve. + * \pre xcv2 does not coincide with the vertical identification curve. + */ + Comparison_result operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, + Arr_curve_end ce) const + { + CGAL_precondition_code + (const Point_2& p1 = (ce == ARR_MIN_END) ? xcv1.left() : xcv1.right();); + CGAL_precondition(!p1.is_no_boundary()); + CGAL_precondition_code + (const Point_2& p2 = (ce == ARR_MIN_END) ? xcv2.left() : xcv2.right();); + CGAL_precondition(!p2.is_no_boundary()); + + CGAL_precondition(xcv1.is_vertical()); + CGAL_precondition(xcv2.is_vertical()); + CGAL_precondition(!xcv1.is_on_boundary()); + CGAL_precondition(!xcv2.is_on_boundary()); + + return EQUAL; } }; @@ -1010,12 +1054,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_y_near_boundary_2(const Traits * traits) : m_traits(traits) {} + Compare_y_near_boundary_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -1027,20 +1071,21 @@ public: * \param ce the arc end indicator. * \return the second comparison result. * \pre the ce ends of the arcs xcv1 and xcv2 lie either on the left - * boundary or on the right boundary of the parameter space. + * boundary or on the right boundary of the parameter space (implying + * that they cannot be vertical). * There is no horizontal identification curve! */ - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, + Comparison_result operator()(const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, Arr_curve_end ce) const { CGAL_precondition(!xcv1.is_degenerate()); CGAL_precondition(!xcv2.is_degenerate()); - const Point_2 & l1 = xcv1.left(); - const Point_2 & r1 = xcv1.right(); - const Point_2 & l2 = xcv2.left(); - const Point_2 & r2 = xcv2.right(); + const Point_2& l1 = xcv1.left(); + const Point_2& r1 = xcv1.right(); + const Point_2& l2 = xcv2.left(); + const Point_2& r2 = xcv2.right(); // If xcv1 is vertical, xcv1 coincides with the discontinuity arc: if (xcv1.is_vertical()) { @@ -1153,7 +1198,7 @@ public: * \return a Boolean indicating whether p lies on the horizontal * identification arc. */ - bool operator()(const Point_2 & p) const + bool operator()(const Point_2& p) const { CGAL_error_msg("There is no horizontal identification arc!"); return false; @@ -1165,7 +1210,7 @@ public: * \return a Boolean indicating whether xcv coincides with the horizontal * identification arc. */ - bool operator()(const X_monotone_curve_2 & xcv) const + bool operator()(const X_monotone_curve_2& xcv) const { CGAL_error_msg("There is no horizontal identification arc!"); return false; @@ -1184,12 +1229,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Is_on_y_identification_2(const Traits * traits) : m_traits(traits) {} + Is_on_y_identification_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -1199,7 +1244,7 @@ public: * \return a Boolean indicating whether p lies on the vertical * identification arc. */ - bool operator()(const Point_2 & p) const { return p.is_mid_boundary(); } + bool operator()(const Point_2& p) const { return p.is_mid_boundary(); } /*! Determine whether an arc coincides with the vertical identification * arc. @@ -1207,7 +1252,7 @@ public: * \return a Boolean indicating whether xcv coincides with the vertical * identification arc. */ - bool operator()(const X_monotone_curve_2 & xcv) const + bool operator()(const X_monotone_curve_2& xcv) const { return xcv.is_on_boundary(); } }; @@ -1215,29 +1260,6 @@ public: Is_on_y_identification_2 is_on_y_identification_2_object() const { return Is_on_y_identification_2(this); } - /*! A functor that compares the x-coordinate of two given points - * that lie on the horizontal identification arc. - * The parameter space does not contain a horizontal identification arc. - */ - class Compare_x_on_boundary_2 { - public: - /*! Compare the x-coordinate of two given points that lie on the - * horizontal identification arc. - * \param p1 the first point. - * \param p2 the second point. - * There is no horizontal identification arc! - */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const - { - CGAL_error_msg("There is no horizontal identification arc!"); - return SMALLER; - } - }; - - /*! Obtain a Compare_x_on_boundary_2 function object */ - Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const - { return Compare_x_on_boundary_2(); } - /*! A functor that compares the y-coordinate of two given points * that lie on the vertical identification arc. */ @@ -1246,12 +1268,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Compare_y_on_boundary_2(const Traits * traits) : m_traits(traits) {} + Compare_y_on_boundary_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -1266,7 +1288,7 @@ public: * \pre p1 lies on the vertical identification arc. * \pre p2 lies on the vertical identification arc. */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const { CGAL_precondition(!p1.is_no_boundary()); CGAL_precondition(!p2.is_no_boundary()); @@ -1290,12 +1312,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Make_x_monotone_2(const Traits * traits) : m_traits(traits) {} + Make_x_monotone_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -1310,7 +1332,7 @@ public: * \return the past-the-end iterator. */ template - OutputIterator operator()(const Curve_2 & c, OutputIterator oi) const + OutputIterator operator()(const Curve_2& c, OutputIterator oi) const { if (c.is_degenerate()) { // The spherical_arc is a degenerate point - wrap it with an object: @@ -1321,7 +1343,7 @@ public: if (c.is_x_monotone()) { // The spherical arc is monotone - wrap it with an object: // *oi++ = make_object(X_monotone_curve_2(c)); - const X_monotone_curve_2 * xc = &c; + const X_monotone_curve_2* xc = &c; *oi++ = make_object(*xc); return oi; } @@ -1330,8 +1352,8 @@ public: // The spherical arc is full if (c.is_vertical()) { // The arc is vertical => divide it into 2 half arcs; - const Direction_3 & np = m_traits->neg_pole(); - const Direction_3 & pp = m_traits->pos_pole(); + const Direction_3& np = m_traits->neg_pole(); + const Direction_3& pp = m_traits->pos_pole(); X_monotone_curve_2 xc1(np, pp, c.normal(), true, true); X_monotone_curve_2 xc2(pp, np, c.normal(), true, false); *oi++ = make_object(xc1); @@ -1358,16 +1380,16 @@ public: return oi; } - const Point_2 & source = c.source(); - const Point_2 & target = c.target(); - const Direction_3 & normal = c.normal(); + const Point_2& source = c.source(); + const Point_2& target = c.target(); + const Direction_3& normal = c.normal(); if (c.is_vertical()) { /* If one of the endpoints coincide with a pole, divide the arc at * the opposite pole: */ - const Direction_3 & np = m_traits->neg_pole(); - const Direction_3 & pp = m_traits->pos_pole(); + const Direction_3& np = m_traits->neg_pole(); + const Direction_3& pp = m_traits->pos_pole(); if (source.is_min_boundary() || target.is_min_boundary()) { X_monotone_curve_2 xc1(source, pp, normal, true, true); X_monotone_curve_2 xc2(pp, target, normal, true, false); @@ -1398,7 +1420,7 @@ public: } bool ccw = ((plane_is_positive && s_is_positive) || (!plane_is_positive && !s_is_positive)); - const Point_2 & pole1 = (ccw) ? pp : np; + const Point_2& pole1 = (ccw) ? pp : np; X_monotone_curve_2 xc1(source, pole1, normal, true, ccw); *oi++ = make_object(xc1); if (s_is_positive != t_is_positive) { @@ -1408,7 +1430,7 @@ public: return oi; } // Construct 2 more arcs: - const Point_2 & pole2 = (ccw) ? np : pp; + const Point_2& pole2 = (ccw) ? np : pp; X_monotone_curve_2 xc2(pole1, pole2, normal, true, !ccw); *oi++ = make_object(xc2); X_monotone_curve_2 xc3(pole2, target, normal, true, ccw); @@ -1422,7 +1444,7 @@ public: Direction_3(-(normal.dz()), 0, normal.dx()) : Direction_3(normal.dz(), 0, -(normal.dx())); #else - const Direction_2 & xy = Traits::identification_xy(); + const Direction_2& xy = Traits::identification_xy(); FT x = xy.dx(); FT y = xy.dy(); FT z((xy.dx() * normal.dx() + xy.dy() * normal.dy()) / -(normal.dz())); @@ -1431,8 +1453,8 @@ public: Point_2 p(dp, Point_2::MID_BOUNDARY_LOC); Direction_2 s = Traits::project_xy(source); Direction_2 t = Traits::project_xy(target); - const Direction_2 & d = Traits::identification_xy(); - const Kernel * kernel = m_traits; + const Direction_2& d = Traits::identification_xy(); + const Kernel* kernel = m_traits; bool directed_right = kernel->counterclockwise_in_between_2_object()(d, s, t); @@ -1454,12 +1476,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Split_2(const Traits * traits) : m_traits(traits) {} + Split_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -1474,13 +1496,13 @@ public: * \pre p lies on xc but is not one of its endpoints. * \pre xc is not degenerate */ - void operator()(const X_monotone_curve_2 & xc, const Point_2 & p, - X_monotone_curve_2 & xc1, X_monotone_curve_2 & xc2) const + void operator()(const X_monotone_curve_2& xc, const Point_2& p, + X_monotone_curve_2& xc1, X_monotone_curve_2& xc2) const { CGAL_precondition(!xc.is_degenerate()); - const Point_2 & source = xc.source(); - const Point_2 & target = xc.target(); - CGAL_precondition_code(const Kernel * kernel = m_traits); + const Point_2& source = xc.source(); + const Point_2& target = xc.target(); + CGAL_precondition_code(const Kernel* kernel = m_traits); CGAL_precondition_code (typename Kernel::Equal_3 equal_3 = kernel->equal_3_object()); CGAL_precondition(!equal_3(p, source)); @@ -1522,20 +1544,20 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Clockwise_in_between_2(const Traits * traits) : m_traits(traits) {} + Clockwise_in_between_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; public: - bool operator()(const Direction_2 & d, - const Direction_2 & d1, const Direction_2 & d2) const + bool operator()(const Direction_2& d, + const Direction_2& d1, const Direction_2& d2) const { - const Kernel * kernel = m_traits; + const Kernel* kernel = m_traits; return kernel->counterclockwise_in_between_2_object()(d, d2, d1); } }; @@ -1561,19 +1583,19 @@ public: * \param oi - the output iterator */ template - OutputIterator compute_intersection(const Point_2 & l1_3, + OutputIterator compute_intersection(const Point_2& l1_3, const Point_2 r1_3, - const Point_2 & l2_3, + const Point_2& l2_3, const Point_2 r2_3, - const Direction_3 & normal, + const Direction_3& normal, bool vertical, - const Direction_2 & start, - const In_between & in_between, + const Direction_2& start, + const In_between& in_between, Project project, OutputIterator oi) const { - typedef std::pair Point_2_pair; - const Kernel * kernel = m_traits; + typedef std::pair Point_2_pair; + const Kernel* kernel = m_traits; typename Kernel::Equal_2 equal = kernel->equal_2_object(); Direction_2 l1 = project(l1_3); @@ -1582,7 +1604,7 @@ public: Direction_2 r2 = project(r2_3); if (equal(l1, l2)) { - const Point_2 & trg = (in_between(r1, l2, r2)) ? r1_3 : r2_3; + const Point_2& trg = (in_between(r1, l2, r2)) ? r1_3 : r2_3; X_monotone_curve_2 xc(l1_3, trg, normal, vertical, true); *oi++ = make_object(xc); return oi; @@ -1600,7 +1622,7 @@ public: *oi++ = make_object(Point_2_pair(r1_3, 1)); return oi; } - const Point_2 & trg = (in_between(r1, l2, r2)) ? r1_3 : r2_3; + const Point_2& trg = (in_between(r1, l2, r2)) ? r1_3 : r2_3; X_monotone_curve_2 xc(l2_3, trg, normal, vertical, true); *oi++ = make_object(xc); return oi; @@ -1614,7 +1636,7 @@ public: *oi++ = make_object(Point_2_pair(r2_3, 1)); return oi; } - const Point_2 & trg = (in_between(r1, l2, r2)) ? r1_3 : r2_3; + const Point_2& trg = (in_between(r1, l2, r2)) ? r1_3 : r2_3; X_monotone_curve_2 xc(l1_3, trg, normal, vertical, true); *oi++ = make_object(xc); return oi; @@ -1626,14 +1648,14 @@ public: * \return true iff point pierces xc. * \pre point lies in the underlying plane of xc. */ - bool is_in_between(const Point_2 & point, - const X_monotone_curve_2 & xc) const + bool is_in_between(const Point_2& point, + const X_monotone_curve_2& xc) const { - const Kernel * kernel = m_traits; + const Kernel* kernel = m_traits; CGAL_precondition(m_traits->has_on(xc.normal(), point)); - const Point_2 & left = xc.left(); - const Point_2 & right = xc.right(); + const Point_2& left = xc.left(); + const Point_2& right = xc.right(); // Handle the poles: if (point.is_max_boundary()) return (right.is_max_boundary()); @@ -1680,12 +1702,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Intersect_2(const Traits * traits) : m_traits(traits) {} + Intersect_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -1700,8 +1722,8 @@ public: * \pre xc1 and xc2 are not degenerate */ template - OutputIterator operator()(const X_monotone_curve_2 & xc1, - const X_monotone_curve_2 & xc2, + OutputIterator operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2, OutputIterator oi) const { CGAL_precondition(!xc1.is_degenerate()); @@ -1715,12 +1737,12 @@ public: Clockwise_in_between_2; typedef typename Kernel::Equal_3 Equal_3; - typedef std::pair Point_2_pair; - const Kernel * kernel = m_traits; + typedef std::pair Point_2_pair; + const Kernel* kernel = m_traits; Equal_3 equal_3 = kernel->equal_3_object(); - const Direction_3 & normal1 = xc1.normal(); - const Direction_3 & normal2 = xc2.normal(); + const Direction_3& normal1 = xc1.normal(); + const Direction_3& normal2 = xc2.normal(); Direction_3 opposite_normal1 = kernel->construct_opposite_direction_3_object()(normal1); @@ -1761,7 +1783,7 @@ public: * it onto the xy plane. If the projection coincide with the negative * x, project onto the zx plane. Otherwise project onto the yz plane. */ - const Point_2 & point = + const Point_2& point = xc1.left().is_min_boundary() ? xc1.right() : xc1.left(); CGAL::Sign xsign = Traits::x_sign(normal1); @@ -1829,12 +1851,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Are_mergeable_2(const Traits * traits) : m_traits(traits) {} + Are_mergeable_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -1847,8 +1869,8 @@ public: * 1. they are supported by the same plane, and * 2. share a common endpoint that is not on the identification arc */ - bool operator()(const X_monotone_curve_2 & xc1, - const X_monotone_curve_2 & xc2) const + bool operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2) const { //! \todo temporary: return false; @@ -1856,7 +1878,7 @@ public: if (xc1.is_empty() || xc2.is_empty()) return true; if (xc1.is_full() && xc2.is_full()) return false; - const Kernel * kernel = m_traits; + const Kernel* kernel = m_traits; typename Kernel::Equal_3 equal = kernel->equal_3_object(); if (xc1.is_degenerate() && xc2.is_degenerate()) @@ -1866,8 +1888,8 @@ public: if (xc2.is_full() && xc1.is_degenerate()) return xc2.has_on(xc1.left()); - const Direction_3 & normal1 = xc1.normal(); - const Direction_3 & normal2 = xc2.normal(); + const Direction_3& normal1 = xc1.normal(); + const Direction_3& normal2 = xc2.normal(); Direction_3 opposite_normal1 = kernel->construct_opposite_direction_3_object()(normal1); if (!equal(normal1, normal2) && !equal(opposite_normal1, normal2)) @@ -1898,12 +1920,12 @@ public: typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) */ - Merge_2(const Traits * traits) : m_traits(traits) {} + Merge_2(const Traits* traits) : m_traits(traits) {} friend class Arr_geodesic_arc_on_sphere_traits_2; @@ -1912,13 +1934,11 @@ 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, - X_monotone_curve_2 & xc) const + void operator()(const X_monotone_curve_2& xc1, + const X_monotone_curve_2& xc2, + X_monotone_curve_2& xc) const { CGAL_precondition (m_traits->are_mergeable_2_object()(xc1, xc2) == true); @@ -1932,7 +1952,7 @@ public: return; } - const Kernel * kernel = m_traits; + const Kernel* kernel = m_traits; typename Kernel::Equal_3 equal = kernel->equal_3_object(); xc.set_is_degenerate(false); @@ -1944,7 +1964,7 @@ public: #if defined(CGAL_FULL_X_MONOTONE_GEODESIC_ARC_ON_SPHERE_IS_SUPPORTED) bool eq2 = equal(xc1.left(), xc2.right()); if (eq1 && eq2) { - const Point_2 & p = + const Point_2& p = xc1.source().is_mid_boundary() ? xc1.source() : xc1.target(); xc.set_source(p); xc.set_target(p); @@ -2000,7 +2020,7 @@ public: * \return an approximation of p's x-coordinate (if i == 0), or an * approximation of p's y-coordinate (if i == 1). */ - Approximate_number_type operator()(const Point_2 & p, int i) const + Approximate_number_type operator()(const Point_2& p, int i) const { CGAL_precondition(i == 0 || i == 1); return (i == 0) ? CGAL::to_double(p.x()) : CGAL::to_double(p.y()); @@ -2019,7 +2039,7 @@ public: * \pre p and q must not be the same. * \return a spherical_arc connecting p and q. */ - X_monotone_curve_2 operator()(const Point_2 & p, const Point_2 & q) const + X_monotone_curve_2 operator()(const Point_2& p, const Point_2& q) const { return X_monotone_curve_2(p, q); } }; @@ -2042,7 +2062,7 @@ public: * \return SMALLER if the curve is directed right; * LARGER if the curve is directed left. */ - Comparison_result operator()(const X_monotone_curve_2 & xc) + Comparison_result operator()(const X_monotone_curve_2& xc) { return (xc.is_directed_right()) ? SMALLER : LARGER; } }; @@ -2056,7 +2076,7 @@ public: * \param xc the curve. * \return the opposite curve. */ - X_monotone_curve_2 operator()(const X_monotone_curve_2 & xc) + X_monotone_curve_2 operator()(const X_monotone_curve_2& xc) { return xc.opposite(); } }; @@ -2068,7 +2088,7 @@ public: #if 0 /*! Inserter for the spherical_arc class used by the traits-class */ template - friend OutputStream & operator<<(OutputStream & os, const Point_2 & p) + friend OutputStream& operator<<(OutputStream& os, const Point_2& p) { CGAL::To_double todouble; os << static_cast(todouble(p.dx())) << ", " @@ -2079,8 +2099,8 @@ public: /*! Inserter for the spherical_arc class used by the traits-class */ template - friend OutputStream & operator<<(OutputStream & os, - const X_monotone_curve_2 & xc) + friend OutputStream& operator<<(OutputStream& os, + const X_monotone_curve_2& xc) { os << "(" << xc.left() << "), (" << xc.right() << ")"; return os; @@ -2088,7 +2108,7 @@ public: /*! Extractor for the spherical_arc class used by the traits-class */ template - friend InputStream & operator>>(InputStream & is, X_monotone_curve_2 & arc) + friend InputStream& operator>>(InputStream& is, X_monotone_curve_2& arc) { std::cerr << "Not implemented yet!" << std::endl; return is; @@ -2135,7 +2155,7 @@ public: {} /*! Constructor */ - Arr_extended_direction_3(const Direction_3 & dir, Location_type location) : + Arr_extended_direction_3(const Direction_3& dir, Location_type location) : Direction_3(dir), m_location(location) {} @@ -2145,20 +2165,20 @@ public: * \param y the y coordinate * \param z the z coordinate */ - Arr_extended_direction_3(const FT & x, const FT & y, const FT & z) : + Arr_extended_direction_3(const FT& x, const FT& y, const FT& z) : Direction_3(x, y, z) { init(Direction_3(x, y, z)); } /*! Constructor from a direction * \param dir the direction */ - Arr_extended_direction_3(const Direction_3 & dir) : Direction_3(dir) + Arr_extended_direction_3(const Direction_3& dir) : Direction_3(dir) { init(dir); } /*! Initialize from a direction * \param dir the direction */ - void init(const Direction_3 & dir) + void init(const Direction_3& dir) { #if (CGAL_IDENTIFICATION_XY == CGAL_X_MINUS_1_Y_0) if (y_sign(dir) != ZERO) { @@ -2181,20 +2201,20 @@ public: Direction_2 dir_xy = Traits::project_xy(dir); Kernel kernel; typename Kernel::Equal_2 equal_2 = kernel.equal_2_object(); - const Direction_2 & xy = Traits::identification_xy(); + const Direction_2& xy = Traits::identification_xy(); m_location = equal_2(dir_xy, xy) ? MID_BOUNDARY_LOC : NO_BOUNDARY_LOC; #endif } /*! Copy constructor */ - Arr_extended_direction_3(const Arr_extended_direction_3 & ed) : + Arr_extended_direction_3(const Arr_extended_direction_3& ed) : Direction_3(static_cast(ed)) { m_location = ed.discontinuity_type(); } /*! Assignment operator */ - Arr_extended_direction_3 & operator=(const Arr_extended_direction_3 & ed) + Arr_extended_direction_3& operator=(const Arr_extended_direction_3& ed) { *(static_cast(this)) = static_cast(ed); m_location = ed.discontinuity_type(); @@ -2269,8 +2289,8 @@ protected: * \param d1 the first direction. * \param d2 the second direction. */ - inline Direction_3 construct_normal_3(const Direction_3 & d1, - const Direction_3 & d2) const + inline Direction_3 construct_normal_3(const Direction_3& d1, + const Direction_3& d2) const { Kernel kernel; Vector_3 v = kernel.construct_cross_product_vector_3_object()(d1.vector(), @@ -2298,9 +2318,9 @@ public: * \param is_degenerate is the arc degenerate (single point)? */ Arr_x_monotone_geodesic_arc_on_sphere_3 - (const Arr_extended_direction_3 & src, - const Arr_extended_direction_3 & trg, - const Direction_3 & normal, + (const Arr_extended_direction_3& src, + const Arr_extended_direction_3& trg, + const Direction_3& normal, bool is_vertical, bool is_directed_right, bool is_full = false, bool is_degenerate = false, bool is_empty = false) : m_source(src), @@ -2317,7 +2337,7 @@ public: * \param other the other arc */ Arr_x_monotone_geodesic_arc_on_sphere_3 - (const Arr_x_monotone_geodesic_arc_on_sphere_3 & other) + (const Arr_x_monotone_geodesic_arc_on_sphere_3& other) { m_source = other.m_source; m_target = other.m_target; @@ -2330,8 +2350,8 @@ public: } /*! Assignment operator */ - Arr_x_monotone_geodesic_arc_on_sphere_3 & operator= - (const Arr_x_monotone_geodesic_arc_on_sphere_3 & other) + Arr_x_monotone_geodesic_arc_on_sphere_3& operator= + (const Arr_x_monotone_geodesic_arc_on_sphere_3& other) { m_source = other.m_source; m_target = other.m_target; @@ -2359,8 +2379,8 @@ public: * \pre the source and target cannot be opposite of each other. */ Arr_x_monotone_geodesic_arc_on_sphere_3 - (const Arr_extended_direction_3 & source, - const Arr_extended_direction_3 & target) : + (const Arr_extended_direction_3& source, + const Arr_extended_direction_3& target) : m_source(source), m_target(target), m_is_full(false), @@ -2406,12 +2426,12 @@ public: Orientation orient = Traits::orientation(s, t); if (orient == COLLINEAR) { set_is_vertical(true); - const Direction_2 & nx = Traits::neg_x_2(); + const Direction_2& nx = Traits::neg_x_2(); if (Traits::orientation(nx, s) == COLLINEAR) { // Project onto xz plane: s = Traits::project_xz(source); t = Traits::project_xz(target); - const Direction_2 & ny = Traits::neg_y_2(); + const Direction_2& ny = Traits::neg_y_2(); Orientation orient1 = Traits::orientation(ny, s); CGAL_assertion_code(Orientation orient2 = Traits::orientation(ny, t)); CGAL_assertion(orient1 == orient2); @@ -2427,7 +2447,7 @@ public: // Project onto yz plane: s = Traits::project_yz(source); t = Traits::project_yz(target); - const Direction_2 & ny = Traits::neg_y_2(); + const Direction_2& ny = Traits::neg_y_2(); Orientation orient1 = Traits::orientation(ny, s); CGAL_assertion_code(Orientation orient2 = Traits::orientation(ny, t)); CGAL_assertion(orient1 == orient2); @@ -2453,7 +2473,7 @@ public: * \param plane the containing plane. * \pre the plane is not vertical */ - Arr_x_monotone_geodesic_arc_on_sphere_3(const Direction_3 & normal) : + Arr_x_monotone_geodesic_arc_on_sphere_3(const Direction_3& normal) : m_normal(normal), m_is_vertical(false), m_is_directed_right(z_sign(normal) == POSITIVE), @@ -2471,7 +2491,7 @@ public: Direction_3(-(normal.dz()), 0, normal.dx()) : Direction_3(normal.dz(), 0, -(normal.dx())); #else - const Direction_2 & xy = Traits::identification_xy(); + const Direction_2& xy = Traits::identification_xy(); FT x = xy.dx(); FT y = xy.dy(); FT z((xy.dx() * normal.dx() + xy.dy() * normal.dy()) / -(normal.dz())); @@ -2487,8 +2507,8 @@ public: * \pre the point lies on the open discontinuity arc */ Arr_x_monotone_geodesic_arc_on_sphere_3 - (const Arr_extended_direction_3 & point, - const Direction_3 & normal) : + (const Arr_extended_direction_3& point, + const Direction_3& normal) : m_source(point), m_target(point), m_normal(normal), @@ -2514,9 +2534,9 @@ public: * \pre Both endpoint lie on the given plane. */ Arr_x_monotone_geodesic_arc_on_sphere_3 - (const Arr_extended_direction_3 & source, - const Arr_extended_direction_3 & target, - const Direction_3 & normal) : + (const Arr_extended_direction_3& source, + const Arr_extended_direction_3& target, + const Direction_3& normal) : m_source(source), m_target(target), m_normal(normal), @@ -2576,17 +2596,17 @@ public: /*! Set the source endpoint direction. * \param p the endpoint to set. */ - void set_source(const Direction_3 & p) { m_source = p; } + void set_source(const Direction_3& p) { m_source = p; } /*! Set the target endpoint direction. * \param p the endpoint to set. */ - void set_target(const Direction_3 & p) { m_target = p; } + void set_target(const Direction_3& p) { m_target = p; } /*! Set the direction of the underlying plane. * \param normal the plane direction. */ - void normal(const Direction_3 & normal) { m_normal = normal; } + void normal(const Direction_3& normal) { m_normal = normal; } void set_is_vertical(bool flag) { m_is_vertical = flag; } void set_is_directed_right(bool flag) { m_is_directed_right = flag; } @@ -2595,20 +2615,20 @@ public: void set_is_empty(bool flag) { m_is_empty = flag; } /*! Obtain the source */ - const Arr_extended_direction_3 & source() const { return m_source; } + const Arr_extended_direction_3& source() const { return m_source; } /*! Obtain the target */ - const Arr_extended_direction_3 & target() const { return m_target; } + const Arr_extended_direction_3& target() const { return m_target; } /*! Obtain the normal to the containing plane */ - const Direction_3 & normal() const { return m_normal; } + const Direction_3& normal() const { return m_normal; } /*! Obtain the (lexicographically) left endpoint direction */ - const Arr_extended_direction_3 & left() const + const Arr_extended_direction_3& left() const { return (m_is_directed_right ? m_source : m_target); } /*! Obtain the (lexicographically) right endpoint */ - const Arr_extended_direction_3 & right() const + const Arr_extended_direction_3& right() const { return (m_is_directed_right ? m_target : m_source); } /*! Determines whether the curve is vertical */ @@ -2655,7 +2675,7 @@ public: #else typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; - const Direction_3 & iden_normal = Traits::identification_normal(); + const Direction_3& iden_normal = Traits::identification_normal(); const Direction_2 iden_normal_xy = Traits::project_xy(iden_normal); Direction_2 normal_xy = Traits::project_xy(m_normal); Kernel kernel; @@ -2676,7 +2696,7 @@ public: * false otherwise. * \pre point does not coincide with one of the poles */ - bool is_in_x_range(const Arr_extended_direction_3 & point) const + bool is_in_x_range(const Arr_extended_direction_3& point) const { typedef Arr_geodesic_arc_on_sphere_traits_2 Traits; @@ -2733,7 +2753,7 @@ public: * \return true if dir is contained in plane; false otherwise. * \pre the plane contains the origin. */ - inline bool has_on(const Direction_3 & dir) const + inline bool has_on(const Direction_3& dir) const { typename Kernel::FT dot = normal().vector() * dir.vector(); return CGAL::sign(dot) == ZERO; @@ -2777,7 +2797,7 @@ public: * \param other the other arc */ Arr_geodesic_arc_on_sphere_3 - (const Arr_geodesic_arc_on_sphere_3 & other) : Base(other) + (const Arr_geodesic_arc_on_sphere_3& other) : Base(other) { m_is_x_monotone = other.m_is_x_monotone; } @@ -2795,9 +2815,9 @@ public: * \pre plane contains src * \pre plane contains trg */ - Arr_geodesic_arc_on_sphere_3(const Arr_extended_direction_3 & src, - const Arr_extended_direction_3 & trg, - const Direction_3 & normal, + Arr_geodesic_arc_on_sphere_3(const Arr_extended_direction_3& src, + const Arr_extended_direction_3& trg, + const Direction_3& normal, bool is_x_monotone, bool is_vertical, bool is_directed_right, bool is_full = false, @@ -2825,8 +2845,8 @@ public: * \pre the source and target cannot be equal. * \pre the source and target cannot be the opoosite of each other. */ - Arr_geodesic_arc_on_sphere_3(const Arr_extended_direction_3 & source, - const Arr_extended_direction_3 & target) + Arr_geodesic_arc_on_sphere_3(const Arr_extended_direction_3& source, + const Arr_extended_direction_3& target) { this->set_source(source); this->set_target(target); @@ -2900,7 +2920,7 @@ public: Direction_2 t = Traits::project_xy(target); Orientation orient = Traits::orientation(s, t); - const Direction_2 & d = Traits::identification_xy(); + const Direction_2& d = Traits::identification_xy(); if (orient == LEFT_TURN) { this->set_is_directed_right(true); set_is_x_monotone(!kernel.counterclockwise_in_between_2_object()(d, s, t)); @@ -2921,9 +2941,9 @@ public: * \pre plane contain the origin * \pre Both endpoints lie on the given plane. */ - Arr_geodesic_arc_on_sphere_3(const Arr_extended_direction_3 & source, - const Arr_extended_direction_3 & target, - const Direction_3 & normal) + Arr_geodesic_arc_on_sphere_3(const Arr_extended_direction_3& source, + const Arr_extended_direction_3& target, + const Direction_3& normal) { Kernel kernel; @@ -3012,7 +3032,7 @@ public: (xz_plane) ? Traits::project_xz : Traits::project_yz; Direction_2 s = project(source); Direction_2 t = project(target); - const Direction_2 & ny = Traits::neg_y_2(); + const Direction_2& ny = Traits::neg_y_2(); typename Kernel::Counterclockwise_in_between_2 ccib = kernel.counterclockwise_in_between_2_object(); set_is_x_monotone((plane_is_positive && !ccib(ny, s, t)) || @@ -3027,7 +3047,7 @@ public: // The arc is not vertical! this->set_is_vertical(false); this->set_is_directed_right(z_sign(normal) == POSITIVE); - const Direction_2 & d = Traits::identification_xy(); + const Direction_2& d = Traits::identification_xy(); Direction_2 s = Traits::project_xy(source); Direction_2 t = Traits::project_xy(target); typename Kernel::Counterclockwise_in_between_2 ccib = @@ -3040,7 +3060,7 @@ public: /*! Construct a full spherical_arc from a plane. * \param plane the containing plane. */ - Arr_geodesic_arc_on_sphere_3(const Direction_3 & normal) + Arr_geodesic_arc_on_sphere_3(const Direction_3& normal) { this->normal(normal); this->set_is_vertical(CGAL::sign(normal.dz()) == ZERO); @@ -3064,8 +3084,8 @@ public: /*! Inserter for the spherical_arc class used by the traits-class */ template -OutputStream & operator<<(OutputStream & os, - const Arr_extended_direction_3 & ed) +OutputStream& operator<<(OutputStream& os, + const Arr_extended_direction_3& ed) { CGAL::To_double todouble; #if defined(CGAL_ARR_GEODESIC_ARC_ON_SPHERE_DETAILS) @@ -3092,8 +3112,8 @@ OutputStream & operator<<(OutputStream & os, /*! Inserter for the spherical_arc class used by the traits-class */ template OutputStream & -operator<<(OutputStream & os, - const Arr_x_monotone_geodesic_arc_on_sphere_3 & arc) +operator<<(OutputStream& os, + const Arr_x_monotone_geodesic_arc_on_sphere_3& arc) { #if defined(CGAL_ARR_GEODESIC_ARC_ON_SPHERE_DETAILS) os << "("; @@ -3111,8 +3131,8 @@ operator<<(OutputStream & os, /*! Extractor for the spherical_arc class used by the traits-class */ template InputStream & -operator>>(InputStream & is, - const Arr_x_monotone_geodesic_arc_on_sphere_3 & arc) +operator>>(InputStream& is, + const Arr_x_monotone_geodesic_arc_on_sphere_3& arc) { std::cerr << "Not implemented yet!" << std::endl; return is; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Arr_plane_3.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Arr_plane_3.h index a55f3540c6d..48e26411326 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Arr_plane_3.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Arr_plane_3.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h index c1078f3bba7..272d216ac80 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_bounding_rational_traits.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_cache.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_cache.h index da10d5c1f51..05df286edf3 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_cache.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_cache.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_curve_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_curve_2.h index 4c2aaf59779..db685311d18 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_curve_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_curve_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -151,11 +151,6 @@ public: p_polyY(NULL), p_normY(NULL) { - CGAL_precondition_code ( - Rat_kernel ker; - typename Rat_kernel::Equal_2 equal = ker.equal_2_object(); - ); - // Copy the control points and compute their bounding box. const int pts_size = std::distance (pts_begin, pts_end); double x, y; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_point_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_point_2.h index 5579c5d2cc3..9fcf0bb9c14 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_point_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_point_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h index 15449cca197..e7b9b89d01f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Bezier_x_monotone_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -89,7 +89,7 @@ private: typedef typename Bezier_cache::Intersection_iter Intersect_iter; // Representation of an intersection point with its multiplicity: - typedef std::pair Intersection_point_2; + typedef std::pair Intersection_point_2; /*! \class Less_intersection_point * Comparison functor for intersection points. @@ -1345,26 +1345,29 @@ bool _Bezier_x_monotone_2::equals // Split the subcurve into two at a given split point. // template -void _Bezier_x_monotone_2::split - (const Point_2& p, - Self& c1, Self& c2) const +void _Bezier_x_monotone_2:: +split(const Point_2& p, Self& c1, Self& c2) const { - //this was added to handle the case where p is the endpoint of another Bezier curve - //and the curve is vertical + //this was added to handle the case where p is the endpoint of another + //Bezier curve and the curve is vertical if ( p.is_rational() && is_vertical() ){ Nt_traits nt_traits; - Rat_point_2 rp=(Rat_point_2) p; + Rat_point_2 rp = (Rat_point_2) p; std::list sols; - typename std::list::iterator sol=sols.begin(); - Integer rpyn=nt_traits.numerator(rp.y()); - Polynomial poly_y=nt_traits.scale(_curve.y_polynomial(),nt_traits.denominator(rp.y())) - nt_traits.construct_polynomial(&rpyn,0); - nt_traits.compute_polynomial_roots (poly_y,0,1,std::back_inserter(sols)); - CGAL_assertion(sols.size()==1); - p.add_originator (Originator(_curve, _xid,*sols.begin()) ); + // typename std::list::iterator sol = sols.begin(); + Integer rpyn = nt_traits.numerator(rp.y()); + Polynomial poly_y = + nt_traits.scale(_curve.y_polynomial(), + nt_traits.denominator(rp.y())) - + nt_traits.construct_polynomial(&rpyn, 0); + nt_traits.compute_polynomial_roots(poly_y, 0, 1, std::back_inserter(sols)); + CGAL_assertion(sols.size() == 1); + p.add_originator(Originator(_curve, _xid,*sols.begin()) ); } - CGAL_precondition (p.get_originator (_curve, _xid) != p.originators_end() || p.is_rational()); + CGAL_precondition(p.get_originator(_curve, _xid) != p.originators_end() || + p.is_rational()); // Duplicate the curve. c1 = c2 = *this; @@ -1380,8 +1383,6 @@ void _Bezier_x_monotone_2::split c1._ps = p; c2._pt = p; } - - return; } // --------------------------------------------------------------------------- diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Circle_segment_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Circle_segment_2.h index 1aa563e8d45..6dc4d38d7ff 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Circle_segment_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Circle_segment_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -24,7 +24,7 @@ /*! \file * Header file for the _Circle_segment_2 class. */ -#include +#include #include #include #include @@ -46,9 +46,9 @@ class _One_root_point_2_rep //: public Ref_counted public: - typedef NumberType_ NT; - typedef _One_root_point_2_rep Self; - typedef _One_root_number CoordNT; + typedef NumberType_ NT; + typedef _One_root_point_2_rep Self; + typedef Sqrt_extension > CoordNT; private: @@ -63,13 +63,9 @@ public: _y (0) {} - /*! Constructor of a point with rational coefficients. */ - _One_root_point_2_rep (const NT& x, const NT& y) : - _x (x), - _y (y) - {} - - /*! Constructor of a point with one-root coefficients. */ + /*! Constructor of a point with one-root coefficients. + This constructor of a point can also be used with rational coefficients + thanks to convertor of CoordNT. */ _One_root_point_2_rep (const CoordNT& x, const CoordNT& y) : _x (x), _y (y) @@ -107,12 +103,9 @@ public: Point_handle (p) {} - /*! Constructor of a point with rational coefficients. */ - _One_root_point_2 (const NT& x, const NT& y) : - Point_handle (Point_rep (x, y)) - {} - - /*! Constructor of a point with one-root coefficients. */ + /*! Constructor of a point with one-root coefficients. + This constructor of a point can also be used with rational coefficients + thanks to convertor of CoordNT. */ _One_root_point_2 (const CoordNT& x, const CoordNT& y) : Point_handle (Point_rep (x, y)) {} @@ -556,8 +549,8 @@ public: else { // In case only the squared root is given: - xv_left = CoordNT (x0, -1, _circ.squared_radius()); - xv_right = CoordNT (x0, 1, _circ.squared_radius()); + xv_left = CoordNT (x0, NT(-1), _circ.squared_radius()); + xv_right = CoordNT (x0, NT(1), _circ.squared_radius()); } vpts[0] = Point_2 (xv_left, y0); @@ -634,7 +627,7 @@ private: if (_has_radius) vpts[n_vpts] = Point_2 (CoordNT (x0 - _radius), y0); else - vpts[n_vpts] = Point_2 (CoordNT (x0, -1, _circ.squared_radius()), + vpts[n_vpts] = Point_2 (CoordNT (x0, NT(-1), _circ.squared_radius()), y0); n_vpts++; @@ -649,7 +642,7 @@ private: if (_has_radius) vpts[n_vpts] = Point_2 (CoordNT (x0 + _radius), y0); else - vpts[n_vpts] = Point_2 (CoordNT (x0, 1, _circ.squared_radius()), + vpts[n_vpts] = Point_2 (CoordNT (x0, NT(1), _circ.squared_radius()), y0); n_vpts++; } @@ -740,7 +733,8 @@ public: // Type definition for the intersection points mapping. typedef std::pair Curve_id_pair; - typedef std::pair Intersection_point_2; + typedef unsigned int Multiplicity; + typedef std::pair Intersection_point_2; typedef std::list Intersection_list; /*! @@ -2071,11 +2065,11 @@ protected: mult = 1; p = Point_2 (CoordNT (vx), - CoordNT (y0(), -1, vdisc)); + CoordNT (y0(), NT(-1), vdisc)); inter_list.push_back (Intersection_point_2 (p, mult)); p = Point_2 (CoordNT (vx), - CoordNT (y0(), 1, vdisc)); + CoordNT (y0(), NT(1), vdisc)); inter_list.push_back (Intersection_point_2 (p, mult)); return; @@ -2108,11 +2102,11 @@ protected: // Compute the two intersection points: mult = 1; - p = Point_2 (CoordNT (x0(), -1, hdisc), + p = Point_2 (CoordNT (x0(), NT(-1), hdisc), CoordNT (hy)); inter_list.push_back (Intersection_point_2 (p, mult)); - p = Point_2 (CoordNT (x0(), 1, hdisc), + p = Point_2 (CoordNT (x0(), NT(1), hdisc), CoordNT (hy)); inter_list.push_back (Intersection_point_2 (p, mult)); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_arc_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_arc_2.h index fa9dceadfd5..0835f2b3e07 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_arc_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_intersections_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_intersections_2.h index 3bd51349a0b..589a3cc89b6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_intersections_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_intersections_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_point_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_point_2.h index 80378429325..c644d604407 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_point_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_point_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h index 17442a31411..b68a407e20e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Consolidated_curve_data_aux.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Consolidated_curve_data_aux.h index 70e3155b87c..904a14773b1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Consolidated_curve_data_aux.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Consolidated_curve_data_aux.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Curve_data_aux.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Curve_data_aux.h index 49fe320f2a3..95fea2d064d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Curve_data_aux.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Curve_data_aux.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Hyperbolic_arc_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Hyperbolic_arc_2.h index 9c9afa1a8cd..a104e507dde 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Hyperbolic_arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Hyperbolic_arc_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -23,7 +23,6 @@ /*! \file * Header file for the _Hyperbolic_arc_2 class. */ -#include #include #include #include diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/One_root_number.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/One_root_number.h index 4cea30d8b75..3d23fe76928 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/One_root_number.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/One_root_number.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Polycurve_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Polycurve_2.h index e869c93eae6..c3a3ce5bb56 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Polycurve_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Polycurve_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Polyline_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Polyline_2.h index ac4b19d6f6d..385e620e816 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Polyline_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Polyline_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Rational_arc_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Rational_arc_2.h index 82dee2cfa8d..e184e7a876b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Rational_arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Rational_arc_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -1834,7 +1834,7 @@ public: typedef typename Base::Rat_vector Rat_vector; typedef typename Base::Polynomial Polynomial; - typedef std::pair Intersection_point_2; + typedef std::pair Intersection_point_2; /// \name Constrcution methods. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Segment_assertions.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Segment_assertions.h index 934e4226157..bafe1325303 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Segment_assertions.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Segment_assertions.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/de_Casteljau_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/de_Casteljau_2.h index 8ce37d82458..734536f89f4 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/de_Casteljau_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/de_Casteljau_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under 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 0dd277cae19..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -861,10 +861,10 @@ public: Parameter_space_in_y_2 parameter_space_in_y_2_object() const { return Parameter_space_in_y_2(); } - /*! A functor that compares the x-coordinates of arc ends near the + /*! A functor that compares the x-limits of arc ends on the * boundary of the parameter space. */ - class Compare_x_near_boundary_2 { + class Compare_x_limit_on_boundary_2 { protected: typedef Arr_great_circular_arc_on_cylinder_traits_2 Traits; @@ -874,13 +874,13 @@ public: /*! Constructor * \param traits the traits (in case it has state) */ - Compare_x_near_boundary_2(const Traits * traits) : m_traits(traits) {} + Compare_x_limit_on_boundary_2(const Traits * traits) : m_traits(traits) {} friend class Arr_great_circular_arc_on_cylinder_traits_2; public: - /*! Compare the x-coordinate of a direction with the x-coordinate of an - * arc end near the boundary. + /*! Compare the x-coordinate of a direction with the x-limit of an + * arc end on the boundary. * \param p the point direction. * \param xcv the arc, the endpoint of which is compared. * \param ce the arc-end indicator - @@ -898,6 +898,8 @@ public: const X_monotone_curve_2 & xcv, Arr_curve_end ce) const { + // TODO implement (simplify) + CGAL_precondition(point.is_no_boundary()); CGAL_precondition_code (const Point_2 & p2 = (ce == ARR_MIN_END) ? xcv.left() : xcv.right();); @@ -931,7 +933,7 @@ public: return (ce == ARR_MIN_END) ? LARGER : SMALLER; } - /*! Compare the x-coordinates of 2 arc ends near the boundary of the + /*! Compare the x-limits of 2 arc ends on the boundary of the * parameter space. * \param xcv1 the first arc. * \param ce1 the first arc end indicator - @@ -955,6 +957,115 @@ public: const X_monotone_curve_2 & xcv2, Arr_curve_end ce2) const { + // TODO implement (simplify) + + CGAL_precondition_code + (const Point_2 & p1 = (ce1 == ARR_MIN_END) ? xcv1.left() : xcv1.right();); + CGAL_precondition(!p1.is_no_boundary()); + CGAL_precondition_code + (const Point_2 & p2 = (ce2 == ARR_MIN_END) ? xcv2.left() : xcv2.right();); + CGAL_precondition(!p2.is_no_boundary()); + + if (xcv1.is_vertical() && xcv2.is_vertical()) { + CGAL_precondition(!xcv1.is_on_boundary()); + CGAL_precondition(!xcv2.is_on_boundary()); + + /* The following is replaced by the code above + * if (xcv1.is_on_boundary() && xcv2.is_on_boundary()) return EQUAL; + * if (xcv1.is_on_boundary()) return SMALLER; + * if (xcv2.is_on_boundary()) return LARGER; + */ + + // Non of the arcs coincide with the discontinuity arc: + // Obtain the directions contained in the underlying planes, which are + // also on the xy-plane: + Direction_3 normal1 = xcv1.plane().orthogonal_direction(); + Direction_2 p = (xcv1.is_directed_right()) ? + Direction_2(-(normal1.dy()), normal1.dx()) : + Direction_2(normal1.dy(), -(normal1.dx())); + Direction_3 normal2 = xcv2.plane().orthogonal_direction(); + Direction_2 q = (xcv2.is_directed_right()) ? + Direction_2(-(normal2.dy()), normal2.dx()) : + Direction_2(normal2.dy(), -(normal2.dx())); + + const Kernel * kernel = m_traits; + if (kernel->equal_2_object()(p, q)) return EQUAL; + const Direction_2 & nx = Traits::neg_x_2(); + return (kernel->counterclockwise_in_between_2_object()(nx, p, q)) ? + LARGER : SMALLER; + } + if (xcv1.is_vertical()) { + CGAL_precondition(!xcv1.is_on_boundary()); + /* The following is replaced by the code above + * if (xcv1.is_on_boundary()) return SMALLER; + */ + return (ce2 == ARR_MAX_END) ? SMALLER : LARGER; + } + if (xcv2.is_vertical()) { + CGAL_precondition(!xcv2.is_on_boundary()); + /* The following is replaced by the code above + * if (xcv2.is_on_boundary()) return LARGER; + */ + return (ce1 == ARR_MAX_END) ? LARGER : SMALLER; + } + // Non of the arcs are vertical: + if (ce1 == ce2) return EQUAL; + if (ce1 == ARR_MIN_END) return SMALLER; + return LARGER; + } + }; + + /*! Obtain a Compare_x_limit_on_boundary_2 function object */ + Compare_x_limit_on_boundary_2 compare_x_limit_on_boundary_2_object() const + { return Compare_x_limit_on_boundary_2(this); } + + + /*! A functor that compares the x-coordinates of arc ends near the + * boundary of the parameter space. + */ + class Compare_x_near_boundary_2 { + protected: + typedef Arr_great_circular_arc_on_cylinder_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits * m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Compare_x_near_boundary_2(const Traits * traits) : m_traits(traits) {} + + friend class Arr_great_circular_arc_on_cylinder_traits_2; + + public: + + /*! Compare the x-coordinates of 2 arc ends near the boundary of the + * parameter space. + * \param xcv1 the first arc. + * \param ce1 the first arc end indicator - + * ARR_MIN_END - the minimal end of xcv1 or + * ARR_MAX_END - the maximal end of xcv1. + * \param xcv2 the second arc. + * \param ce2 the second arc end indicator - + * ARR_MIN_END - the minimal end of xcv2 or + * ARR_MAX_END - the maximal end of xcv2. + * \return the second comparison result: + * SMALLER - x(xcv1, ce1) < x(xcv2, ce2); + * EQUAL - x(xcv1, ce1) = x(xcv2, ce2); + * LARGER - x(xcv1, ce1) > x(xcv2, ce2). + * \pre the ce1 end of the arc xcv1 lies on a boundary. + * \pre the ce2 end of the arc xcv2 lies on a boundary. + * \pre xcv1 does not coincide with the vertical identification curve. + * \pre xcv2 does not coincide with the vertical identification curve. + */ + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + // TODO implement (simplify) + + Arr_curve_end ce1 = ce2 = ce; + CGAL_precondition_code (const Point_2 & p1 = (ce1 == ARR_MIN_END) ? xcv1.left() : xcv1.right();); CGAL_precondition(!p1.is_no_boundary()); @@ -1015,7 +1126,143 @@ public: Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const { return Compare_x_near_boundary_2(this); } + /*! A functor that compares the y-limits of arc ends on the + * boundary of the parameter space. + */ + class Compare_y_limit_on_boundary_2 { + protected: + typedef Arr_great_circular_arc_on_cylinder_traits_2 Traits; + /*! The traits (in case it has state) */ + const Traits * m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Compare_y_limit_on_boundary_2(const Traits * traits) : m_traits(traits) {} + + friend class Arr_great_circular_arc_on_cylinder_traits_2; + + public: + /*! Compare the y-limits of 2 curves at their ends on the boundary + * of the parameter space. + * \param xcv1 the first arc. + * \param xcv2 the second arc. + * \param ce the arc end indicator. + * \return the second comparison result. + * \pre the ce ends of the arcs xcv1 and xcv2 lie either on the left + * boundary or on the right boundary of the parameter space. + * There is no horizontal identification curve! + */ + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + CGAL_precondition(!xcv1.is_degenerate()); + CGAL_precondition(!xcv2.is_degenerate()); + + const Point_2 & l1 = xcv1.left(); + const Point_2 & r1 = xcv1.right(); + const Point_2 & l2 = xcv2.left(); + const Point_2 & r2 = xcv2.right(); + + // If xcv1 is vertical, xcv1 coincides with the discontinuity arc: + if (xcv1.is_vertical()) { + CGAL_precondition(!l1.is_no_boundary()); + CGAL_precondition(!r1.is_no_boundary()); + } + + // If xcv2 is vertical, xcv2 coincides with the discontinuity arc: + if (xcv2.is_vertical()) { + CGAL_precondition(!l2.is_no_boundary()); + CGAL_precondition(!r2.is_no_boundary()); + } + + if (ce == ARR_MIN_END) { + // Handle the south pole. It has the smallest y coords: + if (l1.is_min_boundary()) + return (l2.is_min_boundary()) ? EQUAL : SMALLER; + if (l2.is_min_boundary()) return LARGER; + + // None of xcv1 and xcv2 endpoints coincide with a pole: + Comparison_result cr = m_traits->compare_y(l1, l2); + if (cr != EQUAL) return cr; + + // If Both arcs are vertical, they overlap: + if (xcv1.is_vertical() && xcv2.is_vertical()) return EQUAL; + if (xcv1.is_vertical()) return LARGER; + if (xcv2.is_vertical()) return SMALLER; + + // Non of the arcs is verticel. Thus, non of the endpoints coincide + // with a pole. + // Compare the y-coord. at the x-coord of the most left right-endpoint. + CGAL_assertion(r1.is_no_boundary()); + CGAL_assertion(r2.is_no_boundary()); + + if (m_traits->compare_xy(r1, r2) == LARGER) { + // use r2 and xcv1: + Oriented_side os = m_traits->oriented_side(xcv1.plane(), r2); + return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : + (xcv1.is_directed_right()) ? + ((os == ON_NEGATIVE_SIDE) ? LARGER : SMALLER) : + ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER); + } + // use r1 and xcv2: + Oriented_side os = m_traits->oriented_side(xcv2.plane(), r1); + return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : + (xcv2.is_directed_right()) ? + ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER) : + ((os == ON_NEGATIVE_SIDE) ? LARGER : SMALLER); + } + + // ce == ARR_MAX_END + + // Handle the north pole. It has the largest y coords: + if (r1.is_max_boundary()) return (r2.is_max_boundary()) ? EQUAL : LARGER; + if (r2.is_max_boundary()) return SMALLER; + + // None of xcv1 and xcv2 endpoints coincide with a pole: + Direction_2 r1_xy = Traits::project_xy(r1); + Comparison_result cr = m_traits->compare_y(r1, r2); + if (cr != EQUAL) return cr; + + // If Both arcs are vertical, they overlap: + if (xcv1.is_vertical() && xcv2.is_vertical()) return EQUAL; + if (xcv1.is_vertical()) return LARGER; + if (xcv2.is_vertical()) return SMALLER; + + // Compare to the left: + Direction_2 p_r1 = Traits::project_xy(r1); + cr = m_traits->compare_y(r1, r2); + if (cr != EQUAL) return cr; + + // Non of the arcs is verticel. Thus, non of the endpoints coincide with + // a pole. + // Compare the y-coord. at the x-coord of the most right left-endpoint. + CGAL_assertion(l1.is_no_boundary()); + CGAL_assertion(l2.is_no_boundary()); + + if (m_traits->compare_xy(l1, l2) == SMALLER) { + // use l2 and xcv1: + Oriented_side os = m_traits->oriented_side(xcv1.plane(), l2); + return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : + (xcv1.is_directed_right()) ? + ((os == ON_NEGATIVE_SIDE) ? LARGER : SMALLER) : + ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER); + } + // use l1 and xcv2: + Oriented_side os = m_traits->oriented_side(xcv2.plane(), l1); + return (os == ON_ORIENTED_BOUNDARY) ? EQUAL : + (xcv2.is_directed_right()) ? + ((os == ON_NEGATIVE_SIDE) ? SMALLER : LARGER) : + ((os == ON_NEGATIVE_SIDE) ? LARGER : SMALLER); + } + }; + + /*! Obtain a Compare_y_limit_on_boundary_2 function object */ + Compare_y_limit_on_boundary_2 compare_y_limit_on_boundary_2_object() const + { return Compare_y_limit_on_boundary_2(this); } + /*! A functor that compares the y-coordinates of arc ends near the * boundary of the parameter space. */ @@ -1152,7 +1399,7 @@ public: /*! Obtain a Compare_y_near_boundary_2 function object */ Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const { return Compare_y_near_boundary_2(this); } - + /*! A functor that indicates whether a geometric object lies on the * horizontal identification arc. Since there is no such thing in the * parameter space, the operators immediately return false. @@ -1557,7 +1804,7 @@ public: Project project, OutputIterator oi) const { - typedef std::pair Point_2_pair; + typedef std::pair Point_2_pair; const Kernel * kernel = m_traits; typename Kernel::Equal_2 equal = kernel->equal_2_object(); @@ -1699,7 +1946,7 @@ public: typedef typename Traits::Clockwise_in_between_2 Clockwise_in_between_2; - typedef std::pair Point_2_pair; + typedef std::pair Point_2_pair; const Kernel * kernel = m_traits; CGAL::Object obj = kernel->intersect_3_object()(xc1.plane(), xc2.plane()); @@ -1870,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; @@ -1890,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_hyperbolic_arc_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_hyperbolic_arc_traits_2.h index 4ba3859b5e6..0c19631a9a3 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_hyperbolic_arc_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_hyperbolic_arc_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -53,10 +53,10 @@ public: typedef Tag_false Has_merge_category; typedef Tag_false Has_do_intersect_category; - typedef Arr_oblivious_side_tag Arr_left_side_category; - typedef Arr_oblivious_side_tag Arr_bottom_side_category; - typedef Arr_oblivious_side_tag Arr_top_side_category; - typedef Arr_oblivious_side_tag Arr_right_side_category; + typedef Arr_oblivious_side_tag Left_side_category; + typedef Arr_oblivious_side_tag Bottom_side_category; + typedef Arr_oblivious_side_tag Top_side_category; + typedef Arr_oblivious_side_tag Right_side_category; public: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h index 760972ddab2..ad41e0e92aa 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_landmarks_point_location.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_line_arc_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_line_arc_traits_2.h index 95b978e3b65..d6ee90b2b7a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_line_arc_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_line_arc_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France). +// Copyright (c) 2003,2004,2005,2006,2007,2008,2009,2010,2011 INRIA Sophia-Antipolis (France). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -54,6 +54,7 @@ public: typedef CircularKernel Kernel; typedef typename CircularKernel::Line_arc_2 Curve_2; typedef typename CircularKernel::Line_arc_2 X_monotone_curve_2; + typedef unsigned int Multiplicity; typedef typename CircularKernel::Circular_arc_point_2 Point; typedef typename CircularKernel::Circular_arc_point_2 Point_2; @@ -62,10 +63,10 @@ public: typedef CGAL::Tag_false Has_merge_category; typedef CGAL::Tag_false Has_do_intersect_category; - typedef Arr_oblivious_side_tag Arr_left_side_category; - typedef Arr_oblivious_side_tag Arr_bottom_side_category; - typedef Arr_oblivious_side_tag Arr_top_side_category; - typedef Arr_oblivious_side_tag Arr_right_side_category; + typedef Arr_oblivious_side_tag Left_side_category; + typedef Arr_oblivious_side_tag Bottom_side_category; + typedef Arr_oblivious_side_tag Top_side_category; + typedef Arr_oblivious_side_tag Right_side_category; Arr_line_arc_traits_2(const CircularKernel &k = CircularKernel()) : ck(k) {} 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 2fcc9731869..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -57,10 +57,10 @@ public: typedef Tag_true Has_merge_category; typedef Tag_false Has_do_intersect_category; - typedef Arr_open_side_tag Arr_left_side_category; - typedef Arr_open_side_tag Arr_bottom_side_category; - typedef Arr_open_side_tag Arr_top_side_category; - typedef Arr_open_side_tag Arr_right_side_category; + typedef Arr_open_side_tag Left_side_category; + typedef Arr_open_side_tag Bottom_side_category; + typedef Arr_open_side_tag Top_side_category; + typedef Arr_open_side_tag Right_side_category; typedef typename Kernel::Line_2 Line_2; typedef typename Kernel::Ray_2 Ray_2; @@ -747,7 +747,7 @@ public: typedef Arr_linear_traits_2 Traits; /*! The traits (in case it has state) */ - const Traits * m_traits; + const Traits* m_traits; /*! Constructor * \param traits the traits (in case it has state) @@ -1064,13 +1064,30 @@ public: Parameter_space_in_y_2 parameter_space_in_y_2_object() const { return Parameter_space_in_y_2(); } - /*! A function object that compares the x-coordinates of arc ends near the + /*! A function object that compares the x-limits of arc ends on the * boundary of the parameter space */ - class Compare_x_near_boundary_2 { + class Compare_x_at_limit_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) + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_at_limit_2(const Traits* traits) : m_traits(traits) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_linear_traits_2; + public: - /*! Compare the x-coordinate of a point with the x-coordinate of - * a line end near the boundary at y = +/- oo. + /*! Compare the x-limit of a vertical line at a point with the x-limit of + * a line end on the boundary at y = +/- oo. * \param p the point direction. * \param xcv the line, the endpoint of which is compared. * \param ce the line-end indicator - @@ -1081,19 +1098,66 @@ public: * EQUAL - x(p) = x(xc, ce); * LARGER - x(p) > x(xc, ce). * \pre p lies in the interior of the parameter space. - * \pre the ce end of the line xcv lies on a boundary. + * \pre the ce end of the line xcv lies on a boundary, implying + * that xcv1 is vertical. */ Comparison_result operator()(const Point_2 & p, const X_monotone_curve_2 & xcv, Arr_curve_end ) const { - CGAL_precondition (! xcv.is_degenerate()); - CGAL_precondition (xcv.is_vertical()); + CGAL_precondition(! xcv.is_degenerate()); + CGAL_precondition(xcv.is_vertical()); - Kernel kernel; - return (kernel.compare_x_at_y_2_object() (p, xcv.supp_line())); + const Kernel* kernel = m_traits; + return (kernel->compare_x_at_y_2_object()(p, xcv.supp_line())); } + /*! Compare the x-limits of 2 arcs ends on the boundary of the + * parameter space at y = +/- oo. + * \param xcv1 the first arc. + * \param ce1 the first arc end indicator - + * ARR_MIN_END - the minimal end of xcv1 or + * ARR_MAX_END - the maximal end of xcv1. + * \param xcv2 the second arc. + * \param ce2 the second arc end indicator - + * ARR_MIN_END - the minimal end of xcv2 or + * ARR_MAX_END - the maximal end of xcv2. + * \return the second comparison result: + * SMALLER - x(xcv1, ce1) < x(xcv2, ce2); + * EQUAL - x(xcv1, ce1) = x(xcv2, ce2); + * LARGER - x(xcv1, ce1) > x(xcv2, ce2). + * \pre the ce1 end of the line xcv1 lies on a boundary, implying + * that xcv1 is vertical. + * \pre the ce2 end of the line xcv2 lies on a boundary, implying + * that xcv2 is vertical. + */ + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + Arr_curve_end /* ce1 */, + const X_monotone_curve_2 & xcv2, + Arr_curve_end /*! ce2 */) const + { + CGAL_precondition(! xcv1.is_degenerate()); + CGAL_precondition(! xcv2.is_degenerate()); + CGAL_precondition(xcv1.is_vertical()); + CGAL_precondition(xcv2.is_vertical()); + + const Kernel* kernel = m_traits; + const Point_2 p = kernel->construct_point_2_object()(ORIGIN); + return (kernel->compare_x_at_y_2_object()(p, xcv1.supp_line(), + xcv2.supp_line())); + } + }; + + /*! Obtain a Compare_x_at_limit_2 function object */ + Compare_x_at_limit_2 compare_x_at_limit_2_object() const + { return Compare_x_at_limit_2(this); } + + /*! A function object that compares the x-coordinates of arc ends near the + * boundary of the parameter space + */ + class Compare_x_near_limit_2 { + public: + /*! Compare the x-coordinates of 2 arcs ends near the boundary of the * parameter space at y = +/- oo. * \param xcv1 the first arc. @@ -1108,38 +1172,54 @@ public: * SMALLER - x(xcv1, ce1) < x(xcv2, ce2); * EQUAL - x(xcv1, ce1) = x(xcv2, ce2); * LARGER - x(xcv1, ce1) > x(xcv2, ce2). - * \pre the ce1 end of the line xcv1 lies on a boundary. - * \pre the ce2 end of the line xcv2 lies on a boundary. + * \pre the ce end of the line xcv1 lies on a boundary, implying + * that xcv1 is vertical. + * \pre the ce end of the line xcv2 lies on a boundary, implying + * that xcv2 is vertical. + * \pre the the $x$-coordinates of xcv1 and xcv2 at their ce ends are + * equal, implying that the curves overlap! */ - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - Arr_curve_end /* ce1 */, - const X_monotone_curve_2 & xcv2, - Arr_curve_end /*! ce2 */) const + Comparison_result + operator()(const X_monotone_curve_2& CGAL_precondition_code(xcv1), + const X_monotone_curve_2& CGAL_precondition_code(xcv2), + Arr_curve_end /*! ce2 */) const { - CGAL_precondition (! xcv1.is_degenerate()); - CGAL_precondition (! xcv2.is_degenerate()); - CGAL_precondition (xcv1.is_vertical()); - CGAL_precondition (xcv2.is_vertical()); - - Kernel kernel; - typename Kernel::Point_2 p = kernel.construct_point_2_object() (ORIGIN); - return (kernel.compare_x_at_y_2_object() (p, - xcv1.supp_line(), - xcv2.supp_line())); + CGAL_precondition(! xcv1.is_degenerate()); + CGAL_precondition(! xcv2.is_degenerate()); + CGAL_precondition(xcv1.is_vertical()); + CGAL_precondition(xcv2.is_vertical()); + return EQUAL; } }; - /*! Obtain a Compare_x_near_boundary_2 function object */ - Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const - { return Compare_x_near_boundary_2(); } + /*! Obtain a Compare_x_near_limit_2 function object */ + Compare_x_near_limit_2 compare_x_near_limit_2_object() const + { return Compare_x_near_limit_2(); } - /*! A function object that compares the y-coordinates of arc ends near the + /*! A function object that compares the y-limits of arc ends on the * boundary of the parameter space. */ class Compare_y_near_boundary_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) + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_y_near_boundary_2(const Traits* traits) : m_traits(traits) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_linear_traits_2; + public: - /*! Compare the y-coordinates of 2 lines at their ends near the boundary + /*! Compare the y-limits of 2 lines at their ends on the boundary * of the parameter space at x = +/- oo. * \param xcv1 the first arc. * \param xcv2 the second arc. @@ -1153,42 +1233,38 @@ public: Arr_curve_end ce) const { // Make sure both curves are defined at x = -oo (or at x = +oo). - CGAL_precondition (! xcv1.is_degenerate()); - CGAL_precondition (! xcv2.is_degenerate()); - CGAL_precondition ((ce == ARR_MIN_END && - xcv1.left_infinite_in_x() == ARR_LEFT_BOUNDARY && - xcv2.left_infinite_in_x() == ARR_LEFT_BOUNDARY) || - (ce == ARR_MAX_END && - xcv1.right_infinite_in_x() == ARR_RIGHT_BOUNDARY && - xcv2.right_infinite_in_x() == ARR_RIGHT_BOUNDARY)); + CGAL_precondition(! xcv1.is_degenerate()); + CGAL_precondition(! xcv2.is_degenerate()); + CGAL_precondition((ce == ARR_MIN_END && + xcv1.left_infinite_in_x() == ARR_LEFT_BOUNDARY && + xcv2.left_infinite_in_x() == ARR_LEFT_BOUNDARY) || + (ce == ARR_MAX_END && + xcv1.right_infinite_in_x() == ARR_RIGHT_BOUNDARY && + xcv2.right_infinite_in_x() == ARR_RIGHT_BOUNDARY)); // Compare the slopes of the two supporting lines. - Kernel kernel; - const Comparison_result res_slopes = - kernel.compare_slope_2_object() (xcv1.supp_line(), xcv2.supp_line()); + const Kernel* kernel = m_traits; + const Comparison_result res_slopes = + kernel->compare_slope_2_object()(xcv1.supp_line(), xcv2.supp_line()); if (res_slopes == EQUAL) { // In case the two supporting line are parallel, compare their // relative position at x = 0, which is the same as their position // at infinity. - typename Kernel::Point_2 p = kernel.construct_point_2_object() (ORIGIN); - return (kernel.compare_y_at_x_2_object() (p, - xcv1.supp_line(), + const Point_2 p = kernel->construct_point_2_object()(ORIGIN); + return (kernel->compare_y_at_x_2_object()(p, xcv1.supp_line(), xcv2.supp_line())); } - if (ce == ARR_MIN_END) - // Flip the slope result if we compare at x = -oo: - return ((res_slopes == LARGER) ? SMALLER : LARGER); - - // If we compare at x = +oo, the slope result is what we need: - return (res_slopes); + // Flip the slope result if we compare at x = -oo: + return (ce == ARR_MIN_END) ? CGAL::opposite(res_slopes) : res_slopes; } }; - /*! Obtain a Compare_y_near_boundary_2 function object */ + + /*! Obtain a Compare_y_limit_on_boundary_2 function object */ Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const - { return Compare_y_near_boundary_2(); } + { return Compare_y_near_boundary_2(this); } //@} @@ -1319,7 +1395,7 @@ public: { // Create a pair representing the point with its multiplicity, // which is always 1 for line segments. - std::pair ip_mult (*ip, 1); + std::pair ip_mult (*ip, 1); *oi = make_object (ip_mult); oi++; } @@ -1380,7 +1456,7 @@ public: // The two objects have the same supporting line, but they just share // a common endpoint. Thus we have an intersection point, but we leave // the multiplicity of this point undefined. - std::pair ip_mult (ovlp.left(), 0); + std::pair ip_mult (ovlp.left(), 0); *oi = make_object (ip_mult); oi++; } @@ -1435,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_naive_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_naive_point_location.h index e3cecce5a1e..edad363f428 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_naive_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_naive_point_location.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_basic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_basic_traits_2.h index 73de33279f0..731912e0c75 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_basic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_basic_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -69,10 +69,10 @@ public: typedef Tag_true Has_left_category; typedef Tag_false Has_do_intersect_category; - typedef Arr_oblivious_side_tag Arr_left_side_category; - typedef Arr_oblivious_side_tag Arr_bottom_side_category; - typedef Arr_oblivious_side_tag Arr_top_side_category; - typedef Arr_oblivious_side_tag Arr_right_side_category; + typedef Arr_oblivious_side_tag Left_side_category; + typedef Arr_oblivious_side_tag Bottom_side_category; + typedef Arr_oblivious_side_tag Top_side_category; + typedef Arr_oblivious_side_tag Right_side_category; /*! Default Constructor */ Arr_non_caching_segment_basic_traits_2() @@ -136,10 +136,6 @@ public: Kernel kernel; // The two segments must be defined at q and also to its left. - CGAL_precondition_code( - Compare_y_at_x_2 compare_y_at_x = kernel.compare_y_at_x_2_object(); - ); - CGAL_precondition (Segment_assertions::_assert_is_point_on(p, cv1, Has_exact_division())&& Segment_assertions::_assert_is_point_on(p, cv2, Has_exact_division())); @@ -200,10 +196,6 @@ public: Kernel kernel; // The two segments must be defined at q and also to its right. - CGAL_precondition_code( - Compare_y_at_x_2 compare_y_at_x = kernel.compare_y_at_x_2_object(); - ); - CGAL_precondition (Segment_assertions::_assert_is_point_on(p, cv1, Has_exact_division())&& Segment_assertions::_assert_is_point_on(p, cv2, Has_exact_division())); 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 dbd683b9eb9..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -62,10 +62,10 @@ public: typedef typename Base::Has_left_category Has_left_category; typedef typename Base::Has_do_intersect_category Has_do_intersect_category; - typedef typename Base::Arr_left_side_category Arr_left_side_category; - typedef typename Base::Arr_bottom_side_category Arr_bottom_side_category; - typedef typename Base::Arr_top_side_category Arr_top_side_category; - typedef typename Base::Arr_right_side_category Arr_right_side_category; + typedef typename Base::Left_side_category Left_side_category; + typedef typename Base::Bottom_side_category Bottom_side_category; + typedef typename Base::Top_side_category Top_side_category; + typedef typename Base::Right_side_category Right_side_category; typedef typename Base::Point_2 Point_2; typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; @@ -168,7 +168,6 @@ public: // Make sure that p lies on the interior of the curve. CGAL_precondition_code ( Compare_xy_2 compare_xy = base.compare_xy_2_object(); - Compare_y_at_x_2 compare_y_at_x = base.compare_y_at_x_2_object(); ); Construct_min_vertex_2 min_vertex = base.construct_min_vertex_2_object(); @@ -241,7 +240,7 @@ public: // If the two segments intersect at their endpoints, then the // multiplicity is undefined, but we deliberately ignore it for // efficieny reasons. - std::pair ip_mult(*ip, 1); + std::pair ip_mult(*ip, 1); *oi = make_object (ip_mult); ++oi; } @@ -284,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_observer.h b/Arrangement_on_surface_2/include/CGAL/Arr_observer.h index 5e465972205..1240471da79 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_observer.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_observer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_overlay.h b/Arrangement_on_surface_2/include/CGAL/Arr_overlay.h index a3f8a71ef3d..e2c0a05157c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_overlay.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_overlay.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007 Max-Planck-Institute for Computer Science (Germany). +// Copyright (c) 2007,2009,2011 Max-Planck-Institute for Computer Science (Germany). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under 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 01d93c68b60..102bb4fa18a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -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_point_location/Arr_batched_point_location_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h index 60c171af5f9..99138fce81a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_batched_point_location_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -62,14 +62,14 @@ public: typedef typename Base_traits_2::Has_do_intersect_category Has_do_intersect_category; - typedef typename internal::Arr_complete_left_side_tag< Base_traits_2 >::Tag - Arr_left_side_category; - typedef typename internal::Arr_complete_bottom_side_tag< Base_traits_2 >::Tag - Arr_bottom_side_category; - typedef typename internal::Arr_complete_top_side_tag< Base_traits_2 >::Tag - Arr_top_side_category; - typedef typename internal::Arr_complete_right_side_tag< Base_traits_2 >::Tag - Arr_right_side_category; + typedef typename internal::Arr_complete_left_side_category< Base_traits_2 >::Category + Left_side_category; + typedef typename internal::Arr_complete_bottom_side_category< Base_traits_2 >::Category + Bottom_side_category; + typedef typename internal::Arr_complete_top_side_category< Base_traits_2 >::Category + Top_side_category; + typedef typename internal::Arr_complete_right_side_category< Base_traits_2 >::Category + Right_side_category; /* Overlay is implemented as sweep-line visitor. The sweep-line algorithm * never uses Compare_y_at_x_left_2, and it never performs merging of curves. @@ -209,7 +209,6 @@ public: typedef Ex_x_monotone_curve_2 X_monotone_curve_2; typedef Ex_point_2 Point_2; -#ifdef CGAL_SL_VERBOSE // For debugging purposes: friend std::ostream& operator<< (std::ostream& os, const X_monotone_curve_2& xcv) @@ -225,7 +224,6 @@ public: os << pt.base(); return (os); } -#endif /*! A functor that obtains the left endpoint of an x-monotone curve. */ class Construct_min_vertex_2 { @@ -577,6 +575,86 @@ public: return Parameter_space_in_x_2 (m_base_traits); } + + /*! A function object that determines whether an x-monotone curve or a + * point coincide with the vertical identification curve. + */ + class Is_on_x_identification_2 { + protected: + //! The base traits. + const Base_traits_2 *m_base; + + /*! Constructor. + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Is_on_x_identification_2 (const Base_traits_2* tr) : m_base (tr) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_batched_point_location_traits_2; + + public: + bool operator() (const Point_2 & p) const + { + return m_base->is_on_x_identification_2_object() (p.base()); + } + + bool operator() (const X_monotone_curve_2 & xcv) const + { + return m_base->is_on_x_identification_2_object() (xcv.base()); + } + }; + + /*! Obtain a Is_on_x_identification_2 function object */ + Is_on_x_identification_2 is_on_x_identification_2_object () const + { + return Is_on_x_identification_2 (m_base_traits); + } + + /*! A functor that compares the y-coordinate of two given points + * that lie on the vertical identification curve. + */ + class Compare_y_on_boundary_2 { + protected: + //! The base traits. + const Base_traits_2 * m_base; + + /*! Constructor. + * \param tr The base traits class. It must be passed, to handle + * non stateless traits (e.g., it stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_y_on_boundary_2(const Base_traits_2 * tr) : m_base(tr) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_batched_point_location_traits_2; + + public: + Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + { + return m_base->compare_x_on_boundary_2_object()(p1.base(), p2.base()); + } + Comparison_result operator() (const Point_2 & pt, + const X_monotone_curve_2& xcv, Arr_curve_end ce) const + { + return m_base->compare_x_on_boundary_2_object()(pt.base(), xcv.base(), ce); + } + Comparison_result operator() (const X_monotone_curve_2& xcv1, Arr_curve_end ce1, + const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const + { + return m_base->compare_x_on_boundary_2_object()(xcv1.base(), ce1, xcv2.base(), ce2); + } + }; + + /*! Obtain a Compare_y_on_boundary_2 functor object. */ + Compare_y_on_boundary_2 compare_y_on_boundary_2_object () const + { + return Compare_y_on_boundary_2(m_base_traits); + } + /*! A function object that compares the y-coordinates of curve ends near the * boundary of the parameter space */ @@ -615,41 +693,6 @@ public: return Compare_y_near_boundary_2(m_base_traits); } - /*! A functor that compares the y-coordinate of two given points - * that lie on the vertical identification curve. - */ - class Compare_y_on_boundary_2 { - protected: - //! The base traits. - const Base_traits_2 * m_base; - - /*! Constructor. - * \param tr The base traits class. It must be passed, to handle - * non stateless traits (e.g., it stores data). - * The constructor is declared private to allow only the functor - * obtaining function, which is a member of the nesting class, - * constructing it. - */ - Compare_y_on_boundary_2(const Base_traits_2 * tr) : m_base(tr) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_batched_point_location_traits_2; - - public: - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const - { - return m_base->compare_x_on_boundary_2_object()(p1.base(), p2.base()); - } - }; - - /*! Obtain a Compare_y_on_boundary_2 functor object. */ - Compare_y_on_boundary_2 compare_y_on_boundary_2_object () const - { - return Compare_y_on_boundary_2(m_base_traits); - } - - // TODO Is_on_x_identification_2 - // bottom-top /*! A functor that determines whether an endpoint of an x-monotone arc lies @@ -695,10 +738,46 @@ public: return Parameter_space_in_y_2 (m_base_traits); } - /*! A functor that compares the x-coordinates of curve ends near the + /*! A function object that determines whether an x-monotone curve or a + * point coincide with the horizontal identification curve. + */ + class Is_on_y_identification_2 { + protected: + //! The base traits. + const Base_traits_2 *m_base; + + /*! Constructor. + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Is_on_y_identification_2 (const Base_traits_2* tr) : m_base (tr) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_batched_point_location_traits_2; + + public: + bool operator() (const Point_2 & p) const + { + return m_base->is_on_y_identification_2_object() (p.base()); + } + + bool operator() (const X_monotone_curve_2 & xcv) const + { + return m_base->is_on_y_identification_2_object() (xcv.base()); + } + }; + + /*! Obtain a Is_on_y_identification_2 function object */ + Is_on_y_identification_2 is_on_y_identification_2_object () const + { + return Is_on_y_identification_2 (m_base_traits); + } + + /*! A functor that compares the x-limits of curve ends on the * boundary of the parameter space. */ - class Compare_x_near_boundary_2 { + class Compare_x_at_limit_2 { protected: //! The base traits. const Base_traits_2 * m_base; @@ -710,7 +789,7 @@ public: * obtaining function, which is a member of the nesting class, * constructing it. */ - Compare_x_near_boundary_2(const Base_traits_2 * tr) : m_base(tr) {} + Compare_x_at_limit_2(const Base_traits_2 * tr) : m_base(tr) {} //! Allow its functor obtaining function calling the private constructor. friend class Arr_batched_point_location_traits_2; @@ -720,8 +799,8 @@ public: const X_monotone_curve_2 & xcv, Arr_curve_end ce) const { - return m_base->compare_x_near_boundary_2_object()(p.base(), - xcv.base(), ce); + return m_base->compare_x_at_limit_2_object()(p.base(), + xcv.base(), ce); } Comparison_result operator()(const X_monotone_curve_2 & xcv1, @@ -729,15 +808,52 @@ public: const X_monotone_curve_2 & xcv2, Arr_curve_end ce2) const { - return m_base->compare_x_near_boundary_2_object()(xcv1.base(), ce1, - xcv2.base(), ce2); + return m_base->compare_x_at_limit_2_object()(xcv1.base(), ce1, + xcv2.base(), ce2); } }; - /*! Obtain a Compare_x_near_boundary_2 function object. */ - Compare_x_near_boundary_2 compare_x_near_boundary_2_object () const + /*! Obtain a Compare_x_at_limit_2 function object. */ + Compare_x_at_limit_2 compare_x_at_limit_2_object () const { - return Compare_x_near_boundary_2(m_base_traits); + return Compare_x_at_limit_2(m_base_traits); + } + + /*! A functor that compares the x-coordinates of curve ends near the + * boundary of the parameter space. + */ + class Compare_x_near_limit_2 { + protected: + //! The base traits. + const Base_traits_2 * m_base; + + /*! Constructor. + * \param tr The base traits class. It must be passed, to handle + * non stateless traits (e.g., it stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_near_limit_2(const Base_traits_2 * tr) : m_base(tr) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_batched_point_location_traits_2; + + public: + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + return m_base->compare_x_near_limit_2_object()(xcv1.base(), + xcv2.base(), + ce); + } + }; + + /*! Obtain a Compare_x_near_limit_2 function object. */ + Compare_x_near_limit_2 compare_x_near_limit_2_object () const + { + return Compare_x_near_limit_2(m_base_traits); } /*! A functor that compares the x-coordinate of two given points @@ -773,7 +889,42 @@ public: return Compare_x_on_boundary_2(m_base_traits); } - // TODO Is_on_y_identification_2 + /*! A functor that compares the x-coordinates of curve ends near the + * boundary of the parameter space. + */ + class Compare_x_near_boundary_2 { + protected: + //! The base traits. + const Base_traits_2 * m_base; + + /*! Constructor. + * \param tr The base traits class. It must be passed, to handle + * non stateless traits (e.g., it stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_near_boundary_2(const Base_traits_2 * tr) : m_base(tr) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_batched_point_location_traits_2; + + public: + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + return m_base->compare_x_near_boundary_2_object()(xcv1.base(), + xcv2.base(), + ce); + } + }; + + /*! Obtain a Compare_x_near_boundary_2 function object. */ + Compare_x_near_boundary_2 compare_x_near_boundary_2_object () const + { + return Compare_x_near_boundary_2(m_base_traits); + } }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h index 704d556c713..84390edf6b6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_landmarks_pl_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h index fbbbd5921a6..1c5c55ef4e3 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_generator_base.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h index 2c796e031e5..d161b559536 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h index 44dae141cfb..055f33d27ca 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_halton_generator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h index 06e5bdbb992..c98a2b02d39 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h index f35e5f0e25f..6fab7c972b7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_nearest_neighbor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -131,6 +131,8 @@ public: */ struct Construct_coord_iterator { + typedef const ANT* result_type; + /*! Get an iterator for the approximate coordinates. */ const ANT* operator() (const NN_Point_2& nnp) const { diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h index cd868c6a948..8487a5bd71a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_random_generator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h index 48fa9676cba..237c2fe7f3a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h index 5701783b6e3..6251b72b385 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_vertices_generator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h index a1d2eff2f07..5aad10a88be 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_naive_point_location_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_simple_point_location_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_simple_point_location_impl.h index ce09edc2911..7bfff5456be 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_simple_point_location_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_simple_point_location_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -122,10 +122,6 @@ Object Arr_simple_point_location::_base_vertical_ray_shoot const Comparison_result curve_above_under = (shoot_up ? LARGER : SMALLER); // Go over all halfedges in the arrangement. - typename Traits_adaptor_2::Is_in_x_range_2 is_in_x_range = - geom_traits->is_in_x_range_2_object(); - typename Traits_adaptor_2::Compare_y_at_x_2 compare_y_at_x = - geom_traits->compare_y_at_x_2_object(); typename Traits_adaptor_2::Is_vertical_2 is_vertical = geom_traits->is_vertical_2_object(); typename Traits_adaptor_2::Compare_y_position_2 compare_y_position = @@ -134,8 +130,6 @@ Object Arr_simple_point_location::_base_vertical_ray_shoot geom_traits->compare_y_at_x_right_2_object(); typename Traits_adaptor_2::Compare_y_at_x_left_2 compare_y_at_x_left = geom_traits->compare_y_at_x_left_2_object(); - typename Traits_adaptor_2::Compare_xy_2 compare_xy = - geom_traits->compare_xy_2_object(); typename Dcel::Edge_const_iterator eit = top_traits->dcel().edges_begin(); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h index 17ed77415bd..5c40e66867e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_trapezoid_ric_pl_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h index efebcd8f193..52a1e5c67c4 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_functions.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_impl.h index 059e24dd7a4..2881976bfca 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_triangulation_pl_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h index b5875ea95c2..e060ef267a1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_walk_along_line_pl_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h index da3c8228274..b29435a6a6f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_dag.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_dag.h index d06cdd9f486..85f292b79dc 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_dag.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_dag.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_ninetuple.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_ninetuple.h index ca5679e7bad..8495b0f26cb 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_ninetuple.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_ninetuple.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_predicates.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_predicates.h index c1bea74efdb..8ad5a0f49fe 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_predicates.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_predicates.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h index b91c7d020ed..ca7d0a94045 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits_functions.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits_functions.h index de0e522cf2c..6c560cc193c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits_functions.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_traits_functions.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h index d739f64629c..28be7eef046 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -1663,18 +1663,26 @@ public: return ar.find(left)->second; //return ar[left]; } + /*============================================== Trapezoidal_decomposition_2 public member functions ==============================================*/ public: - - Trapezoidal_decomposition_2(bool rebuild=true) : + Trapezoidal_decomposition_2(bool rebuild = true) : depth_threshold(CGAL_TD_DEFAULT_DEPTH_THRESHOLD), size_threshold(CGAL_TD_DEFAULT_SIZE_THRESHOLD) - {init();set_needs_update(rebuild);} - Trapezoidal_decomposition_2(const double& depth_th,const double& size_th) : - depth_threshold(depth_th),size_threshold(size_th) - {init();set_needs_update(rebuild);} + { + init(); + set_needs_update(rebuild); + } + + Trapezoidal_decomposition_2(const double& depth_th, const double& size_th) : + depth_threshold(depth_th), size_threshold(size_th) + { + init(); + set_needs_update(rebuild); + } + Trapezoidal_decomposition_2(const_Self_ref td) : needs_update_(td.needs_update_), number_of_curves_(td.number_of_curves_), diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_iostream.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_iostream.h index c95fc04702b..091c1df8d22 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_iostream.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_iostream.h @@ -1,4 +1,4 @@ -// Copyright (c) 1999 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_misc.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_misc.h index bf3d5d3ed73..53ffadba12a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_misc.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_misc.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under 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 d3a5cc07b20..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 @@ -1,4 +1,4 @@ -// Copyright(c) 2005 Tel-Aviv University(Israel). +// Copyright (c) 2009,2010,2011 Tel-Aviv University(Israel). // All rights reserved. // // This file is part of CGAL(www.cgal.org); you may redistribute it under @@ -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; @@ -43,13 +43,13 @@ public: typedef Tag_true Has_merge_category; typedef Tag_false Has_do_intersect_category; - typedef Arr_oblivious_side_tag Arr_left_side_category; - typedef Arr_oblivious_side_tag Arr_bottom_side_category; - typedef Arr_oblivious_side_tag Arr_top_side_category; - typedef Arr_oblivious_side_tag Arr_right_side_category; + typedef Arr_oblivious_side_tag Left_side_category; + typedef Arr_oblivious_side_tag Bottom_side_category; + typedef Arr_oblivious_side_tag Top_side_category; + 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: @@ -738,10 +743,10 @@ public: // the polylines is not defined at this point, so we give it // multiplicity 0. if (left_res == SMALLER) { - std::pair p(min_vertex(cv2[i2]), 0); + std::pair p(min_vertex(cv2[i2]), 0); *oi++ = make_object(p); } else { - std::pair p(min_vertex(cv1[i1]), 0); + std::pair p(min_vertex(cv1[i1]), 0); *oi++ = make_object(p); } } @@ -772,17 +777,17 @@ public: *oi++ = make_object(ocv); } else if (right_coincides) { if (right_res == SMALLER) { - std::pair ip(max_vertex(cv1[i1 - 1]), 0); + std::pair ip(max_vertex(cv1[i1 - 1]), 0); *oi++ = make_object(ip); } else if (right_res == LARGER) { - std::pair ip(max_vertex(cv2[i2 - 1]), 0); + std::pair ip(max_vertex(cv2[i2 - 1]), 0); *oi++ = make_object(ip); } else if (i1 > 0) { - std::pair ip(max_vertex(cv1[i1 - 1]), 0); + std::pair ip(max_vertex(cv1[i1 - 1]), 0); *oi++ = make_object(ip); } else { CGAL_assertion(i2 > 0); - std::pair ip(max_vertex(cv2[i2 - 1]), 0); + std::pair ip(max_vertex(cv2[i2 - 1]), 0); *oi++ = make_object(ip); } } @@ -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 d3a5cc07b20..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 @@ -1,4 +1,4 @@ -// Copyright(c) 2005 Tel-Aviv University(Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University(Israel). // All rights reserved. // // This file is part of CGAL(www.cgal.org); you may redistribute it under @@ -43,10 +43,10 @@ public: typedef Tag_true Has_merge_category; typedef Tag_false Has_do_intersect_category; - typedef Arr_oblivious_side_tag Arr_left_side_category; - typedef Arr_oblivious_side_tag Arr_bottom_side_category; - typedef Arr_oblivious_side_tag Arr_top_side_category; - typedef Arr_oblivious_side_tag Arr_right_side_category; + typedef Arr_oblivious_side_tag Left_side_category; + typedef Arr_oblivious_side_tag Bottom_side_category; + typedef Arr_oblivious_side_tag Top_side_category; + typedef Arr_oblivious_side_tag Right_side_category; private: typedef Arr_polyline_traits_2 Self; @@ -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. //@{ @@ -738,10 +743,10 @@ public: // the polylines is not defined at this point, so we give it // multiplicity 0. if (left_res == SMALLER) { - std::pair p(min_vertex(cv2[i2]), 0); + std::pair p(min_vertex(cv2[i2]), 0); *oi++ = make_object(p); } else { - std::pair p(min_vertex(cv1[i1]), 0); + std::pair p(min_vertex(cv1[i1]), 0); *oi++ = make_object(p); } } @@ -772,17 +777,17 @@ public: *oi++ = make_object(ocv); } else if (right_coincides) { if (right_res == SMALLER) { - std::pair ip(max_vertex(cv1[i1 - 1]), 0); + std::pair ip(max_vertex(cv1[i1 - 1]), 0); *oi++ = make_object(ip); } else if (right_res == LARGER) { - std::pair ip(max_vertex(cv2[i2 - 1]), 0); + std::pair ip(max_vertex(cv2[i2 - 1]), 0); *oi++ = make_object(ip); } else if (i1 > 0) { - std::pair ip(max_vertex(cv1[i1 - 1]), 0); + std::pair ip(max_vertex(cv1[i1 - 1]), 0); *oi++ = make_object(ip); } else { CGAL_assertion(i2 > 0); - std::pair ip(max_vertex(cv2[i2 - 1]), 0); + std::pair ip(max_vertex(cv2[i2 - 1]), 0); *oi++ = make_object(ip); } } @@ -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_rat_arc/Algebraic_point_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Algebraic_point_2.h new file mode 100644 index 00000000000..9e10f0453d8 --- /dev/null +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Algebraic_point_2.h @@ -0,0 +1,436 @@ +// Copyright (c) 2011 Tel-Aviv University (Israel), INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Oren Salzman +// Michael Hemmer + +#ifndef CGAL_ALBERAIC_POINT_D_1_H +#define CGAL_ALBERAIC_POINT_D_1_H + +#include + +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include + +namespace CGAL { +namespace Arr_rational_arc { + +//------------------- +//Algebraic_point_2_rep +//------------------- +template +class Algebraic_point_2_rep : public Base_rational_arc_ds_1 +{ +public: + typedef AlgebraicKernelD_1 Algebraic_kernel_d_1; + typedef Base_rational_arc_ds_1 + Base; + + typedef CGAL::Arr_rational_arc::Rational_function + Rational_function; + typedef CGAL::Arr_rational_arc::Rational_function_pair + Rational_function_pair; + + typedef typename Base::Algebraic_real_1 Algebraic_real_1; + typedef typename Algebraic_kernel_d_1::Bound Bound; + typedef typename Base::Integer Integer ; + typedef typename Base::Rational Rational ; + typedef typename Base::Polynomial_1 Polynomial_1; + + typedef typename Base::Root_multiplicity_vector Root_multiplicity_vector; + + typedef typename Get_arithmetic_kernel::Arithmetic_kernel + AK; + typedef typename AK::Bigfloat_interval BFI; + typedef Bigfloat_interval_traits BFI_traits; + typedef CGAL::Polynomial BFI_polynomial; + typedef CGAL::Polynomial_traits_d BFI_polynomial_traits; + + + typedef typename Base::FT_rat_1 FT_rat_1; + typedef typename Base::Polynomial_traits_1 Polynomial_traits_1; + + typedef CGAL::Arr_rational_arc::Cache + Cache; + +public: + Algebraic_point_2_rep(){} + Algebraic_point_2_rep(const Rational_function& rational_function, + const Algebraic_real_1& x_coordinate) : + _rational_function(rational_function), + _x_coordinate(x_coordinate) {} + + //assignment oparator + Algebraic_point_2_rep& operator=(const Algebraic_point_2_rep& other) + { + if (this != &other) // protect against invalid self-assignment + { + _rational_function = other._rational_function; + _x_coordinate = other._x_coordinate; + } + return *this; + } + + Comparison_result compare_xy_2(const Algebraic_point_2_rep& other, + const Cache& cache) const + { + Comparison_result comp = CGAL::compare(_x_coordinate, other.x()); + if (comp != EQUAL) + return comp; + if (_rational_function == other.rational_function()) + return EQUAL; + Rational_function_pair rat_func_pair = + cache.get_rational_pair(_rational_function, other.rational_function()); + return rat_func_pair.compare_f_g_at(_x_coordinate); + } + + Algebraic_real_1& x() + { + return _x_coordinate; + } + + const Algebraic_real_1& x() const + { + return _x_coordinate; + } + + const Rational_function& rational_function() const + { + return _rational_function; + } + + const Polynomial_1& numerator() const { return _rational_function.numer(); } + const Polynomial_1& denominator() const { return _rational_function.denom(); } + + //new functions... + Algebraic_real_1 y() const + { + typedef CGAL::Polynomial Polynomial_2; + //converting the defining polynomial of x and the rational function to + //bivariate polynomials + Polynomial_2 f(_algebraic_kernel.compute_polynomial_1_object()(_x_coordinate)); + + Polynomial_2 y(CGAL::shift(Polynomial_2(1),1)); + Polynomial_2 g(_rational_function.numer() - y * _rational_function.denom()); + + f=CGAL::swap(f, 0, 1); //swap x and y in the polynomial f + g=CGAL::swap(g, 0, 1); //swap x and y in the polynomial g + //compute the resultant in x (polynomial in y) + Polynomial_1 r(CGAL::resultant(f,g)); + + //solve for all roots of resultant + std::list roots; + _algebraic_kernel.solve_1_object()(r, false, std::back_inserter(roots)); + //isolate the right root + unsigned int initial_precision = 16; + int error_bound = 2; + + while (roots.size() > 1) + { + std::pair + y_bounds(this->approximate_absolute_y(error_bound,initial_precision)); + while (CGAL::compare(roots.front(),y_bounds.first) == SMALLER) + roots.pop_front(); + + while (CGAL::compare(y_bounds.second,roots.back()) == SMALLER) + roots.pop_back(); + + error_bound *= 2; + } + + CGAL_postcondition (roots.size() == 1); + return roots.front(); + } + std::pair to_double() const + { + double x = CGAL::to_double(_x_coordinate); + double numer_val = evaluate_at(_rational_function.numer(),x); + double denom_val = evaluate_at(_rational_function.denom(),x); + return std::make_pair(x,numer_val/denom_val); + } + std::pair approximate_absolute_x( int a) const + { + return _algebraic_kernel.approximate_absolute_1_object()(_x_coordinate,a); + } + std::pair approximate_absolute_y( int a) const + { + unsigned int precision = 16; + return approximate_absolute_y(a,precision); + } + std::pair approximate_relative_x( int r) const + { + return _algebraic_kernel.approximate_relative_1_object()(_x_coordinate,r); + } + std::pair approximate_relative_y( int r) const + { + // return zero if y is zero (the code below would not terminate) + // moreover approx relative is actually not well defined + if(_rational_function.sign_at(_x_coordinate)==CGAL::ZERO) + return std::make_pair(Bound(0),Bound(0)); + + + typename BFI_traits::Set_precision set_precision; + typename BFI_polynomial_traits::Evaluate evaluate; + long precision = 16; + Rational error_bound = CGAL::ipower(Rational(1,2),r); + while (true) + { + set_precision(precision); + BFI x_bfi(convert_to_bfi(_x_coordinate)); + + BFI_polynomial + numer_bfi(convert_to_bfi_extended(_rational_function.numer())); + BFI_polynomial + denom_bfi(convert_to_bfi_extended(_rational_function.denom())); + + BFI y_numer_bfi(evaluate(numer_bfi,x_bfi)); + BFI y_denom_bfi(evaluate(denom_bfi,x_bfi)); + + if (CGAL::zero_in(y_denom_bfi) == false) + { + BFI y_bfi(y_numer_bfi/y_denom_bfi); + if (CGAL::compare(CGAL::width(y_bfi), + Rational(CGAL::lower(CGAL::abs(y_bfi))) * error_bound ) + == SMALLER) + return std::make_pair(Bound(CGAL::lower(y_bfi)), + Bound(CGAL::upper(y_bfi))); + } + else precision*=2; + } + } + + std::ostream& print (std::ostream& os) const + { + std::pair double_p; + switch(::CGAL::get_mode(os)) + { + case ::CGAL::IO::PRETTY: + double_p = this->to_double(); + os <<"(" ; + os << double_p.first; + os <<" , " ; + os << double_p.second; + os << ")"; + break; + + case ::CGAL::IO::BINARY: + std::cerr << "BINARY format not yet implemented" << std::endl; + break; + + default: + // ASCII + os <<"x = " << _x_coordinate<<" "; + os <<"rational function = ( " ; + Base::print_polynomial(os, _rational_function.numer(), 'x'); + os << ") / ("; + Base::print_polynomial(os, _rational_function.denom(), 'x'); + os << ")"; + } + + return os; + } +private: + std::pair approximate_absolute_y( int a,unsigned int& precision ) const + { + typename BFI_traits::Set_precision set_precision; + typename BFI_polynomial_traits::Evaluate evaluate; + Rational error_bound = CGAL::ipower(Rational(1,2),a); + while (true) + { + set_precision(precision); + BFI x_bfi(convert_to_bfi(_x_coordinate)); + + BFI_polynomial numer_bfi(convert_to_bfi_extended(_rational_function.numer())); + BFI_polynomial denom_bfi(convert_to_bfi_extended(_rational_function.denom())); + + BFI y_numer_bfi(evaluate(numer_bfi,x_bfi)); + BFI y_denom_bfi(evaluate(denom_bfi,x_bfi)); + + if (CGAL::zero_in(y_denom_bfi) == false) + { + BFI y_bfi(y_numer_bfi/y_denom_bfi); + if (Bound(CGAL::width(y_bfi)) < error_bound ) + return std::make_pair(Bound(CGAL::lower(y_bfi)), + Bound(CGAL::upper(y_bfi)) ); + } + else precision*=2; + } + } + + template + static typename + CGAL::Coercion_traits:: + Arithmetic_kernel::Bigfloat_interval>::Type + convert_to_bfi_extended(const NTX& x) + { + typedef typename Get_arithmetic_kernel::Arithmetic_kernel AK; + typedef typename AK::Bigfloat_interval BFI; + typedef CGAL::Coercion_traits CT; + return typename CT::Cast()(x); + } + + double evaluate_at(const Polynomial_1& poly, const double x) const + { + double x_val = 1; + double ret_val(0); + for (int i(0); i <= poly.degree(); ++i) + { + ret_val = ret_val + x_val*CGAL::to_double(poly[i]); + x_val = x_val*x; + } + return ret_val; + } + +private: + Rational_function _rational_function; //supporting rational function + Algebraic_real_1 _x_coordinate; + + Algebraic_kernel_d_1 _algebraic_kernel; +}; + +template +class Algebraic_point_2 : + public Handle_with_policy > +{ + +public: + typedef Algebraic_kernel_ Algebraic_kernel_d_1; + typedef Handle_with_policy > + Base; + typedef Algebraic_point_2 Self; + typedef Algebraic_point_2_rep Rep; + typedef typename Rep::Rational Rational; + typedef typename Rep::Algebraic_real_1 Algebraic_real_1; + typedef typename Rep::Rational_function Rational_function; + typedef typename Rep::Bound Bound; + typedef typename Rep::Cache Cache; + typedef typename Rep::Polynomial_1 Polynomial_1; + +private: + static Self& get_default_instance() + { + static Algebraic_kernel_d_1 kernel; + static typename Rational_function::Polynomial_1 numer(0); + static typename Rational_function::Polynomial_1 denom(1); + static Rational_function rational_function(numer, denom, &kernel); + + static Algebraic_real_1 x_coordinate = + kernel.construct_algebraic_real_1_object()(Rational(0)); + + static Self default_instance(rational_function,x_coordinate); + + return default_instance; + + /*static Self x = Self(Rational(0),Rational(0),_cache); + return x; */ + } + +public: + explicit Algebraic_point_2(const Rational_function& rational_function, + const Algebraic_real_1& x_coordinate) : + Base(rational_function,x_coordinate) {} + + //used to solve VS bug... + Algebraic_point_2(const Self & p = get_default_instance()) : + Base(static_cast (p)) {} + + Comparison_result compare_xy_2(const Algebraic_point_2& other, + const Cache& cache) const + { + if (this->is_identical (other)) + return CGAL::EQUAL; + return this->ptr()->compare_xy_2(*other.ptr(), cache); + } + + const Polynomial_1& numerator() const { return this->ptr()->numerator(); } + const Polynomial_1& denominator() const { return this->ptr()->denominator(); } + + Algebraic_real_1& x() + { + if (this->is_shared()) + this->copy_on_write(); + return this->ptr()->x(); + } + + const Algebraic_real_1& x() const + { + return this->ptr()->x(); + } + + const Rational_function& rational_function() const + { + return this->ptr()->rational_function(); + } + + Algebraic_real_1 y() const + { + return this->ptr()->y(); + } + + std::pair to_double() const + { + return this->ptr()->to_double(); + } + + std::pair approximate_absolute_x( int a) const + { + return this->ptr()->approximate_absolute_x(a); + } + + std::pair approximate_absolute_y( int a) const + { + return this->ptr()->approximate_absolute_y(a); + } + + std::pair approximate_relative_x( int r) const + { + return this->ptr()->approximate_relative_x(r); + } + + std::pair approximate_relative_y( int r) const + { + return this->ptr()->approximate_relative_y(r); + } + + std::ostream& print(std::ostream& os) const + { + return this->ptr()->print(os); + } +}; //Algebraic_point_2 + + +template < typename Algebraic_kernel_> +std::ostream& operator<<(std::ostream& os, + const Algebraic_point_2 & p) +{ + return (p.print(os)); +} + +} //namespace Arr_rational_arc +} //namespace CGAL { + +#endif //CGAL_ALBERAIC_POINT_D_1_H 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 new file mode 100644 index 00000000000..c85169b85d4 --- /dev/null +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h @@ -0,0 +1,125 @@ +// Copyright (c) 2011 Tel-Aviv University (Israel), INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Oren Salzman +// Michael Hemmer + +#ifndef CGAL_BASE_RATIONAL_ARC_DS_D_1_H +#define CGAL_BASE_RATIONAL_ARC_DS_D_1_H + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +namespace CGAL { +namespace Arr_rational_arc { + +template +class Base_rational_arc_ds_1 +{ +public: + typedef Algebraic_kernel_ Algebraic_kernel; + typedef Base_rational_arc_ds_1 Self; + + //typedef typename Algebraic_kernel::Multiplicity_type Multiplicity; + typedef unsigned int Multiplicity; + typedef typename Algebraic_kernel::Coefficient Coefficient; + + typedef typename Get_arithmetic_kernel::Arithmetic_kernel + Arithmetic_kernel; + typedef typename Arithmetic_kernel::Rational Rational; + typedef typename Arithmetic_kernel::Integer Integer; + typedef typename Algebraic_kernel::Algebraic_real_1 Algebraic_real_1; + + typedef typename Algebraic_kernel::Polynomial_1 Polynomial_1; + typedef Polynomial_traits_d Polynomial_traits_1; + typedef Fraction_traits FT_rat_1; + typedef typename Algebraic_kernel::Solve_1 Solve_1; + typedef typename Algebraic_kernel::Bound Bound; + typedef Algebraic_structure_traits AT_poly; + + typedef Polynomial Poly_rat_1; + typedef Polynomial_traits_d PT_rat_1; + typedef Fraction_traits FT_poly_rat_1; + typedef std::vector Algebraic_vector; + typedef std::vector Multiplicity_vector; + typedef std::vector > + Root_multiplicity_vector; + + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + +public: + + //--------------------------------------------------------------------- + // Print a polynomial nicely. + + static std::ostream& print_polynomial(std::ostream& os, + const Polynomial_1& poly, + char var) + { + // Get the degree. + const int deg = CGAL::degree(poly); + + Integer coeff; + CGAL::Sign sgn; + int k; + + if (deg < 0) + { + os << '0'; + return (os); + } + + for (k = deg; k >= 0; k--) + { + //coeff = pt::Get_coefficient()(poly, k); + coeff = CGAL::get_coefficient(poly, k); + + if (k == deg) + os << coeff; + else if ((sgn = CGAL::sign (coeff)) == POSITIVE) + os << " + " << coeff; + else if (sgn == NEGATIVE) + os << " - " << -coeff; + else + continue; + + if (k > 1) + os << '*' << var << '^' << k; + else if (k == 1) + os << '*' << var; + } + + return (os); + } + +}; //Base_rational_arc_ds_1 + +} // namespace Arr_rational_arc +} //namespace CGAL { + +#endif //CGAL_BASE_RATIONAL_ARC_DS_D_1_H diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Cache.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Cache.h new file mode 100644 index 00000000000..ef8f4ef4451 --- /dev/null +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Cache.h @@ -0,0 +1,323 @@ +// Copyright (c) 2011 Tel-Aviv University (Israel), INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Oren Salzman +// Michael Hemmer + +#ifndef CGAL_RATIONAL_ARC_CACHE +#define CGAL_RATIONAL_ARC_CACHE + +#include +#include +#include +#include + +namespace CGAL { +namespace Arr_rational_arc { + +//------------------- +//Cache +//------------------- +template +class Cache : public Base_rational_arc_ds_1 +{ +public: + typedef AlgebraicKernel_d_1 Algebraic_kernel_d_1; + typedef Base_rational_arc_ds_1 Base; + typedef Cache Self; + + typedef typename Base::Polynomial_1 Polynomial_1; + typedef typename Base::Rational Rational; + typedef typename Base::Algebraic_real_1 Algebraic_real_1; + typedef typename Base::Integer Integer ; + typedef typename Base::FT_rat_1 FT_rat_1; + typedef typename Base::Polynomial_traits_1 Polynomial_traits_1; + + typedef CGAL::Arr_rational_arc::Rational_function + Rational_function; + typedef CGAL::Arr_rational_arc::Rational_function_canonicalized_pair + Rational_function_canonicalized_pair; + typedef CGAL::Arr_rational_arc::Rational_function_pair + Rational_function_pair; + + typedef std::pair Rational_function_key; + class Less_compare_rational_function_key + { + public: + Comparison_result compare(const Rational_function_key& k1, + const Rational_function_key& k2) const + { + Comparison_result cr = + typename Polynomial_traits_1::Compare()(k1.first, k2.first); + if (cr != CGAL::EQUAL) + return (cr); + cr = typename Polynomial_traits_1::Compare()(k1.second, k2.second); + + return cr; + } + + bool operator()(const Rational_function_key& k1, + const Rational_function_key& k2) const + { + Comparison_result cr = compare(k1,k2); + return ((cr == CGAL::LARGER) ? true : false); + } + }; + + typedef typename std::map + Rational_function_map; + + typedef typename Rational_function::Id_type Rational_function_id_type; + typedef std::pair + Rational_function_canonicalized_pair_key; + + class Less_compare_rational_function_pair_key + { + public: + bool operator()(const Rational_function_canonicalized_pair_key& k1, + const Rational_function_canonicalized_pair_key& k2) const + { + return (k1 + Rational_function_canonicalized_pair_map; + +public: + Cache() : + _rat_func_map_watermark(128), _rat_pair_map_watermark(128), _ak_ptr(NULL){}; + + void initialize(Algebraic_kernel_d_1* ak_ptr) + { + _ak_ptr = ak_ptr; + } + void initialize(const Self& other, Algebraic_kernel_d_1* ak_ptr) + { + //copy kernel pointer + _ak_ptr = ak_ptr; + + //copy rational function map + typename Rational_function_map::const_iterator iter1; + for ( iter1 = other.rat_func_map().begin(); + iter1 != other.rat_func_map().end(); + ++iter1) + { + if (iter1->second.is_shared()) + { + Rational_function_key key = iter1->first; + //construct new instance + Rational_function f(iter1->second.numer(), iter1->second.denom(), + _ak_ptr); + _rat_func_map.insert(std::make_pair(key,f)); + } + } + + //copy rational function pair map + typename Rational_function_canonicalized_pair_map::const_iterator iter2; + for ( iter2 = other.rat_pair_map().begin(); + iter2 != other.rat_pair_map().end(); + ++iter2) + { + if (iter2->second.is_shared()) + { + Rational_function_canonicalized_pair_key key = iter2->first; + //construct new instance + Rational_function_canonicalized_pair p(iter2->second.f(), + iter2->second.g(), _ak_ptr); + _rat_pair_map.insert(std::make_pair(key,p)); + } + } + + } + const Rational_function_map& rat_func_map() const + { + return _rat_func_map; + } + + const Rational_function_canonicalized_pair_map& rat_pair_map() const + { + return _rat_pair_map; + } + + const Rational_function& get_rational_function(const Polynomial_1& numer, + const Polynomial_1& denom) const + { + CGAL_precondition (_ak_ptr != NULL); + Rational_function_key key = get_key(numer,denom); + + //look if element exists in cache already + typename Rational_function_map::iterator it = _rat_func_map.lower_bound(key); + + if(it != _rat_func_map.end() && !(_rat_func_map.key_comp()(key, it->first))) + { + return it->second; //iterator to a type + } + else //element does not exist, create it & insert to cache + { + //first check if to clean up cache + if (_rat_func_map.size() > _rat_func_map_watermark) + rat_func_map_clean_up(); + + //then insert the new element + Rational_function f(numer,denom,_ak_ptr); + typename Rational_function_map::iterator it2 = + _rat_func_map.insert(it,std::make_pair(key,f)); + return it2->second; + } + } + const Rational_function& get_rational_function( const Rational& rat) const + { + Integer numer,denom; + typename FT_rat_1::Decompose()(rat,numer,denom); + + Polynomial_1 numer_poly = + typename Polynomial_traits_1::Construct_polynomial()(numer); + Polynomial_1 denom_poly = + typename Polynomial_traits_1::Construct_polynomial()(denom); + + return get_rational_function (numer_poly,denom_poly); + } + + const Rational_function_pair get_rational_pair(const Rational_function& f, + const Rational_function& g) const + { + CGAL_precondition (_ak_ptr != NULL); + CGAL_precondition(!(f==g)); + Rational_function_canonicalized_pair_key key = get_key(f,g); + bool is_opposite = (f.id() < g.id()) ? false : true ; + + //look if element exists in cache already + typename Rational_function_canonicalized_pair_map::iterator it = + _rat_pair_map.lower_bound(key); + + if(it != _rat_pair_map.end() && !(_rat_pair_map.key_comp()(key, it->first))) + { + return (Rational_function_pair(it->second,is_opposite)); + } + else //element does not exist, + { + //first check if to clean up cache + if (_rat_pair_map.size() > _rat_pair_map_watermark) + rat_pair_map_clean_up(); + + //create it & insert to cache + Rational_function_canonicalized_pair p(f, g, _ak_ptr); + std::pair res = + _rat_pair_map.insert(std::make_pair(key,p)); + return (Rational_function_pair(res.first->second,is_opposite)); + } + } + + void cleanup() const + { + rat_pair_map_clean_up(); + rat_func_map_clean_up(); + } +private: + Rational_function_key get_key(const Polynomial_1& numer, + const Polynomial_1& denom) const + { + return Rational_function_key(numer, denom); + } + + Rational_function_key get_key(const Rational_function& f) const + { + return get_key(f.numer(), f.denom()); + } + + Rational_function_canonicalized_pair_key + get_key(const Rational_function& f, const Rational_function& g) const + { + return (f.id() < g.id()) ? + Rational_function_canonicalized_pair_key( f.id(),g.id() ): + Rational_function_canonicalized_pair_key( g.id(),f.id() ); + + } + + void rat_func_map_clean_up() const + { + + //find eraseable rational functions + std::vector eraseable; + typename Rational_function_map::iterator iter1; + for ( iter1 = _rat_func_map.begin(); + iter1 != _rat_func_map.end(); + ++iter1) + { + if (iter1->second.is_shared() == false) + eraseable.push_back(iter1->first); + } + + //erase functions + typename std::vector::iterator iter2; + for ( iter2 = eraseable.begin(); + iter2 != eraseable.end(); + ++iter2) + { + _rat_func_map.erase(*iter2); + } + + //re-set watermark + _rat_func_map_watermark = (std::max)( + 2*_rat_func_map.size(), + typename Rational_function_map::size_type(128)); + + return; + } + void rat_pair_map_clean_up() const + { + //find eraseable rational functions + std::vector eraseable; + typename Rational_function_canonicalized_pair_map::iterator iter1; + for ( iter1 = _rat_pair_map.begin(); + iter1 != _rat_pair_map.end(); + ++iter1) + { + if (iter1->second.is_shared() == false) + eraseable.push_back(iter1->first); + } + + //erase functions + typename std::vector::iterator iter2; + for ( iter2 = eraseable.begin(); + iter2 != eraseable.end(); + ++iter2) + { + _rat_pair_map.erase(*iter2); + } + + //re-set watermark + _rat_pair_map_watermark = + (std::max)(2*_rat_pair_map.size(), + typename Rational_function_canonicalized_pair_map::size_type(128)); + } + +private: + mutable Rational_function_map _rat_func_map; + mutable unsigned int _rat_func_map_watermark; + mutable Rational_function_canonicalized_pair_map _rat_pair_map; + mutable unsigned int _rat_pair_map_watermark; + mutable Algebraic_kernel_d_1* _ak_ptr; +}; //Cache + +} //namespace Arr_rational_arc +} //namespace CGAL { +#endif //CGAL_RATIONAL_ARC_CACHE 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 new file mode 100644 index 00000000000..5a7911fc46a --- /dev/null +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h @@ -0,0 +1,2603 @@ +// Copyright (c) 2011 Tel-Aviv University (Israel), INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Oren Salzman +// Michael Hemmer + +#ifndef CGAL_RATIONAL_ARC_D_1_H +#define CGAL_RATIONAL_ARC_D_1_H + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +namespace CGAL { +namespace Arr_rational_arc { + +//--------------------------------------------------------------------------// +// class Base_rational_arc_d_1 +//Representation of an segment of a rational function, given as: +// +// Numerator(x) +// y = ------------- x_l <= x <= x_r +// Denominator(x) +// +// where Numerator and Denominator are polynomial with integer (or rational) coefficients. +// The class is templated with two parameters: +// Algebraic_kernel: An algebraic kernel for the intersection points of the curves +// +// This class serves as the base for the classes: +// Rational_arc_d_1 (a general, not necessarily continuous arc) +// Continuous_rational_arc_d_1 (a continuous portion of a rational function). +//--------------------------------------------------------------------------// + +template +class Base_rational_arc_d_1 +{ +public: + typedef Algebraic_kernel_ Algebraic_kernel; + typedef Base_rational_arc_d_1 Self; + + typedef CGAL::Arr_rational_arc::Base_rational_arc_ds_1 + Base_rational_arc_ds_1; + typedef CGAL::Arr_rational_arc::Rational_function + Rational_function; + typedef CGAL::Arr_rational_arc::Rational_function_pair + Rational_function_pair; + typedef CGAL::Arr_rational_arc::Algebraic_point_2 + Algebraic_point_2; + + typedef CGAL::Arr_rational_arc::Cache Cache; + + typedef typename Base_rational_arc_ds_1::Multiplicity Multiplicity; + typedef typename Base_rational_arc_ds_1::Polynomial_1 Polynomial_1; + typedef typename Base_rational_arc_ds_1::Coefficient Coefficient; + typedef typename Base_rational_arc_ds_1::Arithmetic_kernel + Arithmetic_kernel; + typedef typename Base_rational_arc_ds_1::Rational Rational; + typedef typename Base_rational_arc_ds_1::Integer Integer; + typedef typename Base_rational_arc_ds_1::Algebraic_real_1 Algebraic_real_1; + typedef typename Base_rational_arc_ds_1::Algebraic_vector Algebraic_vector; + typedef typename Base_rational_arc_ds_1::Multiplicity_vector + Multiplicity_vector; + + typedef std::vector Rat_vector; + + typedef Polynomial_traits_d Polynomial_traits_1; + typedef typename Base_rational_arc_ds_1::FT_rat_1 FT_rat_1; + typedef typename Base_rational_arc_ds_1::Solve_1 Solve_1; + typedef typename Algebraic_kernel::Bound Bound; + typedef Algebraic_structure_traits AT_poly; + + typedef Polynomial Poly_rat_1; + typedef Polynomial_traits_d PT_rat_1; + typedef Fraction_traits FT_poly_rat_1; + + typedef Algebraic_point_2 Point_2; + + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + +public: + const Rational_function& get_rational_function(const Polynomial_1& numerator, + const Polynomial_1& denominator, + const Cache& cache) const + { + return cache.get_rational_function(numerator, denominator); + } + const Rational_function& get_rational_function(const Rational& rat, + const Cache& cache) const + { + return cache.get_rational_function(rat); + } + const Rational_function_pair get_rational_pair(const Rational_function& f, + const Rational_function& g, + const Cache& cache) const + { + CGAL_precondition(f.id() != g.id()); + return cache.get_rational_pair(f, g); + } + +public: + //------------------------------ + //Base_rational_arc_d_1 members + //------------------------------ + enum + { + SRC_AT_X_MINUS_INFTY = 1, + SRC_AT_X_PLUS_INFTY = 2, + SRC_AT_Y_MINUS_INFTY = 4, + SRC_AT_Y_PLUS_INFTY = 8, + + SRC_INFO_BITS = SRC_AT_X_MINUS_INFTY + SRC_AT_X_PLUS_INFTY + + SRC_AT_Y_MINUS_INFTY + SRC_AT_Y_PLUS_INFTY, + + TRG_AT_X_MINUS_INFTY = 16, + TRG_AT_X_PLUS_INFTY = 32, + TRG_AT_Y_MINUS_INFTY = 64, + TRG_AT_Y_PLUS_INFTY = 128, + + TRG_INFO_BITS = TRG_AT_X_MINUS_INFTY + TRG_AT_X_PLUS_INFTY + + TRG_AT_Y_MINUS_INFTY + TRG_AT_Y_PLUS_INFTY, + + IS_DIRECTED_RIGHT = 256, + IS_CONTINUOUS = 512, + IS_VALID = 1024 + }; + + Rational_function _f; // The rational function + Algebraic_point_2 _ps; // The source point. + Algebraic_point_2 _pt; // The target point. + int _info; // A set of Boolean flags. + +public: + //------------ + //Constructors + //------------ + + //--------------------------------------------------------------------------- + //default constructor + Base_rational_arc_d_1() : + _info(0) + {} + + //--------------------------------------------------------------------------- + // Constructor of a whole polynomial curve defined by pcoeffs - the rational + // coefficients of the polynomial p(x). + + Base_rational_arc_d_1(const Polynomial_1& P, const Cache& cache) : + _info(0) + { + _init(P, Integer(1), cache); + } + + Base_rational_arc_d_1(const Rat_vector& pcoeffs, const Cache& cache) : + _info(0) + { + // Set the numerator & denominator polynomials. + Polynomial_1 _numer; + Poly_rat_1 num_rat(typename PT_rat_1::Construct_polynomial()(pcoeffs.begin(), + pcoeffs.end())); + Integer denom_int; + typename FT_poly_rat_1::Decompose()(num_rat, _numer, denom_int); + + _init(_numer,denom_int,cache); + } + + void _init(const Polynomial_1& P,const Integer& Q_int,const Cache& cache) + { + CGAL_precondition(!CGAL::is_zero(Q_int)); + //set rational function + Polynomial_1 Q= typename Polynomial_traits_1::Construct_polynomial()(Q_int); + _f = get_rational_function(P, Q, cache); + + //Mark that the endpoints of the polynomial are unbounded + //(the source is at x = -oo and the target is at x = +oo). + _info = (_info | SRC_AT_X_MINUS_INFTY); + _info = (_info | TRG_AT_X_PLUS_INFTY); + _info = (_info | IS_DIRECTED_RIGHT); + + // Check whether the end points lie at y = -oo or at y = +oo. + const int deg_num(CGAL::degree(P)); + Integer lead_coeff(CGAL::leading_coefficient(Q)); + CGAL::Sign lead_sign(CGAL::sign(lead_coeff)); + + if (deg_num > 0) + { + // Check if the degree is even or odd and check the sign of the leading + // coefficient of the polynomial. + + CGAL_assertion(lead_sign != CGAL::ZERO); + + if (deg_num % 2 == 0) + { + // Polynomial of an even degree. + if (lead_sign == CGAL::NEGATIVE) + _info = (_info | SRC_AT_Y_MINUS_INFTY | TRG_AT_Y_MINUS_INFTY); + else + _info = (_info | SRC_AT_Y_PLUS_INFTY | TRG_AT_Y_PLUS_INFTY); + } + else + { + // Polynomial of an odd degree. + if (lead_sign == CGAL::NEGATIVE) + _info = (_info | SRC_AT_Y_PLUS_INFTY | TRG_AT_Y_MINUS_INFTY); + else + _info = (_info | SRC_AT_Y_MINUS_INFTY | TRG_AT_Y_PLUS_INFTY); + } + } + else + { + // In the case of a constant polynomial it is possible to set a finite + // y-coordinate for the source and target points. + //x coordinate is 0 although in practice is +-oo + _ps = Algebraic_point_2(_f,Algebraic_real_1()); + //x coordinate is 0 although in practice is +-oo + _pt = Algebraic_point_2(_f,Algebraic_real_1()); + } + + // Mark that the arc is continuous and valid. + _info = (_info | IS_CONTINUOUS); + _info = (_info | IS_VALID); + + } + + //--------------------------------------------------------------------------- + //Constructor of a polynomial ray, defined by y = p(x), + //for x_s <= x if the ray is directed to the right, or + //for x_s >= x if it is directed to the left. + //param pcoeffs The rational coefficients of the polynomial p(x). + //param x_s The x-coordinate of the source point. + //param dir_right Is the ray directed to the right (to +oo) or to the left + //(to -oo). + + Base_rational_arc_d_1(const Polynomial_1& P, const Algebraic_real_1& x_s, + bool dir_right, const Cache& cache) : + _info(0) + { + _init(P, Polynomial_1(1), x_s, dir_right, cache); + } + + Base_rational_arc_d_1(const Rat_vector& pcoeffs,const Algebraic_real_1& x_s, + bool dir_right, const Cache& cache) : + _info(0) + { + // Set the numerator & denominator polynomials. + Polynomial_1 _numer; + Poly_rat_1 num_rat(typename PT_rat_1::Construct_polynomial()(pcoeffs.begin(), + pcoeffs.end())); + Integer denom_int; + typename FT_poly_rat_1::Decompose()(num_rat, _numer, denom_int); + + _init(_numer, denom_int, x_s, dir_right, cache); + } + + void _init(const Polynomial_1& P,const Integer& Q_int, + const Algebraic_real_1& x_s, bool dir_right,const Cache& cache) + { + CGAL_precondition(!CGAL::is_zero(Q_int)); + //set rational function + Polynomial_1 Q = typename Polynomial_traits_1::Construct_polynomial()(Q_int); + _f = get_rational_function(P,Q,cache); + + // Mark that the target points of the polynomial is unbounded. + if (dir_right) + { + _info = (_info | TRG_AT_X_PLUS_INFTY); + _info = (_info | IS_DIRECTED_RIGHT); + } + else + { + _info = (_info | TRG_AT_X_MINUS_INFTY); + } + + // Set the source point. + _ps=Algebraic_point_2(_f,x_s); + + // Check whether the target point lies at y = -oo or at y = +oo. + const int deg_num(CGAL::degree(P)); + Integer lead_coeff(CGAL::leading_coefficient(P)); + CGAL::Sign lead_sign(CGAL::sign(lead_coeff)); + + if (deg_num > 0) + { + //Check if the degree is even or odd and check the sign of the leading + // coefficient of the polynomial. + CGAL_assertion(lead_sign != CGAL::ZERO); + + if (dir_right) + { + // The target is at x= +oo, thus: + if (lead_sign == CGAL::POSITIVE) + _info = (_info | TRG_AT_Y_PLUS_INFTY); + else + _info = (_info | TRG_AT_Y_MINUS_INFTY); + } + else + { + // The target is at x= -oo, thus: + if ((deg_num % 2 == 0 && lead_sign == CGAL::POSITIVE) || + (deg_num % 2 == 1 && lead_sign == CGAL::NEGATIVE)) + _info = (_info | TRG_AT_Y_PLUS_INFTY); + else + _info = (_info | TRG_AT_Y_MINUS_INFTY); + } + } + else + { + // In the case of a constant polynomial it is possible to set a finite + // y-coordinate for the target point. + // x coordinate is 0 although in practice is +-oo + _pt = Algebraic_point_2(get_rational_function(P, Q, cache), + Algebraic_real_1()); + } + + // Mark that the arc is continuous and valid. + _info = (_info | IS_CONTINUOUS); + _info = (_info | IS_VALID); + } + + //--------------------------------------------------------------------------- + //Constructor of a polynomial arc, defined by y = p(x), x_min <= x <= x_max. + //for x_s <= x if the ray is directed to the right, or + //for x_s >= x if it is directed to the left. + //param pcoeffs The rational coefficients of the polynomial p(x). + //param x_s The x-coordinate of the source point. + //param x_t The x-coordinate of the target point. + //precondition: The two x-coordinates must not be equal. + Base_rational_arc_d_1(const Polynomial_1& P, + const Algebraic_real_1& x_s, const Algebraic_real_1& x_t, + const Cache& cache): + _info(0) + { + _init(P,Integer(1), x_s, x_t, cache); + } + Base_rational_arc_d_1(const Rat_vector& pcoeffs, + const Algebraic_real_1& x_s,const Algebraic_real_1& x_t, + const Cache& cache): + _info(0) + { + // Set the numerator & denominator polynomials. + Polynomial_1 _numer; + Poly_rat_1 num_rat(typename PT_rat_1::Construct_polynomial()(pcoeffs.begin(), + pcoeffs.end())); + Integer denom_int; + typename FT_poly_rat_1::Decompose()(num_rat, _numer, denom_int); + + _init(_numer, denom_int, x_s, x_t, cache); + } + + void _init(const Polynomial_1& P,const Integer& Q_int, + const Algebraic_real_1& x_s,const Algebraic_real_1& x_t, + const Cache& cache) + { + CGAL_precondition(!CGAL::is_zero(Q_int)); + //set rational function + Polynomial_1 Q = typename Polynomial_traits_1::Construct_polynomial()(Q_int); + _f = get_rational_function(P, Q, cache); + + // Compare the x-coordinates and determine the direction. + Comparison_result x_res = CGAL::compare(x_s, x_t); + + CGAL_precondition(x_res != EQUAL); + + if (x_res == SMALLER) + _info = (_info | IS_DIRECTED_RIGHT); + + // Set the endpoints. + _ps=Algebraic_point_2(_f,x_s); + _pt=Algebraic_point_2(_f,x_t); + + // Mark that the arc is continuous and valid. + _info = (_info | IS_CONTINUOUS); + _info = (_info | IS_VALID); + return; + } + + //--------------------------------------------------------------------------- + //Constructor of a polynomial function, defined by y = p(x)/q(x) for any x. + //param pcoeffs The rational coefficients of the polynomial p(x). + //param qcoeffs The rational coefficients of the polynomial q(x). + Base_rational_arc_d_1(const Polynomial_1& P, const Polynomial_1& Q, + const Cache& cache) : + _info(0) + { + _init(P,Q,cache); + } + + Base_rational_arc_d_1(const Rat_vector& pcoeffs, const Rat_vector& qcoeffs, + const Cache& cache) : + _info(0) + { + Polynomial_1 _numer; + Polynomial_1 _denom; + Poly_rat_1 numer_rat(typename + PT_rat_1::Construct_polynomial()(pcoeffs.begin(), + pcoeffs.end())); + Poly_rat_1 denom_rat(typename + PT_rat_1::Construct_polynomial()(qcoeffs.begin(), + qcoeffs.end())); + Integer denom_numer_int,denom_denom_int; + typename FT_poly_rat_1::Decompose()(numer_rat, _numer, denom_numer_int); + typename FT_poly_rat_1::Decompose()(denom_rat, _denom, denom_denom_int); + _numer *= denom_denom_int; + _denom *= denom_numer_int; + + _init(_numer,_denom,cache); + } + void _init(const Polynomial_1& _P, const Polynomial_1& _Q, const Cache& cache) + { + CGAL_precondition(!CGAL::is_zero(_Q)); + //set rational function + // Set the numerator & denominator polynomials. + + Polynomial_1 P; + Polynomial_1 Q; + _canonicalize(_P, _Q, P, Q); + + _f = get_rational_function(P, Q, cache); + + // Mark that the endpoints of the rational functions are unbounded (the + // source is at x = -oo and the target is at x = +oo). + _info = (_info | SRC_AT_X_MINUS_INFTY); + _info = (_info | TRG_AT_X_PLUS_INFTY); + _info = (_info | IS_DIRECTED_RIGHT); + + + // Analyze the bahaviour of the rational function at x = -oo (the source). + Algebraic_real_1 y0; + const Arr_parameter_space inf_s = _analyze_at_minus_infinity(P, Q, y0); + + if (inf_s == ARR_BOTTOM_BOUNDARY) + _info = (_info | SRC_AT_Y_MINUS_INFTY); + else if (inf_s == ARR_TOP_BOUNDARY) + _info = (_info | SRC_AT_Y_PLUS_INFTY); + else // if (inf_s == ARR_INTERIOR) + _ps = Algebraic_point_2(); //the point is a dummy + //Analyze the bahaviour of the rational function at x = +oo (the target). + const Arr_parameter_space inf_t = _analyze_at_plus_infinity(P, Q, y0); + + if (inf_t == ARR_BOTTOM_BOUNDARY) + _info = (_info | TRG_AT_Y_MINUS_INFTY); + else if (inf_t == ARR_TOP_BOUNDARY) + _info = (_info | TRG_AT_Y_PLUS_INFTY); + else // if (inf_t == ARR_INTERIOR) + _pt = Algebraic_point_2(); //the point is a dummy + + // Mark that the arc is valid. As it may have poles, we mark it + // as continuous only if the denominator has no roots. + _info = ( _info | ( this->_is_continuous() ? + (IS_CONTINUOUS | IS_VALID) : IS_VALID ) ); + } + + //--------------------------------------------------------------------------- + //Constructor of a ray of a rational function, defined by y = p(x)/q(x), + //for x_s <= x if the ray is directed to the right, or + //for x_s >= x if the ray is directed to the left. + //param pcoeffs The rational coefficients of the polynomial p(x). + //param qcoeffs The rational coefficients of the polynomial q(x). + //param x_s The x-coordinate of the source point. + //param dir_right Is the ray directed to the right (to +oo) or to the left + //(to -oo). + Base_rational_arc_d_1(const Polynomial_1& P, const Polynomial_1& Q, + const Algebraic_real_1& x_s, bool dir_right, + const Cache& cache) : + _info(0) + { + _init(P, Q, x_s, dir_right, cache); + } + Base_rational_arc_d_1(const Rat_vector& pcoeffs, const Rat_vector& qcoeffs, + const Algebraic_real_1& x_s, bool dir_right, + const Cache& cache) : + _info(0) + { + // Set the numerator and denominator polynomials. + Polynomial_1 _numer; + Polynomial_1 _denom; + Poly_rat_1 numer_rat(typename + PT_rat_1::Construct_polynomial()(pcoeffs.begin(), + pcoeffs.end())); + Poly_rat_1 denom_rat(typename + PT_rat_1::Construct_polynomial()(qcoeffs.begin(), + qcoeffs.end())); + Integer denom_numer_int,denom_denom_int; + typename FT_poly_rat_1::Decompose()(numer_rat, _numer, denom_numer_int); + typename FT_poly_rat_1::Decompose()(denom_rat, _denom, denom_denom_int); + _numer *= denom_denom_int; + _denom *= denom_numer_int; + + _init(_numer,_denom, x_s, dir_right, cache); + } + + void _init(const Polynomial_1& _P, const Polynomial_1& _Q, + const Algebraic_real_1& x_s, bool dir_right, + const Cache& cache) + { + CGAL_precondition(!CGAL::is_zero(_Q)); + //set rational function + Polynomial_1 P; + Polynomial_1 Q; + _canonicalize(_P,_Q,P,Q); + _f = get_rational_function(P, Q, cache); + + // Mark that the target points of the polynomial is unbounded. + if (dir_right) + { + _info = (_info | TRG_AT_X_PLUS_INFTY); + _info = (_info | IS_DIRECTED_RIGHT); + } + else + { + _info = (_info | TRG_AT_X_MINUS_INFTY); + } + + + //The source point has a bounded x-coordinate. + _ps = Algebraic_point_2(_f, x_s); + //check if the source point lies next to a pole. + if (typename Algebraic_kernel::Sign_at_1()(Q, x_s) != CGAL::ZERO) + { + // We have a nomral endpoint. + //nothing to do.... + } + else + { + // The y-coodinate is unbounded, but we can set its sign. + std::pair signs = _analyze_near_pole(x_s); + const CGAL::Sign sign_s = (dir_right ? signs.second : signs.first); + + _info = (sign_s == CGAL::NEGATIVE) ? + (_info | SRC_AT_Y_MINUS_INFTY) : (_info | SRC_AT_Y_PLUS_INFTY); + } + + // Set the properties of the target. + Algebraic_real_1 y0; + Arr_parameter_space inf_t; + if (dir_right) + { + // The target point is at x = +oo. + inf_t=_analyze_at_plus_infinity(P, Q, y0); + } + else + { + // The target point is at x = -oo. + inf_t =_analyze_at_minus_infinity(P, Q, y0); + } + + if (inf_t == ARR_BOTTOM_BOUNDARY) + _info = (_info | TRG_AT_Y_MINUS_INFTY); + else if (inf_t == ARR_TOP_BOUNDARY) + _info = (_info | TRG_AT_Y_PLUS_INFTY); + else // if (inf_t == ARR_INTERIOR) + _pt = Algebraic_point_2( ); //the point is a dummy + + // Mark that the arc is valid. As it may have poles, we mark it + // as continuous only if the denominator has no roots. + _info = ( _info | ( this->_is_continuous() ? + (IS_CONTINUOUS | IS_VALID) : IS_VALID ) ); + } + //--------------------------------------------------------------------------- + //Constructor of a ray of a rational function, defined by y = p(x)/q(x), + //where: x_min <= x <= x_max + //param pcoeffs The rational coefficients of the polynomial p(x). + //param qcoeffs The rational coefficients of the polynomial q(x). + //param x_s The x-coordinate of the source point. + //param x_t The x-coordinate of the target point. + //precondition: The two x-coordinates must not be equal. + Base_rational_arc_d_1(const Polynomial_1& P, const Polynomial_1& Q, + const Algebraic_real_1& x_s, const Algebraic_real_1& x_t, + const Cache& cache): + _info(0) + { + _init(P, Q, x_s, x_t, cache); + } + + Base_rational_arc_d_1(const Rat_vector& pcoeffs, const Rat_vector& qcoeffs, + const Algebraic_real_1& x_s, const Algebraic_real_1& x_t, + const Cache& cache): + _info(0) + { + Polynomial_1 _numer; + Polynomial_1 _denom; + Poly_rat_1 numer_rat(typename + PT_rat_1::Construct_polynomial()(pcoeffs.begin(), + pcoeffs.end())); + Poly_rat_1 denom_rat(typename + PT_rat_1::Construct_polynomial()(qcoeffs.begin(), + qcoeffs.end())); + Integer denom_numer_int,denom_denom_int; + typename FT_poly_rat_1::Decompose()(numer_rat,_numer,denom_numer_int); + typename FT_poly_rat_1::Decompose()(denom_rat,_denom,denom_denom_int); + _numer *= denom_denom_int; + _denom *= denom_numer_int; + + _init(_numer,_denom,x_s,x_t,cache); + } + + void _init(const Polynomial_1& _P, const Polynomial_1& _Q, + const Algebraic_real_1& x_s, const Algebraic_real_1& x_t, + const Cache& cache) + { + CGAL_precondition(!CGAL::is_zero(_Q)); + //set rational function + Polynomial_1 P; + Polynomial_1 Q; + _canonicalize(_P, _Q, P, Q); + _f = get_rational_function(P, Q, cache); + + // Compare the x-coordinates and determine the direction. + Comparison_result x_res = CGAL::compare(x_s, x_t); + CGAL_precondition(x_res != EQUAL); + + if (x_res == SMALLER) + _info = (_info | IS_DIRECTED_RIGHT); + + //Set the source point and check if it lies next to a pole. + _ps = Algebraic_point_2(_f, x_s); + + //check if source point lies next to a pole. + if (typename Algebraic_kernel::Sign_at_1()(Q,x_s) != CGAL::ZERO) + { + // We have a nomral endpoint. + //nothing to do .. + } + else + { + // The y-coodinate is unbounded, but we can set its sign. + std::pair signs = _analyze_near_pole(x_s); + const CGAL::Sign sign_s = + ((_info & IS_DIRECTED_RIGHT) != 0) ? signs.second : signs.first; + + if (sign_s == CGAL::NEGATIVE) + _info = (_info | SRC_AT_Y_MINUS_INFTY); + else + _info = (_info | SRC_AT_Y_PLUS_INFTY); + } + + //Set the target point and check if it lies next to a pole. + _pt=Algebraic_point_2(_f,x_t); + + //check if target point lies next to a pole. + if (typename Algebraic_kernel::Sign_at_1()(Q,x_t) != CGAL::ZERO) + { + // We have a nomral endpoint. + //nothing to do .. + } + else + { + // The y-coodinate is unbounded, but we can set its sign. + std::pair signs = _analyze_near_pole(x_t); + const CGAL::Sign sign_t = + ((_info & IS_DIRECTED_RIGHT) != 0) ? signs.first : signs.second; + + if (sign_t == CGAL::NEGATIVE) + _info = (_info | TRG_AT_Y_MINUS_INFTY); + else + _info = (_info | TRG_AT_Y_PLUS_INFTY); + } + + //Mark that the arc is valid. As it may have poles, we mark it + //as continuous only if the denominator has no roots. + _info = ( _info | ( this->_is_continuous() ? + (IS_CONTINUOUS | IS_VALID) : IS_VALID ) ); + + } + + //----------------------------- + // Accessing the arc properties + //----------------------------- + + //----------------------------------------------------------------- + //Get the numerator polynomial of the underlying rational function. + const Polynomial_1& numerator() const + { + return(_f.numer()); + } + + //------------------------------------------------------------------ + //Get the denominator polynomial of the underlying rational function + const Polynomial_1& denominator() const + { + return(_f.denom()); + } + + //--------------------------------------------------------- + //Check if the x-coordinate of the source point is infinite + Arr_parameter_space source_parameter_space_in_x() const + { + return + ((_info & SRC_AT_X_MINUS_INFTY) != 0) ? ARR_LEFT_BOUNDARY : + ((_info & SRC_AT_X_PLUS_INFTY) != 0) ? ARR_RIGHT_BOUNDARY : + ARR_INTERIOR; + } + + //--------------------------------------------------------- + //Check if the y-coordinate of the source point is infinite + Arr_parameter_space source_parameter_space_in_y() const + { + return + ((_info & SRC_AT_Y_MINUS_INFTY) != 0) ? ARR_BOTTOM_BOUNDARY : + ((_info & SRC_AT_Y_PLUS_INFTY) != 0) ? ARR_TOP_BOUNDARY : + ARR_INTERIOR; + } + + //--------------------------------------------------------- + //Check if the x-coordinate of the target point is infinite + Arr_parameter_space target_boundary_in_x() const + { + return + ((_info & TRG_AT_X_MINUS_INFTY) != 0) ? ARR_LEFT_BOUNDARY : + ((_info & TRG_AT_X_PLUS_INFTY) != 0) ? ARR_RIGHT_BOUNDARY : + ARR_INTERIOR; + } + + //--------------------------------------------------------- + //Check if the y-coordinate of the target point is infinite + Arr_parameter_space target_boundary_in_y() const + { + return ((_info & TRG_AT_Y_MINUS_INFTY) != 0) ? ARR_BOTTOM_BOUNDARY : + ((_info & TRG_AT_Y_PLUS_INFTY) != 0) ? ARR_TOP_BOUNDARY : + ARR_INTERIOR; + } + + //-------------------- + //Get the source point + const Algebraic_point_2& source() const + { + CGAL_precondition((_info & IS_VALID) != 0 && + source_parameter_space_in_x() == ARR_INTERIOR && + source_parameter_space_in_y() == ARR_INTERIOR); + return (_ps); + } + + //---------------------------------------- + //Get the x-coordinate of the source point + Algebraic_real_1 source_x() const + { + CGAL_precondition((_info & IS_VALID) != 0 && + source_parameter_space_in_x() == ARR_INTERIOR); + return (_ps.x()); + } + + //---------------------------------------- + //Get the y-coordinate of the source point + //TODO: should we eliminate the function??? + //Algebraic source_y () const + //{ + // CGAL_precondition ((_info & IS_VALID) != 0 && + // source_parameter_space_in_y() == ARR_INTERIOR); + // return (_ps.y()); + //} + + //-------------------- + //Get the target point + const Algebraic_point_2& target() const + { + CGAL_precondition((_info & IS_VALID) != 0 && + target_boundary_in_x() == ARR_INTERIOR && + target_boundary_in_y() == ARR_INTERIOR); + return (_pt); + } + + //---------------------------------------- + //Get the x-coordinate of the target point + Algebraic_real_1 target_x() const + { + CGAL_precondition((_info & IS_VALID) != 0 && + target_boundary_in_x() == ARR_INTERIOR); + return (_pt.x()); + } + + //---------------------------------------- + //Get the y-coordinate of the target point + //TODO: should we eliminate the function??? + //Algebraic target_y () const + //{ + // CGAL_precondition ((_info & IS_VALID) != 0 && + // target_boundary_in_y() == ARR_INTERIOR); + // return (_pt.y()); + //} + + //------------------------------------------------------- + //Check if the x-coordinate of the left point is infinite + Arr_parameter_space left_parameter_space_in_x() const + { + return ((_info & IS_DIRECTED_RIGHT) != 0) ? + source_parameter_space_in_x() : target_boundary_in_x(); + } + + //------------------------------------------------------- + //Check if the y-coordinate of the left point is infinite + Arr_parameter_space left_parameter_space_in_y() const + { + return ((_info & IS_DIRECTED_RIGHT) != 0) ? + source_parameter_space_in_y() : target_boundary_in_y(); + } + //-------------------------------------------------------- + //Check if the x-coordinate of the right point is infinite + Arr_parameter_space right_parameter_space_in_x() const + { + return ((_info & IS_DIRECTED_RIGHT) != 0) ? + target_boundary_in_x() : source_parameter_space_in_x(); + } + + //-------------------------------------------------------- + //Check if the y-coordinate of the right point is infinite + Arr_parameter_space right_parameter_space_in_y() const + { + return ((_info & IS_DIRECTED_RIGHT) != 0) ? + target_boundary_in_y() : source_parameter_space_in_y(); + } + + //------------------------------------ + //Get the x_value of the left endpoint + const Algebraic_real_1& left_x() const + { + CGAL_precondition(left_parameter_space_in_x() == ARR_INTERIOR); + return ((_info & IS_DIRECTED_RIGHT) ? _ps.x() : _pt.x()); + } + + //------------------------------------ + //Get the x_value of the right endpoint + const Algebraic_real_1& right_x() const + { + CGAL_precondition((_info & IS_VALID) != 0 && + right_parameter_space_in_x() == ARR_INTERIOR ); + return ((_info & IS_DIRECTED_RIGHT) ? _pt.x() : _ps.x()); + } + //--------------------- + //Get the left endpoint + const Algebraic_point_2& left() const + { + CGAL_precondition(left_parameter_space_in_x() == ARR_INTERIOR && + left_parameter_space_in_y() == ARR_INTERIOR); + return ((_info & IS_DIRECTED_RIGHT) ? _ps : _pt); + } + + //---------------------- + //Get the right endpoint + const Algebraic_point_2& right() const + { + CGAL_precondition(right_parameter_space_in_x() == ARR_INTERIOR && + right_parameter_space_in_y() == ARR_INTERIOR); + return ((_info & IS_DIRECTED_RIGHT) ? _pt : _ps); + } + + //------------------------- + //Check if the arc is valid + bool is_valid() const + { + return ((_info & IS_VALID) != 0); + } + + //------------------------------ + //Check if the arc is continuous + bool is_continuous() const + { + return ((_info & IS_CONTINUOUS) != 0); + } + + //---------------------------------- + //Check if the arc is directed right + bool is_directed_right() const + { + return ((_info & IS_DIRECTED_RIGHT) != 0); + } + + //-------------- + //name Modifiers + //--------------- + + //-------------------------------- + //Mark the arc as being continuous + void set_continuous() + { + _info = (_info | IS_CONTINUOUS); + } + + //----------------------------- + //Mark the arc as being invalid + void set_invalid() + { + _info = (_info & ~IS_VALID); + } + +// bool is_intersecting(Self& arc) +// { +// Arr_parameter_space left_parameter_space = ( (left_parameter_space_in_x()!= ARR_INTERIOR) &&(arc.left_parameter_space_in_x() != ARR_INTERIOR) ) ? +// ARR_LEFT_BOUNDARY : +// ARR_INTERIOR; +// Arr_parameter_space right_parameter_space = ( (right_parameter_space_in_x()!= ARR_INTERIOR) &&(arc.right_parameter_space_in_x()!= ARR_INTERIOR) ) ? +// ARR_RIGHT_BOUNDARY : +// ARR_INTERIOR; +// Algebraic_real_1 left,right; +// if (left_parameter_space == ARR_INTERIOR) +// left = +// (left_parameter_space_in_x()!= ARR_INTERIOR) ? arc.left_x(): +// (arc.left_parameter_space_in_x()!= ARR_INTERIOR) ? left_x() : +// (arc.left_x() < left_x()) ? left_x() : +// arc.left_x(); +// if (right_parameter_space == ARR_INTERIOR) +// right = (right_parameter_space_in_x()!= ARR_INTERIOR) ? arc.right_x(): +// (arc.right_parameter_space_in_x()!= ARR_INTERIOR) ? right_x() : +// (arc.right_x() < right_x()) ? right_x() : +// arc.right_x(); +// if (left > right) +// return false; + +// //check if the base functions are equal +// if (_has_same_base (arc)) +// return true; +// Rational_function_pair rat_pair = get_rational_pair(get_rational_function(this->_numer,this->_denom), +// get_rational_function(arc._numer,arc._denom)); +// return rat_pair.is_intersecting_in_range(left_parameter_space,left,right_parameter_space,right); +// } + + //-------------------------------------------------------- + //Split the arc into two at a given pole. + //The function returns the sub-arc to the left of the pole + //and sets (*this) to be the right sub-arc. + //param x0 The x-coordinate of the pole. + //precondition x0 lies in the interior of the arc. + //return The sub-arc to the left of the pole. + + Self split_at_pole(const Algebraic_real_1& x0) + { + // Analyze the behaviour of the function near the given pole. + const std::pair signs = _analyze_near_pole(x0); + const CGAL::Sign sign_left = signs.first; + const CGAL::Sign sign_right = signs.second; + + // Create a fictitious point that represents the x-coordinate of the pole. + Algebraic_point_2 p0(_f, x0); + + // Make a copy of the current arc. + Self c1 = *this; + + // Split the arc, such that c1 lies to the left of the pole and (*this) + // to its right. + if ((_info & IS_DIRECTED_RIGHT) != 0) + { + c1._pt = p0; + c1._info = (c1._info & ~TRG_INFO_BITS); + if (sign_left == CGAL::NEGATIVE) + c1._info = (c1._info | TRG_AT_Y_MINUS_INFTY); + else + c1._info = (c1._info | TRG_AT_Y_PLUS_INFTY); + + this->_ps = p0; + this->_info = (this->_info & ~SRC_INFO_BITS); + if (sign_right == CGAL::NEGATIVE) + this->_info = (this->_info | SRC_AT_Y_MINUS_INFTY); + else + this->_info = (this->_info | SRC_AT_Y_PLUS_INFTY); + } + else + { + c1._ps = p0; + c1._info = (c1._info & ~SRC_INFO_BITS); + if (sign_left == CGAL::NEGATIVE) + c1._info = (c1._info | SRC_AT_Y_MINUS_INFTY); + else + c1._info = (c1._info | SRC_AT_Y_PLUS_INFTY); + + this->_pt = p0; + this->_info = (this->_info & ~TRG_INFO_BITS); + if (sign_right == CGAL::NEGATIVE) + this->_info = (this->_info | TRG_AT_Y_MINUS_INFTY); + else + this->_info = (this->_info | TRG_AT_Y_PLUS_INFTY); + } + + // Mark the sub-arc c1 as continuous. + c1._info = (c1._info | IS_CONTINUOUS); + + return (c1); + } + + //--------------- + //name Predicates + //--------------- + + + //--------------------------------------------------------------------------- + //Get the relative position of the point with respect to the rational arc. + //param p The query point. + //precondition: p is in the x-range of the arc. + // both p's supporting curve and the rational arc are continous + //return SMALLER if the point is below the arc; + // LARGER if the point is above the arc; + // EQUAL if p lies on the arc. + Comparison_result point_position(const Algebraic_point_2& p, + const Cache& cache) const + { + // Make sure that p is in the x-range of the arc and check whether it + // has the same x-coordinate as one of the endpoints. + CGAL_precondition(is_continuous()); + CGAL_precondition(_is_in_true_x_range(p.x())); + if (p.rational_function() == _f) + return EQUAL; + Rational_function_pair rat_pair(get_rational_pair(p.rational_function(), _f, + cache)); + return rat_pair.compare_f_g_at(p.x()); + } + //--------------------------------------------------------------------------- + //Compare the x-coordinate of a vertical asymptote of the arc + //(one of its ends) and the given point. + Comparison_result compare_end(Arr_curve_end ce, + const Algebraic_point_2& p) const + { + Algebraic_real_1 x0; + + if (ce == ARR_MIN_END) { + CGAL_assertion(left_parameter_space_in_x() == ARR_INTERIOR && + left_parameter_space_in_y() != ARR_INTERIOR); + if ((_info & IS_DIRECTED_RIGHT) != 0) + x0 = _ps.x(); + else + x0 = _pt.x(); + } + else + { + CGAL_assertion(right_parameter_space_in_x() == ARR_INTERIOR && + right_parameter_space_in_y() != ARR_INTERIOR); + if ((_info & IS_DIRECTED_RIGHT) != 0) + x0 = _pt.x(); + else + x0 = _ps.x(); + } + + // Compare the x-coordinates. + const Comparison_result res = CGAL::compare(x0, p.x()); + + if (res != EQUAL) + return (res); + + return ((ce == ARR_MIN_END) ? LARGER : SMALLER); + } + + //------------------------------------------------------------------ + //Compare the x-coordinate of a vertical asymptotes of the two arcs. + //approaching from the same direction + Comparison_result compare_near_end(const Self& arc, Arr_curve_end ce, + const Cache& cache) const + { + CGAL_precondition_code( + if (ce == ARR_MIN_END) + { + CGAL_precondition(this->left_parameter_space_in_y() != ARR_INTERIOR); + CGAL_precondition(arc.left_parameter_space_in_y() != ARR_INTERIOR); + CGAL_precondition(this->left_parameter_space_in_y() == + arc.left_parameter_space_in_y()); + } + else // (ce == ARR_MAX_END) + { + CGAL_precondition(this->right_parameter_space_in_y() != ARR_INTERIOR); + CGAL_precondition(arc.right_parameter_space_in_y() != ARR_INTERIOR); + CGAL_precondition(this->right_parameter_space_in_y() == + arc.right_parameter_space_in_y()); + } + ); + + // Get the x-coordinates of the vertical asymptote. + Algebraic_real_1 x((ce == ARR_MIN_END)? this->left_x() : this->right_x()); + CGAL_assertion(CGAL::compare(x, (ce == ARR_MIN_END)? + arc.left_x () : arc.right_x()) == EQUAL); + + //both arcs have vertical asymptotes and come from the same side of the + //x-axis compare value of functions close to the root on the correct side + if (_has_same_base(arc)) + return CGAL::EQUAL; + Rational_function_pair rat_pair = get_rational_pair(_f,arc._f,cache); + + CGAL::Comparison_result comp_f_g_y = + rat_pair.compare_f_g_at(x,ce == ARR_MAX_END ? + CGAL::NEGATIVE : CGAL::POSITIVE); + if (ce == ARR_MAX_END) + { + return (right_parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) ? + comp_f_g_y : -comp_f_g_y; + } + else + { + return (left_parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) ? + -comp_f_g_y : comp_f_g_y; + } + } + + //------------------------------------------------------------------ + //Compare the x-coordinate of a vertical asymptotes of the two arcs. + Comparison_result compare_ends(Arr_curve_end ind1,const Self& arc, + Arr_curve_end ind2, const Cache& cache) const + { + // Get the x-coordinates of the first vertical asymptote. + Algebraic_real_1 x1; + + if (ind1 == ARR_MIN_END) + { + CGAL_assertion(left_parameter_space_in_x() == ARR_INTERIOR && + left_parameter_space_in_y() != ARR_INTERIOR); + if ((_info & IS_DIRECTED_RIGHT) != 0) + x1 = _ps.x(); + else + x1 = _pt.x(); + } + else + { + CGAL_assertion(right_parameter_space_in_x() == ARR_INTERIOR && + right_parameter_space_in_y() != ARR_INTERIOR); + if ((_info & IS_DIRECTED_RIGHT) != 0) + x1 = _pt.x(); + else + x1 = _ps.x(); + } + + // Get the x-coordinates of the second vertical asymptote. + Algebraic_real_1 x2; + + if (ind2 == ARR_MIN_END) + { + CGAL_assertion(arc.left_parameter_space_in_x() == ARR_INTERIOR && + arc.left_parameter_space_in_y() != ARR_INTERIOR); + if ((arc._info & IS_DIRECTED_RIGHT) != 0) + x2 = arc._ps.x(); + else + x2 = arc._pt.x(); + } + else + { + CGAL_assertion(arc.right_parameter_space_in_x() == ARR_INTERIOR && + arc.right_parameter_space_in_y() != ARR_INTERIOR); + if ((arc._info & IS_DIRECTED_RIGHT) != 0) + x2 = arc._pt.x(); + else + x2 = arc._ps.x(); + } + + // Compare the x-coordinates. In case they are not equal we are done. + const Comparison_result res = CGAL::compare(x1, x2); + + if (res != EQUAL) + return (res); + + // If the x-coordinates of the asymptote are equal, but one arc is + // defined to the left of the vertical asymptote and the other to its + // right, we can easily determine the comparison result. + if (ind1 == ARR_MAX_END && ind2 == ARR_MIN_END) + return (SMALLER); + else if (ind1 == ARR_MIN_END && ind2 == ARR_MAX_END) + return (LARGER); + + //both arcs have vertical asymptotes and come from the same side of the x-axis + //compare value of functions close to the root on the correct side + if (_has_same_base(arc)) + return CGAL::EQUAL; + Rational_function_pair rat_pair = get_rational_pair(_f,arc._f,cache); + + CGAL::Comparison_result comp_f_g_y = + rat_pair.compare_f_g_at(x1, ind1 == ARR_MAX_END ? + CGAL::NEGATIVE : CGAL::POSITIVE); + if( ind1 == ARR_MAX_END) + { + CGAL_postcondition(ind2 == ARR_MAX_END); + CGAL_postcondition(right_parameter_space_in_y() == + arc.right_parameter_space_in_y()); + return (right_parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) ? + comp_f_g_y : -comp_f_g_y; + } + else + { + CGAL_postcondition(ind2 == ARR_MIN_END); + CGAL_postcondition(left_parameter_space_in_y() == + arc.left_parameter_space_in_y()); + return (left_parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) ? + -comp_f_g_y : comp_f_g_y; + } + } + + //------------------------------------------------------------------ + // Compare the slopes of the arc with another given arc + // at their given intersection point. + // param cv The given arc. + // param p The intersection point. + // param mult Output: The mutiplicity of the intersection point. + // return SMALLER if (*this) slope is less than cv's; + // EQUAL if the two slopes are equal; + // LARGER if (*this) slope is greater than cv's. + //Comparison_result compare_slopes (const Self& arc,const Algebraic_point_2& p,unsigned int& mult) const + // + // deleted!!! + + //------------------------------------------------------------------ + // Compare the two arcs at a given intersection point + // param arc The given arc + // param p The intersection point + // param to_left to check to the left or to the right of intersection point + // precondition: Both arcs intersect at p + // return SMALLER if (*this) lies below the other arc; + // EQUAL if the two supporting functions are equal; + // LARGER if (*this) lies above the other arc. + + Comparison_result compare_at_intersection(const Self& arc, + const Algebraic_point_2& p, + bool to_left, const Cache& cache) const + { + CGAL_precondition(this->point_position(p,cache) == CGAL::EQUAL && + arc.point_position(p,cache) == CGAL::EQUAL); + + //check if the base functions are equal + if (_has_same_base(arc)) + return CGAL::EQUAL; + + Rational_function_pair rat_pair = get_rational_pair(this->_f, arc._f,cache); + return rat_pair.compare_f_g_at(p.x(), + to_left ? CGAL::SMALLER : CGAL::LARGER); + } + + //------------------------------------------------------------------ + // Compare the two arcs at x = -oo. + // param arc The given arc + // precondition: Both arcs have a left end which is unbounded in x. + // return SMALLER if (*this) lies below the other arc; + // EQUAL if the two supporting functions are equal; + // LARGER if (*this) lies above the other arc. + + Comparison_result compare_at_minus_infinity(const Self& arc, + const Cache& cache) const + { + CGAL_precondition(left_parameter_space_in_x() == ARR_LEFT_BOUNDARY && + arc.left_parameter_space_in_x() == ARR_LEFT_BOUNDARY); + + //check if the base functions are equal + if (_has_same_base(arc)) + return CGAL::EQUAL; + + Rational_function_pair rat_pair = + get_rational_pair(this->_f, arc._f, cache); + return rat_pair.compare_f_g_at(ARR_LEFT_BOUNDARY); + } + + //------------------------------------------------------------------ + //Compare the two arcs at x = +oo. + //param arc The given arc. + //pre Both arcs are have a right end which is unbounded in x. + //return SMALLER if (*this) lies below the other arc; + // EQUAL if the two supporting functions are equal; + // LARGER if (*this) lies above the other arc. + + Comparison_result compare_at_plus_infinity(const Self& arc, + const Cache& cache) const + { + CGAL_precondition(right_parameter_space_in_x() == ARR_RIGHT_BOUNDARY && + arc.right_parameter_space_in_x() == ARR_RIGHT_BOUNDARY); + + //check if the base functions are equal + if (_has_same_base(arc)) + return CGAL::EQUAL; + + Rational_function_pair rat_pair = get_rational_pair(this->_f, arc._f, cache); + return rat_pair.compare_f_g_at(ARR_RIGHT_BOUNDARY); + } + + //---------------------------------------------------------- + // Check whether the two arcs are equal (have the same graph). + //param arc The compared arc. + //return true if the two arcs have the same graph; false otherwise. + bool equals(const Self& arc) const + { + // The two arc must have the same base rational function. + CGAL_precondition(is_valid()); + CGAL_precondition(arc.is_valid()); + if (! _has_same_base(arc)) + return false; + + // Check that the arc left endpoints are the same. + Arr_parameter_space inf1 = left_parameter_space_in_x(); + Arr_parameter_space inf2 = arc.left_parameter_space_in_x(); + + if (inf1 != inf2) + return false; + + if (inf1 == ARR_INTERIOR) + { + inf1 = left_parameter_space_in_y(); + inf2 = arc.left_parameter_space_in_y(); + + if (inf1 != inf2) + return false; + } + + if (inf1 == ARR_INTERIOR && + CGAL::compare(left().x(), arc.left().x()) != EQUAL) + { + return false; + } + + // Check that the arc right endpoints are the same. + inf1 = right_parameter_space_in_x(); + inf2 = arc.right_parameter_space_in_x(); + + if (inf1 != inf2) + return false; + + if (inf1 == ARR_INTERIOR) + { + inf1 = right_parameter_space_in_y(); + inf2 = arc.right_parameter_space_in_y(); + + if (inf1 != inf2) + return false; + } + + if (inf1 == ARR_INTERIOR && + CGAL::compare(right().x(), arc.right().x()) != EQUAL) + return false; + + // If we reached here, the two arc are equal: + return true; + } + + //---------------------------------------------------------- + //Check whether it is possible to merge the arc with the given arc. + //param arc The query arc. + //return true if it is possible to merge the two arcs; + // false otherwise. + bool can_merge_with(const Self& arc) const + { + // In order to merge the two arcs, they should have the same base + // rational function. + CGAL_precondition(is_valid()); + CGAL_precondition(arc.is_valid()); + if (! _has_same_base(arc)) + return false; + + // Check if the left endpoint of one curve is the right endpoint of + // the other. + + return ((right_parameter_space_in_x() == ARR_INTERIOR && + right_parameter_space_in_y() == ARR_INTERIOR && + arc.left_parameter_space_in_x() == ARR_INTERIOR && + arc.left_parameter_space_in_y() == ARR_INTERIOR && + //CGAL::equal(right_x() ,arc.left_x() )) || + (right_x() == arc.left_x() )) || + (left_parameter_space_in_x() == ARR_INTERIOR && + left_parameter_space_in_y() == ARR_INTERIOR && + arc.right_parameter_space_in_x() == ARR_INTERIOR && + arc.right_parameter_space_in_y() == ARR_INTERIOR && + //CGAL::equal(left_x(), arc.right_x()))); + (left_x() == arc.right_x()))); + } + //------------------------------------ + //Constructions of points and curves + //------------------------------------ + + //------------------------------------ + // Flip the arc (swap its source and target). + // return The flipped arc. + Self flip() const + { + CGAL_precondition(is_valid()); + + // Create the flipped arc. + Self arc; + + arc._f = _f; + arc._ps = _pt; + arc._pt = _ps; + + // Manipulate the information bits. + int src_info = (_info & SRC_INFO_BITS); + int trg_info = (_info & TRG_INFO_BITS); + arc._info = (src_info << 4) | (trg_info >> 4) | IS_VALID; + + if ((_info & IS_DIRECTED_RIGHT) == 0) + arc._info = (arc._info | IS_DIRECTED_RIGHT); + + if ((_info & IS_CONTINUOUS) != 0) + arc._info = (arc._info | IS_CONTINUOUS); + + return (arc); + } + + //------------------------ + // Print the rational arc. + std::ostream& print(std::ostream& os) const + { + // Print y as a rational function of x. + os << "y = ("; + Base_rational_arc_ds_1::print_polynomial(os, this->numerator(), 'x'); + os << ") / ("; + Base_rational_arc_ds_1::print_polynomial(os, this->denominator(), 'x'); + os << ") on "; + + // Print the definition range. + Arr_parameter_space inf_x = source_parameter_space_in_x(); + if (inf_x == ARR_LEFT_BOUNDARY) + os << "(-oo"; + else if (inf_x == ARR_RIGHT_BOUNDARY) + os << "(+oo"; + else if (source_parameter_space_in_y() != ARR_INTERIOR) + os << '(' << CGAL::to_double(source_x()); + else + os << '[' << CGAL::to_double(source().x()); + + os << ", "; + + inf_x = target_boundary_in_x(); + if (inf_x == ARR_LEFT_BOUNDARY) + os << "-oo)"; + else if (inf_x == ARR_RIGHT_BOUNDARY) + os << "+oo)"; + else if (target_boundary_in_y() != ARR_INTERIOR) + os << CGAL::to_double(target_x()) << ')'; + else + os << CGAL::to_double(target().x()) << ']'; + + return (os); + } + +protected: + + + //------------------------------- + //Auxiliary (protected) functions. + //------------------------------- + + //-------------------------------------------------------------------------- + // Cannonicalize numerator and denominator such that: + // There are no common devisor + // If negative sign exists, it is in the numerator + void _canonicalize(const Polynomial_1& P,const Polynomial_1& Q, + Polynomial_1& P_new ,Polynomial_1& Q_new) + { + Polynomial_1 gcd = CGAL::gcd(P,Q); + if (gcd != 1) + { + P_new=CGAL::integral_division(P,gcd); + Q_new=CGAL::integral_division(Q,gcd); + } + else + { + P_new=P; + Q_new=Q; + } + + if (typename AT_poly::Unit_part()(Q_new) == -1) //leading coefficient sign + { + P_new*=-1; + Q_new*=-1; + } + return; + } + + //-------------------------------------------------------------------------- + // Check if the given x-value is in the x-range of the arc. + // param x The x-value. + // param eq_src Output: Is this value equal to the x-coordinate of the + // source point. + // param eq_trg Output: Is this value equal to the x-coordinate of the + // target point. + + bool _is_in_x_range(const Algebraic_real_1& x, bool& eq_src, + bool& eq_trg) const + { + Comparison_result res1; + + eq_src = eq_trg = false; + if ((_info & IS_DIRECTED_RIGHT) != 0) + { + // Compare to the left endpoint (the source in this case). + if ((_info & SRC_AT_X_MINUS_INFTY) != 0) + { + res1 = LARGER; + } + else + { + res1 = CGAL::compare(x, _ps.x()); + + if (res1 == SMALLER) + return false; + + if (res1 == EQUAL) + { + eq_src = true; + return true; + } + } + + // Compare to the right endpoint (the target in this case). + if ((_info & TRG_AT_X_PLUS_INFTY) != 0) + return true; + + const Comparison_result res2 = CGAL::compare(x, _pt.x()); + + if (res2 == LARGER) + return false; + + if (res2 == EQUAL) + eq_trg = true; + + return true; + } + + // Compare to the left endpoint (the target in this case). + if ((_info & TRG_AT_X_MINUS_INFTY) != 0) + { + res1 = LARGER; + } + else + { + res1 = CGAL::compare(x, _pt.x()); + + if (res1 == SMALLER) + return false; + + if (res1 == EQUAL) + { + eq_trg = true; + return true; + } + } + + // Compare to the right endpoint (the source in this case). + if ((_info & SRC_AT_X_PLUS_INFTY) != 0) + return true; + + const Comparison_result res2 = CGAL::compare(x, _ps.x()); + + if (res2 == LARGER) + return false; + + if (res2 == EQUAL) + eq_src = true; + + return true; + } + + //---------------------------------------------------------- + // Check if the given x-value is in the x-range of the arc, + // excluding its open ends. + bool _is_in_true_x_range(const Algebraic_real_1& x) const + { + bool eq_src, eq_trg; + const bool is_in_x_range_closure = _is_in_x_range(x, eq_src, eq_trg); + + if (! is_in_x_range_closure) + return false; + + // Check if we have a vertical asymptote at the source point. + if (eq_src && (_info & (SRC_AT_Y_MINUS_INFTY | SRC_AT_Y_PLUS_INFTY)) != 0) + return false; + + // Check if we have a vertical asymptote at the target point. + if (eq_trg && (_info & (TRG_AT_Y_MINUS_INFTY | TRG_AT_Y_PLUS_INFTY)) != 0) + return false; + + // If we reached here, the value is in the true x-range of the arc. + return true; + } + + //------------------------------------------------------------------------ + // Check if the underlying rational function is the same in the given arc. + // param arc The given arc. + // return true if arc's underlying rational function is the same + // as of *this; + // false otherwise. + + bool _has_same_base(const Self& arc) const + { + return (this->_f == arc._f); + } + //bool operator == (const Self& arc) const + //{ + // if (this == &arc) + // return true; + // if ((_info ==arc._info) &&(_has_same_base(arc) )) + // { + // bool same_source(true); + // bool same_target(true); + // if ( (this->source_parameter_space_in_x () == ARR_INTERIOR) && + // (this->source_parameter_space_in_y () == ARR_INTERIOR) ) + // same_source = (this->source() == arc.source()); + // if ( (this->target_boundary_in_x () == ARR_INTERIOR) && + // (this->target_boundary_in_y () == ARR_INTERIOR) ) + // same_target = (this->target() == arc.target()); + // return (same_source && same_target); + // } + // return false; + //} + + //--------------------------------------------------------------------- + //Compute infinity type of the rational function P(x)/Q(x) at x = -oo. + // param y Output: The value of the horizontal asymptote (if exists). + // return The infinity type for the y-coordinate at x = -oo. + + Arr_parameter_space _analyze_at_minus_infinity(const Polynomial_1& P, + const Polynomial_1& Q, + Algebraic_real_1& y) const + { + // Get the degree of the polynomials. + const int deg_p(CGAL::degree(P)); + const int deg_q(CGAL::degree(Q)); + + if (deg_p <= 0 || deg_p <= deg_q) + { + // We have a zero polynomial or a zero asymptote. + y = 0; + return (ARR_INTERIOR); + } + // Get the leading coefficients. + Integer p_lead(CGAL::leading_coefficient(P)); + Integer q_lead(CGAL::leading_coefficient(Q)); + + if (deg_p == deg_q) + { + // We have a horizontal asymptote. + y = Algebraic_real_1(Rational(p_lead) / Rational(q_lead)); + return (ARR_INTERIOR); + } + + // We have a tendency to infinity. + const int def_diff = deg_p - deg_q; + + return (CGAL::sign(p_lead) == CGAL::sign (q_lead)) ? + ((def_diff % 2 == 0) ? ARR_TOP_BOUNDARY : ARR_BOTTOM_BOUNDARY) : + ((def_diff % 2 == 0) ? ARR_BOTTOM_BOUNDARY : ARR_TOP_BOUNDARY); + } + + //--------------------------------------------------------------------- + //Compute infinity type of the rational function P(x)/Q(x) at x = +oo. + // param y Output: The value of the horizontal asymptote (if exists). + // return The infinity type for the y-coordinate at x = +oo. + + Arr_parameter_space _analyze_at_plus_infinity(const Polynomial_1& P, + const Polynomial_1& Q, + Algebraic_real_1& y) const + { + // Get the degree of the polynomials. + const int deg_p(CGAL::degree(P)); + const int deg_q(CGAL::degree(Q)); + + if (deg_p <= 0 || deg_p <= deg_q) + { + // We have a zero polynomial or a zero asymptote. + y = 0; + return (ARR_INTERIOR); + } + + // Get the leading coefficients. + Integer p_lead(CGAL::leading_coefficient(P)); + Integer q_lead(CGAL::leading_coefficient(Q)); + + if (deg_p == deg_q) + { + // We have a horizontal asymptote. + y = Algebraic_real_1(Rational(p_lead) / Rational(q_lead)); + return (ARR_INTERIOR); + } + + // We have a tendency to infinity. + return (CGAL::sign(p_lead) == CGAL::sign(q_lead)) ? + ARR_TOP_BOUNDARY : ARR_BOTTOM_BOUNDARY; + } + + //--------------------------------------------------------------------- + //Compute all zeros of the denominator polynomial that lie within the + // x-range of the arc + + template + OutputIterator _denominator_roots(OutputIterator oi, bool& root_at_ps, + bool& root_at_pt) const + { + root_at_ps = root_at_pt = false; + + if (CGAL::degree(this->denominator()) == 0) + return (oi); + + // Compute the roots of the denominator polynomial. + std::list q_roots; + bool eq_src, eq_trg; + typename std::list::const_iterator x_iter; + + //solve for roots without caring for multiplicity + //hence the usage of the bool var + + std::copy(_f.poles().begin(),_f.poles().end(),std::back_inserter (q_roots)); + + // Go over the roots and check whether they lie in the x-range of the arc. + for (x_iter = q_roots.begin(); x_iter != q_roots.end(); ++x_iter) + { + if (_is_in_x_range (*x_iter, eq_src, eq_trg)) + { + if (eq_src) + { + root_at_ps = true; + } + else if (eq_trg) + { + root_at_pt = true; + } + else + { + // The root lies in the interior of the arc. + *oi++ = *x_iter; + } + } + } + + return (oi); + } + + //--------------------------------------------------------------------- + // Check whether the arc is continuous. + bool _is_continuous() + { + // Compute the roots of the denominator polynomial, and make sure + // there are none in the range of definition. + std::list q_roots; + bool root_at_ps, root_at_pt; + + this->_denominator_roots(std::back_inserter(q_roots), + root_at_ps, root_at_pt); + + return (q_roots.empty()); + } + + //--------------------------------------------------------------------- + //Determine the signs of the rational functions infinitisimally to the left + // and to the right of the given pole. + // param x0 The x-coordinate of the pole. + // pre x0 lies in the interior of the arc. + // return The signs to the left and to the right of x0. + std::pair + _analyze_near_pole(const Algebraic_real_1& x0) const + { + return std::make_pair( _f.sign_at(x0,CGAL::NEGATIVE), + _f.sign_at(x0,CGAL::POSITIVE)); + } + + //--------------------------------------------------------------------- + // Print a polynomial nicely. + + //std::ostream& _print_polynomial (std::ostream& os, + // const Polynomial_1& poly, + // char var) const + //{ + // // Get the degree. + // const int deg = CGAL::degree(poly); + // + // Integer coeff; + // CGAL::Sign sgn; + // int k; + + // if (deg < 0) + // { + // os << '0'; + // return (os); + // } + + // for (k = deg; k >= 0; k--) + // { + // //coeff = pt::Get_coefficient()(poly, k); + // coeff = CGAL::get_coefficient(poly, k); + // + // if (k == deg) + // os << coeff; + // else if ((sgn = CGAL::sign (coeff)) == POSITIVE) + // os << " + " << coeff; + // else if (sgn == NEGATIVE) + // os << " - " << -coeff; + // else + // continue; + // + // if (k > 1) + // os << '*' << var << '^' << k; + // else if (k == 1) + // os << '*' << var; + // } + + // return (os); + //} + +}; + +//------------------------------- +//! Exporter for rational arcs. +template +std::ostream& operator<<(std::ostream& os, + const Base_rational_arc_d_1 & arc) +{ + return (arc.print(os)); +} + +/*! \class Continuous_rational_arc_d_1 + * Representation of a continuous portion of a rational function. + */ +template +class Continuous_rational_arc_d_1: + public Base_rational_arc_d_1 +{ +public: + bool is_left_to_right() const + { return (this->_info && Base::IS_DIRECTED_RIGHT); } + +public: + typedef Algebraic_kernel_ Algebraic_kernel; + + typedef Continuous_rational_arc_d_1 Self; + typedef Base_rational_arc_d_1 Base; + + typedef typename Base::Integer Integer; + typedef typename Base::Rational Rational; + typedef typename Base::Algebraic_real_1 Algebraic_real_1; + typedef typename Base::Algebraic_point_2 Algebraic_point_2; + typedef typename Base::Polynomial_1 Polynomial_1; + typedef typename Base::Multiplicity Multiplicity; + typedef typename Base::Rational_function Rational_function; + typedef typename Base::Rational_function_pair Rational_function_pair; + + typedef typename Base::Rat_vector Rat_vector; + typedef typename Base::Algebraic_vector Algebraic_vector; + typedef typename Base::Multiplicity_vector Multiplicity_vector; + + typedef typename Base::Cache Cache; + + typedef std::pair Intersection_point_2; + //typedef std::pair Intersection_point_2; + + + /// \name Constrcution methods. + //@{ + + /*! + * Default constructor. + */ + Continuous_rational_arc_d_1() : + Base() + {} + + /*! + * Constrcutor from a base arc. + */ + Continuous_rational_arc_d_1(const Base& arc) : + Base(arc) + { + CGAL_precondition(arc.is_continuous()); + } + + /*! + * Constructor of a whole polynomial curve. + * \param pcoeffs The rational coefficients of the polynomial p(x). + */ + Continuous_rational_arc_d_1(const Polynomial_1& P, const Cache& cache) : + Base(P, cache) + {} + + Continuous_rational_arc_d_1(const Rat_vector& pcoeffs, const Cache& cache) : + Base(pcoeffs, cache) + {} + + /*! + * Constructor of a polynomial ray, defined by y = p(x), for x_s <= x if the + * ray is directed to the right, or for x_s >= x if it is directed to the + * left. + * \param pcoeffs The rational coefficients of the polynomial p(x). + * \param x_s The x-coordinate of the source point. + * \param dir_right Is the ray directed to the right (to +oo) + * or to the left (to -oo). + */ + Continuous_rational_arc_d_1(const Polynomial_1& P, + const Algebraic_real_1& x_s, + bool dir_right, const Cache& cache) : + Base(P, x_s, dir_right,cache) + {} + + Continuous_rational_arc_d_1(const Rat_vector& pcoeffs, + const Algebraic_real_1& x_s, + bool dir_right, const Cache& cache) : + Base(pcoeffs, x_s, dir_right,cache) + {} + + + /*! + * Constructor of a polynomial arc, defined by y = p(x), x_min <= x <= x_max. + * \param pcoeffs The rational coefficients of the polynomial p(x). + * \param x_s The x-coordinate of the source point. + * \param x_t The x-coordinate of the target point. + * \pre The two x-coordinates must not be equal. + */ + Continuous_rational_arc_d_1(const Polynomial_1& P, + const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t, const Cache& cache) : + Base(P, x_s, x_t,cache) + {} + + Continuous_rational_arc_d_1(const Rat_vector& pcoeffs, + const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t, const Cache& cache) : + Base(pcoeffs, x_s, x_t,cache) + {} + + /*! + * Constructor of a polynomial function, defined by y = p(x)/q(x) for any x. + * \param pcoeffs The rational coefficients of the polynomial p(x). + * \param qcoeffs The rational coefficients of the polynomial q(x). + * \pre The denominator polynomial q(x) does not have any roots. + */ + Continuous_rational_arc_d_1(const Polynomial_1& P, const Polynomial_1& Q, + const Cache& cache) : + Base(P, Q,cache) + { + if (!this->_is_continuous()) + { + // Invalid arc, as it is not continuous. + this->set_invalid(); + } + } + + Continuous_rational_arc_d_1(const Rat_vector& pcoeffs, + const Rat_vector& qcoeffs, const Cache& cache) : + Base(pcoeffs, qcoeffs,cache) + { + if (!this->_is_continuous()) + { + // Invalid arc, as it is not continuous. + this->set_invalid(); + } + } + + /*! + * Constructor of a ray of a rational function, defined by y = p(x)/q(x), + * for x_s <= x if the ray is directed to the right, or for x_s >= x if it + * is directed to the left. + * \param pcoeffs The rational coefficients of the polynomial p(x). + * \param qcoeffs The rational coefficients of the polynomial q(x). + * \param x_s The x-coordinate of the source point. + * \param dir_right Is the ray directed to the right (to +oo) + * or to the left (to -oo). + * \pre The denominator polynomial q(x) does not have any roots in the + * x-range of definition. + */ + Continuous_rational_arc_d_1(const Polynomial_1& P,const Polynomial_1& Q, + const Algebraic_real_1& x_s, bool dir_right, + const Cache& cache) : + Base(P, Q, x_s, dir_right,cache) + { + if (!this->_is_continuous()) + { + // Invalid arc, as it is not continuous. + this->set_invalid(); + } + } + + Continuous_rational_arc_d_1(const Rat_vector& pcoeffs, + const Rat_vector& qcoeffs, + const Algebraic_real_1& x_s, bool dir_right, + const Cache& cache) : + Base(pcoeffs, qcoeffs, x_s, dir_right,cache) + { + if (!this->_is_continuous()) + { + // Invalid arc, as it is not continuous. + this->set_invalid(); + } + } + + /*! + * Constructor of a bounded rational arc, defined by y = p(x)/q(x), + * where: x_min <= x <= x_max. + * \param pcoeffs The rational coefficients of the polynomial p(x). + * \param qcoeffs The rational coefficients of the polynomial q(x). + * \param x_s The x-coordinate of the source point. + * \param x_t The x-coordinate of the target point. + * \pre The two x-coordinates must not be equal. + * \pre The denominator polynomial q(x) does not have any roots in the + * x-range of definition (x_min, x_max). + */ + Continuous_rational_arc_d_1(const Polynomial_1& P,const Polynomial_1& Q, + const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t,const Cache& cache) : + Base(P, Q, x_s, x_t,cache) + { + if (!this->_is_continuous()) + { + // Invalid arc, as it is not continuous. + this->set_invalid(); + } + } + Continuous_rational_arc_d_1(const Rat_vector& pcoeffs, + const Rat_vector& qcoeffs, + const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t, const Cache& cache) : + Base(pcoeffs, qcoeffs, x_s, x_t,cache) + { + if (!this->_is_continuous()) + { + // Invalid arc, as it is not continuous. + this->set_invalid(); + } + } + + //@} + + /// \name Constructions of points and curves. + //@{ + + /*! + * Compute the intersections with the given arc. + * \param arc The given intersecting arc. + * \param oi The output iterator. + * \return The past-the-end iterator. + */ + template + OutputIterator intersect(const Self& arc, OutputIterator oi, + const Cache& cache) const + { + CGAL_precondition(this->is_valid() && this->is_continuous()); + CGAL_precondition(arc.is_valid() && arc.is_continuous()); + + if (this->equals(arc)) + { + Self overlap_arc(*this); + *oi++ = make_object(overlap_arc); + return (oi); + } + + if (this->_has_same_base(arc)) + { + // Get the left and right endpoints of (*this) and their information + // bits. + const Algebraic_point_2& left1 = (this->is_directed_right() ? + this->_ps : this->_pt); + const Algebraic_point_2& right1 = (this->is_directed_right() ? + this->_pt : this->_ps); + int info_left1, info_right1; + + if (this->is_directed_right()) + { + info_left1 = (this->_info & this->SRC_INFO_BITS); + info_right1 = ((this->_info & this->TRG_INFO_BITS) >> 4); + } + else + { + info_right1 = (this->_info & this->SRC_INFO_BITS); + info_left1 = ((this->_info & this->TRG_INFO_BITS) >> 4); + } + + // Get the left and right endpoints of the other arc and their + // information bits. + const Algebraic_point_2& left2 = + (arc.is_directed_right() ? arc._ps : arc._pt); + const Algebraic_point_2& right2 = + (arc.is_directed_right() ? arc._pt : arc._ps); + int info_left2, info_right2; + + if (arc.is_directed_right()) + { + info_left2 = (arc._info & this->SRC_INFO_BITS); + info_right2 = ((arc._info & this->TRG_INFO_BITS) >> 4); + } + else + { + info_right2 = (arc._info & this->SRC_INFO_BITS); + info_left2 = ((arc._info & this->TRG_INFO_BITS) >> 4); + } + + // Locate the left curve-end with larger x-coordinate. + bool at_minus_infinity = false; + Arr_parameter_space inf_l1 = this->left_parameter_space_in_x(); + Arr_parameter_space inf_l2 = arc.left_parameter_space_in_x(); + Algebraic_point_2 p_left; + int info_left; + + if (inf_l1 == ARR_INTERIOR && inf_l2 == ARR_INTERIOR) + { + // Let p_left be the rightmost of the two left endpoints. + if (left1.x() > left2.x()) + { + p_left = left1; + info_left = info_left1; + } + else + { + p_left = left2; + info_left = info_left2; + } + } + else if (inf_l1 == ARR_INTERIOR) + { + // Let p_left be the left endpoint of (*this). + p_left = left1; + info_left = info_left1; + } + else if (inf_l2 == ARR_INTERIOR) + { + // Let p_left be the left endpoint of the other arc. + p_left = left2; + info_left = info_left2; + } + else + { + // Both arcs are defined at x = -oo. + at_minus_infinity = true; + info_left = info_left1; + } + + // Locate the right curve-end with smaller x-coordinate. + bool at_plus_infinity = false; + Arr_parameter_space inf_r1 = this->right_parameter_space_in_x(); + Arr_parameter_space inf_r2 = arc.right_parameter_space_in_x(); + Algebraic_point_2 p_right; + int info_right; + + if (inf_r1 == ARR_INTERIOR && inf_r2 == ARR_INTERIOR) + { + // Let p_right be the rightmost of the two right endpoints. + if (right1.x() < right2.x()) + { + p_right = right1; + info_right = info_right1; + } + else + { + p_right = right2; + info_right = info_right2; + } + } + else if (inf_r1 == ARR_INTERIOR) + { + // Let p_right be the right endpoint of (*this). + p_right = right1; + info_right = info_right1; + } + else if (inf_r2 == ARR_INTERIOR) + { + // Let p_right be the right endpoint of the other arc. + p_right = right2; + info_right = info_right2; + } + else + { + // Both arcs are defined at x = +oo. + at_plus_infinity = true; + info_right = info_right2; + } + + // Check the case of two bounded (in x) ends. + if (! at_minus_infinity && ! at_plus_infinity) + { + Comparison_result res = CGAL::compare(p_left.x(), p_right.x()); + if (res == LARGER) + { + // The x-range of the overlap is empty, so there is no overlap. + return (oi); + } + else if (res == EQUAL) + { + // We have a single overlapping point. Just make sure this point + // is not at y = -/+ oo. + if (info_left && + (this->SRC_AT_Y_MINUS_INFTY | this->SRC_AT_Y_PLUS_INFTY) == 0 && + info_right && + (this->SRC_AT_Y_MINUS_INFTY | this->SRC_AT_Y_PLUS_INFTY) == 0) + { + Intersection_point_2 ip(p_left, 0); + + *oi++ = make_object(ip); + } + + return (oi); + } + } + + // Create the overlapping portion of the rational arc by properly setting + // the source (left) and target (right) endpoints and their information + // bits. + Self overlap_arc(*this); + + overlap_arc._ps = p_left; + overlap_arc._pt = p_right; + + overlap_arc._info = ((info_left) | (info_right << 4) | + this->IS_DIRECTED_RIGHT | this->IS_CONTINUOUS | + this->IS_VALID); + + *oi++ = make_object(overlap_arc); + return (oi); + } + + // We wish to find the intersection points between: + // + // y = p1(x)/q1(x) and y = p2(x)/q2(x) + // + // It is clear that the x-coordinates of the intersection points are + // the roots of the polynomial: ip(x) = p1(x)*q2(x) - p2(x)*q1(x). + + Rational_function_pair rat_pair = + this->get_rational_pair(this->_f, arc._f, cache); + + typename Algebraic_vector::const_iterator x_iter; + typename Multiplicity_vector::const_iterator m_iter; + + // Go over the x-values we obtained. For each value produce an + // intersection point if it is contained in the x-range of both curves. + CGAL_precondition(rat_pair.roots().size() == + rat_pair.multiplicities().size()); + for (x_iter = rat_pair.roots().begin(), + m_iter = rat_pair.multiplicities().begin(); + x_iter != rat_pair.roots().end(); + ++x_iter, ++m_iter) + { + if (this->_is_in_true_x_range(*x_iter) && arc._is_in_true_x_range(*x_iter)) + { + // Compute the intersection point and obtain its multiplicity. + Algebraic_point_2 p(this->_f, *x_iter); + // Output the intersection point: + Intersection_point_2 ip(p, *m_iter); + + *oi++ = make_object(ip); + } + } + + return (oi); + } + + /*! + * Split the arc into two at a given split point. + * \param p The split point. + * \param c1 Output: The first resulting arc, lying to the left of p. + * \param c2 Output: The first resulting arc, lying to the right of p. + * \pre p lies in the interior of the arc (not one of its endpoints). + */ + void split(const Algebraic_point_2& p, Self& c1, Self& c2, const Cache& cache) const + { + CGAL_precondition(this->is_valid() && this->is_continuous()); + + // Make sure that p lies on the interior of the arc. + CGAL_precondition(this->point_position(p,cache) == EQUAL && + (this->source_parameter_space_in_x() != ARR_INTERIOR || + this->source_parameter_space_in_y() != ARR_INTERIOR || + (p.x() != this->_ps.x())) && + (this->target_boundary_in_x() != ARR_INTERIOR || + this->target_boundary_in_y() != ARR_INTERIOR || + (p.x() != this->_pt.x()))); + + // Make copies of the current arc. + c1 = *this; + c2 = *this; + + // Split the arc, such that c1 lies to the left of c2. + if ((this->_info & this->IS_DIRECTED_RIGHT) != 0) + { + c1._pt = p; + c1._info = (c1._info & ~this->TRG_INFO_BITS); + c2._ps = p; + c2._info = (c2._info & ~this->SRC_INFO_BITS); + } + else + { + c1._ps = p; + c1._info = (c1._info & ~this->SRC_INFO_BITS); + c2._pt = p; + c2._info = (c2._info & ~this->TRG_INFO_BITS); + } + } + + /*! + * Merge the current arc with the given arc. + * \param arc The arc to merge with. + * \pre The two arcs are mergeable. + */ + void merge(const Self& arc) + { + CGAL_precondition(this->is_valid() && this->is_continuous()); + CGAL_precondition(arc.is_valid() && arc.is_continuous()); + CGAL_precondition(this->can_merge_with(arc)); + + // Check if we should extend the arc to the left or to the right. + if (this->right_parameter_space_in_x() == ARR_INTERIOR && + this->right_parameter_space_in_y() == ARR_INTERIOR && + arc.left_parameter_space_in_x() == ARR_INTERIOR && + arc.left_parameter_space_in_y() == ARR_INTERIOR && + (this->right().x() == arc.left().x())) + { + // Extend the arc to the right. + if ((this->_info & this->IS_DIRECTED_RIGHT) != 0) + { + if (arc.right_parameter_space_in_x() == ARR_INTERIOR && + arc.right_parameter_space_in_y() == ARR_INTERIOR) + { + this->_pt = arc.right(); + } + else + { + if (arc.right_parameter_space_in_x() == ARR_LEFT_BOUNDARY) + this->_info = (this->_info | this->TRG_AT_X_MINUS_INFTY); + else if (arc.right_parameter_space_in_x() == ARR_RIGHT_BOUNDARY) + this->_info = (this->_info | this->TRG_AT_X_PLUS_INFTY); + + if (arc.right_parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) + this->_info = (this->_info | this->TRG_AT_Y_MINUS_INFTY); + else if (arc.right_parameter_space_in_y() == ARR_TOP_BOUNDARY) + this->_info = (this->_info | this->TRG_AT_Y_PLUS_INFTY); + + this->_pt = (arc._info & this->IS_DIRECTED_RIGHT) ? arc._pt : arc._ps; + } + } + else + { + if (arc.right_parameter_space_in_x() == ARR_INTERIOR && + arc.right_parameter_space_in_y() == ARR_INTERIOR) + { + this->_ps = arc.right(); + } + else + { + if (arc.right_parameter_space_in_x() == ARR_LEFT_BOUNDARY) + this->_info = (this->_info | this->SRC_AT_X_MINUS_INFTY); + else if (arc.right_parameter_space_in_x() == ARR_RIGHT_BOUNDARY) + this->_info = (this->_info | this->SRC_AT_X_PLUS_INFTY); + + if (arc.right_parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) + this->_info = (this->_info | this->SRC_AT_Y_MINUS_INFTY); + else if (arc.right_parameter_space_in_y() == ARR_TOP_BOUNDARY) + this->_info = (this->_info | this->SRC_AT_Y_PLUS_INFTY); + + this->_ps = (arc._info & this->IS_DIRECTED_RIGHT) ? arc._pt : arc._ps; + } + } + } + else + { + CGAL_precondition(this->left_parameter_space_in_x() == ARR_INTERIOR && + this->left_parameter_space_in_y() == ARR_INTERIOR && + arc.right_parameter_space_in_x() == ARR_INTERIOR && + arc.right_parameter_space_in_y() == ARR_INTERIOR && + (this->left().x() == arc.right().x())); + + // Extend the arc to the left. + if ((this->_info & this->IS_DIRECTED_RIGHT) != 0) + { + if (arc.left_parameter_space_in_x() == ARR_INTERIOR && + arc.left_parameter_space_in_y() == ARR_INTERIOR) + { + this->_ps = arc.left(); + } + else + { + if (arc.left_parameter_space_in_x() == ARR_LEFT_BOUNDARY) + this->_info = (this->_info | this->SRC_AT_X_MINUS_INFTY); + else if (arc.left_parameter_space_in_x() == ARR_RIGHT_BOUNDARY) + this->_info = (this->_info | this->SRC_AT_X_PLUS_INFTY); + + if (arc.left_parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) + this->_info = (this->_info | this->SRC_AT_Y_MINUS_INFTY); + else if (arc.left_parameter_space_in_y() == ARR_TOP_BOUNDARY) + this->_info = (this->_info | this->SRC_AT_Y_PLUS_INFTY); + + this->_ps = (arc._info & this->IS_DIRECTED_RIGHT) ? arc._ps : arc._pt; + } + } + else + { + if (arc.left_parameter_space_in_x() == ARR_INTERIOR && + arc.left_parameter_space_in_y() == ARR_INTERIOR) + { + this->_pt = arc.left(); + } + else + { + if (arc.left_parameter_space_in_x() == ARR_LEFT_BOUNDARY) + this->_info = (this->_info | this->TRG_AT_X_MINUS_INFTY); + else if (arc.left_parameter_space_in_x() == ARR_RIGHT_BOUNDARY) + this->_info = (this->_info | this->TRG_AT_X_PLUS_INFTY); + + if (arc.left_parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) + this->_info = (this->_info | this->TRG_AT_Y_MINUS_INFTY); + else if (arc.left_parameter_space_in_y() == ARR_TOP_BOUNDARY) + this->_info = (this->_info | this->TRG_AT_Y_PLUS_INFTY); + + this->_pt = (arc._info & this->IS_DIRECTED_RIGHT) ? arc._ps : arc._pt; + } + } + } + } + //@} + + +}; + +//*! \class Rational_arc_2 + // * Representation of a generic, not necessarily continuous, portion of a + // * rational function. + // */ +template +class Rational_arc_d_1 : public Base_rational_arc_d_1 +{ +public: + typedef Algebraic_kernel_ Algebraic_kernel; + + typedef Rational_arc_d_1 Self; + typedef Base_rational_arc_d_1 Base; + typedef Continuous_rational_arc_d_1 Continuous_arc; + + typedef typename Base::Integer Integer; + typedef typename Base::Rational Rational; + typedef typename Base::Algebraic_real_1 Algebraic_real_1; + typedef typename Base::Algebraic_point_2 Algebraic_point_2; + typedef typename Base::Polynomial_1 Polynomial_1; + + typedef typename Base::Rat_vector Rat_vector; + + typedef typename Base::Cache Cache; + + /// \name Constrcution methods. + //@{ + + /*! + * Default constructor. + */ + Rational_arc_d_1() : + Base() + {} + + /*! + * Constructor of a whole polynomial curve. + * \param pcoeffs The rational coefficients of the polynomial p(x). + */ + Rational_arc_d_1(const Polynomial_1& P, const Cache& cache) : + Base(P, cache) + {} + + Rational_arc_d_1(const Rat_vector& pcoeffs, const Cache& cache) : + Base(pcoeffs, cache) + {} + + /*! + * Constructor of a polynomial ray, defined by y = p(x), for x_s <= x if the + * ray is directed to the right, or for x_s >= x if it is directed to the + * left. + * \param pcoeffs The rational coefficients of the polynomial p(x). + * \param x_s The x-coordinate of the source point. + * \param dir_right Is the ray directed to the right (to +oo) + * or to the left (to -oo). + */ + Rational_arc_d_1(const Polynomial_1& P, const Algebraic_real_1& x_s, + bool dir_right, const Cache& cache) : + Base(P, x_s, dir_right,cache) + {} + + Rational_arc_d_1(const Rat_vector& pcoeffs, const Algebraic_real_1& x_s, + bool dir_right, const Cache& cache) : + Base(pcoeffs, x_s, dir_right,cache) + {} + + + /*! + * Constructor of a polynomial arc, defined by y = p(x), x_min <= x <= x_max. + * \param pcoeffs The rational coefficients of the polynomial p(x). + * \param x_s The x-coordinate of the source point. + * \param x_t The x-coordinate of the target point. + * \pre The two x-coordinates must not be equal. + */ + Rational_arc_d_1(const Polynomial_1& P, const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t, const Cache& cache) : + Base(P, x_s, x_t, cache) + {} + + Rational_arc_d_1(const Rat_vector& pcoeffs, const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t,const Cache& cache) : + Base(pcoeffs, x_s, x_t, cache) + {} + + /*! + * Constructor of a polynomial function, defined by y = p(x)/q(x) for any x. + * \param pcoeffs The rational coefficients of the polynomial p(x). + * \param qcoeffs The rational coefficients of the polynomial q(x). + */ + Rational_arc_d_1(const Polynomial_1& P,const Polynomial_1& Q, const Cache& cache) : + Base(P, Q,cache) + {} + + Rational_arc_d_1(const Rat_vector& pcoeffs, const Rat_vector& qcoeffs, + const Cache& cache) : + Base(pcoeffs, qcoeffs, cache) + {} + + /*! + * Constructor of a ray of a rational function, defined by y = p(x)/q(x), + * for x_s <= x if the ray is directed to the right, or for x_s >= x if it + * is directed to the left. + * \param pcoeffs The rational coefficients of the polynomial p(x). + * \param qcoeffs The rational coefficients of the polynomial q(x). + * \param x_s The x-coordinate of the source point. + * \param dir_right Is the ray directed to the right (to +oo) + * or to the left (to -oo). + */ + Rational_arc_d_1(const Polynomial_1& P,const Polynomial_1& Q, + const Algebraic_real_1& x_s, bool dir_right, const Cache& cache) : + Base(P, Q, x_s, dir_right, cache) + {} + + Rational_arc_d_1(const Rat_vector& pcoeffs, const Rat_vector& qcoeffs, + const Algebraic_real_1& x_s, bool dir_right, const Cache& cache) : + Base(pcoeffs, qcoeffs, x_s, dir_right, cache) + {} + + /*! + * Constructor of a bounded rational arc, defined by y = p(x)/q(x), + * where: x_min <= x <= x_max. + * \param pcoeffs The rational coefficients of the polynomial p(x). + * \param qcoeffs The rational coefficients of the polynomial q(x). + * \param x_s The x-coordinate of the source point. + * \param x_t The x-coordinate of the target point. + * \pre The two x-coordinates must not be equal. + */ + Rational_arc_d_1(const Polynomial_1& P,const Polynomial_1& Q, + const Algebraic_real_1& x_s, const Algebraic_real_1& x_t, + const Cache& cache) : + Base(P, Q, x_s, x_t, cache) + {} + + Rational_arc_d_1(const Rat_vector& pcoeffs, const Rat_vector& qcoeffs, + const Algebraic_real_1& x_s, const Algebraic_real_1& x_t, + const Cache& cache) : + Base(pcoeffs, qcoeffs, x_s, x_t, cache) + {} + //@} + + /*! + * Subdivide the given portion of a rational function into continuous + * sub-arcs, splitting it at the roots of the denominator polynomial. + * \param oi An output iterator of Continuous_rational_arc_d_1 objects. + */ + template + OutputIterator make_continuous(OutputIterator oi) const + { + // Compute the roots of the denominator polynomial. + std::list q_roots; + bool root_at_ps, root_at_pt; + + if ((this->_info & this->IS_CONTINUOUS) == 0) + this->_denominator_roots(std::back_inserter(q_roots), + root_at_ps, root_at_pt); + + // Check the case of a continuous arc: + Base arc = *this; + + if (q_roots.empty()) + { + arc.set_continuous(); + *oi++ = Continuous_arc(arc); + return (oi); + } + + // The denominator has roots: split the arc accordingly. + typename std::list::const_iterator iter; + + for (iter = q_roots.begin(); iter != q_roots.end(); ++iter) + { + *oi++ = Continuous_arc(arc.split_at_pole(*iter)); + } + + // Add the final x-monotone sub-arc. + arc.set_continuous(); + *oi++ = Continuous_arc(arc); + + return (oi); + } +}; + +} //name_space Arr_rational_arc +} //namespace CGAL { + +#endif //CGAL_RATIONAL_ARC_D_1_H diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_function.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_function.h new file mode 100644 index 00000000000..f0d7fe505a9 --- /dev/null +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_function.h @@ -0,0 +1,266 @@ +// Copyright (c) 2011 Tel-Aviv University (Israel), INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Oren Salzman +// Michael Hemmer + +#ifndef CGAL_RATIONAL_FUNCTION_H +#define CGAL_RATIONAL_FUNCTION_H + +#include +#include +namespace CGAL { +namespace Arr_rational_arc { + +template +class Rational_function_rep : public Base_rational_arc_ds_1 +{ +public: + typedef AlgebraicKernel_d_1 Algebraic_kernel_d_1; + typedef Base_rational_arc_ds_1 Base; + + typedef typename Base::Polynomial_1 Polynomial_1; + typedef typename Base::Algebraic_real_1 Algebraic_real_1; + typedef typename Base::Algebraic_vector Algebraic_vector; + typedef typename Base::Multiplicity Multiplicity; + typedef typename Base::Multiplicity_vector Multiplicity_vector; + typedef typename Base::Root_multiplicity_vector Root_multiplicity_vector; + typedef typename Base::Solve_1 Solve_1; + +public: + Rational_function_rep() : _ak_ptr(NULL){} + Rational_function_rep(const Polynomial_1& numer, + const Polynomial_1& denom, + Algebraic_kernel_d_1* ak_ptr): + _numer(numer), _denom(denom),_ak_ptr(ak_ptr) + { + initialize(); + } + + CGAL::Sign sign_at (const Algebraic_real_1& x, + CGAL::Sign epsilon = CGAL::ZERO) const + { + //find interval + typename Algebraic_vector::const_iterator iter = + std::lower_bound(_event_roots.begin(), _event_roots.end(),x); + + //case of a value larger than largest root + if (iter == _event_roots.end()) + return (_sign.back()); + + typename Algebraic_vector::iterator::difference_type dist = + iter - _event_roots.begin(); + + //if x is not a root, ignore epsilons + if (*iter != x) + return (_sign[dist]); + + //x is a root + if (epsilon == CGAL::ZERO) + return (CGAL::EQUAL); + else if (epsilon == CGAL::NEGATIVE) + return (_sign[dist] ); + else // CGAL::POSITIVE + return (_sign[dist+1]); + } + + CGAL::Sign sign_near_minus_infinity() const + { + return _sign.front(); + } + + bool operator==(const Rational_function_rep& other) const + { + return ((this->_numer == other.numer()) && + (this->_denom == other.denom()) ); + } + + const Polynomial_1& numer() const + { + return _numer; + } + + const Polynomial_1& denom() const + { + return _denom; + } + + const Algebraic_vector& poles() const + { + return _poles; + } + + const Multiplicity_vector& pole_multiplicities() const + { + return _pole_multiplicities; + } + +private: + void initialize() + { + CGAL_precondition(_ak_ptr != NULL); + CGAL_precondition(CGAL::is_zero(_denom) == false); + if (CGAL::is_zero(_numer)) + { + //function does not change sign + _sign.push_back(CGAL::ZERO); + return; + } + + Solve_1 solve_1 (_ak_ptr->solve_1_object()); + Root_multiplicity_vector rm_poles_vec,rm_intersctions_vec; + solve_1(_denom, std::back_inserter(rm_poles_vec)); //poles + solve_1(_numer, std::back_inserter(rm_intersctions_vec)); //intersections with zero + + //reserve memory + typename Root_multiplicity_vector::size_type num_of_poles = + rm_poles_vec.size(); + typename Root_multiplicity_vector::size_type num_of_intersections = + rm_intersctions_vec.size(); + + _poles.reserve(num_of_poles); + _pole_multiplicities.reserve(num_of_poles); + + _event_roots.reserve(num_of_poles + num_of_intersections); + _pole_multiplicities.reserve(num_of_poles + num_of_intersections); + + //initialize poles + for ( typename Root_multiplicity_vector::iterator it = rm_poles_vec.begin(); + it != rm_poles_vec.end() ; + ++it) + { + _poles.push_back(it->first); + _pole_multiplicities.push_back(it->second); + } + + //initialize events + Root_multiplicity_vector events_mult_vec; + std::merge( rm_poles_vec.begin() , rm_poles_vec.end() , + rm_intersctions_vec.begin() , rm_intersctions_vec.end() , + std::back_inserter(events_mult_vec)); + + typename Root_multiplicity_vector::iterator it; + for (it = events_mult_vec.begin(); it != events_mult_vec.end(); ++it) + { + _event_roots.push_back(it->first); + _event_multiplicities.push_back(it->second); + } + + //initialize left most interval (at -oo) + //for (ax^n+.../x^m+...) the sign is: sign(a) * (-1)^(n +m) + CGAL::Sign curr_sign = CGAL::sign(CGAL::leading_coefficient(_numer)); + if ((CGAL::degree(_numer) + CGAL::degree(_denom)) % 2 == 1) + curr_sign = curr_sign * CGAL::NEGATIVE; + _sign.push_back(curr_sign); + + typename Multiplicity_vector::iterator it2; + for (it2 = _event_multiplicities.begin(); + it2 != _event_multiplicities.end(); + ++it2) + { + if (*it2 % 2 == 1) + curr_sign = curr_sign * CGAL::NEGATIVE; + _sign.push_back(curr_sign); + } + } + +private: + Polynomial_1 _numer; + Polynomial_1 _denom; + Algebraic_vector _poles; //roots of the denominator + Multiplicity_vector _pole_multiplicities; //multiplicities of the poles + Algebraic_vector _event_roots; //poles and intersection points with y=0, function can change signs in these events + Multiplicity_vector _event_multiplicities; //multiplicities of the events + std::vector _sign; //function's sign in the corresponding interval induced by _event_roots (if no roots then only one value) + mutable Algebraic_kernel_d_1* _ak_ptr; + +};//Rational_function_rep + +template < class Algebraic_kernel_ > +class Rational_function: + public Handle_with_policy > +{ +public: + typedef Algebraic_kernel_ Algebraic_kernel_d_1; + typedef Handle_with_policy > + Base; + typedef Rational_function Self; + typedef Rational_function_rep Rep; + typedef typename Rep::Algebraic_real_1 Algebraic_real_1; + typedef typename Rep::Polynomial_1 Polynomial_1; + typedef typename Rep::Algebraic_vector Algebraic_vector; + typedef typename Rep::Multiplicity_vector Multiplicity_vector; + + typedef typename Base::Id_type Id_type; +private: + static Self& get_default_instance() + { + static Algebraic_kernel_d_1 kernel; + static Self x = Self(Polynomial_1(0), Polynomial_1(1), &kernel); + return x; + } +public: + Rational_function(const Polynomial_1& numer, + const Polynomial_1& denom, + Algebraic_kernel_d_1* ak_ptr) : + Base(numer,denom,ak_ptr) {} + + //used to solve VS bug... + Rational_function (const Self & r = get_default_instance()) : + Base(static_cast (r)) {} + + CGAL::Sign sign_at(const Algebraic_real_1& x, + CGAL::Sign epsilon = CGAL::ZERO) const + { + return this->ptr()->sign_at(x,epsilon); + } + + CGAL::Sign sign_near_minus_infinity() const + { + return this->ptr()->sign_near_minus_infinity (); + } + bool operator== (const Self & other) const + { + if (this->is_identical (other)) + return true; + return (*(this->ptr()) == *(other.ptr())); + } + + const Polynomial_1& numer () const + { + return this->ptr()->numer(); + } + + const Polynomial_1& denom () const + { + return this->ptr()->denom(); + } + + const Algebraic_vector& poles () const + { + return this->ptr()->poles(); + } + + const Multiplicity_vector& pole_multiplicities () const + { + return this->ptr()->pole_multiplicities(); + } +}; //Rational_function + +} //namespace Arr_rational_arc +} //namespace CGAL { + +#endif //CGAL_RATIONAL_FUNCTION_H diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_function_canonicalized_pair.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_function_canonicalized_pair.h new file mode 100644 index 00000000000..4fe80ec8888 --- /dev/null +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_function_canonicalized_pair.h @@ -0,0 +1,508 @@ +// Copyright (c) 2011 Tel-Aviv University (Israel), INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Oren Salzman +// Michael Hemmer + +#ifndef CGAL_RATIONAL_FUNCTION_CANONICALIZED_PAIR_H +#define CGAL_RATIONAL_FUNCTION_CANONICALIZED_PAIR_H + +#include +#include +#include + +namespace CGAL { +namespace Arr_rational_arc { + +template +class Rational_function_canonicalized_pair_rep: + public Base_rational_arc_ds_1 +{ +public: + typedef AlgebraicKernel_d_1 Algebraic_kernel_d_1; + typedef Base_rational_arc_ds_1 Base; + + typedef CGAL::Arr_rational_arc::Rational_function + Rational_function; + typedef typename Base::Polynomial_1 Polynomial_1; + typedef typename Base::Algebraic_real_1 Algebraic_real_1; + typedef typename Base::Algebraic_vector Algebraic_vector; + typedef typename Base::Multiplicity Multiplicity; + typedef typename Base::Multiplicity_vector Multiplicity_vector; + typedef typename Base::Root_multiplicity_vector Root_multiplicity_vector; + typedef typename Base::Solve_1 Solve_1; + typedef typename Base::Bound Bound; + typedef typename Base::Coefficient Coefficient; + +public: + Rational_function_canonicalized_pair_rep(const Rational_function& f, + const Rational_function& g, + Algebraic_kernel_d_1* ak_ptr) + :_f(f),_g(g),_ak_ptr(ak_ptr) + { + CGAL_precondition(_ak_ptr != NULL); + //canonicalized representation + if ( !(f.id() < g.id()) ) + std::swap(_f,_g); + _resultant = (_f.numer() * _g.denom() - _f.denom() * _g.numer()); + + //f and g are not the same... + CGAL_precondition(CGAL::is_zero(_resultant) == false); + + Solve_1 solve_1(_ak_ptr->solve_1_object()); + Root_multiplicity_vector rm_vec; + +#if 1 + solve_1(_resultant,std::back_inserter(rm_vec)); +#else + assert(false); + // don't use this code yet since g and resultant/g may still have a + // common root + if( CGAL::internal::may_have_common_factor(_f.denom(),_g.denom())){ + Polynomial_1 g = CGAL::gcd(_f.denom(), _g.denom()); + solve_1(CGAL::integral_division(_resultant, g), + std::back_inserter(rm_vec)); + solve_1(g, std::back_inserter(rm_vec)); + std::sort(rm_vec.begin(), rm_vec.end()); + }else{ + solve_1(_resultant, std::back_inserter(rm_vec)); + } +#endif + + _roots.reserve(rm_vec.size()); + _multiplicities.reserve(rm_vec.size()); + + for (typename Root_multiplicity_vector::iterator it = rm_vec.begin(); + it != rm_vec.end() ; + ++it) + { + _roots.push_back(it->first); + _multiplicities.push_back(it->second); + } + + Algebraic_vector tmp; + tmp.reserve(_f.poles().size() + _g.poles().size()); + _event_roots.reserve(rm_vec.size() + _f.poles().size() + _g.poles().size()); + //merge the roots of f,g & resultant + std::merge( _f.poles().begin(), _f.poles().end(), + _g.poles().begin(), _g.poles().end(), + std::back_inserter(tmp)); + std::merge(tmp.begin(), tmp.end(), + _roots.begin(), _roots.end(), + std::back_inserter(_event_roots)); + + //remove duplicate entries + typename Algebraic_vector::iterator new_end,old_end; + new_end = std::unique(_event_roots.begin(), old_end=_event_roots.end()); + _event_roots.erase(new_end,old_end); + + //compute the values of _is_above + bool curr_is_above = get_is_above_near_minus_infinity(); + _is_above.push_back(curr_is_above); + + // TBD: is_sorted is provided both by stl and boost. The interface of + // boost version changed, and as of version ? it accepts a single + // argument, that is a model of the SinglePassRange concept. The stl + // version, on the other hand, is on it's way out. + // (The name is wrong-should be is_ordered). + // + // CGAL_precondition(std::is_sorted(_f.poles().begin(),_f.poles().end())); + // CGAL_precondition(std::is_sorted(_g.poles().begin(),_g.poles().end())); + // CGAL_precondition(std::is_sorted(_roots.begin(),_roots.end())); + + typename Algebraic_vector ::const_iterator it_f_pole = _f.poles().begin(); + typename Multiplicity_vector::const_iterator it_f_mult = + _f.pole_multiplicities().begin(); + typename Algebraic_vector ::const_iterator it_g_pole = _g.poles().begin(); + typename Multiplicity_vector::const_iterator it_g_mult = + _g.pole_multiplicities().begin(); + typename Algebraic_vector ::const_iterator it_r_root = _roots.begin(); + typename Multiplicity_vector::const_iterator it_r_mult = + _multiplicities.begin() ; + while ( (it_f_pole != _f.poles().end()) || + (it_g_pole != _g.poles().end()) || + (it_r_root != _roots.end())) + { + //std::cout << "_f._poles.size() " << _f._poles.size() < tmp_is_above = + compute_is_above_explicitly(); + ); + CGAL_postcondition(_is_above == tmp_is_above); + } + + Comparison_result compare_f_g_at(const Algebraic_real_1& x, + CGAL::Sign epsilon = CGAL::ZERO) const + { + //f and g must be different + CGAL_precondition(!CGAL::is_zero(_resultant)); + + //find interval + typename Algebraic_vector::const_iterator iter = + std::lower_bound(_event_roots.begin(), _event_roots.end(),x); + + //case of a value larger than largest root + if (iter == _event_roots.end()) + return (_is_above.back() ? CGAL:: LARGER : CGAL::SMALLER); + + typename Algebraic_vector::iterator::difference_type dist = + iter - _event_roots.begin(); + + //if x is not a root, ignore epsilons + if (*iter != x){ + return (_is_above[dist] ? CGAL:: LARGER : CGAL::SMALLER); + } + + //x is a root + if (epsilon == CGAL::ZERO){ + CGAL_precondition(_f.poles().end() == + std::find(_f.poles().begin(), _f.poles().end(),x)); + CGAL_precondition(_g.poles().end() == + std::find(_g.poles().begin(), _g.poles().end(),x)); + return (CGAL::EQUAL); + } + + if (epsilon == CGAL::NEGATIVE) + return (_is_above[dist] ? CGAL:: LARGER : CGAL::SMALLER); + else // CGAL::POSITIVE + return (_is_above[dist+1] ? CGAL:: LARGER : CGAL::SMALLER); + } + Comparison_result compare_f_g_at(Arr_parameter_space boundary) const + { + CGAL_precondition((boundary == ARR_LEFT_BOUNDARY) || + (boundary == ARR_RIGHT_BOUNDARY) ); + + //f and g are the same... + if (CGAL::is_zero(_resultant)) + return CGAL::EQUAL; + + if (boundary == ARR_LEFT_BOUNDARY) + return _is_above.front() ? CGAL::LARGER : CGAL::SMALLER ; + else // boundary = ARR_RIGHT_BOUNDARY + return _is_above.back() ? CGAL::LARGER : CGAL::SMALLER ; + } + + bool is_intersecting_in_range(const Arr_parameter_space left_parameter_space, + const Algebraic_real_1 left, + const Arr_parameter_space right_parameter_space, + const Algebraic_real_1 right) const + { + //the two function intersect iff the left index and the right index + //of the array _is_above are different + + //get left index + typename Algebraic_vector::const_iterator left_index = + (left_parameter_space == ARR_LEFT_BOUNDARY) ? + _event_roots.begin(): + std::lower_bound(_event_roots.begin(), _event_roots.end(),left); + //check if intersect at left index + if (*left_index == left) + return true; + + //get right index + typename Algebraic_vector::const_iterator right_index = + (right_parameter_space == ARR_RIGHT_BOUNDARY) ? + _event_roots.begin(): + std::lower_bound(_event_roots.begin(), _event_roots.end(),right); + //check if intersect at right index + if (*right_index == right) + return true; + + //check if indices are the same + return (left_index == right_index); + } + + const Rational_function& f() const + { + return _f; + } + + const Rational_function& g() const + { + return _g; + } + + const Algebraic_vector & roots() const + { + return _roots; + } + + const Multiplicity_vector & multiplicities() const + { + return _multiplicities; + } + +private: + bool get_is_above_near_minus_infinity() + { + bool r = _get_is_above_near_minus_infinity(); + CGAL_postcondition(r == __get_is_above_near_minus_infinity()); + return r; + } + + bool _get_is_above_near_minus_infinity() + { + int f_deg = CGAL::degree(_f.numer()) - CGAL::degree(_f.denom()); + int g_deg = CGAL::degree(_g.numer()) - CGAL::degree(_g.denom()); + + if (f_deg > g_deg) //f is stronger than g + { + CGAL::Sign sign = _f.sign_near_minus_infinity(); + return (sign == CGAL::NEGATIVE) ? false : + (sign == CGAL::POSITIVE) ? true : + (_g.sign_near_minus_infinity() == CGAL::NEGATIVE); // _f == zero; + } + if (f_deg < g_deg) //g is stronger than f + { + CGAL::Sign sign = _g.sign_near_minus_infinity(); + return (sign == CGAL::NEGATIVE) ? true : + (sign == CGAL::POSITIVE) ? false : + (_f.sign_near_minus_infinity() == CGAL::POSITIVE); // _g == zero; + } + + //both have the same degree difference, + //check who's leading coeeficient ratio is larger + Coefficient lead_coeff_ratio = + CGAL::abs(CGAL::leading_coefficient(_f.numer())) * + CGAL::leading_coefficient(_g.denom()) - + CGAL::abs(CGAL::leading_coefficient(_g.numer())) * + CGAL::leading_coefficient(_f.denom()); + if (lead_coeff_ratio > 0)//f is stronger than g + return (_f.sign_near_minus_infinity() == CGAL::NEGATIVE ) ? false : true; + if (lead_coeff_ratio < 0) //g is stronger than f + return (_g.sign_near_minus_infinity() == CGAL::NEGATIVE ) ? true : false; + + //ratio is the same, instead of continuing with taylor expansion, + //compute explicitly + + return __get_is_above_near_minus_infinity(); + } + + bool __get_is_above_near_minus_infinity() + { + Bound b; + if (_event_roots.empty()) + b = Bound(0); + else + { + b = (_ak_ptr->approximate_relative_1_object()(_event_roots.front(), 0)).first - 1; //lower bound of first root + } + return is_above_at(b); + } + + bool is_above_at(const Bound& b) + { + //return true if f is above g at b which means return (sign == positive) of : + // + // numer_f * denom _g - numer_f * denom _g + //f-g= -------------------------------------- at b + // denom _f * denom _g + + //TODO: unnescecary construction of real + Algebraic_real_1 x(_ak_ptr->construct_algebraic_real_1_object()(b)); + + CGAL::Sign numer = _ak_ptr->sign_at_1_object()(_resultant, x); + CGAL::Sign denom_f = _ak_ptr->sign_at_1_object()(_f.denom(),x); + CGAL::Sign denom_g = _ak_ptr->sign_at_1_object()(_g.denom(),x); + CGAL::Sign denom = denom_f * denom_g ; + CGAL::Sign s = numer*denom; + + CGAL_precondition(s != CGAL::ZERO); + + return (s == CGAL::POSITIVE); + } + std::vector compute_is_above_explicitly() + { + std::vector tmp_is_above; + if (_event_roots.size()== 0) + { + Bound b = 1; //all bound are legal, choose 1 for simplicity + tmp_is_above.push_back(is_above_at(b)); + return tmp_is_above; + } + + tmp_is_above.reserve(_event_roots.size()+1); + //left boundary + Bound b = (_ak_ptr->approximate_relative_1_object() + (_event_roots.front(),0)).first - 1; //lower bound of first root + tmp_is_above.push_back(is_above_at(b)); + + //mid intervals + typename Algebraic_vector::size_type i; + for (i = 0; i < _event_roots.size()-1; ++i) + { + b = _ak_ptr->bound_between_1_object()(_event_roots[i],_event_roots[i+1]); + tmp_is_above.push_back(is_above_at(b)); + } + + //right boundary + b = (_ak_ptr->approximate_relative_1_object()(_event_roots.back(), 0)).second + 1; //lower bound of last root + tmp_is_above.push_back(is_above_at(b)); + return tmp_is_above; + } + +private: + Rational_function _f,_g; + Polynomial_1 _resultant; + Algebraic_vector _roots; + //roots of resultant merged with roots of f & g's denomenators + Algebraic_vector _event_roots; + Multiplicity_vector _multiplicities; + //is f above g in the interval induced by index i of _roots + std::vector _is_above; + Algebraic_kernel_d_1* _ak_ptr; +}; // Rational_function_canonicalized_pair_rep + +template +class Rational_function_canonicalized_pair: + public Handle_with_policy > +{ +public: + typedef Algebraic_kernel_ Algebraic_kernel_d_1; + typedef Rational_function_canonicalized_pair_rep + Rep; + typedef Handle_with_policy Base; + typedef Rational_function_canonicalized_pair + Self; + typedef typename Rep::Rational_function Rational_function; + typedef typename Rep::Algebraic_real_1 Algebraic_real_1; + typedef typename Rep::Polynomial_1 Polynomial_1; + typedef typename Rep::Algebraic_vector Algebraic_vector; + typedef typename Rep::Multiplicity_vector Multiplicity_vector; + typedef typename Rep::Root_multiplicity_vector Root_multiplicity_vector; + + Rational_function_canonicalized_pair(const Rational_function& f, + const Rational_function& g, + Algebraic_kernel_d_1* ak_ptr) : + Base(f, g, ak_ptr) {} + //used to solve VS bug... + Rational_function_canonicalized_pair(const Self & p) : + Base(static_cast (p)) {} + + Comparison_result compare_f_g_at(const Algebraic_real_1& x, + CGAL::Sign epsilon = CGAL::ZERO) const + { + return this->ptr()->compare_f_g_at(x,epsilon); + } + + Comparison_result compare_f_g_at(Arr_parameter_space boundary) const + { + return this->ptr()->compare_f_g_at(boundary); + } + + bool is_intersecting_in_range(const Arr_parameter_space left_parameter_space, + const Algebraic_real_1 left, + const Arr_parameter_space right_parameter_space, + const Algebraic_real_1 right) const + { + return this->ptr()->is_intersecting_in_range(left_parameter_space, left, + right_parameter_space, right); + } + + const Rational_function& f() const + { + return this->ptr()->f(); + } + + const Rational_function& g() const + { + return this->ptr()->g(); + } + + const Algebraic_vector & roots() const + { + return this->ptr()->roots(); + } + + const Multiplicity_vector & multiplicities() const + { + return this->ptr()->multiplicities(); + } +}; //Rational_function_canonicalized_pair + +} //namespace Arr_rational_arc +} //namespace CGAL { + +#endif //CGAL_RATIONAL_FUNCTION_CANONICALIZED_PAIR_H diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_function_ordered_pair.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_function_ordered_pair.h new file mode 100644 index 00000000000..c6201779ea2 --- /dev/null +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_function_ordered_pair.h @@ -0,0 +1,105 @@ +// Copyright (c) 2011 Tel-Aviv University (Israel), INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Oren Salzman +// Michael Hemmer + +#ifndef CGAL_RATIONAL_FUNCTION_ORDERED_PAIR_H +#define CGAL_RATIONAL_FUNCTION_ORDERED_PAIR_H + + +#include +#include +#include + +namespace CGAL { +namespace Arr_rational_arc +{ +template +class Rational_function_ordered_pair: + public Base_rational_arc_ds_1 +{ +public: + typedef AlgebraicKernel_d_1 Algebraic_kernel_d_1; + typedef Base_rational_arc_ds_1 Base; + typedef CGAL::Arr_rational_arc::Rational_function_pair + Rational_function_pair; + typedef CGAL::Arr_rational_arc::Rational_function + Rational_function; + + typedef typename Base::Polynomial_1 Polynomial_1; + typedef typename Base::Algebraic_real_1 Algebraic_real_1; + typedef typename Base::Algebraic_vector Algebraic_vector; + typedef typename Base::Multiplicity Multiplicity; + typedef typename Base::Multiplicity_vector Multiplicity_vector; + typedef typename Base::Root_multiplicity_vector Root_multiplicity_vector; + +public: + Rational_function_ordered_pair(const Rational_function_pair& rat_pair, + bool is_opposite = false) : + _rat_pair(rat_pair), _is_opposite(is_opposite) + {} + + Comparison_result compare_f_g_at(const Algebraic_real_1& x, + CGAL::Sign epsilon = CGAL::ZERO) + { + Comparison_result cr = _rat_pair.compare_f_g_at(x,epsilon); + if (_is_opposite == false) + return cr; + return (cr == CGAL:: LARGER ) ? CGAL:: SMALLER : + (cr == CGAL:: SMALLER ) ? CGAL:: LARGER : + /* (cr == CGAL::EQUAL)*/ CGAL:: EQUAL; + } + + Comparison_result compare_f_g_at(Arr_parameter_space boundary) + { + Comparison_result cr = _rat_pair.compare_f_g_at(boundary); + if (_is_opposite == false) + return cr; + return (cr == CGAL:: LARGER ) ? CGAL:: SMALLER : + (cr == CGAL:: SMALLER ) ? CGAL:: LARGER : + /* (cr == CGAL::EQUAL)*/ CGAL::EQUAL; + } + + bool is_intersecting_in_range(const Arr_parameter_space left_parameter_space, + const Algebraic_real_1 left, + const Arr_parameter_space right_parameter_space, + const Algebraic_real_1 right) + { + return _rat_pair.is_intersecting_in_range(left_parameter_space, left, + right_parameter_space, right); + } + + const Algebraic_vector & roots() const + { + return _rat_pair.roots(); + } + + const Multiplicity_vector & multiplicities() const + { + return _rat_pair.multiplicities(); + } + +private: + const Rational_function_pair& _rat_pair; + bool _is_opposite; +}; // Rational_function_ordered_pair + + +} //namespace Arr_rational_arc +} //namespace CGAL { + +#endif //CGAL_RATIONAL_FUNCTION_ORDERED_PAIR_H diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_function_pair.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_function_pair.h new file mode 100644 index 00000000000..87166bc9d73 --- /dev/null +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_function_pair.h @@ -0,0 +1,97 @@ +// Copyright (c) 2011 Tel-Aviv University (Israel), INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Oren Salzman +// Michael Hemmer + +#ifndef CGAL_RATIONAL_FUNCTION_ORDERED_PAIR_H +#define CGAL_RATIONAL_FUNCTION_ORDERED_PAIR_H + + +#include +#include +#include + +namespace CGAL { +namespace Arr_rational_arc { + +template +class Rational_function_pair: + public Base_rational_arc_ds_1 +{ +public: + typedef AlgebraicKernel_d_1 Algebraic_kernel_d_1; + typedef Base_rational_arc_ds_1 Base; + typedef CGAL::Arr_rational_arc::Rational_function_canonicalized_pair + Rational_function_canonicalized_pair; + typedef CGAL::Arr_rational_arc::Rational_function + Rational_function; + + typedef typename Base::Polynomial_1 Polynomial_1; + typedef typename Base::Algebraic_real_1 Algebraic_real_1; + typedef typename Base::Algebraic_vector Algebraic_vector; + typedef typename Base::Multiplicity Multiplicity; + typedef typename Base::Multiplicity_vector Multiplicity_vector; + typedef typename Base::Root_multiplicity_vector Root_multiplicity_vector; + +public: + Rational_function_pair(const Rational_function_canonicalized_pair& rat_pair, + bool is_opposite = false) : + _rat_pair(rat_pair), _is_opposite(is_opposite) + {} + + Comparison_result compare_f_g_at(const Algebraic_real_1& x , + CGAL::Sign epsilon = CGAL::ZERO) + { + Comparison_result cr = _rat_pair.compare_f_g_at(x,epsilon); + return (_is_opposite) ? -cr : cr ; + } + + Comparison_result compare_f_g_at(Arr_parameter_space boundary) + { + Comparison_result cr = _rat_pair.compare_f_g_at(boundary); + return (_is_opposite) ? -cr : cr ; + } + + bool is_intersecting_in_range(const Arr_parameter_space left_parameter_space, + const Algebraic_real_1 left, + const Arr_parameter_space right_parameter_space, + const Algebraic_real_1 right) + { + return _rat_pair.is_intersecting_in_range(left_parameter_space, left, + right_parameter_space, right); + } + + const Algebraic_vector & roots() const + { + return _rat_pair.roots(); + } + + const Multiplicity_vector & multiplicities() const + { + return _rat_pair.multiplicities(); + } + +private: + const Rational_function_canonicalized_pair& _rat_pair; + bool _is_opposite; +}; // Rational_function_pair + + +} //namespace Arr_rational_arc +} //namespace CGAL { + +#endif //CGAL_RATIONAL_FUNCTION_ORDERED_PAIR_H diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Singleton.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Singleton.h new file mode 100644 index 00000000000..ee300dabbbf --- /dev/null +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Singleton.h @@ -0,0 +1,55 @@ +// Copyright (c) 2011 Tel-Aviv University (Israel), INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Oren Salzman +// Michael Hemmer + + + +#ifndef SINGLETON_H_ +#define SINGLETON_H_ + +namespace CGAL { +namespace Arr_rational_arc { +template +class Singleton +{ +public: + static T* instance() + { + if(!m_pInstance) + m_pInstance = new T; + assert(m_pInstance !=NULL); + return m_pInstance; + } + + static void DestroyInstance() + { + delete m_pInstance; + m_pInstance = NULL; + }; +private: + Singleton(); // ctor hidden + ~Singleton(); // dtor hidden +private: + static T* m_pInstance; +}; + +template T* Singleton::m_pInstance=NULL; + +} // namespace Arr_rational_arc +} //namespace CGAL { +#endif // SINGLETON_H_ 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 ea618292c84..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -20,6 +20,10 @@ #ifndef CGAL_ARR_RATIONAL_ARC_TRAITS_2_H #define CGAL_ARR_RATIONAL_ARC_TRAITS_2_H +#define CGAL_DEPRECATED_HEADER "" +#define CGAL_REPLACEMENT_HEADER "" +#include + /*! \file * Definition of the Arr_rational_arc_traits_2 class. */ @@ -58,10 +62,10 @@ public: typedef Tag_true Has_merge_category; typedef Tag_false Has_do_intersect_category; - typedef Arr_open_side_tag Arr_left_side_category; - typedef Arr_open_side_tag Arr_bottom_side_category; - typedef Arr_open_side_tag Arr_top_side_category; - typedef Arr_open_side_tag Arr_right_side_category; + typedef Arr_open_side_tag Left_side_category; + typedef Arr_open_side_tag Bottom_side_category; + typedef Arr_open_side_tag Top_side_category; + typedef Arr_open_side_tag Right_side_category; // Traits objects: typedef _Rational_arc_2 Curve_2; @@ -501,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); } //@} @@ -616,16 +634,17 @@ public: Parameter_space_in_y_2 parameter_space_in_y_2_object() const { return Parameter_space_in_y_2(); } - /*! A function object that compares the x-coordinates of arc ends near the + + /*! A function object that compares the x-limits of arc ends on the * boundary of the parameter space */ - class Compare_x_near_boundary_2 { + class Compare_x_at_limit_2 { public: - /*! Compare the x-coordinate of a point with the x-coordinate of - * a line end near the boundary at y = +/- oo. - * \param p the point direction. - * \param xcv the line, the endpoint of which is compared. - * \param ce the line-end indicator - + /*! Compare the x-coordinate of a point and the x-coordinate of the limit + * of a rational arc at its specificed end at y = +/- oo. + * \param p the point. + * \param xcv the parametric curve, the endpoint of which is compared. + * \param ce identifies an open end of xcv - * ARR_MIN_END - the minimal end of xc or * ARR_MAX_END - the maximal end of xc. * \return the comparison result: @@ -633,44 +652,82 @@ public: * EQUAL - x(p) = x(xc, ce); * LARGER - x(p) > x(xc, ce). * \pre p lies in the interior of the parameter space. - * \pre the ce end of the line xcv lies on a boundary. + * \pre the ce end of the curve xcv lies on a boundary, implying that xcv + * is either a vertical line or a curve with a vertical asymptote. */ Comparison_result operator()(const Point_2 & p, const X_monotone_curve_2 & xcv, Arr_curve_end ce) const { + // TODO implement (simplify) return (xcv.compare_end (p, ce)); } - /*! Compare the x-coordinates of 2 arcs ends near the boundary of the - * parameter space at y = +/- oo. + /*! Compare the x-coordinates of the limits of 2 parameteric curves at + * their specificed ends at y = +/- oo. * \param xcv1 the first arc. - * \param ce1 the first arc end indicator - + * \param ce1 identifies an open end of ce1 - * ARR_MIN_END - the minimal end of xcv1 or * ARR_MAX_END - the maximal end of xcv1. * \param xcv2 the second arc. - * \param ce2 the second arc end indicator - + * \param ce2 identifies an open end of ce2 - * ARR_MIN_END - the minimal end of xcv2 or * ARR_MAX_END - the maximal end of xcv2. * \return the second comparison result: * SMALLER - x(xcv1, ce1) < x(xcv2, ce2); * EQUAL - x(xcv1, ce1) = x(xcv2, ce2); * LARGER - x(xcv1, ce1) > x(xcv2, ce2). - * \pre the ce1 end of the line xcv1 lies on a boundary. - * \pre the ce2 end of the line xcv2 lies on a boundary. + * \pre the ce1 end of the line xcv1 lies on a boundary, implying that xcv1 + * is either a vertical line or a curve with a vertical asymptote. + * \pre the ce2 end of the line xcv2 lies on a boundary, implying that xcv2 + * is either a vertical line or a curve with a vertical asymptote. */ Comparison_result operator()(const X_monotone_curve_2 & xcv1, Arr_curve_end ce1, const X_monotone_curve_2 & xcv2, Arr_curve_end ce2) const { + // TODO implement (simplify) return xcv1.compare_ends (ce1, xcv2, ce2); } }; - /*! Obtain a Compare_x_near_boundary_2 function object */ - Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const - { return Compare_x_near_boundary_2(); } + /*! Obtain a Compare_x_at_limit_2 function object */ + Compare_x_at_limit_2 compare_x_at_limit_2_object() const + { return Compare_x_at_limit_2(); } + + /*! A function object that compares the x-coordinates of arc ends near the + * boundary of the parameter space + */ + class Compare_x_near_limit_2 { + public: + + /*! Compare the x-coordinates of 2 arcs ends near the boundary of the + * parameter space at y = +/- oo. + * \param xcv1 the first arc. + * \param xcv2 the second arc. + * \param ce the curve end indicator - + * ARR_MIN_END - the minimal end of curves or + * ARR_MAX_END - the maximal end of curves. + * \return the second comparison result: + * SMALLER - x(xcv1, ce) < x(xcv2, ce); + * EQUAL - x(xcv1, ce) = x(xcv2, ce); + * LARGER - x(xcv1, ce) > x(xcv2, ce). + * \pre the ce end of the line xcv1 lies on a boundary. + * \pre the ce end of the line xcv2 lies on a boundary. + */ + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + // TODO implement (simplify) + return xcv1.compare_ends (ce, xcv2, ce); + } + }; + + /*! Obtain a Compare_x_near_limit_2 function object */ + Compare_x_near_limit_2 compare_x_near_limit_2_object() const + { return Compare_x_near_limit_2(); } /*! A function object that compares the y-coordinates of arc ends near the 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 new file mode 100644 index 00000000000..074ee5e9b82 --- /dev/null +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h @@ -0,0 +1,1312 @@ +// Copyright (c) 2011 Tel-Aviv University (Israel), INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Oren Salzman +// Michael Hemmer + +#ifndef CGAL_ARR_RATIONAL_ARC_TRAITS_D_1_H +#define CGAL_ARR_RATIONAL_ARC_TRAITS_D_1_H + +#include +#include +#include +#include +#include +#include +#include + + + +namespace CGAL { + +/*! \class + * A traits class for maintaining an arrangement of bounded arcs (segments) of + * rational functions of arbitrary degree. + * + * The class is templated with two parameters: + * Alg_kernel A geometric kernel, where Alg_kernel::FT is the number type + * for the coordinates of arrangement vertices, which are algebraic + * numbers (defined by Nt_traits::Algebraic). + * Nt_traits A traits class for performing various operations on the integer, + * rational and algebraic types. + */ + +template +class Arr_rational_function_traits_2 +{ +public: + typedef AlgebraicKernel_d_1 Algebraic_kernel_d_1; + + typedef Arr_rational_function_traits_2 + Self; + typedef Arr_rational_arc::Base_rational_arc_ds_1 + Base_rational_arc_ds_1; + + // Traits objects: + typedef Arr_rational_arc::Base_rational_arc_d_1 + Base_curve_2; + typedef Arr_rational_arc::Continuous_rational_arc_d_1 + X_monotone_curve_2; + typedef Arr_rational_arc::Rational_arc_d_1 + Curve_2; + typedef Arr_rational_arc::Algebraic_point_2 + Point_2; + + typedef typename Base_rational_arc_ds_1::Algebraic_real_1 Algebraic_real_1; + typedef typename Base_rational_arc_ds_1::Multiplicity Multiplicity; + typedef typename Base_curve_2::Rat_vector Rat_vector; + + typedef typename Base_rational_arc_ds_1::Integer Integer; + typedef typename Base_rational_arc_ds_1::Rational Rational; + typedef typename Base_rational_arc_ds_1::Polynomial_1 Polynomial_1; + typedef typename Base_rational_arc_ds_1::Coefficient Coefficient; + + typedef typename Base_rational_arc_ds_1::FT_rat_1 FT_rat_1; + typedef typename Base_rational_arc_ds_1::Polynomial_traits_1 + Polynomial_traits_1; + + typedef typename Algebraic_kernel_d_1::Bound Bound; + typedef Bound + Approximate_number_type; + + typedef CGAL::Arr_rational_arc::Rational_function + Rational_function; + typedef CGAL::Arr_rational_arc::Cache Cache; + + //Category tags: + typedef Tag_true Has_left_category; + typedef Tag_true Has_merge_category; + typedef Tag_true Has_do_intersect_category; + + typedef Tag_true Has_vertical_segment_category; + + typedef Arr_open_side_tag Left_side_category; + typedef Arr_open_side_tag Bottom_side_category; + typedef Arr_open_side_tag Top_side_category; + typedef Arr_open_side_tag Right_side_category; + +private: + mutable Cache _cache; + mutable Algebraic_kernel_d_1* _ak_ptr; + bool delete_ak; + +public: + Algebraic_kernel_d_1* algebraic_kernel_d_1() const {return _ak_ptr;} + + bool delete_ak_internal_flag() const + { + return delete_ak; + } + // Algebraic_kernel_d_1& algebraic_kernel_d_1() {return _ak;} + +public: + const Cache& cache() const {return _cache;} + +public: + //------------ + //Constructors + //------------ + + //--------------------- + // Default constructor. + Arr_rational_function_traits_2() : delete_ak(true) + { + _ak_ptr = new Algebraic_kernel_d_1; + _cache.initialize(_ak_ptr); + } + + Arr_rational_function_traits_2(Algebraic_kernel_d_1* ak_ptr) : + _ak_ptr(ak_ptr),delete_ak(false) + { + _cache.initialize(_ak_ptr); + } + + Arr_rational_function_traits_2(const Self& other) + :delete_ak(other.delete_ak_internal_flag()) + { + //copy kernel + if (delete_ak) + _ak_ptr = new Algebraic_kernel_d_1(*other.algebraic_kernel_d_1()); + else + _ak_ptr = other.algebraic_kernel_d_1(); + + //copy cache + _cache.initialize(other.cache(), _ak_ptr); + } + + ~Arr_rational_function_traits_2() + { + if (delete_ak) + delete (_ak_ptr); + } + + /*! A functor that constructs an x_monotone curve */ + class Construct_x_monotone_curve_2 + { + protected: + typedef Arr_rational_function_traits_2 Traits; + typedef CGAL::Arr_rational_arc::Cache Cache; + + /*! The traits */ + const Traits* _traits; + + /*! Constructor + * \param traits the traits + */ + Construct_x_monotone_curve_2(const Traits* traits) : _traits(traits) {} + + friend class Arr_rational_function_traits_2; + + public: + typedef typename Base_rational_arc_ds_1::Polynomial_1 Polynomial_1; + typedef typename Base_rational_arc_ds_1::Algebraic_real_1 + Algebraic_real_1; + typedef Arr_rational_arc::Continuous_rational_arc_d_1 + X_monotone_curve_2; + typedef Polynomial_1 argument_type; + typedef Polynomial_1 first_argument_type; + typedef Polynomial_1 second_argument_type; + typedef X_monotone_curve_2 result_type; + + X_monotone_curve_2 operator()( const Polynomial_1& P) const + { + return X_monotone_curve_2(P, _traits->cache()); + } + + template + X_monotone_curve_2 operator()( InputIterator begin, InputIterator end) const + { + Rat_vector rat_vec(begin,end); + return X_monotone_curve_2(rat_vec, _traits->cache()); + } + + X_monotone_curve_2 operator()(const Polynomial_1& P, + const Algebraic_real_1& x_s, + bool dir_right) const + { + return X_monotone_curve_2(P, x_s, dir_right, _traits->cache()); + } + + template + X_monotone_curve_2 operator()(InputIterator begin, InputIterator end, + const Algebraic_real_1& x_s, + bool dir_right) const + { + Rat_vector rat_vec(begin,end); + return X_monotone_curve_2(rat_vec, x_s, dir_right, _traits->cache()); + } + + X_monotone_curve_2 operator()(const Polynomial_1& P, + const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t) const + { + return X_monotone_curve_2(P, x_s, x_t, _traits->cache()); + } + + template + X_monotone_curve_2 operator()(InputIterator begin, InputIterator end, + const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t) const + { + Rat_vector rat_vec(begin,end); + return X_monotone_curve_2(rat_vec, x_s, x_t, _traits->cache()); + } + + X_monotone_curve_2 operator()(const Polynomial_1& P, + const Polynomial_1& Q) const + { + return X_monotone_curve_2(P, Q, _traits->cache()); + } + + template + X_monotone_curve_2 operator()(InputIterator begin_numer, + InputIterator end_numer, + InputIterator begin_denom, + InputIterator end_denom) const + { + Rat_vector rat_vec_numer(begin_numer,end_numer); + Rat_vector rat_vec_denom(begin_denom,end_denom); + return X_monotone_curve_2(rat_vec_numer, rat_vec_denom, _traits->cache()); + } + + X_monotone_curve_2 operator()(const Polynomial_1& P, const Polynomial_1& Q, + const Algebraic_real_1& x_s, + bool dir_right) const + { + return X_monotone_curve_2(P, Q, x_s, dir_right, _traits->cache()); + } + + template + X_monotone_curve_2 operator()(InputIterator begin_numer, + InputIterator end_numer, + InputIterator begin_denom, + InputIterator end_denom, + const Algebraic_real_1& x_s, + bool dir_right) const + { + Rat_vector rat_vec_numer(begin_numer,end_numer); + Rat_vector rat_vec_denom(begin_denom,end_denom); + return X_monotone_curve_2(rat_vec_numer, rat_vec_denom, x_s,dir_right, + _traits->cache()); + } + + X_monotone_curve_2 operator()(const Polynomial_1& P, + const Polynomial_1& Q, + const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t) const + { + return X_monotone_curve_2(P, Q, x_s, x_t, _traits->cache()); + } + + template + X_monotone_curve_2 operator()(InputIterator begin_numer, + InputIterator end_numer, + InputIterator begin_denom, + InputIterator end_denom, + const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t) const + { + Rat_vector rat_vec_numer(begin_numer, end_numer); + Rat_vector rat_vec_denom(begin_denom, end_denom); + return X_monotone_curve_2(rat_vec_numer, rat_vec_denom, x_s, x_t, + _traits->cache()); + } + }; + + Construct_x_monotone_curve_2 construct_x_monotone_curve_2_object() const + { + return Construct_x_monotone_curve_2(this); + } + + /*! A functor that constructs an arbitrary curve */ + class Construct_curve_2 + { + protected: + typedef Arr_rational_function_traits_2 Traits; + typedef CGAL::Arr_rational_arc::Cache Cache; + + /*! The traits */ + const Traits* _traits; + + /*! Constructor + * \param traits the traits + */ + Construct_curve_2(const Traits* traits) : _traits(traits) {} + + friend class Arr_rational_function_traits_2; + + public: + typedef typename Base_rational_arc_ds_1::Polynomial_1 Polynomial_1; + typedef typename Base_rational_arc_ds_1::Algebraic_real_1 + Algebraic_real_1; + typedef Arr_rational_arc::Rational_arc_d_1 + Curve_2; + typedef Polynomial_1 argument_type; + typedef Polynomial_1 first_argument_type; + typedef Polynomial_1 second_argument_type; + typedef Curve_2 result_type; + + Curve_2 operator()(const Polynomial_1& P) const + { + return Curve_2(P, _traits->cache()); + } + + template + Curve_2 operator()(InputIterator begin, InputIterator end) const + { + Rat_vector rat_vec(begin, end); + return Curve_2(rat_vec, _traits->cache()); + } + + Curve_2 operator()(const Polynomial_1& P, + const Algebraic_real_1& x_s, bool dir_right) const + { + return Curve_2(P, x_s, dir_right, _traits->cache()); + } + + template + Curve_2 operator()(InputIterator begin, InputIterator end, + const Algebraic_real_1& x_s, bool dir_right) const + { + Rat_vector rat_vec(begin, end); + return Curve_2(rat_vec, x_s, dir_right, _traits->cache()); + } + + Curve_2 operator()(const Polynomial_1& P, + const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t) const + { + return Curve_2(P, x_s, x_t, _traits->cache()); + } + + template + Curve_2 operator()(InputIterator begin, InputIterator end, + const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t) const + { + Rat_vector rat_vec(begin,end); + return Curve_2(rat_vec, x_s, x_t, _traits->cache()); + } + + Curve_2 operator()(const Polynomial_1& P, const Polynomial_1& Q) const + { + return Curve_2(P, Q, _traits->cache()); + } + + template + Curve_2 operator()(InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom) const + { + Rat_vector rat_vec_numer(begin_numer, end_numer); + Rat_vector rat_vec_denom(begin_denom, end_denom); + return Curve_2(rat_vec_numer, rat_vec_denom, _traits->cache()); + } + + Curve_2 operator()(const Polynomial_1& P, const Polynomial_1& Q, + const Algebraic_real_1& x_s, bool dir_right) const + { + return Curve_2(P, Q, x_s, dir_right, _traits->cache()); + } + + template + Curve_2 operator()(InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom, + const Algebraic_real_1& x_s, bool dir_right) const + { + Rat_vector rat_vec_numer(begin_numer,end_numer); + Rat_vector rat_vec_denom(begin_denom,end_denom); + return Curve_2(rat_vec_numer, rat_vec_denom, x_s, dir_right, + _traits->cache()); + } + + Curve_2 operator()(const Polynomial_1& P, const Polynomial_1& Q, + const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t) const + { + return Curve_2(P, Q, x_s, x_t, _traits->cache()); + } + + template + Curve_2 operator()(InputIterator begin_numer, InputIterator end_numer, + InputIterator begin_denom, InputIterator end_denom, + const Algebraic_real_1& x_s, + const Algebraic_real_1& x_t) const + { + Rat_vector rat_vec_numer(begin_numer,end_numer); + Rat_vector rat_vec_denom(begin_denom,end_denom); + return Curve_2(rat_vec_numer, rat_vec_denom, x_s, x_t, _traits->cache()); + } + }; + + Construct_curve_2 construct_curve_2_object() const + { + return Construct_curve_2(this); + } + + /*! Construct a point */ + class Construct_point_2 + { + protected: + typedef Arr_rational_function_traits_2 Traits; + typedef CGAL::Arr_rational_arc::Cache Cache; + + /*! The traits */ + const Traits* _traits; + + /*! Constructor + * \param traits the traits + */ + Construct_point_2(const Traits* traits) : _traits(traits) {} + + friend class Arr_rational_function_traits_2; + + public: + Point_2 operator()(const Rational_function& rational_function, + const Algebraic_real_1& x_coordinate) + { + return Point_2(rational_function, x_coordinate); + } + + Point_2 operator()(const Rational& x, const Rational& y) + { + Integer y_numer,y_denom; + typename FT_rat_1::Decompose()(y,y_numer,y_denom); + + return Point_2(_traits->cache().get_rational_function(Rational(y_numer, + y_denom)), + _traits->algebraic_kernel_d_1()-> + construct_algebraic_real_1_object()(x)); + } + Point_2 operator()(const Algebraic_real_1& x, const Rational& y) + { + Integer y_numer; + Integer y_denom; + typename FT_rat_1::Decompose()(y, y_numer, y_denom); + return Point_2(_traits->cache().get_rational_function(Rational(y_numer, + y_denom)), + x); + } + }; //Construct_point + + Construct_point_2 construct_point_2_object() const + { + return Construct_point_2(this); + } + +// class Construct_vertical_segment +// { +// private: +// Cache& _cache; + +// public: +// Construct_vertical_segment(Cache& cache) : _cache(cache) {} + +// Vertical_segment operator()(const Point_2& p) const +// { +// return Vertical_segment(p); +// } + +// Vertical_segment operator()(const Point_2& p, bool is_directed_up) const +// { +// return Vertical_segment(p, is_directed_up); +// } + +// Vertical_segment operator()(const Point_2& p1,const Point_2& p2) const +// { +// return Vertical_segment(p1, p2, _cache); +// } +// }; //Construct_vertical_segment + +// Construct_vertical_segment construct_vertical_segment_object() const +// { +// return Construct_vertical_segment(_cache); +// } + + //------------------------ + //Functor definitions. + //------------------------ + + //--------------------------------------------------------------- + //A functor that compares the x-coordinates of two points + class Compare_x_2 + { + public: + /*! + * Compare the x-coordinates of two points. + * \param p1 The first point. + * \param p2 The second point. + * \return LARGER if x(p1) > x(p2); + * SMALLER if x(p1) < x(p2); + * EQUAL if x(p1) = x(p2). + */ + Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + { + Comparison_result comp = CGAL::compare(p1.x(), p2.x()); + return (comp); + } + }; + + /*! Obtain a Compare_x_2 functor object. */ + Compare_x_2 compare_x_2_object() const + { + return Compare_x_2(); + } + + /*! A functor that compares two points lexigoraphically: by x, then by y. */ + class Compare_xy_2 + { + protected: + typedef Arr_rational_function_traits_2 Traits; + typedef CGAL::Arr_rational_arc::Cache Cache; + + /*! The traits */ + const Traits* _traits; + + /*! Constructor + * \param traits the traits + */ + Compare_xy_2(const Traits* traits) : _traits(traits) {} + + friend class Arr_rational_function_traits_2; + + public: + /*! + * Compares two points lexigoraphically: by x, then by y. + * \param p1 The first point. + * \param p2 The second point. + * \return LARGER if x(p1) > x(p2), or if x(p1) = x(p2) and y(p1) > y(p2); + * SMALLER if x(p1) < x(p2), or if x(p1) = x(p2) and y(p1) < y(p2); + * EQUAL if the two points are equal. + */ + Comparison_result operator()(const Point_2& p1, const Point_2& p2) const + { + return p1.compare_xy_2(p2, _traits->cache()); + } + }; + + /*! Obtain a Compare_xy_2 functor object. */ + Compare_xy_2 compare_xy_2_object() const + { + return Compare_xy_2(this); + } + + /*! A functor that obtains the left endpoint of a curve. */ + class Construct_min_vertex_2 + { + public: + /*! + * Get the left endpoint of the x-monotone curve (segment). + * \param cv The curve. + * \return The left endpoint. + */ + const Point_2& operator()(const X_monotone_curve_2 & cv) const + { + return (cv.left()); + } + }; + + /*! Obtain a Construct_min_vertex_2 functor object. */ + Construct_min_vertex_2 construct_min_vertex_2_object() const + { + return Construct_min_vertex_2(); + } + + /*! A functor that obtains the right endpoint of a curve. */ + class Construct_max_vertex_2 + { + public: + /*! + * Get the right endpoint of the x-monotone curve (segment). + * \param cv The curve. + * \return The right endpoint. + */ + const Point_2& operator() (const X_monotone_curve_2& cv) const + { + return (cv.right()); + } + }; + + /*! Obtain a Construct_max_vertex_2 functor object. */ + Construct_max_vertex_2 construct_max_vertex_2_object() const + { + return Construct_max_vertex_2(); + } + + /*! A functor that checks whether a given curve is vertical. */ + class Is_vertical_2 + { + public: + /*! + * Check whether the given x-monotone curve is a vertical segment. + * \param cv The curve. + * \return (true) if the curve is a vertical segment; (false) otherwise. + */ + bool operator()(const X_monotone_curve_2&) const + { + // A rational function can never be vertical. + return false; + } + }; + + /*! Obtain an Is_vertical_2 functor object. */ + Is_vertical_2 is_vertical_2_object() const + { + return Is_vertical_2(); + } + + /*! A functor that compares the y-coordinates of a point and a curve at + * the point x-coordinate. + */ + class Compare_y_at_x_2 + { + private: + Cache& _cache; + public: + Compare_y_at_x_2(Cache& cache) : _cache(cache) {} + /*! + * Return the location of the given point with respect to the input curve. + * \param cv The curve. + * \param p The point. + * \pre p is in the x-range of cv. + * \return SMALLER if y(p) < cv(x(p)), i.e. the point is below the curve; + * LARGER if y(p) > cv(x(p)), i.e. the point is above the curve; + * EQUAL if p lies on the curve. + */ + Comparison_result operator()(const Point_2& p, + const X_monotone_curve_2& cv) const + { + return (cv.point_position(p,_cache)); + } + }; + + /*! Obtain a Compare_y_at_x_2 functor object. */ + Compare_y_at_x_2 compare_y_at_x_2_object () const + { + return Compare_y_at_x_2(_cache); + } + + /*! A functor that compares compares the y-coordinates of two curves + * immediately to the left of their intersection point. + */ + class Compare_y_at_x_left_2 + { + private: + Cache& _cache; + + public: + Compare_y_at_x_left_2(Cache& cache) :_cache(cache) {} + /*! + * Compares the y value of two x-monotone curves immediately to the left + * of their intersection point. + * \param cv1 The first curve. + * \param cv2 The second curve. + * \param p The intersection point. + * \pre The point p lies on both curves, and both of them must be also be + * defined (lexicographically) to its left. + * \return The relative position of cv1 with respect to cv2 immdiately to + * the left of p: SMALLER, LARGER or EQUAL. + */ + Comparison_result operator() (const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2, + const Point_2& p) const + { + // Make sure that p lies on both curves, and that both are defined to its + // left (so their left endpoint is lexicographically smaller than p). + CGAL_precondition(cv1.point_position(p,_cache) == EQUAL && + cv2.point_position(p,_cache) == EQUAL); + + CGAL_precondition((cv1.left_parameter_space_in_x() != ARR_INTERIOR || + cv1.left_parameter_space_in_y() != ARR_INTERIOR || + (p.x() > cv1.left().x())) && + (cv2.left_parameter_space_in_x() != ARR_INTERIOR || + cv2.left_parameter_space_in_y() != ARR_INTERIOR || + (p.x() > cv2.left().x()))); + + // Compare the two arcs. + return cv1.compare_at_intersection (cv2,p,true,_cache);} + }; + + /*! Obtain a Compare_y_at_x_left_2 functor object. */ + Compare_y_at_x_left_2 compare_y_at_x_left_2_object() const + { + return Compare_y_at_x_left_2(_cache); + } + + /*! A functor that compares compares the y-coordinates of two curves + * immediately to the right of their intersection point. + */ + class Compare_y_at_x_right_2 + { + private: + Cache& _cache; + + public: + Compare_y_at_x_right_2(Cache& cache) :_cache(cache) {} + /*! + * Compares the y value of two x-monotone curves immediately to the right + * of their intersection point. + * \param cv1 The first curve. + * \param cv2 The second curve. + * \param p The intersection point. + * \pre The point p lies on both curves, and both of them must be also be + * defined (lexicographically) to its right. + * \return The relative position of cv1 with respect to cv2 immdiately to + * the right of p: SMALLER, LARGER or EQUAL. + */ + Comparison_result operator() (const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2, + const Point_2& p) const + { + // Make sure that p lies on both curves, and that both are defined to its + // left (so their left endpoint is lexicographically smaller than p). + CGAL_precondition(cv1.point_position (p,_cache) == EQUAL && + cv2.point_position (p,_cache) == EQUAL); + + + CGAL_precondition((cv1.right_parameter_space_in_x() != ARR_INTERIOR || + cv1.right_parameter_space_in_y() != ARR_INTERIOR || + (p.x() < cv1.right().x())) && + (cv2.right_parameter_space_in_x() != ARR_INTERIOR || + cv2.right_parameter_space_in_y() != ARR_INTERIOR || + (p.x() < cv2.right().x()))); + + + // Compare the two arcs. + return cv1.compare_at_intersection (cv2,p,false,_cache); + } + }; + + /*! Obtain a Compare_y_at_x_right_2 functor object. */ + Compare_y_at_x_right_2 compare_y_at_x_right_2_object () const + { + return Compare_y_at_x_right_2(_cache); + } + + /*! A functor that checks whether two points and two curves are identical. */ + class Equal_2 + { + protected: + typedef Arr_rational_function_traits_2 Traits; + typedef CGAL::Arr_rational_arc::Cache Cache; + /*! The traits */ + const Traits* _traits; + + /*! Constructor + * \param traits the traits + */ + Equal_2(const Traits* traits) : _traits(traits) {} + + friend class Arr_rational_function_traits_2; + + public: + /*! + * Check if the two x-monotone curves are the same (have the same graph). + * \param cv1 The first curve. + * \param cv2 The second curve. + * \return (true) if the two curves are the same; (false) otherwise. + */ + bool operator() (const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2) const + { + if (&cv1 == &cv2) + return true; + + return (cv1.equals(cv2)); + } + + /*! + * Check if the two points are the same. + * \param p1 The first point. + * \param p2 The second point. + * \return (true) if the two point are the same; (false) otherwise. + */ + bool operator()(const Point_2& p1, const Point_2& p2) const + { + if (&p1 == &p2) + return true; + + return + (p1.compare_xy_2(p2, _traits->cache()) == CGAL::EQUAL) ? + true : false; + } + }; + + /*! Obtain an Equal_2 functor object. */ + Equal_2 equal_2_object() const + { + return Equal_2(this); + } + + /*! A functor that divides a curve into continues (x-monotone) curves. */ + class Make_x_monotone_2 + { + public: + + /*! + * Cut the given conic curve (or conic arc) into x-monotone subcurves + * and insert them to the given output iterator. + * \param cv The curve. + * \param oi The output iterator, whose value-type is Object. The returned + * objects is a wrapper for an X_monotone_curve_2 object. + * \return The past-the-end iterator. + */ + template + OutputIterator operator()(const Curve_2& cv, OutputIterator oi) const + { + // Make the rational arc continuous. + std::list arcs; + + cv.make_continuous(std::back_inserter(arcs)); + + // Create objects. + typename std::list::const_iterator iter; + + for (iter = arcs.begin(); iter != arcs.end(); ++iter) + { + *oi = make_object (*iter); + ++oi; + } + + return (oi); + } + }; + + /*! Obtain a Make_x_monotone_2 functor object. */ + Make_x_monotone_2 make_x_monotone_2_object() const + { + return Make_x_monotone_2(); + } + + /*! A functor that splits a curve at a point. */ + class Split_2 + { + private: + Cache& _cache; + + public: + Split_2(Cache& cache) : _cache(cache) {} + /*! + * Split a given x-monotone curve at a given point into two sub-curves. + * \param cv The curve to split + * \param p The split point. + * \param c1 Output: The left resulting subcurve (p is its right endpoint). + * \param c2 Output: The right resulting subcurve (p is its left endpoint). + * \pre p lies on cv but is not one of its end-points. + */ + void operator()(const X_monotone_curve_2& cv, const Point_2 & p, + X_monotone_curve_2& c1, X_monotone_curve_2& c2) const + { + cv.split(p, c1, c2, _cache); + } + }; + + /*! Obtain a Split_2 functor object. */ + Split_2 split_2_object() const + { + return Split_2(_cache); + } + + /*! A functor that computes intersections between two curves. */ + class Intersect_2 + { + private: + Cache& _cache; + public: + Intersect_2(Cache& cache) : _cache(cache) {} + /*! + * Find the intersections of the two given curves and insert them to the + * given output iterator. As two segments may itersect only once, only a + * single will be contained in the iterator. + * \param cv1 The first curve. + * \param cv2 The second curve. + * \param oi The output iterator. + * \return The past-the-end iterator. + */ + template + OutputIterator operator()(const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2, + OutputIterator oi) const + { + return (cv1.intersect (cv2, oi,_cache)); + } + }; + + /*! Obtain an Intersect_2 functor object. */ + Intersect_2 intersect_2_object() const + { + return Intersect_2(_cache); + } + + /*! A functor that tests whether two curves can be merged. */ + class Are_mergeable_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. + */ + bool operator()(const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2) const + { + return (cv1.can_merge_with(cv2)); + } + }; + + /*! Obtain an Are_mergeable_2 functor object. */ + Are_mergeable_2 are_mergeable_2_object() const + { + return Are_mergeable_2(); + } + + /*! \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. + */ + 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); + } + }; + + /*! Obtain a Merge_2 functor object. */ + Merge_2 merge_2_object() const + { + return Merge_2(this); + } + + //@} + + /// \name Functor definitions to handle boundaries + //@{ + + /*! A function object that obtains the parameter space of a geometric + * entity along the x-axis + */ + class Parameter_space_in_x_2 { + public: + /*! Obtains the parameter space at the end of a line along the x-axis. + * \param xcv the line + * \param ce the line end indicator: + * ARR_MIN_END - the minimal end of xc or + * ARR_MAX_END - the maximal end of xc + * \return the parameter space at the ce end of the line xcv. + * ARR_LEFT_BOUNDARY - the line approaches the identification arc from + * the right at the line left end. + * ARR_INTERIOR - the line does not approache the identification arc. + * ARR_RIGHT_BOUNDARY - the line approaches the identification arc from + * the left at the line right end. + */ + Arr_parameter_space operator()(const X_monotone_curve_2 & xcv, + Arr_curve_end ce) const + { + return (ce == ARR_MIN_END) ? + xcv.left_parameter_space_in_x() : xcv.right_parameter_space_in_x(); + } + + /*! Obtains the parameter space at a point along the x-axis. + * \param p the point. + * \return the parameter space at p. + */ + Arr_parameter_space operator()(const Point_2 ) const + { + return ARR_INTERIOR; + } + }; + + /*! Obtain a Parameter_space_in_x_2 function object */ + Parameter_space_in_x_2 parameter_space_in_x_2_object() const + { return Parameter_space_in_x_2(); } + + /*! A function object that obtains the parameter space of a geometric + * entity along the y-axis + */ + class Parameter_space_in_y_2 { + public: + /*! Obtains the parameter space at the end of a line along the y-axis . + * Note that if the line end coincides with a pole, then unless the line + * coincides with the identification arc, the line end is considered to + * be approaching the boundary, but not on the boundary. + * If the line coincides with the identification arc, it is assumed to + * be smaller than any other object. + * \param xcv the line + * \param ce the line end indicator: + * ARR_MIN_END - the minimal end of xc or + * ARR_MAX_END - the maximal end of xc + * \return the parameter space at the ce end of the line xcv. + * ARR_BOTTOM_BOUNDARY - the line approaches the south pole at the line + * left end. + * ARR_INTERIOR - the line does not approache a contraction point. + * ARR_TOP_BOUNDARY - the line approaches the north pole at the line + * right end. + */ + Arr_parameter_space operator()(const X_monotone_curve_2 & xcv, + Arr_curve_end ce) const + { + return (ce == ARR_MIN_END) ? + xcv.left_parameter_space_in_y() : xcv.right_parameter_space_in_y(); + } + + /*! Obtains the parameter space at a point along the y-axis. + * \param p the point. + * \return the parameter space at p. + */ + Arr_parameter_space operator()(const Point_2 ) const + { + return ARR_INTERIOR; + } + }; + + /*! Obtain a Parameter_space_in_y_2 function object */ + Parameter_space_in_y_2 parameter_space_in_y_2_object() const + { return Parameter_space_in_y_2(); } + + /*! A function object that compares the x-coordinates of arc ends near the + * boundary of the parameter space + */ + class Compare_x_near_boundary_2 { + public: + /*! Compare the x-coordinate of a point with the x-coordinate of + * a line end near the boundary at y = +/- oo. + * \param p the point direction. + * \param xcv the line, the endpoint of which is compared. + * \param ce the line-end indicator - + * ARR_MIN_END - the minimal end of xc or + * ARR_MAX_END - the maximal end of xc. + * \return the comparison result: + * SMALLER - x(p) < x(xc, ce); + * EQUAL - x(p) = x(xc, ce); + * LARGER - x(p) > x(xc, ce). + * \pre p lies in the interior of the parameter space. + * \pre the ce end of the line xcv lies on a boundary. + */ + Comparison_result operator()(const Point_2 & p, + const X_monotone_curve_2 & xcv, + Arr_curve_end ce) const + { + Comparison_result r = xcv.compare_end(ce, p); + if (r == EQUAL) + return EQUAL; + return (r == NEGATIVE) ? POSITIVE : NEGATIVE ; + } + + /*! Compare the x-coordinates of 2 arcs ends near the boundary of the + * parameter space at y = +/- oo. + * \param xcv1 the first arc. + * \param ce1 the first arc end indicator - + * ARR_MIN_END - the minimal end of xcv1 or + * ARR_MAX_END - the maximal end of xcv1. + * \param xcv2 the second arc. + * \param ce2 the second arc end indicator - + * ARR_MIN_END - the minimal end of xcv2 or + * ARR_MAX_END - the maximal end of xcv2. + * \return the second comparison result: + * SMALLER - x(xcv1, ce1) < x(xcv2, ce2); + * EQUAL - x(xcv1, ce1) = x(xcv2, ce2); + * LARGER - x(xcv1, ce1) > x(xcv2, ce2). + * \pre the ce1 end of the line xcv1 lies on a boundary. + * \pre the ce2 end of the line xcv2 lies on a boundary. + */ + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce2) const + { + return xcv1.compare_ends(ce1, xcv2, ce2); + } + }; + + /*! Obtain a Compare_x_near_boundary_2 function object */ + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const + { return Compare_x_near_boundary_2(); } + + + /*! A function object that compares the y-coordinates of arc ends near the + * boundary of the parameter space. + */ + class Compare_y_near_boundary_2 + { + private: + Cache& _cache; + + public: + /*! Compare the y-coordinates of 2 lines at their ends near the boundary + * of the parameter space at x = +/- oo. + * \param xcv1 the first arc. + * \param xcv2 the second arc. + * \param ce the line end indicator. + * \return the second comparison result. + * \pre the ce ends of the lines xcv1 and xcv2 lie either on the left + * boundary or on the right boundary of the parameter space. + */ + Compare_y_near_boundary_2(Cache& cache) : _cache(cache) {} + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + return (ce == ARR_MIN_END) ? + xcv1.compare_at_minus_infinity(xcv2,_cache) : + xcv1.compare_at_plus_infinity(xcv2,_cache); + } + }; + + /*! Obtain a Compare_y_near_boundary_2 function object */ + Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const + { return Compare_y_near_boundary_2(_cache); } + + + /*! A function object that compares at limit + */ + //new functor + class Compare_x_at_limit_2 + { + public: + /*! Compares the x coordinate of p with the curve end + * of xcv that is defined by ce at its limit. + * Returns SMALLER, EQUAL, or LARGER accordingly. + */ + Comparison_result operator()(const Point_2& p, + const X_monotone_curve_2& xcv, + Arr_curve_end ce) + { + CGAL_precondition(Parameter_space_in_x_2()(xcv,ce) == ARR_INTERIOR); + CGAL_precondition(Parameter_space_in_y_2()(xcv,ce) != ARR_INTERIOR); + return CGAL::compare(p.x(), + (ce == ARR_MIN_END) ? xcv.left_x() : xcv.right_x()); + } + /*! Compares the curve end of xcv1 that is defined by ce1 + * with the curve end of xcv2 that is defined by ce2 + * at their limits in x. + * Returns SMALLER, EQUAL, or LARGER accordingly. + */ + Comparison_result operator()(const X_monotone_curve_2& xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2& xcv2, + Arr_curve_end ce2) + { + CGAL_precondition(Parameter_space_in_x_2()(xcv1,ce1) == ARR_INTERIOR); + CGAL_precondition(Parameter_space_in_y_2()(xcv1,ce1) != ARR_INTERIOR); + CGAL_precondition(Parameter_space_in_x_2()(xcv2,ce2) == ARR_INTERIOR); + CGAL_precondition(Parameter_space_in_y_2()(xcv2,ce2) != ARR_INTERIOR); + + return CGAL::compare((ce1 == ARR_MIN_END) ? xcv1.left_x() : xcv1.right_x(), + (ce2 == ARR_MIN_END) ? xcv2.left_x() : xcv2.right_x()); + } + + }; //Compare_x_at_limit_2 + + /*! Obtain a Compare_x_at_limit_2 function object */ + Compare_x_at_limit_2 compare_x_at_limit_2_object() const + { return Compare_x_at_limit_2(); } + //@} + + /// \name Functor definitions for the Boolean set-operation traits. + //@{ + + //new functor + class Compare_x_near_limit_2 + { + private: + Cache& _cache; + + public: + Compare_x_near_limit_2(Cache& cache) : _cache(cache) {} + /*! Compares the curve end of xcv1 that is defined by ce1 + * with the curve end of xcv2 that is defined by ce2 + * at their limits in x. + * Returns SMALLER, EQUAL, or LARGER accordingly. + */ + Comparison_result operator()( const X_monotone_curve_2& xcv1, + const X_monotone_curve_2& xcv2, + Arr_curve_end ce) const + { + return xcv1.compare_near_end(xcv2,ce,_cache); + } + }; //Compare_x_near_limit_2 + + /*! Obtain a Compare_x_near_limit_2 function object */ + Compare_x_near_limit_2 compare_x_near_limit_2_object() const + { return Compare_x_near_limit_2(_cache); } + + class Compare_endpoints_xy_2 + { + public: + + /*! + * Compare the endpoints of an $x$-monotone curve lexicographically. + * (assuming the curve has a designated source and target points). + * \param cv The curve. + * \return SMALLER if the curve is directed right; + * LARGER if the curve is directed left. + */ + Comparison_result operator()(const X_monotone_curve_2& cv) + { + if (cv.is_directed_right()) + return (SMALLER); + else + return (LARGER); + } + }; + + /*! Obtain a Compare_endpoints_xy_2 functor object. */ + Compare_endpoints_xy_2 compare_endpoints_xy_2_object() const + { + return Compare_endpoints_xy_2(); + } + + class Construct_opposite_2 + { + public: + + /*! + * Construct an opposite x-monotone (with swapped source and target). + * \param cv The curve. + * \return The opposite curve. + */ + X_monotone_curve_2 operator()(const X_monotone_curve_2& cv) + { + return (cv.flip()); + } + }; + + /*! Obtain a Construct_opposite_2 functor object. */ + Construct_opposite_2 construct_opposite_2_object() const + { + return Construct_opposite_2(); + } + + //@} + + class Approximate_2{ + Approximate_number_type approx_x(const Point_2& p){ + return Approximate_number_type(p.x().lower()); + } + Approximate_number_type approx_y(const Point_2& p){ + typedef typename Algebraic_kernel_d_1::Polynomial_1 Polynomial_1; + typename CGAL::Coercion_traits::Cast cast; + return + cast(p.rational_function().numer()).evaluate(p.x().lower())/ + cast(p.rational_function().denom()).evaluate(p.x().lower()); + } + public: + Approximate_number_type operator()(const Point_2& p, int i){ + if(i==0) return approx_x(p); + if(i==1) return approx_y(p); + assert(false); + return Approximate_number_type(0); + } + }; + + Approximate_2 approximate_2_object() const { return Approximate_2(); } + + void cleanup_cache() const + { + _cache.cleanup(); + } +}; //Arr_rational_function_traits_2 + +} //namespace CGAL { + +#endif //CGAL_ARR_RATIONAL_ARC_TRAITS_D_1_H 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 b057f89d64f..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -63,10 +63,10 @@ public: typedef Tag_true Has_merge_category; typedef Tag_false Has_do_intersect_category; - typedef Arr_oblivious_side_tag Arr_left_side_category; - typedef Arr_oblivious_side_tag Arr_bottom_side_category; - typedef Arr_oblivious_side_tag Arr_top_side_category; - typedef Arr_oblivious_side_tag Arr_right_side_category; + typedef Arr_oblivious_side_tag Left_side_category; + typedef Arr_oblivious_side_tag Bottom_side_category; + typedef Arr_oblivious_side_tag Top_side_category; + typedef Arr_oblivious_side_tag Right_side_category; typedef typename Kernel::Line_2 Line_2; typedef CGAL::Segment_assertions > @@ -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. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_simple_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_simple_point_location.h index 560f82d8d05..25b424643a6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_simple_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_simple_point_location.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_on_sphere_transformation.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_on_sphere_transformation.h index 290e1a41df8..182d33b254c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_on_sphere_transformation.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_on_sphere_transformation.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Tel-Aviv University (Israel). +// Copyright (c) 2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -34,4 +34,4 @@ class Arr_on_sphere_transformation } //namespace CGAL -#endif \ No newline at end of file +#endif diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h index 1b44ccab33f..ebcf7730663 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_arr_dcel.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_arr_dcel.h index 8dcffde2032..0b78f537c1d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_arr_dcel.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_arr_dcel.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_initializer_visitor.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_initializer_visitor.h index 78b41b5d54b..0d96e8a8bcc 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_initializer_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_initializer_visitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_overlay.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_overlay.h index 0ee3f443826..062a4ea4752 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_overlay.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_overlay.h @@ -1,4 +1,4 @@ -// Copyright(c) 2006 Tel-Aviv University(Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University(Israel). // All rights reserved. // // This file is part of CGAL(www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h index 39b1a64505a..2c404ebb5b4 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_polyhedron_3.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h index 8922a49a6a2..830f0ccf333 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_traits.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_transformation.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_transformation.h index aae0d5faa72..e2938bb37fc 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_transformation.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_transformation.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Tel-Aviv University (Israel). +// Copyright (c) 2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h index 7ed9c5efaf2..42c1efdf6fa 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h index 345c3471562..d976b5de447 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 Tel-Aviv University (Israel). +// Copyright (c) 2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h index 699eb6f937b..55b586a5598 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_topology_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006, Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -85,43 +85,42 @@ public: typedef typename Dcel::Isolated_vertex Isolated_vertex; //@} - // TODO remove adaptor as top-traits might be instantiated by Aos_2 itself + //! \name Arrangement types + //!@{ + typedef Arr_spherical_topology_traits_2 Self; typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; - - typedef Arr_spherical_topology_traits_2 - Self; + //!@} ///! \name The side tags //@{ - // are inherited from the geometry traits - typedef typename Traits_adaptor_2::Arr_left_side_category Arr_left_side_category; - typedef typename Traits_adaptor_2::Arr_bottom_side_category Arr_bottom_side_category; - typedef typename Traits_adaptor_2::Arr_top_side_category Arr_top_side_category; - typedef typename Traits_adaptor_2::Arr_right_side_category Arr_right_side_category; + typedef typename Traits_adaptor_2::Left_side_category Left_side_category; + typedef typename Traits_adaptor_2::Bottom_side_category Bottom_side_category; + typedef typename Traits_adaptor_2::Top_side_category Top_side_category; + typedef typename Traits_adaptor_2::Right_side_category Right_side_category; BOOST_MPL_ASSERT ( (boost::mpl::or_< - boost::is_same< Arr_left_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_left_side_category, Arr_identified_side_tag > >) + boost::is_same< Left_side_category, Arr_oblivious_side_tag >, + boost::is_same< Left_side_category, Arr_identified_side_tag > >) ); BOOST_MPL_ASSERT ( (boost::mpl::or_< - boost::is_same< Arr_bottom_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_bottom_side_category, Arr_contracted_side_tag > >) + boost::is_same< Bottom_side_category, Arr_oblivious_side_tag >, + boost::is_same< Bottom_side_category, Arr_contracted_side_tag > >) ); BOOST_MPL_ASSERT ( (boost::mpl::or_< - boost::is_same< Arr_top_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_top_side_category, Arr_contracted_side_tag > >) + boost::is_same< Top_side_category, Arr_oblivious_side_tag >, + boost::is_same< Top_side_category, Arr_contracted_side_tag > >) ); BOOST_MPL_ASSERT ( (boost::mpl::or_< - boost::is_same< Arr_right_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_right_side_category, Arr_identified_side_tag > >) + boost::is_same< Right_side_category, Arr_oblivious_side_tag >, + boost::is_same< Right_side_category, Arr_identified_side_tag > >) ); //@} @@ -359,7 +358,7 @@ public: private: /// \name Auxiliary type definitions. //@{ - typedef Arrangement_on_surface_2 Arr; + typedef Arrangement_on_surface_2 Arr; // Type definition for the constuction sweep-line visitor. typedef Arr_construction_subcurve CSubcurve; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h index b29f72bf51f..a2a855feab1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007, 2009 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -38,191 +38,191 @@ namespace CGAL { struct Arr_boundary_side_tag {}; struct Arr_oblivious_side_tag : public virtual Arr_boundary_side_tag {}; -struct Arr_open_side_tag : public virtual Arr_boundary_side_tag {}; -struct Arr_closed_side_tag : public virtual Arr_boundary_side_tag {}; -struct Arr_contracted_side_tag : public virtual Arr_boundary_side_tag {}; -struct Arr_identified_side_tag : public virtual Arr_boundary_side_tag {}; +struct Arr_open_side_tag : public virtual Arr_oblivious_side_tag {}; +struct Arr_closed_side_tag : public virtual Arr_oblivious_side_tag {}; +struct Arr_contracted_side_tag : public virtual Arr_oblivious_side_tag {}; +struct Arr_identified_side_tag : public virtual Arr_oblivious_side_tag {}; -BOOST_MPL_HAS_XXX_TRAIT_DEF(Arr_left_side_category) -BOOST_MPL_HAS_XXX_TRAIT_DEF(Arr_bottom_side_category) -BOOST_MPL_HAS_XXX_TRAIT_DEF(Arr_top_side_category) -BOOST_MPL_HAS_XXX_TRAIT_DEF(Arr_right_side_category) +BOOST_MPL_HAS_XXX_TRAIT_DEF(Left_side_category) +BOOST_MPL_HAS_XXX_TRAIT_DEF(Bottom_side_category) +BOOST_MPL_HAS_XXX_TRAIT_DEF(Top_side_category) +BOOST_MPL_HAS_XXX_TRAIT_DEF(Right_side_category) namespace internal { //! type to provide left side tag (is oblivious if not existing) template < class Traits_, bool B > -struct Get_left_side_tag { +struct Get_left_side_category { }; template < class Traits_ > -struct Get_left_side_tag< Traits_, true > { - typedef typename Traits_::Arr_left_side_category Tag; +struct Get_left_side_category< Traits_, true > { + typedef typename Traits_::Left_side_category Category; }; template < class Traits_ > -struct Get_left_side_tag< Traits_, false > { - typedef Arr_oblivious_side_tag Tag; +struct Get_left_side_category< Traits_, false > { + typedef Arr_oblivious_side_tag Category; }; template < class Traits_ > -struct Arr_complete_left_side_tag { +struct Arr_complete_left_side_category { public: typedef Traits_ Traits; typedef typename - Get_left_side_tag< Traits, has_Arr_left_side_category< Traits >::value >::Tag Tag; + Get_left_side_category< Traits, has_Left_side_category< Traits >::value >::Category Category; }; template < class GeometryTraits_2, bool b > -struct Validate_left_side_tag {}; +struct Validate_left_side_category {}; template < class GeometryTraits_2 > -struct Validate_left_side_tag< GeometryTraits_2, true > { - void missing__Arr_left_side_category() {} +struct Validate_left_side_category< GeometryTraits_2, true > { + void missing__Left_side_category() {} }; template < class GeometryTraits_2 > -struct Validate_left_side_tag< GeometryTraits_2, false > { - void missing__Arr_left_side_category() +struct Validate_left_side_category< GeometryTraits_2, false > { + void missing__Left_side_category() { bool - missing__Arr_left_side_category__assuming__Arr_oblivious_side_tag__instead; + missing__Left_side_category__assuming__Arr_oblivious_side_tag__instead; } }; //! type to provide bottom side tag (is oblivious if not existing) template < class Traits_, bool B > -struct Get_bottom_side_tag { +struct Get_bottom_side_category { }; template < class Traits_ > -struct Get_bottom_side_tag< Traits_, true > { - typedef typename Traits_::Arr_bottom_side_category Tag; +struct Get_bottom_side_category< Traits_, true > { + typedef typename Traits_::Bottom_side_category Category; }; template < class Traits_ > -struct Get_bottom_side_tag< Traits_, false > { - typedef Arr_oblivious_side_tag Tag; +struct Get_bottom_side_category< Traits_, false > { + typedef Arr_oblivious_side_tag Category; }; template < class Traits_ > -struct Arr_complete_bottom_side_tag { +struct Arr_complete_bottom_side_category { public: typedef Traits_ Traits; typedef typename - Get_bottom_side_tag< Traits, has_Arr_bottom_side_category< Traits >::value >::Tag - Tag; + Get_bottom_side_category< Traits, has_Bottom_side_category< Traits >::value >::Category + Category; }; template < class GeometryTraits_2, bool b > -struct Validate_bottom_side_tag {}; +struct Validate_bottom_side_category {}; template < class GeometryTraits_2 > -struct Validate_bottom_side_tag< GeometryTraits_2, true > { - void missing__Arr_bottom_side_category() {} +struct Validate_bottom_side_category< GeometryTraits_2, true > { + void missing__Bottom_side_category() {} }; template < class GeometryTraits_2 > -struct Validate_bottom_side_tag< GeometryTraits_2, false > { - void missing__Arr_bottom_side_category() +struct Validate_bottom_side_category< GeometryTraits_2, false > { + void missing__Bottom_side_category() { bool - missing__Arr_bottom_side_category__assuming__Arr_oblivious_side_tag__instead; + missing__Bottom_side_category__assuming__Arr_oblivious_side_tag__instead; } }; //! type to provide top side tag (is oblivious if not existing) template < class Traits_, bool B > -struct Get_top_side_tag { +struct Get_top_side_category { }; template < class Traits_ > -struct Get_top_side_tag< Traits_, true > { - typedef typename Traits_::Arr_top_side_category Tag; +struct Get_top_side_category< Traits_, true > { + typedef typename Traits_::Top_side_category Category; }; template < class Traits_ > -struct Get_top_side_tag< Traits_, false > { - typedef Arr_oblivious_side_tag Tag; +struct Get_top_side_category< Traits_, false > { + typedef Arr_oblivious_side_tag Category; }; template < class Traits_ > -struct Arr_complete_top_side_tag { +struct Arr_complete_top_side_category { public: typedef Traits_ Traits; typedef typename - Get_top_side_tag< Traits, has_Arr_top_side_category< Traits >::value >::Tag Tag; + Get_top_side_category< Traits, has_Top_side_category< Traits >::value >::Category Category; }; template < class GeometryTraits_2, bool b > -struct Validate_top_side_tag {}; +struct Validate_top_side_category {}; template < class GeometryTraits_2 > -struct Validate_top_side_tag< GeometryTraits_2, true > { - void missing__Arr_top_side_category() {} +struct Validate_top_side_category< GeometryTraits_2, true > { + void missing__Top_side_category() {} }; template < class GeometryTraits_2 > -struct Validate_top_side_tag< GeometryTraits_2, false > { - void missing__Arr_top_side_category() +struct Validate_top_side_category< GeometryTraits_2, false > { + void missing__Top_side_category() { - bool missing__Arr_top_side_category__assuming__Arr_oblivious_side_tag__instead; + bool missing__Top_side_category__assuming__Arr_oblivious_side_tag__instead; } }; //! type to provide right side tag (is oblivious if not existing) template < class Traits_, bool B > -struct Get_right_side_tag { +struct Get_right_side_category { }; template < class Traits_ > -struct Get_right_side_tag< Traits_, true > { - typedef typename Traits_::Arr_right_side_category Tag; +struct Get_right_side_category< Traits_, true > { + typedef typename Traits_::Right_side_category Category; }; template < class Traits_ > -struct Get_right_side_tag< Traits_, false > { - typedef Arr_oblivious_side_tag Tag; +struct Get_right_side_category< Traits_, false > { + typedef Arr_oblivious_side_tag Category; }; template < class Traits_ > -struct Arr_complete_right_side_tag { +struct Arr_complete_right_side_category { public: typedef Traits_ Traits; typedef typename - Get_right_side_tag< Traits, has_Arr_right_side_category< Traits >::value >::Tag - Tag; + Get_right_side_category< Traits, has_Right_side_category< Traits >::value >::Category + Category; }; template < class GeometryTraits_2, bool b > -struct Validate_right_side_tag {}; +struct Validate_right_side_category {}; template < class GeometryTraits_2 > -struct Validate_right_side_tag< GeometryTraits_2, true > { - void missing__Arr_right_side_category() {} +struct Validate_right_side_category< GeometryTraits_2, true > { + void missing__Right_side_category() {} }; template < class GeometryTraits_2 > -struct Validate_right_side_tag< GeometryTraits_2, false > { - void missing__Arr_right_side_category() +struct Validate_right_side_category< GeometryTraits_2, false > { + void missing__Right_side_category() { bool - missing__Arr_right_side_category__assuming__Arr_oblivious_side_tag__instead; + missing__Right_side_category__assuming__Arr_oblivious_side_tag__instead; } }; @@ -242,23 +242,23 @@ struct Arr_not_all_sides_non_open_tag {}; /*!\brief Struct to determine whether all side tags are "oblivious" */ -template < class ArrLeftSideTag, class ArrBottomSideTag, - class ArrTopSideTag, class ArrRightSideTag > +template < class ArrLeftSideCategory, class ArrBottomSideCategory, + class ArrTopSideCategory, class ArrRightSideCategory > struct Arr_are_all_sides_oblivious_tag { public: //! This instance's first template parameter - typedef ArrLeftSideTag Arr_left_side_category; + typedef ArrLeftSideCategory Left_side_category; //! This instance's second template parameter - typedef ArrBottomSideTag Arr_bottom_side_category; + typedef ArrBottomSideCategory Bottom_side_category; //! This instance's third template parameter - typedef ArrTopSideTag Arr_top_side_category; + typedef ArrTopSideCategory Top_side_category; //! This instance's fourth template parameter - typedef ArrRightSideTag Arr_right_side_category; + typedef ArrRightSideCategory Right_side_category; private: @@ -266,22 +266,22 @@ private: typedef boost::mpl::bool_< false > false_; typedef boost::mpl::if_< - boost::is_same< Arr_left_side_category, Arr_oblivious_side_tag >, + boost::is_same< Left_side_category, Arr_oblivious_side_tag >, true_, false_ > Left_oblivious; typedef boost::mpl::if_< - boost::is_same< Arr_bottom_side_category, Arr_oblivious_side_tag >, + boost::is_same< Bottom_side_category, Arr_oblivious_side_tag >, true_, false_ > Bottom_oblivious; typedef boost::mpl::if_< - boost::is_same< Arr_top_side_category, Arr_oblivious_side_tag >, + boost::is_same< Top_side_category, Arr_oblivious_side_tag >, true_, false_ > Top_oblivious; typedef boost::mpl::if_< - boost::is_same< Arr_right_side_category, Arr_oblivious_side_tag >, + boost::is_same< Right_side_category, Arr_oblivious_side_tag >, true_, false_ > Right_oblivious; @@ -301,23 +301,23 @@ public: /*!\brief Struct to determine whether all side tags are "non-open" */ -template < class ArrLeftSideTag, class ArrBottomSideTag, - class ArrTopSideTag, class ArrRightSideTag > +template < class ArrLeftSideCategory, class ArrBottomSideCategory, + class ArrTopSideCategory, class ArrRightSideCategory > struct Arr_are_all_sides_non_open_tag { public: //! This instance's first template parameter - typedef ArrLeftSideTag Arr_left_side_category; + typedef ArrLeftSideCategory Left_side_category; //! This instance's second template parameter - typedef ArrBottomSideTag Arr_bottom_side_category; + typedef ArrBottomSideCategory Bottom_side_category; //! This instance's third template parameter - typedef ArrTopSideTag Arr_top_side_category; + typedef ArrTopSideCategory Top_side_category; //! This instance's fourth template parameter - typedef ArrRightSideTag Arr_right_side_category; + typedef ArrRightSideCategory Right_side_category; private: @@ -325,22 +325,22 @@ private: typedef boost::mpl::bool_< false > false_; typedef boost::mpl::if_< - boost::is_same< Arr_left_side_category, Arr_open_side_tag >, + boost::is_same< Left_side_category, Arr_open_side_tag >, true_, false_ > Left_open; typedef boost::mpl::if_< - boost::is_same< Arr_bottom_side_category, Arr_open_side_tag >, + boost::is_same< Bottom_side_category, Arr_open_side_tag >, true_, false_ > Bottom_open; typedef boost::mpl::if_< - boost::is_same< Arr_top_side_category, Arr_open_side_tag >, + boost::is_same< Top_side_category, Arr_open_side_tag >, true_, false_ > Top_open; typedef boost::mpl::if_< - boost::is_same< Arr_right_side_category, Arr_open_side_tag >, + boost::is_same< Right_side_category, Arr_open_side_tag >, true_, false_ > Right_open; @@ -362,23 +362,23 @@ public: /*!\brief Struct to check consistent tagging of identifications */ -template < class ArrLeftSideTag, class ArrBottomSideTag, - class ArrTopSideTag, class ArrRightSideTag > +template < class ArrLeftSideCategory, class ArrBottomSideCategory, + class ArrTopSideCategory, class ArrRightSideCategory > struct Arr_sane_identified_tagging { public: //! This instance's first template parameter - typedef ArrLeftSideTag Arr_left_side_category; + typedef ArrLeftSideCategory Left_side_category; //! This instance's second template parameter - typedef ArrBottomSideTag Arr_bottom_side_category; + typedef ArrBottomSideCategory Bottom_side_category; //! This instance's third template parameter - typedef ArrTopSideTag Arr_top_side_category; + typedef ArrTopSideCategory Top_side_category; //! This instance's fourth template parameter - typedef ArrRightSideTag Arr_right_side_category; + typedef ArrRightSideCategory Right_side_category; private: @@ -386,22 +386,22 @@ private: typedef boost::mpl::bool_< false > false_; typedef boost::mpl::if_< - boost::is_same< Arr_left_side_category, Arr_identified_side_tag >, + boost::is_same< Left_side_category, Arr_identified_side_tag >, true_, false_ > Left_identified; typedef boost::mpl::if_< - boost::is_same< Arr_bottom_side_category, Arr_identified_side_tag >, + boost::is_same< Bottom_side_category, Arr_identified_side_tag >, true_, false_ > Bottom_identified; typedef boost::mpl::if_< - boost::is_same< Arr_top_side_category, Arr_identified_side_tag >, + boost::is_same< Top_side_category, Arr_identified_side_tag >, true_, false_ > Top_identified; typedef boost::mpl::if_< - boost::is_same< Arr_right_side_category, Arr_identified_side_tag >, + boost::is_same< Right_side_category, Arr_identified_side_tag >, true_, false_ > Right_identified; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h index 8a5b7273535..b125e8ceceb 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_batched_pl_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h index e3a1098fddc..e44b04ee654 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_construction_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h index 146f6f3b800..bf37162cbd7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_insertion_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_overlay_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_overlay_helper.h index ee3b711630f..22047a0a136 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_overlay_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_overlay_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h index 2358b3f32ba..e6f48ffe781 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_topology_traits_2_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h index 4d1988e0990..da50af21a93 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_bounded_planar_vert_decomp_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h index 5118e766313..766e698870c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_inc_insertion_zone_visitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h index d29b4734ceb..5ddc7247021 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_planar_topology_traits_base_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -422,6 +422,20 @@ is_in_face(const Face *f, const Point_2& p, const Vertex *v) const // Note that if p coincides with this vertex, p is obviously not in the // interior of the component. const Halfedge *first = *(f->outer_ccbs_begin()); + + + // Some left ends of curves may not yet have the curve assigned, + // In case they are at TOP/BOTTOM they are not comparable to p + // We advance first until we find a comparable vertex to start with. + // We always find such a vertex since on the ccb there is at least one + // interior vertex or a vertex at LEFT/RIGHT which are comparable. + while( first->vertex()->parameter_space_in_x()==ARR_INTERIOR + && first->has_null_curve() + && first->next()->has_null_curve()){ + first = first->next(); + } + + const Halfedge *curr = first; Comparison_result res_source; Comparison_result res_target; @@ -440,7 +454,15 @@ is_in_face(const Face *f, const Point_2& p, const Vertex *v) const // the component. if (curr->vertex() == v) return (false); - + + // We jump over vertices at TOP/BOTTOM that do not yet have a curve + if( curr->vertex()->parameter_space_in_x()==ARR_INTERIOR + && curr->has_null_curve() + && curr->next()->has_null_curve()){ + curr = curr->next(); + continue; + } + res_target = compare_xy (p, curr->vertex()); // In case the current halfedge belongs to an "antenna", namely its diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h index 805e05131f8..891e0b7361a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_batched_pl_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h index 0d382f20700..714195de49a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_construction_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2007 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h index cf440e1dfbd..bc9f81641f9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_insertion_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2007 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h index c78f977fcea..efe3edf7e79 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_overlay_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h index 7689c3d9afd..35c8eef8010 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_topology_traits_2_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006, Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -188,8 +188,8 @@ is_in_face(const Face * f, const Point_2 & p, const Vertex * v) const m_traits->compare_x_2_object(); typename Traits_adaptor_2::Compare_y_at_x_2 cmp_y_at_x_op = m_traits->compare_y_at_x_2_object(); - typename Traits_adaptor_2::Compare_x_near_boundary_2 cmp_x_near_bnd = - m_traits->compare_x_near_boundary_2_object(); + typename Traits_adaptor_2::Compare_x_point_curve_end_2 cmp_x_pt_ce = + m_traits->compare_x_point_curve_end_2_object(); /* Maintain a counter of the number of x-monotone curves that intersect an * upward vertical ray emanating from p. Handle degenerate cases as @@ -266,9 +266,9 @@ is_in_face(const Face * f, const Point_2 & p, const Vertex * v) const if ((bnd1 == ARR_TOP_BOUNDARY) && (bnd2 == ARR_TOP_BOUNDARY)) { // Compare the x-coordinates: Comparison_result rc1 = - cmp_x_near_bnd(p, curr->curve(), ARR_MAX_END); + cmp_x_pt_ce(p, curr->curve(), ARR_MAX_END); Comparison_result rc2 = - cmp_x_near_bnd(p, curr->next()->curve(), ARR_MAX_END); + cmp_x_pt_ce(p, curr->next()->curve(), ARR_MAX_END); if (rc1 == opposite(rc2)) ++num_intersections; } curr = curr->next(); @@ -334,11 +334,11 @@ is_in_face(const Face * f, const Point_2 & p, const Vertex * v) const res_source = (bnd_source == ARR_INTERIOR) ? cmp_x_op(p, curr->opposite()->vertex()->point()) : - cmp_x_near_bnd(p, curr->curve(), ind_source); + cmp_x_pt_ce(p, curr->curve(), ind_source); res_target = (bnd_target == ARR_INTERIOR) ? cmp_x_op(p, curr->vertex()->point()) : - cmp_x_near_bnd(p, curr->curve(), ind_target); + cmp_x_pt_ce(p, curr->curve(), ind_target); /* If a vertical ray is shot from p upward, the x-monotone curve * associated with curr is hit once. @@ -720,21 +720,21 @@ _locate_around_pole(Vertex * v, // Traverse all other halfedges, and compare their x-positions next to the // pole with the query curve xc. - typename Traits_adaptor_2::Compare_x_near_boundary_2 cmp_x_near_bnd = - m_traits->compare_x_near_boundary_2_object(); + typename Traits_adaptor_2::Compare_x_curve_ends_2 cmp_x_curve_ends = + m_traits->compare_x_curve_ends_2_object(); Arr_curve_end curr_end, next_end; Comparison_result curr_res, next_res; Comparison_result curr_next_res; curr_end = (curr->direction() == ARR_RIGHT_TO_LEFT) ? ARR_MIN_END : ARR_MAX_END; - curr_res = cmp_x_near_bnd(xc, ind, curr->curve(), curr_end); + curr_res = cmp_x_curve_ends(xc, ind, curr->curve(), curr_end); do { next_end = (next->direction() == ARR_RIGHT_TO_LEFT) ? ARR_MIN_END : ARR_MAX_END; - next_res = cmp_x_near_bnd(xc, ind, next->curve(), next_end); + next_res = cmp_x_curve_ends(xc, ind, next->curve(), next_end); curr_next_res = - cmp_x_near_bnd(curr->curve(), curr_end, next->curve(), next_end); + cmp_x_curve_ends(curr->curve(), curr_end, next->curve(), next_end); if (curr_next_res == cross_res) { // The line of discontinuity must lie between curr and next, so the // comparison result of xc with the two curves should be equal: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h index 495da360de4..c8f36a32848 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_spherical_vert_decomp_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h index 49b55766a2c..77908c5e2ec 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_batched_pl_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h index 180392a302e..ce1958b1046 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_construction_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h index 4f2ff28120e..058bb6ea922 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_insertion_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h index e994cfbd82e..d5026ec59c6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_overlay_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h index 74461ea091d..4449e858bea 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_topology_traits_2_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -271,9 +271,8 @@ are_equal(const Vertex *v, if (v_cv == NULL) return (v->parameter_space_in_x() == ps_x && v->parameter_space_in_y() == ps_y); - - CGAL_assertion (v_ind == ind); - res = this->traits->compare_y_near_boundary_2_object() (cv, *v_cv, v_ind); + + res = this->traits->compare_y_curve_ends_2_object() (cv, *v_cv, v_ind); } else { @@ -289,7 +288,7 @@ are_equal(const Vertex *v, v->parameter_space_in_y() == ps_y); res = - this->traits->compare_x_near_boundary_2_object() (cv, ind, *v_cv, v_ind); + this->traits->compare_x_curve_ends_2_object() (cv, ind, *v_cv, v_ind); } return (res == EQUAL); @@ -622,7 +621,7 @@ compare_x (const Point_2& p, const Vertex* v) const const X_monotone_curve_2 *v_cv = _curve (v, v_ind); CGAL_assertion (v_cv != NULL); - return (this->traits->compare_x_near_boundary_2_object() (p, *v_cv, v_ind)); + return (this->traits->compare_x_point_curve_end_2_object() (p, *v_cv, v_ind)); } // In this case v represents a normal point, and we compare it with p. @@ -659,7 +658,7 @@ compare_xy (const Point_2& p, const Vertex* v) const CGAL_assertion (v_cv != NULL); Comparison_result res = - this->traits->compare_x_near_boundary_2_object() (p, *v_cv, v_ind); + this->traits->compare_x_point_curve_end_2_object() (p, *v_cv, v_ind); if (res != EQUAL) return (res); @@ -784,9 +783,9 @@ _is_on_fictitious_edge (const X_monotone_curve_2& cv, Arr_curve_end ind, (ps_x == ARR_LEFT_BOUNDARY) ? ARR_MIN_END : ARR_MAX_END; res1 = - this->traits->compare_y_near_boundary_2_object() (cv, - *_curve (v1, v_ind), - ind); + this->traits->compare_y_curve_ends_2_object() (cv, + *_curve (v1, v_ind), + ind); if (res1 == EQUAL) { eq_source = true; @@ -811,9 +810,9 @@ _is_on_fictitious_edge (const X_monotone_curve_2& cv, Arr_curve_end ind, (ps_x == ARR_LEFT_BOUNDARY) ? ARR_MIN_END : ARR_MAX_END; res2 = - this->traits->compare_y_near_boundary_2_object() (cv, - *_curve (v2, v_ind), - ind); + this->traits->compare_y_curve_ends_2_object() (cv, + *_curve (v2, v_ind), + ind); if (res2 == EQUAL) { @@ -860,9 +859,9 @@ _is_on_fictitious_edge (const X_monotone_curve_2& cv, Arr_curve_end ind, // The comparison result in this case is trivial. if (v_cv1 != NULL) { - res1 = this->traits->compare_x_near_boundary_2_object() (cv, ind, - *v_cv1, v_ind); - + res1 = this->traits->compare_x_curve_ends_2_object() (cv, ind, + *v_cv1, v_ind); + if (res1 == EQUAL) { eq_source = true; @@ -899,9 +898,9 @@ _is_on_fictitious_edge (const X_monotone_curve_2& cv, Arr_curve_end ind, // The comparison result in this case is trivial. if (v_cv2 != NULL) { - res2 = this->traits->compare_x_near_boundary_2_object() (cv, ind, - *v_cv2, v_ind); - + res2 = this->traits->compare_x_curve_ends_2_object() (cv, ind, + *v_cv2, v_ind); + if (res2 == EQUAL) { eq_target = true; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h index 1718ca6ea92..407a80115e5 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Arr_unb_planar_vert_decomp_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Sign_of_path.h b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Sign_of_path.h index dd9f4a50eca..81eabba8f7a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Sign_of_path.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_topology_traits/Sign_of_path.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2008 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h index 73c767be5e1..cfb8241d6b2 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tracing_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -63,14 +63,16 @@ public: COMPARE_ENDPOINTS_XY_OP, PARAMETER_SPACE_IN_X_OP, - COMPARE_Y_NEAR_BOUNDARY_OP, - COMPARE_Y_ON_BOUNDARY_OP, IS_ON_X_IDENTIFICATION_OP, + COMPARE_Y_ON_BOUNDARY_OP, + COMPARE_Y_NEAR_BOUNDARY_OP, PARAMETER_SPACE_IN_Y_OP, - COMPARE_X_NEAR_BOUNDARY_OP, - COMPARE_X_ON_BOUNDARY_OP, IS_ON_Y_IDENTIFICATION_OP, + COMPARE_X_AT_LIMIT_OP, + COMPARE_X_NEAR_LIMIT_OP, + COMPARE_X_ON_BOUNDARY_OP, + COMPARE_X_NEAR_BOUNDARY_OP, NUMBER_OF_OPERATIONS }; @@ -133,29 +135,39 @@ private: bool compare_endpoints_xy_op() const { return (0 != (m_flags & (0x1 << COMPARE_ENDPOINTS_XY_OP))); } + // left-right + bool parameter_space_in_x_op() const { return (0 != (m_flags & (0x1 << PARAMETER_SPACE_IN_X_OP))); } - bool compare_y_near_boundary_op() const - { return (0 != (m_flags & (0x1 << COMPARE_Y_NEAR_BOUNDARY_OP))); } + bool is_on_x_identification_op() const + { return m_flags & (0x1 << IS_ON_X_IDENTIFICATION_OP); } bool compare_y_on_boundary_op() const { return (0 != (m_flags & (0x1 << COMPARE_Y_ON_BOUNDARY_OP))); } - bool is_on_x_identification_op() const - { return (0 != (m_flags & (0x1 << IS_ON_X_IDENTIFICATION_OP))); } - + bool compare_y_near_boundary_op() const + { return m_flags & (0x1 << COMPARE_Y_NEAR_BOUNDARY_OP); } + + // bottom-top + bool parameter_space_in_y_op() const { return (0 != (m_flags & (0x1 << PARAMETER_SPACE_IN_Y_OP))); } - bool compare_x_near_boundary_op() const - { return (0 != (m_flags & (0x1 << COMPARE_X_NEAR_BOUNDARY_OP))); } + bool is_on_y_identification_op() const + { return m_flags & (0x1 << IS_ON_Y_IDENTIFICATION_OP); } + + bool compare_x_at_limit_op() const + { return m_flags & (0x1 << COMPARE_X_AT_LIMIT_OP); } + + bool compare_x_near_limit_op() const + { return m_flags & (0x1 << COMPARE_X_NEAR_LIMIT_OP); } bool compare_x_on_boundary_op() const { return (0 != (m_flags & (0x1 << COMPARE_X_ON_BOUNDARY_OP))); } - bool is_on_y_identification_op() const - { return (0 != (m_flags & (0x1 << IS_ON_Y_IDENTIFICATION_OP))); } + bool compare_x_near_boundary_op() const + { return m_flags & (0x1 << COMPARE_X_NEAR_BOUNDARY_OP); } public: /*! Default constructor */ @@ -193,18 +205,19 @@ public: typedef typename Base::Has_merge_category Has_merge_category; typedef typename Base::Has_do_intersect_category Has_do_intersect_category; - typedef typename internal::Arr_complete_left_side_tag< Base >::Tag - Arr_left_side_category; - typedef typename internal::Arr_complete_bottom_side_tag< Base >::Tag - Arr_bottom_side_category; - typedef typename internal::Arr_complete_top_side_tag< Base >::Tag - Arr_top_side_category; - typedef typename internal::Arr_complete_right_side_tag< Base >::Tag - Arr_right_side_category; + typedef typename internal::Arr_complete_left_side_category< Base >::Category + Left_side_category; + typedef typename internal::Arr_complete_bottom_side_category< Base >::Category + Bottom_side_category; + typedef typename internal::Arr_complete_top_side_category< Base >::Category + Top_side_category; + typedef typename internal::Arr_complete_right_side_category< Base >::Category + Right_side_category; typedef typename Base::Point_2 Point_2; typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; typedef typename Base::Curve_2 Curve_2; + typedef typename Base::Multiplicity Multiplicity; /*! A functor that compares the x-coordinates of two points */ class Compare_x_2 { @@ -615,7 +628,7 @@ public: continue; } - std::pair point_pair; + std::pair point_pair; if (assign (point_pair, *it)) { std::cout << " result[" << i++ << "]: p: " << point_pair.first << ", multiplicity: " << point_pair.second << std::endl; @@ -742,6 +755,8 @@ public: } }; + // left-right + /*! A functor that determines whether an endpoint of an x-monotone curve lies * on a boundary of the parameter space along the x axis. */ @@ -773,6 +788,112 @@ public: } }; + /*! A functor that determines whether a point or curve is on + * x-identification. + */ + class Is_on_x_identification_2 { + private: + typename Base::Is_on_x_identification_2 m_object; + bool m_enabled; + + public: + /*! Construct */ + Is_on_x_identification_2(const Base * base, bool enabled = true) : + m_object(base->is_on_x_identification_2_object()), m_enabled(enabled) {} + /*! Operate + * \param p1 the point. + */ + Comparison_result operator()(const Point_2 & p) const + { + if (!m_enabled) return m_object(p); + std::cout << "is_on_x_identification" << std::endl + << " p: " << p << std::endl; + Comparison_result cr = m_object(p); + std::cout << " result: " << cr << std::endl; + return cr; + } + + /*! Operate + * \param xcv1 the curve + */ + Comparison_result operator()(const X_monotone_curve_2 & xcv) const + { + if (!m_enabled) return m_object(xcv); + std::cout << "is_on_x_identification" << std::endl + << " xcv: " << xcv << std::endl; + Comparison_result cr = m_object(xcv); + std::cout << " result: " << cr << std::endl; + return cr; + } + }; + + /*! A functor that compares the y-coordinate of two given points + * that lie on vertical boundaries. + */ + class Compare_y_on_boundary_2 { + private: + typename Base::Compare_y_on_boundary_2 m_object; + bool m_enabled; + + public: + /*! Construct */ + Compare_y_on_boundary_2(const Base * base, bool enabled = true) : + m_object(base->compare_y_on_boundary_2_object()), + m_enabled(enabled) + {} + + /*! Operate + * \param p1 the first point. + * \param p2 the second point. + */ + Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + { + if (!m_enabled) return m_object(p1, p2); + std::cout << "compare_y_on_boundary" << std::endl + << " p1: " << p1 << std::endl + << " p2: " << p2 << std::endl; + Comparison_result cr = m_object(p1, p2); + std::cout << " result: " << cr << std::endl; + return cr; + } + }; + + /*! A functor that compares the y-coordinates of curve ends near the + * boundary of the parameter space. + */ + class Compare_y_near_boundary_2 { + private: + typename Base::Compare_y_near_boundary_2 m_object; + bool m_enabled; + + public: + /*! Construct */ + Compare_y_near_boundary_2(const Base * base, bool enabled = true) : + m_object(base->compare_y_near_boundary_2_object()), m_enabled(enabled) {} + + /*! Operate + * \param xcv1 the first curve the end point of which is tested + * \param xcv2 the second curve the end point of which is tested + * \param ce the curve-end identifier + * \return the comparison result + */ + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + if (!m_enabled) return m_object(xcv1, xcv2, ce); + std::cout << "compare_y_near_boundary" << std::endl + << " ce: " << ce << std::endl + << " xcv1: " << xcv1 << std::endl + << " xcv2: " << xcv2 << std::endl; + Comparison_result cr = m_object(xcv1, xcv2, ce); + std::cout << " result: " << cr << std::endl; + return cr; + } + }; + + // bottom-top + /*! A functor that determines whether an endpoint of an x-monotone arc lies * on a boundary of the parameter space along the y axis. */ @@ -817,192 +938,6 @@ public: } }; - /*! A functor that compares the x-coordinates of curve ends near the - * boundary of the parameter space. - */ - class Compare_x_near_boundary_2 { - private: - typename Base::Compare_x_near_boundary_2 m_object; - bool m_enabled; - - public: - /*! Construct */ - Compare_x_near_boundary_2(const Base * base, bool enabled = true) : - m_object(base->compare_x_near_boundary_2_object()), m_enabled(enabled) {} - - /*! Operate - * \param p the first point - * \param xcv the curve the end of which is to be compared - * \param ce the curve-end identifier - * \return the comparison result - */ - Comparison_result operator()(const Point_2 & p, - const X_monotone_curve_2 & xcv, - Arr_curve_end ce) const - { - if (!m_enabled) return m_object(p, xcv, ce); - std::cout << "compare_x_near_boundary 1" << std::endl - << " p: " << p << std::endl - << " ce: " << ce << ", xcv: " << xcv << std::endl; - Comparison_result cr = m_object(p, xcv, ce); - std::cout << " result: " << std::endl; - return cr; - } - - /*! Operate - * \param xcv1 the first curve the end of which is to be compared - * \param ce1 the identifier of the end of the first curve - * \param xcv2 the second curve the end of which is to be compared - * \param ce2 the identifier of the end of the second curve - * \return the comparison result - */ - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - Arr_curve_end ce1, - const X_monotone_curve_2 & xcv2, - Arr_curve_end ce2) const - { - if (!m_enabled) return m_object(xcv1, ce1, xcv2, ce2); - std::cout << "compare_x_near_boundary 2" << std::endl - << " ce1: " << ce1 << ", xcv1: " << xcv1 << std::endl - << " ce2: " << ce2 << ", xcv2: " << xcv2 << std::endl; - Comparison_result cr = m_object(xcv1, ce1, xcv2, ce2); - std::cout << " result: " << cr << std::endl; - return cr; - } - }; - - /*! A functor that compares the y-coordinates of curve ends near the - * boundary of the parameter space. - */ - class Compare_y_near_boundary_2 { - private: - typename Base::Compare_y_near_boundary_2 m_object; - bool m_enabled; - - public: - /*! Construct */ - Compare_y_near_boundary_2(const Base * base, bool enabled = true) : - m_object(base->compare_y_near_boundary_2_object()), m_enabled(enabled) {} - - /*! Operate - * \param xcv1 the first curve the end point of which is tested - * \param xcv2 the second curve the end point of which is tested - * \param ce the curve-end identifier - * \return the comparison result - */ - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, - Arr_curve_end ce) const - { - if (!m_enabled) return m_object(xcv1, xcv2, ce); - std::cout << "compare_y_near_boundary" << std::endl - << " ce: " << ce << std::endl - << " xcv1: " << xcv1 << std::endl - << " xcv2: " << xcv2 << std::endl; - Comparison_result cr = m_object(xcv1, xcv2, ce); - std::cout << " result: " << cr << std::endl; - return cr; - } - }; - - /*! A functor that compares the x-coordinate of two given points - * that lie on horizontal boundaries. - */ - class Compare_x_on_boundary_2 { - private: - typename Base::Compare_x_on_boundary_2 m_object; - bool m_enabled; - - public: - /*! Construct */ - Compare_x_on_boundary_2(const Base * base, bool enabled = true) : - m_object(base->compare_x_on_boundary_2_object()), m_enabled(enabled) {} - /*! Operate - * \param p1 the first point. - * \param p2 the second point. - */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const - { - if (!m_enabled) return m_object(p1, p2); - std::cout << "compare_x_on_boundary" << std::endl - << " p1: " << p1 << std::endl - << " p2: " << p2 << std::endl; - Comparison_result cr = m_object(p1, p2); - std::cout << " result: " << cr << std::endl; - return cr; - } - }; - - /*! A functor that compares the y-coordinate of two given points - * that lie on vertical boundaries. - */ - class Compare_y_on_boundary_2 { - private: - typename Base::Compare_y_on_boundary_2 m_object; - bool m_enabled; - - public: - /*! Construct */ - Compare_y_on_boundary_2(const Base * base, bool enabled = true) : - m_object(base->compare_y_on_boundary_2_object()), - m_enabled(enabled) - {} - - /*! Operate - * \param p1 the first point. - * \param p2 the second point. - */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const - { - if (!m_enabled) return m_object(p1, p2); - std::cout << "compare_y_on_boundary" << std::endl - << " p1: " << p1 << std::endl - << " p2: " << p2 << std::endl; - Comparison_result cr = m_object(p1, p2); - std::cout << " result: " << cr << std::endl; - return cr; - } - }; - - /*! A functor that determines whether a point or curve is on - * x-identification. - */ - class Is_on_x_identification_2 { - private: - typename Base::Is_on_x_identification_2 m_object; - bool m_enabled; - - public: - /*! Construct */ - Is_on_x_identification_2(const Base * base, bool enabled = true) : - m_object(base->is_on_x_identification_2_object()), m_enabled(enabled) {} - /*! Operate - * \param p1 the point. - */ - Comparison_result operator()(const Point_2 & p) const - { - if (!m_enabled) return m_object(p); - std::cout << "is_on_x_identification" << std::endl - << " p: " << p << std::endl; - Comparison_result cr = m_object(p); - std::cout << " result: " << cr << std::endl; - return cr; - } - - /*! Operate - * \param xcv1 the curve - */ - Comparison_result operator()(const X_monotone_curve_2 & xcv) const - { - if (!m_enabled) return m_object(xcv); - std::cout << "is_on_x_identification" << std::endl - << " xcv: " << xcv << std::endl; - Comparison_result cr = m_object(xcv); - std::cout << " result: " << cr << std::endl; - return cr; - } - }; - /*! A functor that determines whether a point or curve is on * y-identification. */ @@ -1041,11 +976,204 @@ public: return cr; } }; + + /*! A functor that compares the x-limits of curve ends on the + * boundary of the parameter space. + */ + class Compare_x_at_limit_2 { + private: + typename Base::Compare_x_at_limit_2 m_object; + bool m_enabled; + + public: + /*! Construct */ + Compare_x_at_limit_2(const Base * base, bool enabled = true) : + m_object(base->compare_x_at_limit_2_object()), m_enabled(enabled) {} + + /*! Operate + * \param p the first point + * \param xcv the curve the end of which is to be compared + * \param ce the curve-end identifier + * \return the comparison result + */ + Comparison_result operator()(const Point_2 & p, + const X_monotone_curve_2 & xcv, + Arr_curve_end ce) const + { + if (!m_enabled) return m_object(p, xcv, ce); + std::cout << "compare_x_at_limit 1" << std::endl + << " p: " << p << std::endl + << " ce: " << ce << ", xcv: " << xcv << std::endl; + Comparison_result cr = m_object(p, xcv, ce); + std::cout << " result: " << std::endl; + return cr; + } + + /*! Operate + * \param xcv1 the first curve the end of which is to be compared + * \param ce1 the identifier of the end of the first curve + * \param xcv2 the second curve the end of which is to be compared + * \param ce2 the identifier of the end of the second curve + * \return the comparison result + */ + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce2) const + { + if (!m_enabled) return m_object(xcv1, ce1, xcv2, ce2); + std::cout << "compare_x_at_limit 2" << std::endl + << " ce1: " << ce1 << ", xcv1: " << xcv1 << std::endl + << " ce2: " << ce2 << ", xcv2: " << xcv2 << std::endl; + Comparison_result cr = m_object(xcv1, ce1, xcv2, ce2); + std::cout << " result: " << cr << std::endl; + return cr; + } + }; + + + /*! A functor that compares the x-coordinates of curve ends near the + * boundary of the parameter space. + */ + class Compare_x_near_limit_2 { + private: + typename Base::Compare_x_near_limit_2 m_object; + bool m_enabled; + + public: + /*! Construct */ + Compare_x_near_limit_2(const Base * base, bool enabled = true) : + m_object(base->compare_x_near_limit_2_object()), m_enabled(enabled) {} + + /*! Operate + * \param xcv1 the first curve the end of which is to be compared + * \param ce1 the identifier of the end of the first curve + * \param xcv2 the second curve the end of which is to be compared + * \param ce2 the identifier of the end of the second curve + * \return the comparison result + */ + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + if (!m_enabled) return m_object(xcv1, xcv2, ce); + std::cout << "compare_x_near_limit 2" << std::endl + << " xcv1: " << xcv1 << std::endl + << " xcv2: " << xcv2 << std::endl + << " ce: " << ce << std::endl; + Comparison_result cr = m_object(xcv1, xcv2, ce); + std::cout << " result: " << cr << std::endl; + return cr; + } + }; + + /*! A functor that compares the x-coordinate of two given points + * that lie on horizontal boundaries. + */ + class Compare_x_on_boundary_2 { + private: + typename Base::Compare_x_on_boundary_2 m_object; + bool m_enabled; + + public: + /*! Construct */ + Compare_x_on_boundary_2(const Base * base, bool enabled = true) : + m_object(base->compare_x_on_boundary_2_object()), m_enabled(enabled) {} + /*! Operate + * \param p1 the first point. + * \param p2 the second point. + */ + Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + { + if (!m_enabled) return m_object(p1, p2); + std::cout << "compare_x_on_boundary" << std::endl + << " p1: " << p1 << std::endl + << " p2: " << p2 << std::endl; + Comparison_result cr = m_object(p1, p2); + std::cout << " result: " << cr << std::endl; + return cr; + } + + /*! Operate + * \param pt the point. + * \param xcv the curve. + * \param ce the curve-end + */ + Comparison_result operator()(const Point_2 & pt, + const X_monotone_curve_2 & xcv, Arr_curve_end ce) const + { + if (!m_enabled) return m_object(pt, xcv, ce); + std::cout << "compare_x_on_boundary" << std::endl + << " pt: " << pt << std::endl + << " xcv: " << xcv << std::endl + << " ce: " << ce << std::endl; + Comparison_result cr = m_object(pt, xcv, ce); + std::cout << " result: " << cr << std::endl; + return cr; + } + + /*! Operate + * \param xcv1 the first curve. + * \param ce1 the first curve-end + * \param xcv2 the second curve. + * \param ce2 the second curve-end + */ + Comparison_result operator()(const X_monotone_curve_2 & xcv1, Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, Arr_curve_end ce2) const + { + if (!m_enabled) return m_object(xcv2, ce1, xcv2, ce2); + std::cout << "compare_x_on_boundary" << std::endl + << "xcv1: " << xcv1 << std::endl + << " ce1: " << ce1 << std::endl + << "xcv2: " << xcv2 << std::endl + << " ce2: " << ce2 << std::endl; + Comparison_result cr = m_object(xcv1, ce1, xcv2, ce2); + std::cout << " result: " << cr << std::endl; + return cr; + } + + }; + /*! A functor that compares the x-coordinates of curve ends near the + * boundary of the parameter space. + */ + class Compare_x_near_boundary_2 { + private: + typename Base::Compare_x_near_boundary_2 m_object; + bool m_enabled; + + public: + /*! Construct */ + Compare_x_near_boundary_2(const Base * base, bool enabled = true) : + m_object(base->compare_x_near_boundary_2_object()), m_enabled(enabled) {} + + /*! Operate + * \param xcv1 the first curve the end of which is to be compared + * \param ce1 the identifier of the end of the first curve + * \param xcv2 the second curve the end of which is to be compared + * \param ce2 the identifier of the end of the second curve + * \return the comparison result + */ + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + if (!m_enabled) return m_object(xcv1, xcv2, ce); + std::cout << "compare_x_near_boundary 2" << std::endl + << " xcv1: " << xcv1 << std::endl + << " xcv2: " << xcv2 << std::endl + << " ce: " << ce << std::endl; + Comparison_result cr = m_object(xcv1, xcv2, ce); + std::cout << " result: " << cr << std::endl; + return cr; + } + }; + //@} /// \name Obtain the appropriate functor //@{ + Compare_x_2 compare_x_2_object() const { return Compare_x_2(this, compare_x_op()); } @@ -1094,34 +1222,40 @@ public: Compare_endpoints_xy_2 compare_endpoints_xy_2_object() const { return Compare_endpoints_xy_2(this, compare_endpoints_xy_op()); } + // left-right + Parameter_space_in_x_2 parameter_space_in_x_2_object() const { return Parameter_space_in_x_2(this, parameter_space_in_x_op()); } + Is_on_x_identification_2 is_on_x_identification_2_object() const + { return Is_on_x_identification_2(this, is_on_x_identification_op()); } + + Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const + { return Compare_y_on_boundary_2(this, compare_y_on_boundary_op()); } + Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const { return Compare_y_near_boundary_2(this, compare_y_near_boundary_op()); } - Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const - { - return Compare_y_on_boundary_2(this, compare_y_on_boundary_op()); - } - - Is_on_x_identification_2 is_on_x_identification_2_object() const - { return Is_on_x_identification_2(this, is_on_x_identification_op()); } + // bottom-top Parameter_space_in_y_2 parameter_space_in_y_2_object() const { return Parameter_space_in_y_2(this, parameter_space_in_y_op()); } - Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const - { return Compare_x_near_boundary_2(this, compare_x_near_boundary_op()); } - - Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const - { - return Compare_x_on_boundary_2(this, compare_x_on_boundary_op()); - } - Is_on_y_identification_2 is_on_y_identification_2_object() const { return Is_on_y_identification_2(this, is_on_y_identification_op()); } + Compare_x_at_limit_2 compare_x_at_limit_2_object() const + { return Compare_x_at_limit_2(this, compare_x_at_limit_op()); } + + Compare_x_near_limit_2 compare_x_near_limit_2_object() const + { return Compare_x_near_limit_2(this, compare_x_near_limit_op()); } + + Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const + { return Compare_x_on_boundary_2(this, compare_x_on_boundary_op()); } + + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const + { return Compare_x_near_boundary_2(this, compare_x_near_boundary_op()); } + //@} }; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_trapezoid_ric_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_trapezoid_ric_point_location.h index ac054c06977..aaf0bb4d308 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_trapezoid_ric_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_trapezoid_ric_point_location.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h index 694971b4f6c..d9a28a2a644 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_triangulation_point_location.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h index 9e6fee34189..4a93f07f31f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_unb_planar_topology_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -75,42 +75,42 @@ public: typedef typename Base::Isolated_vertex Isolated_vertex; //@} - // TODO remove adaptor as top-traits might be instantiated by Aos_2 itself - typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; - - typedef Arr_unb_planar_topology_traits_2 Self; + //! \name Arrangement types + //!@{ + typedef Arr_unb_planar_topology_traits_2 Self; + typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; + //!@} + ///! \name The side tags //@{ - // are inherited from the geometry traits - typedef typename Traits_adaptor_2::Arr_left_side_category Arr_left_side_category; - typedef typename Traits_adaptor_2::Arr_bottom_side_category Arr_bottom_side_category; - typedef typename Traits_adaptor_2::Arr_top_side_category Arr_top_side_category; - typedef typename Traits_adaptor_2::Arr_right_side_category Arr_right_side_category; - + typedef typename Traits_adaptor_2::Left_side_category Left_side_category; + typedef typename Traits_adaptor_2::Bottom_side_category Bottom_side_category; + typedef typename Traits_adaptor_2::Top_side_category Top_side_category; + typedef typename Traits_adaptor_2::Right_side_category Right_side_category; + BOOST_MPL_ASSERT( (boost::mpl::or_< - boost::is_same< Arr_left_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_left_side_category, Arr_open_side_tag > > + boost::is_same< Left_side_category, Arr_oblivious_side_tag >, + boost::is_same< Left_side_category, Arr_open_side_tag > > ) ); BOOST_MPL_ASSERT( (boost::mpl::or_< - boost::is_same< Arr_bottom_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_bottom_side_category, Arr_open_side_tag > > + boost::is_same< Bottom_side_category, Arr_oblivious_side_tag >, + boost::is_same< Bottom_side_category, Arr_open_side_tag > > ) ); BOOST_MPL_ASSERT( (boost::mpl::or_< - boost::is_same< Arr_top_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_top_side_category, Arr_open_side_tag > > + boost::is_same< Top_side_category, Arr_oblivious_side_tag >, + boost::is_same< Top_side_category, Arr_open_side_tag > > ) ); BOOST_MPL_ASSERT( (boost::mpl::or_< - boost::is_same< Arr_right_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_right_side_category, Arr_open_side_tag > > + boost::is_same< Right_side_category, Arr_oblivious_side_tag >, + boost::is_same< Right_side_category, Arr_open_side_tag > > ) ); //@} @@ -225,7 +225,7 @@ private: /// \name Auxiliary type definitions. //@{ - typedef Arrangement_on_surface_2 Arr; + typedef Arrangement_on_surface_2 Arr; // Type definition for the constuction sweep-line visitor. typedef Arr_construction_subcurve CSubcurve; diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_vertex_index_map.h b/Arrangement_on_surface_2/include/CGAL/Arr_vertex_index_map.h index 96a78f32da9..0b74188a92e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_vertex_index_map.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_vertex_index_map.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_vertex_map.h b/Arrangement_on_surface_2/include/CGAL/Arr_vertex_map.h index 83a3e6b07cc..909014fb403 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_vertex_map.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_vertex_map.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h index 192887fde5a..c780fbceea7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_vertical_decomposition_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_walk_along_line_point_location.h b/Arrangement_on_surface_2/include/CGAL/Arr_walk_along_line_point_location.h index 13aeb4f7d9a..7529d031ec5 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_walk_along_line_point_location.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_walk_along_line_point_location.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2.h index cf032ce464b..c0ab88a79d5 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -164,18 +164,13 @@ public: ///! \name Specialized access methods. //@{ - /*! Get the geometry-traits class (for backward compatibility). */ + /*! Obtain the geometry-traits class. */ const Traits_2* traits () const { return (this->geometry_traits()); } - Traits_2* traits () - { - return (this->geometry_traits()); - } - - /*! Get the number of vertices at infinity. */ + /*! Obtain the number of vertices at infinity. */ Size number_of_vertices_at_infinity () const { // The vertices at infinity are valid, but not concrete: @@ -183,7 +178,7 @@ public: this->topology_traits()->number_of_concrete_vertices()); } - /*! Get the unbounded face (non-const version). */ + /*! Obtain the unbounded face (non-const version). */ Face_handle unbounded_face () { // The fictitious un_face contains all other valid faces in a single diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_compute_zone_visitor.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_compute_zone_visitor.h index fcee1f89048..523e2dde57f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_compute_zone_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_compute_zone_visitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_default_planar_topology.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_default_planar_topology.h index b5d19673ca9..2e1d8008ac6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_default_planar_topology.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_default_planar_topology.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006, 2009 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -64,10 +64,10 @@ struct Default_planar_topology : public internal::Default_planar_topology_impl < GeomTraits, Dcel, typename Arr_are_all_sides_oblivious_tag< - typename internal::Arr_complete_left_side_tag< GeomTraits >::Tag, - typename internal::Arr_complete_bottom_side_tag< GeomTraits> ::Tag, - typename internal::Arr_complete_top_side_tag< GeomTraits >::Tag, - typename internal::Arr_complete_right_side_tag< GeomTraits >::Tag >::result + typename internal::Arr_complete_left_side_category< GeomTraits >::Category, + typename internal::Arr_complete_bottom_side_category< GeomTraits> ::Category, + typename internal::Arr_complete_top_side_category< GeomTraits >::Category, + typename internal::Arr_complete_right_side_category< GeomTraits >::Category >::result > {}; diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_do_intersect_zone_visitor.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_do_intersect_zone_visitor.h index b46cc304ba0..742354fe803 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_do_intersect_zone_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_do_intersect_zone_visitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_on_surface_with_history_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_on_surface_with_history_2_impl.h index 056a1baa15c..d538e11a220 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_on_surface_with_history_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_on_surface_with_history_2_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h index 91005032b4d..9e5f5ccceb0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005, 2009 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -18,7 +18,7 @@ // // Author(s) : Ron Wein s // Efi Fogel -// Eric Berberich +// Eric Berberich // (based on old version by Iddo Hanniel // Eyal Flato // Oren Nechushtan @@ -56,54 +56,53 @@ public: typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; typedef typename Base::Point_2 Point_2; - // Tags. + // Categories typedef typename Base::Has_left_category Has_left_category; typedef typename Base::Has_do_intersect_category Has_do_intersect_category; - typedef typename internal::Arr_complete_left_side_tag< Base >::Tag - Arr_left_side_category; - typedef typename internal::Arr_complete_bottom_side_tag< Base >::Tag - Arr_bottom_side_category; - typedef typename internal::Arr_complete_top_side_tag< Base >::Tag - Arr_top_side_category; - typedef typename internal::Arr_complete_right_side_tag< Base >::Tag - Arr_right_side_category; + typedef typename internal::Arr_complete_left_side_category< Base >::Category + Left_side_category; + typedef typename internal::Arr_complete_bottom_side_category< Base >::Category + Bottom_side_category; + typedef typename internal::Arr_complete_top_side_category< Base >::Category + Top_side_category; + typedef typename internal::Arr_complete_right_side_category< Base >::Category + Right_side_category; protected: // left-right dispatch typedef CGAL::internal::Arr_left_right_implementation_dispatch< - Arr_left_side_category, Arr_right_side_category > LR; + Left_side_category, Right_side_category > LR; - typedef typename LR::Parameter_space_in_x_2_curve_end_tag - Psx_2_curve_end_tag; - typedef typename LR::Parameter_space_in_x_2_curve_tag Psx_2_curve_tag; - typedef typename LR::Parameter_space_in_x_2_point_tag Psx_2_point_tag; - typedef typename LR::Compare_y_near_boundary_2_curve_ends_tag - Cmp_y_nb_2_curve_ends_tag; - typedef typename LR::Compare_y_on_boundary_2_points_tag - Cmp_y_ob_2_points_tag; - typedef typename LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve_tag; - typedef typename LR::Is_on_y_identification_2_point_tag Ioyi_2_point_tag; + typedef typename LR::Parameter_space_in_x_2_curve_end_tag Psx_2_curve_end_tag; + typedef typename LR::Parameter_space_in_x_2_curve_tag Psx_2_curve_tag; + typedef typename LR::Parameter_space_in_x_2_point_tag Psx_2_point_tag; + typedef typename LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve_tag; + typedef typename LR::Is_on_y_identification_2_point_tag Ioyi_2_point_tag; + typedef typename LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points_tag; + typedef typename LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends_tag; // bottom-top dispatch typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< - Arr_bottom_side_category, Arr_top_side_category > BT; + Bottom_side_category, Top_side_category > BT; - typedef typename BT::Parameter_space_in_y_2_curve_end_tag - Psy_2_curve_end_tag; - typedef typename BT::Parameter_space_in_y_2_curve_tag Psy_2_curve_tag; - typedef typename BT::Parameter_space_in_y_2_point_tag Psy_2_point_tag; - typedef typename BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end_tag; - typedef typename BT::Compare_x_near_boundary_2_curve_ends_tag - Cmp_x_nb_2_curve_ends_tag; - typedef typename BT::Compare_x_on_boundary_2_points_tag - Cmp_x_ob_2_points_tag; - typedef typename BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve_tag; - typedef typename BT::Is_on_x_identification_2_point_tag Ioxi_2_point_tag; + typedef typename BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end_tag; + typedef typename BT::Parameter_space_in_y_2_curve_tag Psy_2_curve_tag; + typedef typename BT::Parameter_space_in_y_2_point_tag Psy_2_point_tag; + typedef typename BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve_tag; + typedef typename BT::Is_on_x_identification_2_point_tag Ioxi_2_point_tag; + + typedef typename BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end_tag; + typedef typename BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends_tag; + typedef typename BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends_tag; + + typedef typename BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points_tag; + typedef typename BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end_tag; + typedef typename BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends_tag; + typedef typename BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends_tag; public: @@ -332,9 +331,14 @@ public: //@} + + + /// \name Overriden functors for boundaries. //@{ + // left-right + /*! A functor that determines the location of a geometric object * with respect to the parameter space along the x axis. */ @@ -463,7 +467,213 @@ public: return Parameter_space_in_x_2(this); } + /*! A function object that determines whether an x-monotone curve or a + * point coincide with the vertical identification curve. + */ + class Is_on_y_identification_2 { + protected: + //! The base traits. + const Base * m_base; + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Is_on_y_identification_2 (const Base * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_traits_basic_adaptor_2; + + public: + /*! Determones whether a point lies on the vertical identification curve + * \param p the point. + * \return true if p lies on the vertical identification curve, and + * false otherwise. + */ + bool operator() (const Point_2 & p) const + { + return is_on_y_idn (p, Ioyi_2_point_tag()); + } + + /*! Determones whether an x-monotone curve coicide with the vertical + * identification curve + * \param xcv the point. + * \return true if xcv coincides with an identification curve, + * and false otherwise. + */ + bool operator()(const X_monotone_curve_2 & xcv) const + { + return is_on_y_idn (xcv, Ioyi_2_curve_tag()); + } + + private: + bool is_on_y_idn (const Point_2 & p, Arr_use_traits_tag) const + { + return m_base->is_on_identification_2_object ()(p); + } + + bool is_on_y_idn (const Point_2 &, Arr_use_dummy_tag) const + { + CGAL_error(); + return SMALLER; + } + + bool is_on_y_idn (const X_monotone_curve_2 & xcv, Arr_use_traits_tag) const + { + return m_base->is_on_y_identification_2_object ()(xcv); + } + + bool is_on_y_idn (const X_monotone_curve_2 &, Arr_use_dummy_tag) const + { + CGAL_error(); + return SMALLER; + } + }; + + /*! Obtain a Is_on_y_identification_2 function object. */ + Is_on_y_identification_2 is_on_y_identification_2_object() const + { + return Is_on_y_identification_2(this); + } + + + /*! A function object that compares the y-coordinates of curve ends near the + * boundary of the parameter space. + */ + class Compare_y_near_boundary_2 { + protected: + //! The base traits. + const Base * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_y_near_boundary_2(const Base * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_traits_basic_adaptor_2; + + /*! + * Implementation of the operator() in case the base should used. + */ + Comparison_result comp_y_near_bnd (const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce, + Arr_use_traits_tag) const + { + return m_base->compare_y_near_boundary_2_object()(xcv1, xcv2, ce); + } + + /*! + * Implementation of the operator() in case the dummy should be used. + */ + Comparison_result comp_y_near_bnd (const X_monotone_curve_2 &, + const X_monotone_curve_2 &, + Arr_curve_end, Arr_use_dummy_tag) const + { + CGAL_error(); + return EQUAL; + } + + public: + /*! + * Compare the relative y-positions of two curve ends. + * \param xcv1 The first curve. + * \param xcv2 The second curve. + * \param ce The relevant end of xcv1 and xcv2. + * \pre Both curve ends have a special boundary in x. + * \return SMALLER if xcv1 lies below xcv2; + * LARGER if xcv1 lies above xcv2; + * EQUAL in case of an overlap. + */ + Comparison_result operator() (const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + // The function is implemented based on the tag disatching + // If the traits class does not support open curves, we just + // return EQUAL, as this comparison will not be invoked anyway. + return comp_y_near_bnd (xcv1, xcv2, ce, Cmp_y_nb_2_curve_ends_tag()); + } + }; + + /*! Obtain a Compare_y_near_boundary_2 functor. */ + Compare_y_near_boundary_2 compare_y_near_boundary_2_object () const + { + return Compare_y_near_boundary_2(this); + } + + /*! A function object that compares the y-coordinate of two given points + * that lie on vertical boundaries. + */ + class Compare_y_on_boundary_2 { + protected: + //! The base traits. + const Base * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_y_on_boundary_2(const Base * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_traits_basic_adaptor_2; + + /*! + * Implementation of the operator() in case the base should be used. + */ + Comparison_result comp_y_on_bnd (const Point_2 & p1, const Point_2 & p2, + Arr_use_traits_tag) const + { + return m_base->compare_y_on_boundary_2_object()(p1, p2); + } + + /*! + * Implementation of the operator() in case the dummy should be used. + */ + Comparison_result comp_y_on_bnd (const Point_2 &, const Point_2 &, + Arr_use_dummy_tag) const + { + CGAL_error(); + return SMALLER; + } + + public: + /*! Compare the relative y-positions of two points. + * \param p1 The first point. + * \param p2 The second point. + * \pre Both points lie on vertical boundaries. + * \return SMALLER if xcv1 lies below xcv2; + * LARGER if xcv1 lies above xcv2; + * EQUAL in case of an overlap. + */ + Comparison_result operator() (const Point_2 & p1, const Point_2 & p2) const + { + // The function is implemented based on the tag dispatching. + // If the traits class does not support open curves, we just + // return EQUAL, as this comparison will not be invoked anyway. + return comp_y_on_bnd (p1, p2, Cmp_y_ob_2_points_tag()); + } + }; + + /*! Obtain a Compare_y_on_boundary_2 function object. */ + Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const + { + return Compare_y_on_boundary_2(this); + } + + // bottom-top /*! A functor that determines the location of a geometric object * with respect to the parameter space along the y axis. @@ -588,305 +798,6 @@ public: return Parameter_space_in_y_2(this); } - /*! A functor that compares the x-coordinates of curve ends near the - * boundary of the parameter space - */ - class Compare_x_near_boundary_2 { - protected: - //! The base traits. - const Base * m_base; - - /*! Constructor. - * \param base The base traits class. It must be passed, to handle non - * stateless traits objects, (which stores data). - * The constructor is declared private to allow only the functor - * obtaining function, which is a member of the nesting class, - * constructing it. - */ - Compare_x_near_boundary_2(const Base * base) : m_base(base) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_traits_basic_adaptor_2; - - /*! - * Implementation of the operator() in case the base should be used. - */ - Comparison_result _compare_point_curve (const Point_2 & p, - const X_monotone_curve_2 & xcv, - Arr_curve_end ce, - Arr_use_traits_tag) const - { - return (m_base->compare_x_near_boundary_2_object()(p, xcv, ce)); - } - - /*! - * Implementation of the operator() in case the dummy should be used. - */ - Comparison_result _compare_point_curve(const Point_2 &, - const X_monotone_curve_2 &, - Arr_curve_end, - Arr_use_dummy_tag) const - { - CGAL_error(); - return EQUAL; - } - - /*! - * Implementation of the operator() in case the base should be used. - */ - Comparison_result _compare_curves (const X_monotone_curve_2 & xcv1, - Arr_curve_end ce1, - const X_monotone_curve_2 & xcv2, - Arr_curve_end ce2, - Arr_use_traits_tag) const - { - return m_base->compare_x_near_boundary_2_object()(xcv1, ce1, xcv2, ce2); - } - - /*! - * Implementation of the operator() in case the dummy should be used. - */ - Comparison_result _compare_curves (const X_monotone_curve_2 &, - Arr_curve_end, - const X_monotone_curve_2 &, - Arr_curve_end, - Arr_use_dummy_tag) const - { - CGAL_error(); - return EQUAL; - } - - public: - /*! Compare the relative x-positions of a vertical curve and another given - * curve end. - * \param p A reference point; we refer to a vertical line incident to p. - * \param xcv The compared curve. - * \param ind ARR_MIN_END if we refer to xcv's minimal end; - * ARR_MAX_END if we refer to its maximal end. - * \pre xcv's relevant end has a special boundary in y. - * \return SMALLER if p lies to the left of xcv; - * LARGER if p lies to the right xcv; - * EQUAL in case of an overlap. - */ - Comparison_result operator() (const Point_2 & p, - const X_monotone_curve_2 & xcv, - Arr_curve_end ce) const - { - return _compare_point_curve(p, xcv, ce, Cmp_x_nb_2_point_curve_end_tag()); - } - - /*! Compare the relative x-positions of two curve ends. - * \param xcv1 The first curve. - * \param ind1 ARR_MIN_END if we refer to xcv1's minimal end; - * ARR_MAX_END if we refer to its maximal end. - * \param xcv2 The second curve. - * \param ind2 ARR_MIN_END if we refer to xcv2's minimal end; - * ARR_MAX_END if we refer to its maximal end. - * \pre Both curve ends have a special boundary in y. - * \return SMALLER if xcv1 lies to the left of xcv2; - * LARGER if xcv1 lies to the right xcv2; - * EQUAL in case of an overlap. - */ - Comparison_result operator() (const X_monotone_curve_2 & xcv1, - Arr_curve_end ce1, - const X_monotone_curve_2 & xcv2, - Arr_curve_end ce2) const - { - return _compare_curves(xcv1, ce1, xcv2, ce2, Cmp_x_nb_2_curve_ends_tag()); - } - }; - - /*! Obtain a Compare_x_near_boundary_2 function object. */ - Compare_x_near_boundary_2 compare_x_near_boundary_2_object () const - { - return Compare_x_near_boundary_2(this); - } - - /*! A function object that compares the y-coordinates of curve ends near the - * boundary of the parameter space. - */ - class Compare_y_near_boundary_2 { - protected: - //! The base traits. - const Base * m_base; - - /*! Constructor. - * \param base The base traits class. It must be passed, to handle non - * stateless traits objects, (which stores data). - * The constructor is declared private to allow only the functor - * obtaining function, which is a member of the nesting class, - * constructing it. - */ - Compare_y_near_boundary_2(const Base * base) : m_base(base) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_traits_basic_adaptor_2; - - /*! - * Implementation of the operator() in case the base should used. - */ - Comparison_result comp_y_near_bnd (const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, - Arr_curve_end ce, - Arr_use_traits_tag) const - { - return m_base->compare_y_near_boundary_2_object()(xcv1, xcv2, ce); - } - - /*! - * Implementation of the operator() in case the dummy should be used. - */ - Comparison_result comp_y_near_bnd (const X_monotone_curve_2 &, - const X_monotone_curve_2 &, - Arr_curve_end, Arr_use_dummy_tag) const - { - CGAL_error(); - return EQUAL; - } - - public: - /*! - * Compare the relative y-positions of two curve ends. - * \param xcv1 The first curve. - * \param xcv2 The second curve. - * \param ce The relevant end of xcv1 and xcv2. - * \pre Both curve ends have a special boundary in x. - * \return SMALLER if xcv1 lies below xcv2; - * LARGER if xcv1 lies above xcv2; - * EQUAL in case of an overlap. - */ - Comparison_result operator() (const X_monotone_curve_2 & xcv1, - const X_monotone_curve_2 & xcv2, - Arr_curve_end ce) const - { - // The function is implemented based on the tag disatching - // If the traits class does not support open curves, we just - // return EQUAL, as this comparison will not be invoked anyway. - return comp_y_near_bnd (xcv1, xcv2, ce, Cmp_y_nb_2_curve_ends_tag()); - } - }; - - /*! Obtain a Compare_y_near_boundary_2 functor. */ - Compare_y_near_boundary_2 compare_y_near_boundary_2_object () const - { - return Compare_y_near_boundary_2(this); - } - - /*! A function object that compares the x-coordinate of two given points - * that lie on horizontal boundaries. - */ - class Compare_x_on_boundary_2 { - protected: - //! The base traits. - const Base * m_base; - - /*! Constructor. - * \param base The base traits class. It must be passed, to handle non - * stateless traits objects, (which stores data). - * The constructor is declared private to allow only the functor - * obtaining function, which is a member of the nesting class, - * constructing it. - */ - Compare_x_on_boundary_2(const Base * base) : m_base(base) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_traits_basic_adaptor_2; - - public: - /*! Compare the x-coordinate of two given points that lie on horizontal - * boundaries - * \param p1 the first point. - * \param p2 the second point. - */ - Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const - { - return comp_x_on_bnd (p1, p2, Cmp_x_ob_2_points_tag()); - } - - private: - Comparison_result comp_x_on_bnd (const Point_2 & p1, const Point_2 & p2, - Arr_use_traits_tag) const - { - return m_base->compare_x_on_boundary_2_object ()(p1, p2); - } - - Comparison_result comp_x_on_bnd (const Point_2 &, const Point_2 &, - Arr_use_dummy_tag) const - { - CGAL_error(); - return SMALLER; - } - }; - - /*! Obtain a Compare_x_on_boundary_2 function object. */ - Compare_x_on_boundary_2 compare_x_on_boundary_2_object () const - { - return Compare_x_on_boundary_2(this); - } - - /*! A function object that compares the y-coordinate of two given points - * that lie on vertical boundaries. - */ - class Compare_y_on_boundary_2 { - protected: - //! The base traits. - const Base * m_base; - - /*! Constructor. - * \param base The base traits class. It must be passed, to handle non - * stateless traits objects, (which stores data). - * The constructor is declared private to allow only the functor - * obtaining function, which is a member of the nesting class, - * constructing it. - */ - Compare_y_on_boundary_2(const Base * base) : m_base(base) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_traits_basic_adaptor_2; - - /*! - * Implementation of the operator() in case the base should be used. - */ - Comparison_result comp_y_on_bnd (const Point_2 & p1, const Point_2 & p2, - Arr_use_traits_tag) const - { - return m_base->compare_y_on_boundary_2_object()(p1, p2); - } - - /*! - * Implementation of the operator() in case the dummy should be used. - */ - Comparison_result comp_y_on_bnd (const Point_2 &, const Point_2 &, - Arr_use_dummy_tag) const - { - CGAL_error(); - return SMALLER; - } - - public: - /*! Compare the relative y-positions of two points. - * \param p1 The first point. - * \param p2 The second point. - * \pre Both points lie on vertical boundaries. - * \return SMALLER if xcv1 lies below xcv2; - * LARGER if xcv1 lies above xcv2; - * EQUAL in case of an overlap. - */ - Comparison_result operator() (const Point_2 & p1, const Point_2 & p2) const - { - // The function is implemented based on the tag dispatching. - // If the traits class does not support open curves, we just - // return EQUAL, as this comparison will not be invoked anyway. - return comp_y_on_bnd (p1, p2, Cmp_y_ob_2_points_tag()); - } - }; - - /*! Obtain a Compare_y_on_boundary_2 function object. */ - Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const - { - return Compare_y_on_boundary_2(this); - } - /*! A function object that determines whether an x-monotone curve or a * point coincide with the horizontal identification curve. */ @@ -926,7 +837,7 @@ public: */ bool operator()(const X_monotone_curve_2 & xcv) const { - return is_on_idn (xcv, Ioxi_2_curve_tag()); + return is_on_x_idn (xcv, Ioxi_2_curve_tag()); } private: @@ -960,11 +871,11 @@ public: { return Is_on_x_identification_2(this); } - - /*! A function object that determines whether an x-monotone curve or a - * point coincide with the vertical identification curve. + + /*! A functor that compares the x-limits of curve ends near the + * boundary of the parameter space */ - class Is_on_y_identification_2 { + class Compare_x_at_limit_2 { protected: //! The base traits. const Base * m_base; @@ -976,63 +887,800 @@ public: * obtaining function, which is a member of the nesting class, * constructing it. */ - Is_on_y_identification_2 (const Base * base) : m_base(base) {} - + Compare_x_at_limit_2(const Base * base) : m_base(base) {} + //! Allow its functor obtaining function calling the private constructor. friend class Arr_traits_basic_adaptor_2; + + /*! + * Implementation of the operator() in case the base should be used. + */ + Comparison_result _compare_point_curve (const Point_2 & p, + const X_monotone_curve_2 & xcv, + Arr_curve_end ce, + Arr_use_traits_tag) const + { + return (m_base->compare_x_at_limit_2_object()(p, xcv, ce)); + } + + /*! + * Implementation of the operator() in case the dummy should be used. + */ + Comparison_result _compare_point_curve(const Point_2 &, + const X_monotone_curve_2 &, + Arr_curve_end, + Arr_use_dummy_tag) const + { + CGAL_error(); + return EQUAL; + } + + /*! + * Implementation of the operator() in case the base should be used. + */ + Comparison_result _compare_curves (const X_monotone_curve_2 & xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce2, + Arr_use_traits_tag) const + { + return m_base->compare_x_at_limit_2_object()(xcv1, ce1, xcv2, ce2); + } + + /*! + * Implementation of the operator() in case the dummy should be used. + */ + Comparison_result _compare_curves (const X_monotone_curve_2 &, + Arr_curve_end, + const X_monotone_curve_2 &, + Arr_curve_end, + Arr_use_dummy_tag) const + { + CGAL_error(); + return EQUAL; + } public: - /*! Determones whether a point lies on the vertical identification curve - * \param p the point. - * \return true if p lies on the vertical identification curve, and - * false otherwise. + /*! Compare the x-limits of a vertical curve and another given + * curve end. + * \param p A reference point; we refer to a vertical line incident to p. + * \param xcv The compared curve. + * \param ind ARR_MIN_END if we refer to xcv's minimal end; + * ARR_MAX_END if we refer to its maximal end. + * \pre xcv's relevant end has a special boundary in y. + * \return SMALLER if p lies to the left of xcv; + * LARGER if p lies to the right xcv; + * EQUAL in case of an overlap. */ - bool operator() (const Point_2 & p) const + Comparison_result operator() (const Point_2 & p, + const X_monotone_curve_2 & xcv, + Arr_curve_end ce) const { - return is_on_y_idn (p, Ioyi_2_point_tag()); + return _compare_point_curve(p, xcv, ce, Cmp_x_al_2_point_curve_end_tag()); } - /*! Determones whether an x-monotone curve coicide with the vertical - * identification curve - * \param xcv the point. - * \return true if xcv coincides with an identification curve, - * and false otherwise. + /*! Compare the x-limits of two curve ends on the boundary. + * \param xcv1 The first curve. + * \param ind1 ARR_MIN_END if we refer to xcv1's minimal end; + * ARR_MAX_END if we refer to its maximal end. + * \param xcv2 The second curve. + * \param ind2 ARR_MIN_END if we refer to xcv2's minimal end; + * ARR_MAX_END if we refer to its maximal end. + * \pre Both curve ends have a special boundary in y. + * \return SMALLER if xcv1 lies to the left of xcv2; + * LARGER if xcv1 lies to the right xcv2; + * EQUAL in case of an overlap. */ - bool operator()(const X_monotone_curve_2 & xcv) const + Comparison_result operator() (const X_monotone_curve_2 & xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce2) const { - return is_on_y_idn (xcv, Ioyi_2_curve_tag()); - } - - private: - bool is_on_y_idn (const Point_2 & p, Arr_use_traits_tag) const - { - return m_base->is_on_identification_2_object ()(p); - } - - bool is_on_y_idn (const Point_2 &, Arr_use_dummy_tag) const - { - CGAL_error(); - return SMALLER; - } - - bool is_on_y_idn (const X_monotone_curve_2 & xcv, Arr_use_traits_tag) const - { - return m_base->is_on_identification_2_object ()(xcv); - } - - bool is_on_y_idn (const X_monotone_curve_2 &, Arr_use_dummy_tag) const - { - CGAL_error(); - return SMALLER; + return _compare_curves(xcv1, ce1, xcv2, ce2, Cmp_x_al_2_curve_ends_tag()); } }; - /*! Obtain a Is_on_y_identification_2 function object. */ - Is_on_y_identification_2 is_on_y_identification_2_object() const + /*! Obtain a Compare_x_at_limit_2 function object. */ + Compare_x_at_limit_2 compare_x_at_limit_2_object () const { - return Is_on_y_identification_2(this); + return Compare_x_at_limit_2(this); + } + + /*! A functor that compares the x-coordinates of curve ends near the + * boundary of the parameter space + */ + class Compare_x_near_limit_2 { + protected: + //! The base traits. + const Base * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_near_limit_2(const Base * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_traits_basic_adaptor_2; + + /*! + * Implementation of the operator() in case the base should be used. + */ + Comparison_result _compare_curves (const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce, + Arr_use_traits_tag) const + { + return m_base->compare_x_near_limit_2_object()(xcv1, xcv2, ce); + } + + /*! + * Implementation of the operator() in case the dummy should be used. + */ + Comparison_result _compare_curves (const X_monotone_curve_2 &, + const X_monotone_curve_2 &, + Arr_curve_end, + Arr_use_dummy_tag) const + { + CGAL_error(); + return EQUAL; + } + + public: + + /*! Compare the relative x-positions of two curve ends. + * \param xcv1 The first curve. + * \param xcv2 The second curve. + * \param ce ARR_MIN_END if we refer to the curves' minimal end; + * ARR_MAX_END if we refer to the curves' maximal end. + * \pre Both curve ends have a special boundary in y. + * \return SMALLER if xcv1 lies to the left of xcv2; + * LARGER if xcv1 lies to the right xcv2; + * EQUAL in case of an overlap. + */ + Comparison_result operator() (const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + return _compare_curves(xcv1, xcv2, ce, Cmp_x_nl_2_curve_ends_tag()); + } + }; + + /*! Obtain a Compare_x_near_limit_2 function object. */ + Compare_x_near_limit_2 compare_x_near_limit_2_object () const + { + return Compare_x_near_limit_2(this); + } + + /*! A function object that compares the x-coordinate of two given points + * that lie on horizontal boundaries. + */ + class Compare_x_on_boundary_2 { + protected: + //! The base traits. + const Base * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_on_boundary_2(const Base * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_traits_basic_adaptor_2; + + public: + /*! Compare the x-coordinate of two given points projected onto the horizontal boundaries + * \param p1 the first point. + * \param p2 the second point. + */ + Comparison_result operator()(const Point_2 & p1, const Point_2 & p2) const + { + return comp_x_on_bnd (p1, p2, Cmp_x_ob_2_points_tag()); + } + + /*! Compare the x-coordinate of a point and a curve-end projected onto the horizontal + * boundaries + * \param pt the point. + * \param xcv the curve + * \param ce the curve-end + */ + Comparison_result operator()(const Point_2 & pt, const X_monotone_curve_2 & xcv, Arr_curve_end ce) const + { + return comp_x_on_bnd (pt, xcv, ce, Cmp_x_ob_2_point_curve_end_tag()); + } + + /*! Compare the x-coordinates of two curve-ends projected onto the horizontal + * boundaries + * \param xcv1 the curve + * \param ce1 the curve-end + * \param xcv2 the curve + * \param ce2 the curve-end + */ + Comparison_result operator()(const X_monotone_curve_2 & xcv1, Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, Arr_curve_end ce2) const + { + return comp_x_on_bnd (xcv1, ce1, xcv2, ce2, Cmp_x_ob_2_curve_ends_tag()); + } + + private: + Comparison_result comp_x_on_bnd (const Point_2 & p1, const Point_2 & p2, + Arr_use_traits_tag) const + { + return m_base->compare_x_on_boundary_2_object ()(p1, p2); + } + + Comparison_result comp_x_on_bnd (const Point_2 &, const Point_2 &, + Arr_use_dummy_tag) const + { + CGAL_error(); + return SMALLER; + } + + Comparison_result comp_x_on_bnd (const Point_2 & pt, const X_monotone_curve_2 & xcv, Arr_curve_end ce, + Arr_use_traits_tag) const + { + return m_base->compare_x_on_boundary_2_object ()(pt, xcv, ce); + } + + Comparison_result comp_x_on_bnd (const Point_2 &, const X_monotone_curve_2 & xcv, Arr_curve_end ce, + Arr_use_dummy_tag) const + { + CGAL_error(); + return SMALLER; + } + + + Comparison_result comp_x_on_bnd (const X_monotone_curve_2 & xcv1, Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, Arr_curve_end ce2, + Arr_use_traits_tag) const + { + return m_base->compare_x_on_boundary_2_object ()(xcv1, ce1, xcv2, ce2); + } + + Comparison_result comp_x_on_bnd (const X_monotone_curve_2 & xcv1, Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, Arr_curve_end ce2, + Arr_use_dummy_tag) const + { + CGAL_error(); + return SMALLER; + } + + }; + + /*! Obtain a Compare_x_on_boundary_2 function object. */ + Compare_x_on_boundary_2 compare_x_on_boundary_2_object () const + { + return Compare_x_on_boundary_2(this); + } + + + /*! A functor that compares the x-coordinates of curve ends near the + * boundary of the parameter space + */ + class Compare_x_near_boundary_2 { + protected: + //! The base traits. + const Base * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_near_boundary_2(const Base * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_traits_basic_adaptor_2; + + /*! + * Implementation of the operator() in case the base should be used. + */ + Comparison_result _compare_curves (const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce, + Arr_use_traits_tag) const + { + return m_base->compare_x_near_boundary_2_object()(xcv1, xcv2, ce); + } + + /*! + * Implementation of the operator() in case the dummy should be used. + */ + Comparison_result _compare_curves (const X_monotone_curve_2 &, + const X_monotone_curve_2 &, + Arr_curve_end, + Arr_use_dummy_tag) const + { + CGAL_error(); + return EQUAL; + } + + public: + + /*! Compare the relative x-positions of two curve ends. + * \param xcv1 The first curve. + * \param xcv2 The second curve. + * \param ce ARR_MIN_END if we refer to the curves' minimal end; + * ARR_MAX_END if we refer to the curves' maximal end. + * \pre Both curve ends have a special boundary in y. + * \return SMALLER if xcv1 lies to the left of xcv2; + * LARGER if xcv1 lies to the right xcv2; + * EQUAL in case of an overlap. + */ + Comparison_result operator() (const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + return _compare_curves(xcv1, xcv2, ce, Cmp_x_nb_2_curve_ends_tag()); + } + }; + + /*! Obtain a Compare_x_near_boundary_2 function object. */ + Compare_x_near_boundary_2 compare_x_near_boundary_2_object () const + { + return Compare_x_near_boundary_2(this); + } + + + // special non-public comparison functors + + + /*! A functor that compares the y-coordinates of curve ends near the + * boundary of the parameter space + */ + class Compare_y_curve_ends_2 { + protected: + //! The base traits. + const Self * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_y_curve_ends_2(const Self * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_traits_basic_adaptor_2; + + protected: + + // for open + Comparison_result _compare_curve_ends(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce, + Arr_open_side_tag) const + { + Comparison_result res = + m_base->compare_y_near_boundary_2_object()(xcv1, xcv2, ce); + + return res; + } + + // for non-open + Comparison_result _compare_curve_ends(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce, + Arr_oblivious_side_tag) const + { + Comparison_result res = + m_base->compare_y_on_boundary_2_object()( + m_base->construct_vertex_at_curve_end_2_object()(xcv1, ce), + m_base->construct_vertex_at_curve_end_2_object()(xcv2, ce) + ); + + return res; + + } + + public: + + /*! Compare the relative y-positions of two curve ends. + * \param xcv1 The first curve. + * \param ind1 ARR_MIN_END if we refer to xcv1's minimal end; + * ARR_MAX_END if we refer to its maximal end. + * \param xcv2 The second curve. + * \param ind2 ARR_MIN_END if we refer to xcv2's minimal end; + * ARR_MAX_END if we refer to its maximal end. + * \pre Both curve ends have a special boundary in y. + * \return SMALLER if xcv1 lies to the left of xcv2; + * LARGER if xcv1 lies to the right xcv2; + * EQUAL in case of an overlap. + */ + Comparison_result operator() (const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + + Arr_parameter_space ps1 = + m_base->parameter_space_in_x_2_object()(xcv1, ce); + + CGAL_precondition(ps1 != ARR_INTERIOR); + + CGAL_assertion_code( + Arr_parameter_space ps2 = + m_base->parameter_space_in_x_2_object()(xcv2, ce); + ); + CGAL_assertion(ps1 == ps2); + + switch (ps1) { + + case ARR_LEFT_BOUNDARY: + return _compare_curve_ends(xcv1, xcv2, ce, Left_side_category()); + + case ARR_RIGHT_BOUNDARY: + return _compare_curve_ends(xcv1, xcv2, ce, Right_side_category()); + + case ARR_INTERIOR: + // fall-through + default: + CGAL_error(); // never reached + return CGAL::EQUAL; + } + + } + }; + + /*! Obtain a Compare_y_curve_ends_2 function object. */ + Compare_y_curve_ends_2 compare_y_curve_ends_2_object () const + { + return Compare_y_curve_ends_2(this); + } + + /*! A functor that compares the x-coordinates of curve ends near the + * boundary of the parameter space + */ + class Compare_x_point_curve_end_2 { + protected: + //! The base traits. + const Self * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_point_curve_end_2(const Self * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_traits_basic_adaptor_2; + + protected: + + // for open + Comparison_result _compare_point_curve_end(const Point_2 & pt, + const X_monotone_curve_2 & xcv, + Arr_curve_end ce, + Arr_open_side_tag) const + { + Comparison_result res = + m_base->compare_x_at_limit_2_object()(pt, xcv, ce); + + if (res != EQUAL || m_base->is_vertical_2_object()(xcv)) { + return res; + } + + // look at the side from which the + // vertical asymptote is approached + res = (ce == CGAL::ARR_MIN_END ? CGAL::SMALLER : CGAL::LARGER); + + return res; + } + + + // for contraction + Comparison_result _compare_point_curve_end(const Point_2 & pt, + const X_monotone_curve_2 & xcv, + Arr_curve_end ce, + Arr_contracted_side_tag) const + { + Comparison_result res = + m_base->compare_x_on_boundary_2_object()(pt, xcv, ce); + + if (res != EQUAL || m_base->is_vertical_2_object()(xcv)) { + return res; + } + + // look at the side from which the + // vertical asymptote is approached + res = (ce == CGAL::ARR_MIN_END ? CGAL::SMALLER : CGAL::LARGER); + + return res; + } + + // for others + Comparison_result _compare_point_curve_end(const Point_2 & pt, + const X_monotone_curve_2 & xcv, + Arr_curve_end ce, + Arr_oblivious_side_tag) const + { + Comparison_result res = + m_base->compare_x_on_boundary_2_object()( + pt, + m_base->construct_vertex_at_curve_end_2_object()(xcv, ce)); + + return res; + } + + + public: + + /*! Compare the relative x-positions of a point and a curve end. + * \param pt The point + * \param xcv The curve. + * \param ce ARR_MIN_END if we refer to xcv's minimal end; + * ARR_MAX_END if we refer to its maximal end. + * \pre Both curve ends have a special boundary in y. + * \return SMALLER if pt lies to the left of xcv; + * LARGER if pt lies to the right xcv; + * EQUAL in case of an overlap. + */ + Comparison_result operator() (const Point_2 & pt, + const X_monotone_curve_2 & xcv, + Arr_curve_end ce) const + { + + Arr_parameter_space ps = + m_base->parameter_space_in_y_2_object()(xcv, ce); + + CGAL_precondition(ps != ARR_INTERIOR); + + switch (ps) { + + case ARR_BOTTOM_BOUNDARY: + return _compare_point_curve_end(pt, xcv, ce, Bottom_side_category()); + + case ARR_TOP_BOUNDARY: + return _compare_point_curve_end(pt, xcv, ce, Top_side_category()); + + case ARR_INTERIOR: + // fall-through + default: + CGAL_error(); // never reached + return CGAL::EQUAL; + } + + } + + }; + + /*! Obtain a Compare_x_point_curve_end_2 function object. */ + Compare_x_point_curve_end_2 compare_x_point_curve_end_2_object () const + { + return Compare_x_point_curve_end_2(this); + } + + + /*! A functor that compares the x-coordinates of curve ends near the + * boundary of the parameter space + */ + class Compare_x_curve_ends_2 { + protected: + //! The base traits. + const Self * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_curve_ends_2(const Self * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_traits_basic_adaptor_2; + + + protected: + + Comparison_result _compare_curve_ends_same_x(const X_monotone_curve_2 & xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce2) const { + + CGAL::Comparison_result res = CGAL::EQUAL; + + CGAL::Arr_parameter_space loc1 = m_base->parameter_space_in_y_2_object()(xcv1, ce1); + CGAL::Arr_parameter_space loc2 = m_base->parameter_space_in_y_2_object()(xcv2, ce2); + bool vert1 = m_base->is_vertical_2_object()(xcv1); + bool vert2 = m_base->is_vertical_2_object()(xcv2); + + // now we are in the open case: ARR_MIN_END > vertical > ARR_MAX_END + if (vert1) { + if (!vert2) { + res = (ce2 == CGAL::ARR_MIN_END ? CGAL::SMALLER : CGAL::LARGER); + return res; + } + // both are vertical + if (loc1 == loc2) { // both ends converge to the same infinity + res = CGAL::EQUAL; + return res; + } + res = (loc1 == CGAL::ARR_BOTTOM_BOUNDARY ? + CGAL::SMALLER : CGAL::LARGER); + return res; + } + + if (vert2) { + res = (ce1 == CGAL::ARR_MIN_END ? CGAL::LARGER : CGAL::SMALLER); + return res; + } + + // otherwise: both ends have asymptotic behaviour + if (ce1 == ce2) { // both ends approach asymptote from one side + if (loc1 == loc2) { // need special y-comparison + res = m_base->compare_x_near_limit_2_object()(xcv1, xcv2, ce2); + return res; + } + // else: order can be determined without y-comparison + res = CGAL::EQUAL; + return res; + } + // curve ends approach vertical asymptote (or singularity) from + // different sides => no comparisons required + res = (ce1 == CGAL::ARR_MIN_END ? CGAL::LARGER : CGAL::SMALLER); + return res; + + } + + + // for open + Comparison_result _compare_curve_ends(const X_monotone_curve_2 & xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce2, + Arr_open_side_tag) const { + + Comparison_result res = + m_base->compare_x_at_limit_2_object()(xcv1, ce1, xcv2, ce2); + + if (res == EQUAL) { + res = _compare_curve_ends_same_x(xcv1, ce1, xcv2, ce2); + } + + return res; + + } + + // for contracted + Comparison_result _compare_curve_ends(const X_monotone_curve_2 & xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce2, + Arr_contracted_side_tag) const { + + Comparison_result res = + m_base->compare_x_on_boundary_2_object()(xcv1, ce1, xcv2, ce2); + + if (res == EQUAL) { + res = _compare_curve_ends_same_x(xcv1, ce1, xcv2, ce2); + } + + return res; + } + + + // for others + Comparison_result _compare_curve_ends(const X_monotone_curve_2 & xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce2, + Arr_oblivious_side_tag) const { + + Comparison_result res = + m_base->compare_x_on_boundary_2_object()( + m_base->construct_vertex_at_curve_end_2_object()(xcv1, ce1), + m_base->construct_vertex_at_curve_end_2_object()(xcv2, ce2) + ); + + return res; + } + + public: + + /*! Compare the relative x-positions of two curve ends. + * \param xcv1 The first curve. + * \param ind1 ARR_MIN_END if we refer to xcv1's minimal end; + * ARR_MAX_END if we refer to its maximal end. + * \param xcv2 The second curve. + * \param ind2 ARR_MIN_END if we refer to xcv2's minimal end; + * ARR_MAX_END if we refer to its maximal end. + * \pre Both curve ends have a special boundary in y. + * \return SMALLER if xcv1 lies to the left of xcv2; + * LARGER if xcv1 lies to the right xcv2; + * EQUAL in case of an overlap. + */ + Comparison_result operator() (const X_monotone_curve_2 & xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce2) const + { + + bool first_open = !m_base->is_closed_2_object()(xcv1, ce1); + bool second_open = !m_base->is_closed_2_object()(xcv2, ce2); + + if (first_open) { + if (second_open) { + return _compare_curve_ends(xcv1, ce1, xcv2, ce2, + // both sides are open, so pick one + Bottom_side_category()); + } else { + return CGAL::opposite(m_base->compare_x_point_curve_end_2_object()( + m_base->construct_vertex_at_curve_end_2_object()(xcv2, ce2), + xcv1, ce1)); + } + } else { + if (second_open) { + return m_base->compare_x_point_curve_end_2_object()( + m_base->construct_vertex_at_curve_end_2_object()(xcv1, ce1), + xcv2, ce2); + + } else { + return _compare_curve_ends(xcv1, ce1, xcv2, ce2, + // both sides are non-open, so pick one + Bottom_side_category()); + } + } + + } + }; + + /*! Obtain a Compare_x_curve_ends_2 function object. */ + Compare_x_curve_ends_2 compare_x_curve_ends_2_object () const + { + return Compare_x_curve_ends_2(this); } + class Construct_vertex_at_curve_end_2 { + protected: + //! The base traits. + const Self * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Construct_vertex_at_curve_end_2(const Self * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_traits_basic_adaptor_2; + + public: + Point_2 operator() (const X_monotone_curve_2 & xcv, + Arr_curve_end ce) const + { + if (ce == ARR_MIN_END) { + return m_base->construct_min_vertex_2_object()(xcv); + } + // else + return m_base->construct_max_vertex_2_object()(xcv); + + } + }; + + /*! Obtain a Construct_vertex_at_curve_end_2 function object. */ + Construct_vertex_at_curve_end_2 construct_vertex_at_curve_end_2_object () const + { + return Construct_vertex_at_curve_end_2(this); + } + /*! A function object that determines whether a curve end is closed. */ class Is_closed_2 { protected: @@ -1050,17 +1698,20 @@ public: //! Allow its functor obtaining function calling the private constructor. friend class Arr_traits_basic_adaptor_2; - - bool _is_closed(Arr_boundary_side_tag) const + + inline + bool _is_closed(Arr_oblivious_side_tag) const { return true; } + inline bool _is_closed(Arr_open_side_tag) const { return false; } + inline bool _is_closed(const X_monotone_curve_2 & xcv, Arr_curve_end ce) const { Arr_parameter_space ps = @@ -1072,16 +1723,16 @@ public: switch (ps) { case ARR_LEFT_BOUNDARY: - return _is_closed(Arr_left_side_category()); + return _is_closed(Left_side_category()); case ARR_BOTTOM_BOUNDARY: - return _is_closed(Arr_bottom_side_category()); + return _is_closed(Bottom_side_category()); case ARR_TOP_BOUNDARY: - return _is_closed(Arr_top_side_category()); + return _is_closed(Top_side_category()); case ARR_RIGHT_BOUNDARY: - return _is_closed(Arr_right_side_category()); + return _is_closed(Right_side_category()); case ARR_INTERIOR: // fall-through @@ -1126,8 +1777,8 @@ public: Parameter_space_in_x_2 ps_x = m_self->parameter_space_in_x_2_object(); Parameter_space_in_y_2 ps_y = m_self->parameter_space_in_y_2_object(); Compare_x_2 compare_x = m_self->compare_x_2_object(); - Compare_x_near_boundary_2 - compare_x_near_bnd = m_self->compare_x_near_boundary_2_object(); + Compare_x_point_curve_end_2 + compare_x_point_curve_end = m_self->compare_x_point_curve_end_2_object(); // Compare p to the position of the left end of the curve. // Note that if the left end of xcv lies at x boundary, p is obviously to @@ -1144,7 +1795,7 @@ public: // The left endpoint of xcv is a normal point. compare_x (p, m_self->construct_min_vertex_2_object() (xcv)) : // The left end of xcv lies at y boundary. - compare_x_near_bnd (p, xcv, ARR_MIN_END); + compare_x_point_curve_end (p, xcv, ARR_MIN_END); if (res == SMALLER) return (false); // p is to the left of the x-range. @@ -1165,7 +1816,7 @@ public: // The right endpoint of xcv is a normal point. compare_x (p, m_self->construct_max_vertex_2_object() (xcv)) : // The right end of xcv lies at y boundary: - compare_x_near_bnd (p, xcv, ARR_MAX_END); + compare_x_point_curve_end (p, xcv, ARR_MAX_END); return (res != LARGER); } @@ -1187,8 +1838,10 @@ public: m_self->construct_min_vertex_2_object(); Construct_max_vertex_2 max_vertex = m_self->construct_max_vertex_2_object(); - Compare_x_near_boundary_2 compare_x_near_bnd = - m_self->compare_x_near_boundary_2_object(); + Compare_x_point_curve_end_2 compare_x_point_curve_end = + m_self->compare_x_point_curve_end_2_object(); + Compare_x_curve_ends_2 compare_x_curve_ends = + m_self->compare_x_curve_ends_2_object(); // Locate the rightmost of the two left endpoints of the two curves. // Note that we guard for curve ends with special boundary. @@ -1227,12 +1880,12 @@ public: if (ps_y1 == ARR_INTERIOR) { res = (ps_y2 == ARR_INTERIOR) ? compare_x (min_vertex (xcv1), min_vertex (xcv2)) : - compare_x_near_bnd (min_vertex (xcv1), xcv2, ARR_MIN_END); + compare_x_point_curve_end (min_vertex (xcv1), xcv2, ARR_MIN_END); } else { res = (ps_y2 == ARR_INTERIOR) ? - opposite(compare_x_near_bnd (min_vertex (xcv2), xcv1, ARR_MIN_END)): - compare_x_near_bnd (xcv1, ARR_MIN_END, xcv2, ARR_MIN_END); + opposite(compare_x_point_curve_end (min_vertex (xcv2), xcv1, ARR_MIN_END)): + compare_x_curve_ends (xcv1, ARR_MIN_END, xcv2, ARR_MIN_END); } if (res == LARGER) { @@ -1279,12 +1932,12 @@ public: if (ps_y1 == ARR_INTERIOR) { res = (ps_y2 == ARR_INTERIOR) ? compare_x (max_vertex (xcv1), max_vertex (xcv2)) : - compare_x_near_bnd (max_vertex (xcv1), xcv2, ARR_MAX_END); + compare_x_point_curve_end (max_vertex (xcv1), xcv2, ARR_MAX_END); } else { res = (ps_y2 == ARR_INTERIOR) ? - opposite(compare_x_near_bnd (max_vertex (xcv2), xcv1, ARR_MAX_END)): - compare_x_near_bnd (xcv1, ARR_MAX_END, xcv2, ARR_MAX_END); + opposite(compare_x_point_curve_end (max_vertex (xcv2), xcv1, ARR_MAX_END)): + compare_x_curve_ends (xcv1, ARR_MAX_END, xcv2, ARR_MAX_END); } if (res == SMALLER) { @@ -1302,13 +1955,13 @@ public: if (by_left == ARR_INTERIOR) { res = (by_right == ARR_INTERIOR) ? compare_x (min_vertex (*xcv_left), max_vertex (*xcv_right)) : - compare_x_near_bnd (min_vertex (*xcv_left), *xcv_right, ARR_MAX_END); + compare_x_point_curve_end (min_vertex (*xcv_left), *xcv_right, ARR_MAX_END); } else { res = (by_right == ARR_INTERIOR) ? - opposite(compare_x_near_bnd (max_vertex (*xcv_right), - *xcv_left, ARR_MIN_END)) : - compare_x_near_bnd (*xcv_left, ARR_MIN_END, *xcv_right, ARR_MAX_END); + opposite(compare_x_point_curve_end (max_vertex (*xcv_right), + *xcv_left, ARR_MIN_END)) : + compare_x_curve_ends (*xcv_left, ARR_MIN_END, *xcv_right, ARR_MAX_END); } // The two curves overlap in their x-range if and only if the left end @@ -1375,8 +2028,10 @@ public: Compare_y_at_x_2 compare_y_at_x = m_self->compare_y_at_x_2_object(); Construct_min_vertex_2 min_vertex = m_self->construct_min_vertex_2_object(); - Compare_x_near_boundary_2 - compare_x_near_bnd = m_self->compare_x_near_boundary_2_object(); + Compare_x_point_curve_end_2 + compare_x_point_curve_end = m_self->compare_x_point_curve_end_2_object(); + Compare_x_curve_ends_2 + compare_x_curve_ends = m_self->compare_x_curve_ends_2_object(); Compare_y_near_boundary_2 compare_y_near_bnd = m_self->compare_y_near_boundary_2_object(); @@ -1448,7 +2103,7 @@ public: // Both curves have vertical asymptotes with the same sign in y. // Check which asymptote is the rightmost. Note that in this case // the vertical asymptotes cannot be equal. - l_res = compare_x_near_bnd(xcv1, ARR_MIN_END, xcv2, ARR_MIN_END); + l_res = compare_x_curve_ends(xcv1, ARR_MIN_END, xcv2, ARR_MIN_END); CGAL_assertion (l_res != EQUAL); if (ps_y1 == ARR_TOP_BOUNDARY) @@ -1461,7 +2116,7 @@ public: // Compare the x-positions of this endpoint and the asymptote. const Point_2& left2 = min_vertex(xcv2); - l_res = compare_x_near_bnd(left2, xcv1, ARR_MIN_END); + l_res = compare_x_point_curve_end(left2, xcv1, ARR_MIN_END); if (l_res == LARGER) { // left2 lies in the x-range of xcv1, so it is safe to compare: @@ -1485,7 +2140,7 @@ public: // Compare the x-positions of this endpoint and the asymptote. const Point_2& left1 = min_vertex(xcv1); - l_res = compare_x_near_bnd(left1, xcv2, ARR_MIN_END); + l_res = compare_x_point_curve_end(left1, xcv2, ARR_MIN_END); if (l_res == LARGER) // left1 lies in the x-range of xcv2, so it is safe to compare: @@ -1854,19 +2509,15 @@ public: typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; typedef typename Base::Point_2 Point_2; - // Tags. + // Categories. typedef typename Base::Has_left_category Has_left_category; typedef typename Base::Has_merge_category Has_merge_category; typedef typename Base::Has_do_intersect_category Has_do_intersect_category; - typedef typename internal::Arr_complete_left_side_tag< Base >::Tag - Arr_left_side_category; - typedef typename internal::Arr_complete_bottom_side_tag< Base >::Tag - Arr_bottom_side_category; - typedef typename internal::Arr_complete_top_side_tag< Base >::Tag - Arr_top_side_category; - typedef typename internal::Arr_complete_right_side_tag< Base >::Tag - Arr_right_side_category; + typedef typename Base::Left_side_category Left_side_category; + typedef typename Base::Bottom_side_category Bottom_side_category; + typedef typename Base::Top_side_category Top_side_category; + typedef typename Base::Right_side_category Right_side_category; /// \name Construction. //@{ diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h index 47b4755fbfc..384c66e0a38 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007, 2009 Tel-Aviv University (Israel). +// Copyright (c) 2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -15,7 +15,7 @@ // $Id$ // // -// Author(s): Eric Berberich +// Author(s): Eric Berberich #ifndef CGAL_ARR_TRAITS_ADAPTOR_2_DISPATCHING_H #define CGAL_ARR_TRAITS_ADAPTOR_2_DISPATCHING_H @@ -44,527 +44,9 @@ struct Arr_use_traits_tag {}; namespace internal { -//////////////// -// left-right // -//////////////// - -namespace Parameter_space_in_x_2 { - - // Curve-end - - template < class ArrSideTag > - struct Curve_end { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_end< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_end< Arr_open_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_end< Arr_contracted_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_end< Arr_closed_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_end< Arr_identified_side_tag > { - typedef Arr_use_traits_tag type; - }; - - // Curve - - template < class ArrSideTag > - struct Curve { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_contracted_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_closed_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve< Arr_identified_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - // Point - - template < class ArrSideTag > - struct Point { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_contracted_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Point< Arr_closed_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Point< Arr_identified_side_tag > { - typedef Arr_use_dummy_tag type; - }; - -} // namespace Parameter_space_in_x_2 - - -namespace Compare_y_near_boundary_2 { - -// Curve-ends - - template < class ArrSideTag > - struct Curve_ends { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_ends< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_ends< Arr_open_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_ends< Arr_contracted_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_ends< Arr_closed_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_ends< Arr_identified_side_tag > { - typedef Arr_use_traits_tag type; - }; - -} // Compare_y_near_boundary_2 - -namespace Compare_y_on_boundary_2 { - - // Poitns - template < class ArrSideTag > - struct Points { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Points< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Points< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Points< Arr_contracted_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Points< Arr_closed_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Points< Arr_identified_side_tag > { - typedef Arr_use_traits_tag type; - }; - -} // namespace Compare_y_on_boundary_2 - -namespace Is_on_y_identification_2 { - - // Curve - - template < class ArrSideTag > - struct Curve { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_contracted_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_closed_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_identified_side_tag > { - typedef Arr_use_traits_tag type; - }; - - // Point - - template < class ArrSideTag > - struct Point { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_contracted_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_closed_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_identified_side_tag > { - typedef Arr_use_traits_tag type; - }; - -} // namespace Is_on_y_identification_2 - - - -//////////////// -// bottom-top // -//////////////// - -namespace Parameter_space_in_y_2 { - - // Curve-end - - template < class ArrSideTag > - struct Curve_end { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_end< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_end< Arr_open_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_end< Arr_contracted_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_end< Arr_closed_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_end< Arr_identified_side_tag > { - typedef Arr_use_traits_tag type; - }; - - // Curve - - template < class ArrSideTag > - struct Curve { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_contracted_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_closed_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve< Arr_identified_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - // Point - - template < class ArrSideTag > - struct Point { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_contracted_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Point< Arr_closed_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Point< Arr_identified_side_tag > { - typedef Arr_use_dummy_tag type; - }; - -} // namespace Parameter_space_in_y_2 - -namespace Compare_x_near_boundary_2 { - - // Point_curve-end - - template < class ArrSideTag > - struct Point_curve_end { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point_curve_end< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point_curve_end< Arr_open_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Point_curve_end< Arr_contracted_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Point_curve_end< Arr_closed_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Point_curve_end< Arr_identified_side_tag > { - typedef Arr_use_traits_tag type; - }; - - // Curve-ends - - template < class ArrSideTag > - struct Curve_ends { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_ends< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve_ends< Arr_open_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_ends< Arr_contracted_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_ends< Arr_closed_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Curve_ends< Arr_identified_side_tag > { - typedef Arr_use_traits_tag type; - }; - -} // Compare_y_near_boundary_2 - -namespace Compare_x_on_boundary_2 { - - // Poitns - template < class ArrSideTag > - struct Points { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Points< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Points< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Points< Arr_contracted_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Points< Arr_closed_side_tag > { - typedef Arr_use_traits_tag type; - }; - - template <> - struct Points< Arr_identified_side_tag > { - typedef Arr_use_traits_tag type; - }; - -} // namespace Compare_x_on_boundary_2 - -namespace Is_on_x_identification_2 { - - // Curve - - template < class ArrSideTag > - struct Curve { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_contracted_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_closed_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Curve< Arr_identified_side_tag > { - typedef Arr_use_traits_tag type; - }; - - // Point - - template < class ArrSideTag > - struct Point { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_oblivious_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_open_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_contracted_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_closed_side_tag > { - typedef Arr_use_dummy_tag type; - }; - - template <> - struct Point< Arr_identified_side_tag > { - typedef Arr_use_traits_tag type; - }; - -} // namespace Is_on_x_identification_2 - +/////////////// +// combining // +/////////////// //! struct to combine results in "or"-fashion template < class ArrSmallerImplementationTag, class ArrLargerImplementationTag > @@ -603,173 +85,873 @@ public: }; + +//////////////// +// left-right // +//////////////// + +namespace Parameter_space_in_x_2 { + + // Curve-end + + template < class ArrSideTag > + struct Curve_end { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_end< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_end< Arr_open_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_end< Arr_closed_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_end< Arr_contracted_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_end< Arr_identified_side_tag > { + typedef Arr_use_traits_tag type; + }; + + // Curve + + template < class ArrSideTag > + struct Curve { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_closed_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve< Arr_contracted_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_identified_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + // Point + + template < class ArrSideTag > + struct Point { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_closed_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Point< Arr_contracted_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Point< Arr_identified_side_tag > { + typedef Arr_use_dummy_tag type; + }; + +} // namespace Parameter_space_in_x_2 + + +namespace Is_on_y_identification_2 { + + // Curve + + template < class ArrSideTag > + struct Curve { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_closed_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_contracted_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_identified_side_tag > { + typedef Arr_use_traits_tag type; + }; + + // Point + + template < class ArrSideTag > + struct Point { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_closed_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_contracted_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_identified_side_tag > { + typedef Arr_use_traits_tag type; + }; + +} // namespace Is_on_y_identification_2 + + +namespace Compare_y_on_boundary_2 { + + // Poitns + template < class ArrSideTag > + struct Points { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Points< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Points< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Points< Arr_closed_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Points< Arr_contracted_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Points< Arr_identified_side_tag > { + typedef Arr_use_traits_tag type; + }; + +} // namespace Compare_y_on_boundary_2 + + +namespace Compare_y_near_boundary_2 { + +// Curve-ends + + template < class ArrSideTag > + struct Curve_ends { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_open_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_ends< Arr_closed_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_ends< Arr_contracted_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_ends< Arr_identified_side_tag > { + typedef Arr_use_traits_tag type; + }; + +} // Compare_y_near_boundary_2 + + + template < class ArrLeftSideTag, class ArrRightSideTag > struct Arr_left_right_implementation_dispatch { public: //! This instance's first template parameter - typedef ArrLeftSideTag Arr_left_side_category; + typedef ArrLeftSideTag Left_side_category; //! This instance's second template parameter - typedef ArrRightSideTag Arr_right_side_category; + typedef ArrRightSideTag Right_side_category; public: //! tag type for Parameter_space_in_x_2 (curve-end signature) typedef typename internal::Or_traits< typename - internal::Parameter_space_in_x_2::Curve_end< Arr_left_side_category >::type, + internal::Parameter_space_in_x_2::Curve_end< Left_side_category >::type, typename - internal::Parameter_space_in_x_2::Curve_end< Arr_right_side_category >::type + internal::Parameter_space_in_x_2::Curve_end< Right_side_category >::type >::type Parameter_space_in_x_2_curve_end_tag; //! tag type for Parameter_space_in_x_2 (curve signature) typedef typename internal::Or_traits< typename - internal::Parameter_space_in_x_2::Curve< Arr_left_side_category >::type, + internal::Parameter_space_in_x_2::Curve< Left_side_category >::type, typename - internal::Parameter_space_in_x_2::Curve< Arr_right_side_category >::type + internal::Parameter_space_in_x_2::Curve< Right_side_category >::type >::type Parameter_space_in_x_2_curve_tag; //! tag type for Parameter_space_in_x_2 (point signature) typedef typename internal::Or_traits< typename - internal::Parameter_space_in_x_2::Point< Arr_left_side_category >::type, + internal::Parameter_space_in_x_2::Point< Left_side_category >::type, typename - internal::Parameter_space_in_x_2::Point< Arr_right_side_category >::type >::type + internal::Parameter_space_in_x_2::Point< Right_side_category >::type >::type Parameter_space_in_x_2_point_tag; - - //! tag type for Compare_y_near_boundary_2 (curve-ends signature) - typedef typename internal::Or_traits< - typename - internal::Compare_y_near_boundary_2::Curve_ends< Arr_left_side_category >::type, - typename - internal::Compare_y_near_boundary_2::Curve_ends< Arr_right_side_category >::type - >::type - Compare_y_near_boundary_2_curve_ends_tag; - - // TODO Compare_y_right_of_2 ??? - - //! tag type for Compare_y_on_boundary_2 (points signature) - typedef typename internal::Or_traits< - typename - internal::Compare_y_on_boundary_2::Points< Arr_left_side_category >::type, - typename - internal::Compare_y_on_boundary_2::Points< Arr_right_side_category >::type - >::type - Compare_y_on_boundary_2_points_tag; - - //! tag type for Is_on_y_identification_2 (point signature) - typedef typename internal::Or_traits< - typename - internal::Is_on_y_identification_2::Point< Arr_left_side_category >::type, - typename - internal::Is_on_y_identification_2::Point< Arr_right_side_category >::type - >::type - Is_on_y_identification_2_point_tag; - //! tag type for Is_on_y_identification_2 (curve signature) typedef typename internal::Or_traits< typename - internal::Is_on_y_identification_2::Curve< Arr_left_side_category >::type, + internal::Is_on_y_identification_2::Curve< Left_side_category >::type, typename - internal::Is_on_y_identification_2::Curve< Arr_right_side_category >::type + internal::Is_on_y_identification_2::Curve< Right_side_category >::type >::type Is_on_y_identification_2_curve_tag; + //! tag type for Is_on_y_identification_2 (point signature) + typedef typename internal::Or_traits< + typename + internal::Is_on_y_identification_2::Point< Left_side_category >::type, + typename + internal::Is_on_y_identification_2::Point< Right_side_category >::type + >::type + Is_on_y_identification_2_point_tag; + + //! tag type for Compare_y_on_boundary_2 (points signature) + typedef typename internal::Or_traits< + typename + internal::Compare_y_on_boundary_2::Points< Left_side_category >::type, + typename + internal::Compare_y_on_boundary_2::Points< Right_side_category >::type + >::type + Compare_y_on_boundary_2_points_tag; + + //! tag type for Compare_y_near_boundary_2 (curve-ends signature) + typedef typename internal::Or_traits< + typename + internal::Compare_y_near_boundary_2::Curve_ends< Left_side_category >::type, + typename + internal::Compare_y_near_boundary_2::Curve_ends< Right_side_category >::type + >::type + Compare_y_near_boundary_2_curve_ends_tag; + }; // left-right-dispatch +//////////////// +// bottom-top // +//////////////// + +namespace Parameter_space_in_y_2 { + + // Curve-end + + template < class ArrSideTag > + struct Curve_end { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_end< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_end< Arr_open_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_end< Arr_closed_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_end< Arr_contracted_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_end< Arr_identified_side_tag > { + typedef Arr_use_traits_tag type; + }; + + // Curve + + template < class ArrSideTag > + struct Curve { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_closed_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve< Arr_contracted_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_identified_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + // Point + + template < class ArrSideTag > + struct Point { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_closed_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Point< Arr_contracted_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Point< Arr_identified_side_tag > { + typedef Arr_use_dummy_tag type; + }; + +} // namespace Parameter_space_in_y_2 + + +namespace Is_on_x_identification_2 { + + // Curve + + template < class ArrSideTag > + struct Curve { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_closed_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_contracted_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve< Arr_identified_side_tag > { + typedef Arr_use_traits_tag type; + }; + + // Point + + template < class ArrSideTag > + struct Point { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_closed_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_contracted_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point< Arr_identified_side_tag > { + typedef Arr_use_traits_tag type; + }; + +} // namespace Is_on_x_identification_2 + + +namespace Compare_x_at_limit_2 { + + // Point_curve-end + + template < class ArrSideTag > + struct Point_curve_end { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point_curve_end< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point_curve_end< Arr_open_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Point_curve_end< Arr_closed_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point_curve_end< Arr_contracted_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point_curve_end< Arr_identified_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + // Curve-ends + + template < class ArrSideTag > + struct Curve_ends { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_open_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_ends< Arr_closed_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_contracted_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_identified_side_tag > { + typedef Arr_use_dummy_tag type; + }; + +} // Compare_x_at_limit_2 + +namespace Compare_x_near_limit_2 { + + // Curve-ends + + template < class ArrSideTag > + struct Curve_ends { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_open_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_ends< Arr_closed_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_contracted_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_identified_side_tag > { + typedef Arr_use_dummy_tag type; + }; + +} // Compare_x_near_limit_2 + + +namespace Compare_x_on_boundary_2 { + + // Points + template < class ArrSideTag > + struct Points { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Points< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Points< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Points< Arr_closed_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Points< Arr_contracted_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Points< Arr_identified_side_tag > { + typedef Arr_use_traits_tag type; + }; + + // Point_curve-end + + template < class ArrSideTag > + struct Point_curve_end { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point_curve_end< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point_curve_end< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point_curve_end< Arr_closed_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Point_curve_end< Arr_contracted_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Point_curve_end< Arr_identified_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + // Curve-ends + + template < class ArrSideTag > + struct Curve_ends { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_closed_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_contracted_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_ends< Arr_identified_side_tag > { + typedef Arr_use_dummy_tag type; + }; + +} // namespace Compare_x_on_boundary_2 + + +namespace Compare_x_near_boundary_2 { + + // Curve-ends + + template < class ArrSideTag > + struct Curve_ends { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_oblivious_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_open_side_tag > { + typedef Arr_use_dummy_tag type; + }; + + template <> + struct Curve_ends< Arr_closed_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_ends< Arr_contracted_side_tag > { + typedef Arr_use_traits_tag type; + }; + + template <> + struct Curve_ends< Arr_identified_side_tag > { + typedef Arr_use_traits_tag type; + }; + +} // Compare_y_near_boundary_2 + + + template < class ArrBottomSideTag, class ArrTopSideTag > struct Arr_bottom_top_implementation_dispatch { public: //! This instance's first template parameter - typedef ArrBottomSideTag Arr_bottom_side_category; + typedef ArrBottomSideTag Bottom_side_category; //! This instance's second template parameter - typedef ArrTopSideTag Arr_top_side_category; + typedef ArrTopSideTag Top_side_category; public: //! tag type for Parameter_space_in_y_2 (curve-end signature) typedef typename internal::Or_traits< typename - internal::Parameter_space_in_y_2::Curve_end< Arr_bottom_side_category >::type, + internal::Parameter_space_in_y_2::Curve_end< Bottom_side_category >::type, typename - internal::Parameter_space_in_y_2::Curve_end< Arr_top_side_category >::type + internal::Parameter_space_in_y_2::Curve_end< Top_side_category >::type >::type Parameter_space_in_y_2_curve_end_tag; //! tag type for Parameter_space_in_y_2 (curve signature) typedef typename internal::Or_traits< typename - internal::Parameter_space_in_y_2::Curve< Arr_bottom_side_category >::type, + internal::Parameter_space_in_y_2::Curve< Bottom_side_category >::type, typename - internal::Parameter_space_in_y_2::Curve< Arr_top_side_category >::type + internal::Parameter_space_in_y_2::Curve< Top_side_category >::type >::type Parameter_space_in_y_2_curve_tag; //! tag type for Parameter_space_in_y_2 (point signature) typedef typename internal::Or_traits< typename - internal::Parameter_space_in_y_2::Point< Arr_bottom_side_category >::type, + internal::Parameter_space_in_y_2::Point< Bottom_side_category >::type, typename - internal::Parameter_space_in_y_2::Point< Arr_top_side_category >::type >::type + internal::Parameter_space_in_y_2::Point< Top_side_category >::type >::type Parameter_space_in_y_2_point_tag; - //! tag type for Compare_x_near_boundary_2 (point-curve-end signature) + //! tag type for Is_on_x_identification_2 (curve signature) typedef typename internal::Or_traits< typename - internal::Compare_x_near_boundary_2::Point_curve_end< Arr_bottom_side_category > - ::type, + internal::Is_on_x_identification_2::Curve< Bottom_side_category >::type, typename - internal::Compare_x_near_boundary_2::Point_curve_end< Arr_top_side_category >::type + internal::Is_on_x_identification_2::Curve< Top_side_category >::type >::type - Compare_x_near_boundary_2_point_curve_end_tag; - - //! tag type for Compare_x_near_boundary_2 (curve-ends signature) - typedef typename internal::Or_traits< - typename - internal::Compare_x_near_boundary_2::Curve_ends< Arr_bottom_side_category >::type, - typename - internal::Compare_x_near_boundary_2::Curve_ends< Arr_top_side_category >::type - >::type - Compare_x_near_boundary_2_curve_ends_tag; - - //! tag type for Compare_y_on_boundary_2 (points signature) - typedef typename internal::Or_traits< - typename - internal::Compare_x_on_boundary_2::Points< Arr_bottom_side_category >::type, - typename - internal::Compare_x_on_boundary_2::Points< Arr_top_side_category >::type - >::type - Compare_x_on_boundary_2_points_tag; + Is_on_x_identification_2_curve_tag; //! tag type for Is_on_x_identification_2 (point signature) typedef typename internal::Or_traits< typename - internal::Is_on_x_identification_2::Point< Arr_bottom_side_category >::type, + internal::Is_on_x_identification_2::Point< Bottom_side_category >::type, typename - internal::Is_on_x_identification_2::Point< Arr_top_side_category >::type + internal::Is_on_x_identification_2::Point< Top_side_category >::type >::type Is_on_x_identification_2_point_tag; - //! tag type for Is_on_x_identification_2 (curve signature) + //! tag type for Compare_x_at_limit_2 (point-curve-end signature) typedef typename internal::Or_traits< typename - internal::Is_on_x_identification_2::Curve< Arr_bottom_side_category >::type, + internal::Compare_x_at_limit_2::Point_curve_end< Bottom_side_category > + ::type, typename - internal::Is_on_x_identification_2::Curve< Arr_top_side_category >::type + internal::Compare_x_at_limit_2::Point_curve_end< Top_side_category >::type >::type - Is_on_x_identification_2_curve_tag; + Compare_x_at_limit_2_point_curve_end_tag; + + //! tag type for Compare_x_at_limit_2 (curve-ends signature) + typedef typename internal::Or_traits< + typename + internal::Compare_x_at_limit_2::Curve_ends< Bottom_side_category >::type, + typename + internal::Compare_x_at_limit_2::Curve_ends< Top_side_category >::type + >::type + Compare_x_at_limit_2_curve_ends_tag; + + //! tag type for Compare_x_near_limit_boundary_2 (curve-ends signature) + typedef typename internal::Or_traits< + typename + internal::Compare_x_near_limit_2::Curve_ends< Bottom_side_category > + ::type, + typename + internal::Compare_x_near_limit_2::Curve_ends< Top_side_category >::type + >::type + Compare_x_near_limit_2_curve_ends_tag; + + //! tag type for Compare_x_on_boundary_2 (points signature) + typedef typename internal::Or_traits< + typename + internal::Compare_x_on_boundary_2::Points< Bottom_side_category >::type, + typename + internal::Compare_x_on_boundary_2::Points< Top_side_category >::type + >::type + Compare_x_on_boundary_2_points_tag; + + //! tag type for Compare_x_on_boundary_2 (point_curve-end signature) + typedef typename internal::Or_traits< + typename + internal::Compare_x_on_boundary_2::Point_curve_end< Bottom_side_category >::type, + typename + internal::Compare_x_on_boundary_2::Point_curve_end< Top_side_category >::type + >::type + Compare_x_on_boundary_2_point_curve_end_tag; + + //! tag type for Compare_x_on_boundary_2 (curve-ends signature) + typedef typename internal::Or_traits< + typename + internal::Compare_x_on_boundary_2::Curve_ends< Bottom_side_category >::type, + typename + internal::Compare_x_on_boundary_2::Curve_ends< Top_side_category >::type + >::type + Compare_x_on_boundary_2_curve_ends_tag; -}; // bottom-top-dispatch + //! tag type for Compare_x_near_boundary_2 (curve-ends signature) + typedef typename internal::Or_traits< + typename + internal::Compare_x_near_boundary_2::Curve_ends< Bottom_side_category >::type, + typename + internal::Compare_x_near_boundary_2::Curve_ends< Top_side_category >::type + >::type + Compare_x_near_boundary_2_curve_ends_tag; + + }; // bottom-top-dispatch } // namespace internal diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_with_history_accessor.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_with_history_accessor.h index 5a3f19a3c30..2e8ec0c343b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_with_history_accessor.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_with_history_accessor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_2_iterators.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_2_iterators.h index 0c4df3b7831..581d5241d47 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_2_iterators.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_2_iterators.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h index e6c9cdb5a1c..94c3aa86b29 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_global.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h index d75ae0a90e3..21af74a3dbe 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_on_surface_2_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005, 2009 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -53,32 +53,32 @@ Arrangement_on_surface_2::Arrangement_on_surface_2 () : m_topol_traits() { - typedef has_Arr_left_side_category Cond_left; - typedef internal::Validate_left_side_tag< GeomTraits, Cond_left::value > - Validate_left_side_tag; - void (Validate_left_side_tag::*pleft)(void) = - &Validate_left_side_tag::missing__Arr_left_side_category; + typedef has_Left_side_category Cond_left; + typedef internal::Validate_left_side_category< GeomTraits, Cond_left::value > + Validate_left_side_category; + void (Validate_left_side_category::*pleft)(void) = + &Validate_left_side_category::missing__Left_side_category; (void)pleft; - typedef has_Arr_bottom_side_category Cond_bottom; - typedef internal::Validate_bottom_side_tag< GeomTraits, Cond_bottom::value > - Validate_bottom_side_tag; - void (Validate_bottom_side_tag::*pbottom)(void) = - &Validate_bottom_side_tag::missing__Arr_bottom_side_category; + typedef has_Bottom_side_category Cond_bottom; + typedef internal::Validate_bottom_side_category< GeomTraits, Cond_bottom::value > + Validate_bottom_side_category; + void (Validate_bottom_side_category::*pbottom)(void) = + &Validate_bottom_side_category::missing__Bottom_side_category; (void)pbottom; - typedef has_Arr_top_side_category Cond_top; - typedef internal::Validate_top_side_tag< GeomTraits, Cond_top::value > - Validate_top_side_tag; - void (Validate_top_side_tag::*ptop)(void) = - &Validate_top_side_tag::missing__Arr_top_side_category; + typedef has_Top_side_category Cond_top; + typedef internal::Validate_top_side_category< GeomTraits, Cond_top::value > + Validate_top_side_category; + void (Validate_top_side_category::*ptop)(void) = + &Validate_top_side_category::missing__Top_side_category; (void)ptop; - typedef has_Arr_right_side_category Cond_right; - typedef internal::Validate_right_side_tag< GeomTraits, Cond_right::value > - Validate_right_side_tag; - void (Validate_right_side_tag::*pright)(void) = - &Validate_right_side_tag::missing__Arr_right_side_category; + typedef has_Right_side_category Cond_right; + typedef internal::Validate_right_side_category< GeomTraits, Cond_right::value > + Validate_right_side_category; + void (Validate_right_side_category::*pright)(void) = + &Validate_right_side_category::missing__Right_side_category; (void)pright; // Initialize the DCEL structure to represent an empty arrangement. @@ -87,8 +87,6 @@ Arrangement_on_surface_2::Arrangement_on_surface_2 () : // Allocate the traits. m_geom_traits = new Traits_adaptor_2; m_own_traits = true; - - init_boundary_types(); } //----------------------------------------------------------------------------- @@ -112,32 +110,32 @@ Arrangement_on_surface_2(const Geometry_traits_2 * geom_traits) : m_topol_traits (geom_traits) { - typedef has_Arr_left_side_category Cond_left; - typedef internal::Validate_left_side_tag< GeomTraits, Cond_left::value > - Validate_left_side_tag; - void (Validate_left_side_tag::*pleft)(void) = - &Validate_left_side_tag::missing__Arr_left_side_category; + typedef has_Left_side_category Cond_left; + typedef internal::Validate_left_side_category< GeomTraits, Cond_left::value > + Validate_left_side_category; + void (Validate_left_side_category::*pleft)(void) = + &Validate_left_side_category::missing__Left_side_category; (void)pleft; - typedef has_Arr_bottom_side_category Cond_bottom; - typedef internal::Validate_bottom_side_tag< GeomTraits, Cond_bottom::value > - Validate_bottom_side_tag; - void (Validate_bottom_side_tag::*pbottom)(void) = - &Validate_bottom_side_tag::missing__Arr_bottom_side_category; + typedef has_Bottom_side_category Cond_bottom; + typedef internal::Validate_bottom_side_category< GeomTraits, Cond_bottom::value > + Validate_bottom_side_category; + void (Validate_bottom_side_category::*pbottom)(void) = + &Validate_bottom_side_category::missing__Bottom_side_category; (void)pbottom; - typedef has_Arr_top_side_category Cond_top; - typedef internal::Validate_top_side_tag< GeomTraits, Cond_top::value > - Validate_top_side_tag; - void (Validate_top_side_tag::*ptop)(void) = - &Validate_top_side_tag::missing__Arr_top_side_category; + typedef has_Top_side_category Cond_top; + typedef internal::Validate_top_side_category< GeomTraits, Cond_top::value > + Validate_top_side_category; + void (Validate_top_side_category::*ptop)(void) = + &Validate_top_side_category::missing__Top_side_category; (void)ptop; - typedef has_Arr_right_side_category Cond_right; - typedef internal::Validate_right_side_tag< GeomTraits, Cond_right::value > - Validate_right_side_tag; - void (Validate_right_side_tag::*pright)(void) = - &Validate_right_side_tag::missing__Arr_right_side_category; + typedef has_Right_side_category Cond_right; + typedef internal::Validate_right_side_category< GeomTraits, Cond_right::value > + Validate_right_side_category; + void (Validate_right_side_category::*pright)(void) = + &Validate_right_side_category::missing__Right_side_category; (void)pright; // Initialize the DCEL structure to represent an empty arrangement. @@ -146,8 +144,6 @@ Arrangement_on_surface_2(const Geometry_traits_2 * geom_traits) : // Set the traits. m_geom_traits = static_cast (geom_traits); m_own_traits = false; - - init_boundary_types(); } //----------------------------------------------------------------------------- @@ -230,10 +226,6 @@ void Arrangement_on_surface_2::assign (const Self& arr) // Notify the observers that the assignment has been performed. _notify_after_assign (); - - init_boundary_types(); - - return; } //----------------------------------------------------------------------------- @@ -396,6 +388,7 @@ insert_in_face_interior(const X_monotone_curve_2& cv, Face_handle f) // right end. _place_and_set_curve_end (p_f, cv, ARR_MAX_END, ps_x2, ps_y2, &fict_prev2); + // Create the edge connecting the two vertices (note we know v1 is // lexicographically smaller than v2). DHalfedge *new_he; @@ -418,9 +411,23 @@ insert_in_face_interior(const X_monotone_curve_2& cv, Face_handle f) } else { + // Both vertices are inserted using their predecessor halfedges. // Note that in this case we may create a new face. + bool new_face_created = false; + + // This is a bug fix and we could not think of a better one. + // In case the inserted curve has two vertical asymptotes at the top + // it happens that fict_prev1 is split by the max end and becomes the + // prev edge, which is fict_prev2. Since both pointers are equal they + // both point to the max end. Thus, we advance fict_prev1 by one + // such that it points to the min end again. + // Note that this only happens at the top. At the bottom everything + // goes fine since the insertion order is reverted with respect to the + // orientation of the edges. + if (fict_prev1 == fict_prev2) + fict_prev1 = fict_prev1->next(); new_he = _insert_at_vertices (cv, fict_prev1, @@ -2540,6 +2547,7 @@ _insert_at_vertices(const X_monotone_curve_2& cv, { CGAL_precondition(prev1 != NULL); CGAL_precondition(prev2 != NULL); + CGAL_precondition(prev1 != prev2); // Get the vertices that match cv's endpoints. DVertex *v1 = prev1->vertex(); @@ -2602,7 +2610,7 @@ _insert_at_vertices(const X_monotone_curve_2& cv, std::cout << "curr: fictitious" << std::endl; } std::cout << "dir: " - << (curr->direction() == CGAL::LEFT_TO_RIGHT ? "L2R" : "R2L") + << (curr->direction() == CGAL::ARR_LEFT_TO_RIGHT ? "L2R" : "R2L") << std::endl; curr = curr->next(); } @@ -2624,7 +2632,7 @@ _insert_at_vertices(const X_monotone_curve_2& cv, std::cout << "curr: fictitious" << std::endl; } std::cout << "dir: " - << (curr->direction() == CGAL::LEFT_TO_RIGHT ? "L2R" : "R2L") + << (curr->direction() == CGAL::ARR_LEFT_TO_RIGHT ? "L2R" : "R2L") << std::endl; curr = curr->next(); } @@ -3389,25 +3397,33 @@ _compare_vertices_xy_impl (const DVertex * v1, const DVertex * v2, { if (v1 == v2) return (EQUAL); - + // Check the boundary conditions in y: const Arr_parameter_space ps_y1 = v1->parameter_space_in_y(); const Arr_parameter_space ps_y2 = v2->parameter_space_in_y(); - // In case one of the vertices is a singularity point in y, then the - // "negative" singularity is the smallest vertex, and the "positive" - // singularity is considered to be the largest vertex. - if ((m_boundary_types[ps_y1] == ARR_CONTRACTION) && - (m_boundary_types[ps_y2] == ARR_CONTRACTION)) { - if ((ps_y1 == ARR_BOTTOM_BOUNDARY) || (ps_y2 == ARR_TOP_BOUNDARY)) - return SMALLER; - if ((ps_y2 == ARR_BOTTOM_BOUNDARY) || (ps_y1 == ARR_TOP_BOUNDARY)) - return LARGER; - } - + // In case one of the vertices is a contraction point in y, then the + // "negative" contraction is the smallest vertex, and the "positive" + // contraction is considered to be the largest vertex. + if (((ps_y1 == ARR_BOTTOM_BOUNDARY) && + is_contracted(Bottom_side_category())) || + ((ps_y2 == ARR_TOP_BOUNDARY) && + is_contracted(Top_side_category()))) + return SMALLER; + + if (((ps_y2 == ARR_BOTTOM_BOUNDARY) && + is_contracted(Bottom_side_category())) || + ((ps_y1 == ARR_TOP_BOUNDARY) && + is_contracted(Top_side_category()))) + return LARGER; + // Check the boundary conditions in x: const Arr_parameter_space ps_x1 = v1->parameter_space_in_x(); const Arr_parameter_space ps_x2 = v2->parameter_space_in_x(); + + // A more elegant code: + // if (ps_x1 == ps_x2) || (ps_y1 == ps_y1) compare ... + // if (ps_x1 == ARR_LEFT_BOUNDARY) { return (ps_x1 == ps_x2) ? @@ -3433,10 +3449,8 @@ _compare_vertices_xy_impl (const DVertex * v1, const DVertex * v2, m_geom_traits->compare_xy_2_object() (v1->point(), v2->point()) : LARGER; } - if (ps_y2 == ARR_BOTTOM_BOUNDARY) - return (LARGER); - else if (ps_y2 == ARR_TOP_BOUNDARY) - return (SMALLER); + if (ps_y2 == ARR_BOTTOM_BOUNDARY) return (LARGER); + else if (ps_y2 == ARR_TOP_BOUNDARY) return (SMALLER); // If we reached here, both vertices do not have boundary conditions, and // we can just compare their associated points lexicographically. @@ -3470,7 +3484,7 @@ _find_leftmost_vertex_on_open_loop (const DHalfedge *he_before, // We go over the sequence of vertices, starting from he_before's target // vertex, until reaching he_after's source vertex, and find the leftmost // one. Note that we do this carefully, keeping track of the number of - // times we crossed the line of discontinuity in x or in y (if they exist). + // times we crossed the identification curve in x or in y (if they exist). // Note that the path must not be incident to any vertex on open boundary. typename Traits_adaptor_2::Parameter_space_in_x_2 parameter_space_in_x = m_geom_traits->parameter_space_in_x_2_object(); @@ -3568,7 +3582,7 @@ _find_leftmost_vertex_on_open_loop (const DHalfedge *he_before, } } - // If we cross the line of discontinuity in x, then we must update the + // If we cross the identification curve in x, then we must update the // index. Note that a crossing takes place in the following cases: // . . // . . @@ -3581,25 +3595,25 @@ _find_leftmost_vertex_on_open_loop (const DHalfedge *he_before, // if ((ps_x == ARR_LEFT_BOUNDARY) && (ps_x_next == ARR_RIGHT_BOUNDARY)) { - CGAL_assertion((m_boundary_types[ps_x] == ARR_IDENTIFICATION) && - (m_boundary_types[ps_x_next] == ARR_IDENTIFICATION)); + CGAL_assertion(is_identified(Left_side_category()) && + is_identified(Right_side_category())); x_cross_count++; index--; } else if ((ps_x == ARR_RIGHT_BOUNDARY) && (ps_x_next == ARR_LEFT_BOUNDARY)) { - CGAL_assertion((m_boundary_types[ps_x] == ARR_IDENTIFICATION) && - (m_boundary_types[ps_x_next] == ARR_IDENTIFICATION)); + CGAL_assertion(is_identified(Left_side_category()) && + is_identified(Right_side_category())); x_cross_count++; index++; } - // Check if we cross the line of discontinuity in y. + // Check if we cross the identification curve in y. if (((ps_y == ARR_BOTTOM_BOUNDARY) && (ps_y_next == ARR_TOP_BOUNDARY)) || ((ps_y == ARR_TOP_BOUNDARY) && (ps_y_next == ARR_BOTTOM_BOUNDARY))) { - CGAL_assertion((m_boundary_types[ps_y] == ARR_IDENTIFICATION) && - (m_boundary_types[ps_y_next] == ARR_IDENTIFICATION)); + CGAL_assertion(is_identified(Bottom_side_category()) && + is_identified(Top_side_category())); y_cross_count++; } } @@ -3639,8 +3653,8 @@ _find_leftmost_vertex_on_open_loop (const DHalfedge *he_before, } while (he != he_after); - // Determine if the path is perimetric, namely if there exists a line of - // discontinuity in x (or in y), and we have crossed it an odd number of + // Determine if the path is perimetric, namely if there exists an identification + // curve in x (or in y), and we have crossed it an odd number of // times. is_perimetric = (x_cross_count % 2 == 1) || (y_cross_count % 2 == 1); @@ -3666,10 +3680,10 @@ _find_leftmost_vertex_on_closed_loop (const DHalfedge *he_anchor, // vertex and stopping at the source vertex of its twin. As this path is a // closed loop, he_anchor's twin is reachable from he_anchor. // Note that we do this carefully, keeping track of the number of times we - // crossed the line of discontinuity in x or in y (if they exist). We return + // crossed the identification curve in x or in y (if they exist). We return // the leftmost vertex we find, along with its index with respect of the - // he_anchor halfedge; this index is decremented each time we cross the line - // of discontinuity from right to left, and + // he_anchor halfedge; this index is decremented each time we cross the + // identification curve from right to left, and // incremented each time we cross it from left to right. typename Traits_adaptor_2::Parameter_space_in_x_2 parameter_space_in_x = m_geom_traits->parameter_space_in_x_2_object(); @@ -3736,7 +3750,7 @@ _find_leftmost_vertex_on_closed_loop (const DHalfedge *he_anchor, ps_y_next = parameter_space_in_y (he->next()->curve(), ARR_MAX_END); } - // If we cross the line of discontinuity in x, then we must update the + // If we cross the identification curve in x, then we must update the // index. Note that a crossing takes place in the following cases: // . . // . . @@ -3749,25 +3763,25 @@ _find_leftmost_vertex_on_closed_loop (const DHalfedge *he_anchor, // if ((ps_x == ARR_LEFT_BOUNDARY) && (ps_x_next == ARR_RIGHT_BOUNDARY)) { - CGAL_assertion((m_boundary_types[ps_x] == ARR_IDENTIFICATION) && - (m_boundary_types[ps_x_next] == ARR_IDENTIFICATION)); + CGAL_assertion(is_identified(Left_side_category()) && + is_identified(Right_side_category())); x_cross_count++; index--; } else if ((ps_x == ARR_RIGHT_BOUNDARY) && (ps_x_next == ARR_LEFT_BOUNDARY)) { - CGAL_assertion((m_boundary_types[ps_x] == ARR_IDENTIFICATION) && - (m_boundary_types[ps_x_next] == ARR_IDENTIFICATION)); + CGAL_assertion(is_identified(Left_side_category()) && + is_identified(Right_side_category())); x_cross_count++; index++; } - // Check if we cross the line of discontinuity in y. + // Check if we cross the identification curve in y. if (((ps_y == ARR_BOTTOM_BOUNDARY) && (ps_y_next == ARR_TOP_BOUNDARY)) || ((ps_y == ARR_TOP_BOUNDARY) && (ps_y_next == ARR_BOTTOM_BOUNDARY))) { - CGAL_assertion((m_boundary_types[ps_y] == ARR_IDENTIFICATION) && - (m_boundary_types[ps_y_next] == ARR_IDENTIFICATION)); + CGAL_assertion(is_identified(Bottom_side_category()) && + is_identified(Top_side_category())); y_cross_count++; } } @@ -3796,8 +3810,8 @@ _find_leftmost_vertex_on_closed_loop (const DHalfedge *he_anchor, } while (he->next() != he_anchor->opposite()); - // Determine if the path is perimetric, namely if there exists a line of - // discontinuity in x (or in y), and we have crossed it an odd number of + // Determine if the path is perimetric, namely if there exists an identification + // curve in x (or in y), and we have crossed it an odd number of // times. is_perimetric = (x_cross_count % 2 == 1) || (y_cross_count % 2 == 1); @@ -3867,35 +3881,37 @@ _is_inside_new_face (const DHalfedge *prev1, p_cv_next = &(prev2->next()->curve()); } - // Check if the vertex lies on the line of discontinuity in y, in which case + // Check if the vertex lies on the identification curve in y, in which case // special care must be taken. - if ((v_min->parameter_space_in_y() != ARR_INTERIOR) && - (m_boundary_types[v_min->parameter_space_in_y()] == ARR_IDENTIFICATION)) + if (((v_min->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) && + is_identified(Bottom_side_category())) || + ((v_min->parameter_space_in_y() == ARR_TOP_BOUNDARY) && + is_identified(Top_side_category()))) { - // Both current and next curves are incident to the line of discontinuity. + // Both current and next curves are incident to the identification curve. // As v_min is the leftmost vertex, we now that their left ends must have - // a boundary condition of type discontinuity in y. + // a boundary condition of type identification in y. Arr_parameter_space ps_y_curr = m_geom_traits->parameter_space_in_y_2_object()(*p_cv_curr, ARR_MIN_END); Arr_parameter_space ps_y_next = m_geom_traits->parameter_space_in_y_2_object()(*p_cv_next, ARR_MIN_END); - // Check if the curves lie on opposite sides of the line of discontinuity. + // Check if the curves lie on opposite sides of the identification curve. if ((ps_y_curr == ARR_BOTTOM_BOUNDARY) && (ps_y_next == ARR_TOP_BOUNDARY)) { // In this case the current curve is "above" the next one to the right - // of v_min, in a cyclic order around the line of discontinuity. + // of v_min, in a cyclic order around the identification curve. return (true); } else if ((ps_y_curr == ARR_TOP_BOUNDARY) && (ps_y_next == ARR_BOTTOM_BOUNDARY)) { // In this case the current curve is "below" the next one to the right - // of v_min, in a cyclic order around the line of discontinuity. + // of v_min, in a cyclic order around the identification curve. return (false); } - // If both curves are on the same side of the line of discontinuity, we + // If both curves are on the same side of the identification curve, we // continue to compare them to the right of v_min. CGAL_assertion (((ps_y_curr == ARR_BOTTOM_BOUNDARY) && (ps_y_next == ARR_BOTTOM_BOUNDARY)) || @@ -3903,26 +3919,28 @@ _is_inside_new_face (const DHalfedge *prev1, (ps_y_next == ARR_TOP_BOUNDARY))); } - // Check if the leftmost vertex is asingularity point in y, in which case + // Check if the leftmost vertex is acontraction point in y, in which case // special care must be taken. - if ((v_min->parameter_space_in_y() != ARR_INTERIOR) && - (m_boundary_types[v_min->parameter_space_in_y()] == ARR_CONTRACTION)) + if (((v_min->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) && + is_contracted(Bottom_side_category())) || + ((v_min->parameter_space_in_y() == ARR_TOP_BOUNDARY) && + is_contracted(Top_side_category()))) { // Get the curve-ends for cv_curr and cv_next that conincide with the - // singularity point. + // contraction point. Arr_curve_end ind_curr; Arr_curve_end ind_next; if (he_left_low != NULL) { - // The singularity point is he_left_low's target and cv_curr is its + // The contraction point is he_left_low's target and cv_curr is its // associated curve. ind_curr = (he_left_low->direction() == ARR_LEFT_TO_RIGHT) ? ARR_MAX_END : ARR_MIN_END; if (he_left_low->next() != he_last) { - // The singularity point is he_left_low->next()'s source and cv_next + // The contraction point is he_left_low->next()'s source and cv_next // is its associated curve. ind_next = (he_left_low->next()->direction() == ARR_LEFT_TO_RIGHT) ? ARR_MIN_END : ARR_MAX_END; @@ -3947,18 +3965,28 @@ _is_inside_new_face (const DHalfedge *prev1, m_geom_traits->parameter_space_in_y_2_object() (cv, ARR_MIN_END))) ? ARR_MIN_END : ARR_MAX_END; - // The singularity point is prev2->next()'s source and cv_next + // The contraction point is prev2->next()'s source and cv_next // is its associated curve. ind_next = (prev2->next()->direction() == ARR_LEFT_TO_RIGHT) ? ARR_MIN_END : ARR_MAX_END; } // Compare the horizontal position of the two curve-ends at the point - // of singularity. - const Comparison_result x_res = - m_geom_traits->compare_x_near_boundary_2_object() (*p_cv_curr, ind_curr, - *p_cv_next, ind_next); + // of contraction. + Comparison_result x_res = EQUAL; + + if (ind_curr != ind_next) { + x_res = (ind_curr == ARR_MAX_END ? SMALLER : LARGER); + } else { + + CGAL_assertion(ind_curr == ind_next); + + x_res = + m_geom_traits->compare_x_curve_ends_2_object() (*p_cv_curr, ind_curr, + *p_cv_next, ind_next); + + } CGAL_assertion (x_res != EQUAL); return (((v_min->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) && @@ -3967,6 +3995,8 @@ _is_inside_new_face (const DHalfedge *prev1, (x_res == LARGER))); } + // TODO EBEB minimal point can also be on left boundary where we have to call boundary-functors + return (m_geom_traits->compare_y_at_x_right_2_object() (*p_cv_curr, *p_cv_next, v_min->point()) == LARGER); } @@ -4335,8 +4365,6 @@ _remove_edge (DHalfedge *e, bool remove_source, bool remove_target) oc1->set_halfedge (prev1); // Notify the observers that a new outer CCB has been formed. - Ccb_halfedge_circulator hccb = (Halfedge_handle(he1->next()))->ccb(); - _notify_after_split_outer_ccb (Face_handle (f1), Halfedge_handle (he1->next())->ccb(), Halfedge_handle (prev1)->ccb()); diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h index 5a504443712..28c2223512d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arrangement_zone_2_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005, 2009 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -718,8 +718,8 @@ _is_to_left_impl(const Point_2& p, Halfedge_handle he, if (ps_y != ARR_INTERIOR) { // Check if p is to the left of the minimal curve-end: const Comparison_result res = - m_geom_traits->compare_x_near_boundary_2_object() (p, he->curve(), - ARR_MIN_END); + m_geom_traits->compare_x_point_curve_end_2_object() (p, he->curve(), + ARR_MIN_END); return ((res == SMALLER) || (res == EQUAL && ps_y == ARR_TOP_BOUNDARY)); } @@ -755,8 +755,8 @@ _is_to_right_impl(const Point_2& p, Halfedge_handle he, if (ps_y != ARR_INTERIOR) { // Check if p is to the right of the maximal curve-end: const Comparison_result res = - m_geom_traits->compare_x_near_boundary_2_object() (p, he->curve(), - ARR_MAX_END); + m_geom_traits->compare_x_point_curve_end_2_object() (p, he->curve(), + ARR_MAX_END); return ((res == LARGER) || (res == EQUAL && ps_y == ARR_BOTTOM_BOUNDARY)); } diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Open_hash.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Open_hash.h index fe121d521c1..c4e77f61497 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Open_hash.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Open_hash.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/arrangement_type_traits.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/arrangement_type_traits.h index 4095c48f7a3..04ccaddc121 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_2/arrangement_type_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_2/arrangement_type_traits.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2009,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h index 5273a5aac7a..4aa8428cbff 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2009 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -73,15 +73,15 @@ public: typedef Arr_traits_basic_adaptor_2 Traits_adaptor_2; // .. as it completes (potentially) missing side tags - typedef typename Traits_adaptor_2::Arr_left_side_category Arr_left_side_category; - typedef typename Traits_adaptor_2::Arr_bottom_side_category Arr_bottom_side_category; - typedef typename Traits_adaptor_2::Arr_top_side_category Arr_top_side_category; - typedef typename Traits_adaptor_2::Arr_right_side_category Arr_right_side_category; + typedef typename Traits_adaptor_2::Left_side_category Left_side_category; + typedef typename Traits_adaptor_2::Bottom_side_category Bottom_side_category; + typedef typename Traits_adaptor_2::Top_side_category Top_side_category; + typedef typename Traits_adaptor_2::Right_side_category Right_side_category; BOOST_MPL_ASSERT( (typename - Arr_sane_identified_tagging< Arr_left_side_category, Arr_bottom_side_category, - Arr_top_side_category, Arr_right_side_category >::result) + Arr_sane_identified_tagging< Left_side_category, Bottom_side_category, + Top_side_category, Right_side_category >::result) ); public: @@ -95,8 +95,8 @@ public: // maybe remove this in a future version (that supports complete handling // of all sides) typedef typename Arr_are_all_sides_oblivious_tag< - Arr_left_side_category, Arr_bottom_side_category, - Arr_top_side_category, Arr_right_side_category >::result + Left_side_category, Bottom_side_category, + Top_side_category, Right_side_category >::result Are_all_sides_oblivious_tag; public: @@ -656,10 +656,6 @@ public: Vertex() {} - /*! \deprecated Use is_at_open_boundary instead. */ - CGAL_DEPRECATED bool is_at_infinity() const - { return (Base::has_null_point()); } - /*! Check whether the vertex lies on an open boundary. */ bool is_at_open_boundary () const { @@ -1073,8 +1069,6 @@ protected: const Traits_adaptor_2 * m_geom_traits; // the geometry-traits adaptor. bool m_own_traits; // inidicates whether the geometry // traits should be freed up. - Arr_boundary_type m_boundary_types[4]; - public: /// \name Constructors. @@ -1654,62 +1648,43 @@ public: protected: - /// \name Allocating and de-allocating points and curves. + /// \name Determining the boundary-side conditions. //@{ - /*! Is one of the given x and y parameter spaces open? + /*! Determines whether a boundary-side categoty indicates an open side. + */ + inline bool is_open(Arr_boundary_side_tag) const { return false; } + inline bool is_open(Arr_open_side_tag) const { return true; } + + /*! Determines whether the given x and y parameter spaces are open. * These parameter spaces are typically associated with a particular curve * end. * \param ps_x The parameter space in x. * \param ps_y The parameter space in y. */ - inline bool is_open(Arr_parameter_space ps_x, Arr_parameter_space ps_y) - const + inline bool is_open(Arr_parameter_space ps_x, Arr_parameter_space ps_y) const { return - (((ps_x != ARR_INTERIOR) && (m_boundary_types[ps_x] == ARR_OPEN)) || - ((ps_y != ARR_INTERIOR) && (m_boundary_types[ps_y] == ARR_OPEN))); - } + (((ps_x == ARR_LEFT_BOUNDARY) && is_open(Left_side_category())) || + ((ps_x == ARR_RIGHT_BOUNDARY) && is_open(Right_side_category())) || + ((ps_y == ARR_BOTTOM_BOUNDARY) && is_open(Bottom_side_category())) || + ((ps_y == ARR_TOP_BOUNDARY) && is_open(Top_side_category()))); - /*! Initialize the boundary_types array */ - inline void init_boundary_types() - { - init_boundary_side(ARR_LEFT_BOUNDARY, Arr_left_side_category()); - init_boundary_side(ARR_BOTTOM_BOUNDARY, Arr_bottom_side_category()); - init_boundary_side(ARR_TOP_BOUNDARY, Arr_top_side_category()); - init_boundary_side(ARR_RIGHT_BOUNDARY, Arr_right_side_category()); } - /*! Initialize the boundary_types array */ - void init_boundary_side(Arr_parameter_space ps, Arr_oblivious_side_tag) - { - m_boundary_types[ps] = ARR_OBLIVIOUS; - } - - /*! Initialize the boundary_types array */ - void init_boundary_side(Arr_parameter_space ps, Arr_open_side_tag) - { - m_boundary_types[ps] = ARR_OPEN; - } + /*! Determines whether a boundary-side categoty indicates a constracted side. + */ + inline bool is_contracted(Arr_boundary_side_tag) const { return false; } + inline bool is_contracted(Arr_contracted_side_tag) const { return true; } - /*! Initialize the boundary_types array */ - void init_boundary_side(Arr_parameter_space ps, Arr_closed_side_tag) - { - m_boundary_types[ps] = ARR_CLOSED; - } - - /*! Initialize the boundary_types array */ - void init_boundary_side(Arr_parameter_space ps, Arr_contracted_side_tag) - { - m_boundary_types[ps] = ARR_CONTRACTION; - } - - /*! Initialize the boundary_types array */ - void init_boundary_side(Arr_parameter_space ps, - Arr_identified_side_tag) - { - m_boundary_types[ps] = ARR_IDENTIFICATION; - } + /*! Determines whether a boundary-side categoty indicates a constracted side. + */ + inline bool is_identified(Arr_boundary_side_tag) const { return false; } + inline bool is_identified(Arr_identified_side_tag) const { return true; } + //@} + + /// \name Allocating and de-allocating points and curves. + //@{ /*! Allocate a new point. */ Point_2 *_new_point (const Point_2& pt) diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_with_history_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_with_history_2.h index b3a37b32e0a..2761413dc14 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_with_history_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_on_surface_with_history_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_with_history_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_with_history_2.h index 645f4dbcabf..2150b8e0e3a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_with_history_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_with_history_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h b/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h index caafc4c7103..c68fd1e55b8 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arrangement_zone_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -66,15 +66,15 @@ protected: typedef Arr_traits_adaptor_2 Traits_adaptor_2; - typedef typename Traits_adaptor_2::Arr_left_side_category Arr_left_side_category; - typedef typename Traits_adaptor_2::Arr_bottom_side_category Arr_bottom_side_category; - typedef typename Traits_adaptor_2::Arr_top_side_category Arr_top_side_category; - typedef typename Traits_adaptor_2::Arr_right_side_category Arr_right_side_category; + typedef typename Traits_adaptor_2::Left_side_category Left_side_category; + typedef typename Traits_adaptor_2::Bottom_side_category Bottom_side_category; + typedef typename Traits_adaptor_2::Top_side_category Top_side_category; + typedef typename Traits_adaptor_2::Right_side_category Right_side_category; BOOST_MPL_ASSERT( (typename - Arr_sane_identified_tagging< Arr_left_side_category, Arr_bottom_side_category, - Arr_top_side_category, Arr_right_side_category >::result) + Arr_sane_identified_tagging< Left_side_category, Bottom_side_category, + Top_side_category, Right_side_category >::result) ); public: @@ -89,12 +89,13 @@ public: typedef typename Geometry_traits_2::Point_2 Point_2; typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2; + typedef typename Geometry_traits_2::Multiplicity Multiplicity; protected: typedef typename Arr_are_all_sides_oblivious_tag< - Arr_left_side_category, Arr_bottom_side_category, - Arr_top_side_category, Arr_right_side_category >::result + Left_side_category, Bottom_side_category, + Top_side_category, Right_side_category >::result Are_all_sides_oblivious_tag; typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; @@ -102,7 +103,7 @@ protected: typedef typename Arrangement_2::Face_const_handle Face_const_handle; // Types used for caching intersection points: - typedef std::pair Intersect_point_2; + typedef std::pair Intersect_point_2; typedef std::list Intersect_list; typedef std::map Intersect_map; 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 57c257974b3..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2005, 2009 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -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 @@ -96,22 +100,22 @@ public: typedef typename Traits_adaptor_2::Point_2 Point_2; typedef typename Traits_adaptor_2::X_monotone_curve_2 X_monotone_curve_2; - typedef typename Traits_adaptor_2::Arr_left_side_category Arr_left_side_category; - typedef typename Traits_adaptor_2::Arr_bottom_side_category Arr_bottom_side_category; - typedef typename Traits_adaptor_2::Arr_top_side_category Arr_top_side_category; - typedef typename Traits_adaptor_2::Arr_right_side_category Arr_right_side_category; + typedef typename Traits_adaptor_2::Left_side_category Left_side_category; + typedef typename Traits_adaptor_2::Bottom_side_category Bottom_side_category; + typedef typename Traits_adaptor_2::Top_side_category Top_side_category; + typedef typename Traits_adaptor_2::Right_side_category Right_side_category; BOOST_MPL_ASSERT( (typename - Arr_sane_identified_tagging< Arr_left_side_category, Arr_bottom_side_category, - Arr_top_side_category, Arr_right_side_category >::result) + Arr_sane_identified_tagging< Left_side_category, Bottom_side_category, + Top_side_category, Right_side_category >::result) ); protected: typedef typename Arr_are_all_sides_oblivious_tag< - Arr_left_side_category, Arr_bottom_side_category, - Arr_top_side_category, Arr_right_side_category >::result + Left_side_category, Bottom_side_category, + Top_side_category, Right_side_category >::result Are_all_sides_oblivious_tag; public: diff --git a/Arrangement_on_surface_2/include/CGAL/CORE_algebraic_number_traits.h b/Arrangement_on_surface_2/include/CGAL/CORE_algebraic_number_traits.h index 00a1a2d6a95..05e99924158 100644 --- a/Arrangement_on_surface_2/include/CGAL/CORE_algebraic_number_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/CORE_algebraic_number_traits.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h index ae8e24c0fb1..4a793cb0191 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2010 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2007,2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or @@ -934,6 +934,59 @@ public: //! \name Predicates //!@{ + /*! + * Compare the relative x-limits of a vertical line at an interior point + * and the arc's end on a bottom or top boundary + * + * \param p A reference point; we refer to a vertical line incident to p. + * \param ce ARR_MIN_END if we refer to the arc's minimal end, + * ARR_MAX_END if we refer to its maximal end. + * \return CGAL::SMALLER if p lies to the left of the arc; + * CGAL::LARGER if p lies to the right of the arc; + * CGAL::EQUAL in case of an overlap. + * + * \pre the arc's relevant end is on bottom or top boundary + */ + CGAL::Comparison_result compare_x_at_limit( + CGAL::Arr_curve_end ce, + const Point_2& p + ) const { + + CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_at_limit_2, + compare_x_at_limit_2) + CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this)); + return compare_x_at_limit_2( + p, *dynamic_cast< const Kernel_arc_2* >(this), ce + ); + } + + + /*!\brief + * Compare the relative x-limits of the curve end of \c *this + * and \c cv2 + * \param ce1 ARR_MIN_END if we refer to this' minimal end, + * ARR_MAX_END if we refer to this' maximal end. + * \param cv2 The second curve. + * \param ce2 ARR_MIN_END if we refer to its minimal end, + * ARR_MAX_END if we refer to its maximal end. + * \return CGAL::SMALLER if \c this lies to the left of cv2; + * CGAL::LARGER if \c this lies to the right of cv2; + * CGAL::EQUAL in case of an overlap. + * + * \pre the curve ends lie on the bottom or top boundary + */ + CGAL::Comparison_result compare_x_at_limit( + CGAL::Arr_curve_end ce1, + const Kernel_arc_2& cv2, CGAL::Arr_curve_end ce2) const { + + CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_at_limit_2, + compare_x_at_limit_2) + CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this)); + return compare_x_at_limit_2( + *dynamic_cast< const Kernel_arc_2* >(this), ce1, cv2, ce2 + ); + } + /*! * Compare the relative x-positions of an interior point * and the arc's end on a bottom or top boundary @@ -947,15 +1000,15 @@ public: * * \pre the arc's relevant end is on bottom or top boundary */ - CGAL::Comparison_result compare_x_near_boundary( + CGAL::Comparison_result compare_x_near_limit( CGAL::Arr_curve_end ce, const Point_2& p ) const { - CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_near_boundary_2, - compare_x_near_boundary_2) + CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_near_limit_2, + compare_x_near_limit_2) CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this)); - return compare_x_near_boundary_2( + return compare_x_near_limit_2( p, *dynamic_cast< const Kernel_arc_2* >(this), ce ); } @@ -974,16 +1027,13 @@ public: * * \pre the curve ends lie on the bottom or top boundary */ - CGAL::Comparison_result compare_x_near_boundary( - CGAL::Arr_curve_end ce1, - const Kernel_arc_2& cv2, CGAL::Arr_curve_end ce2) const { + CGAL::Comparison_result compare_x_near_limit(const Kernel_arc_2& cv2, + CGAL::Arr_curve_end ce) const { - CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_near_boundary_2, - compare_x_near_boundary_2) + CGAL_CKvA_2_GRAB_CK_FUNCTOR_FOR_ARC(Compare_x_near_limit_2, + compare_x_near_limit_2) CGAL_precondition(dynamic_cast< const Kernel_arc_2* >(this)); - return compare_x_near_boundary_2( - *dynamic_cast< const Kernel_arc_2* >(this), ce1, cv2, ce2 - ); + return compare_x_near_limit_2(*dynamic_cast< const Kernel_arc_2* >(this), cv2, ce); } /*!\brief @@ -3183,9 +3233,23 @@ public: bool operator == (const Kernel_arc_2& arc2) const { return is_equal(arc2); } + +#if defined(_MSC_VER) + // befriending the kernel point + friend typename Curved_kernel_via_analysis_2::Point_2; + + // befriending the kernel arc + friend typename Curved_kernel_via_analysis_2::Arc_2; + + // befriending the functors +#define CGAL_BEFRIEND_CKvA_2_FUNCTOR(Z) \ + friend typename Curved_kernel_via_analysis_2::Z; \ + friend typename Curved_kernel_via_analysis_2_Functors:: \ + Z +#else // befriending the kernel point friend class Curved_kernel_via_analysis_2::Point_2; - + // befriending the kernel arc friend class Curved_kernel_via_analysis_2::Arc_2; @@ -3193,34 +3257,36 @@ public: #define CGAL_BEFRIEND_CKvA_2_FUNCTOR(Z) \ friend class Curved_kernel_via_analysis_2::Z; \ friend class Curved_kernel_via_analysis_2_Functors:: \ - Z; - + Z +#endif + //Curved_kernel_via_analysis_2_functors< // Curved_kernel_via_analysis_2> >; - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Construct_arc_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Is_vertical_2) + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Construct_arc_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Is_vertical_2); - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Construct_min_vertex_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Construct_max_vertex_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_y_at_x_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_y_at_x_left_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_y_at_x_right_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Is_in_x_range_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Equal_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Do_overlap_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Intersect_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Trim_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Split_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Are_mergeable_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Merge_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Is_on_2) + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Construct_min_vertex_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Construct_max_vertex_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_y_at_x_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_y_at_x_left_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_y_at_x_right_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Is_in_x_range_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Equal_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Do_overlap_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Intersect_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Trim_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Split_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Are_mergeable_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Merge_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Is_on_2); - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Parameter_space_in_x_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_y_near_boundary_2) + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Parameter_space_in_x_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_y_near_boundary_2); - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Parameter_space_in_y_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_x_near_boundary_2) + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Parameter_space_in_y_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_x_at_limit_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_x_near_limit_2); #undef CGAL_BEFRIEND_CKvA_2_FUNCTOR @@ -3229,7 +3295,7 @@ private: // type of CurveSweepTraits model typedef CGAL::Sweep_curves_adapter_2< Curved_kernel_via_analysis_2 > SCA_2; // befriend segment for Self::_intersection_points - friend struct internal::Generic_arc_2; + friend class internal::Generic_arc_2; /* // befriend all functors diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curve_interval_arcno_cache.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curve_interval_arcno_cache.h index 192da5ec925..ac3e72ec1dc 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curve_interval_arcno_cache.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curve_interval_arcno_cache.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2007,2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h index 0050a9f622c..fceff291f5b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2008 Max-Planck-Institute Saarbruecken (Germany). +// Copyright (c) 2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h index 08bfef30416..1fe873c8e40 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_functors.h @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2008 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2007,2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or @@ -2081,23 +2081,75 @@ public: result_type operator()(const Arc_2& cv1, const Arc_2& cv2, CGAL::Arr_curve_end ce) const { - CERR("\ncompare_y_near_boundary; cv1: " << cv1 << "; cv2: " << - cv2 << "; end: " << ce << "\n"); - - CGAL::Arr_parameter_space loc1 = cv1.location(ce); - CGAL_precondition(cv1.is_on_left_right(loc1)); - CGAL_precondition(loc1 == cv2.location(ce)); - // comparing ids is the same as calling is_identical() ?? - if (cv1.id() == cv2.id()) { - CGAL::Comparison_result res = CGAL::EQUAL; - CERR("result: " << res << "\n"); - return res; - } - - // in this setting same handling as for +/-oo ? - CGAL::Comparison_result res = cv1._compare_arc_numbers(cv2, loc1); + CERR("\ncompare_y_near_boundary; cv1: " << cv1 << "; cv2: " << + cv2 << "; end: " << ce << "\n"); + + + CGAL::Comparison_result res = CGAL::EQUAL; + + CGAL::Arr_parameter_space loc1 = cv1.location(ce); + CGAL_precondition(cv1.is_on_left_right(loc1)); + CGAL_precondition(loc1 == cv2.location(ce)); + // comparing ids is the same as calling is_identical() ?? + if (cv1.id() == cv2.id()) { + CERR("result: " << res << "\n"); // EQUAL + return res; + } + + // both points lie on the left-right-identification, i.e., equalx + // TODO this interface is NOT official + CGAL::Object obj1 = + cv1.curve().asymptotic_value_of_arc(loc1, cv1.arcno()); + CGAL::Object obj2 = + cv2.curve().asymptotic_value_of_arc(loc1, cv2.arcno()); + + typename Point_2::Curved_kernel_via_analysis_2::Curve_kernel_2:: + Algebraic_real_1 y1, y2; + CGAL::Arr_parameter_space ps1, ps2; + + if (CGAL::assign(ps1, obj1)) { + if (CGAL::assign(ps2, obj2)) { + res = CGAL::EQUAL; + } else { + CGAL_assertion(CGAL::assign(y2, obj2)); + res = (ps1 == CGAL::ARR_BOTTOM_BOUNDARY ? + CGAL::SMALLER : CGAL::LARGER); + } + } else { + CGAL_assertion_code(bool check = ) + CGAL::assign(y1, obj1); + CGAL_assertion(check); + if (CGAL::assign(ps2, obj2)) { + res = (ps2 == CGAL::ARR_TOP_BOUNDARY ? + CGAL::SMALLER : CGAL::LARGER); + } else { + CGAL_assertion_code(bool check = ) + CGAL::assign(y2, obj2); + CGAL_assertion(check); + + // Remark: Is filtered + res = Base::_ckva()->kernel().compare_1_object()(y1, y2); + } + } + + if (res != EQUAL) { CERR("result: " << res << "\n"); return res; + } + + CGAL_precondition(cv1.is_on_left_right(loc1)); + CGAL_precondition(loc1 == cv2.location(ce)); + // comparing ids is the same as calling is_identical() ?? + if (cv1.id() == cv2.id()) { + CGAL::Comparison_result res = CGAL::EQUAL; + CERR("result: " << res << "\n"); + return res; + } + + // in this setting same handling as for +/-oo ? + res = cv1._compare_arc_numbers(cv2, loc1); + CERR("result: " << res << "\n"); + return res; } }; @@ -2160,11 +2212,12 @@ public: }; + /*!\brief - * Functor that compares x-coordinates near the top or bottom boundary + * Functor that compares x-limits at the top or bottom boundary */ template < class CurvedKernelViaAnalysis_2 > -class Compare_x_near_boundary_2 : public +class Compare_x_at_limit_2 : public Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { public: @@ -2183,12 +2236,12 @@ public: //! the arity of the functor - Compare_x_near_boundary_2(Curved_kernel_via_analysis_2 *kernel) : + Compare_x_at_limit_2(Curved_kernel_via_analysis_2 *kernel) : Base(kernel) { } - /*!\brief Compare the x-coordinate of a point with the x-coordinate of - * an arcend near the boundary at bottom or top boundary + /*!\brief Compare the x-limit of a vertical with the x-limit of + * an arc end near the boundary at bottom or top boundary * * \param p the point direction. * \param cv the arc, the endpoint of which is compared. @@ -2206,12 +2259,13 @@ public: result_type operator()(const Point_2& p, const Arc_2& cv, CGAL::Arr_curve_end ce) const { - CERR("\ncompare_x_near_boundary: p: " << p << "\n cv: " << + + CERR("\ncompare_x_at_limit: p: " << p << "\n cv: " << cv << "; curve_end: " << ce << "\n"); // this curve end has boundary only in y CGAL_precondition(cv.is_on_bottom_top(cv.location(ce))); - if (cv.is_singular()) // the curve end goes to singularity => x-order + if (cv.is_singular()) // the curve end goes to contraction => x-order return CGAL::EQUAL; // doesn't matter CGAL::Comparison_result res = @@ -2219,21 +2273,11 @@ public: kernel().compare_1_object()( p.x(), cv.curve_end_x(ce) ); - // for vertical arcs equality of x-coordinates means overlapping - // in case of discontinuity => x-comparison is enough - if (res != CGAL::EQUAL || cv.is_vertical() || cv.is_on_disc()) { - CERR("result: " << res << "\n"); - return res; - } - - // look at the side from which the - // vertical asymptote is approached - res = (ce == CGAL::ARR_MIN_END ? CGAL::SMALLER : CGAL::LARGER); CERR("result: " << res << "\n"); return res; } - /*! Compare the x-coordinates of 2 arcs ends near the top or bottom + /*! Compare the x-limits of 2 arcs ends near the top or bottom * boundary of the parameter space * \param cv1 the first arc. * \param ce1 the first arc end indicator - @@ -2254,7 +2298,7 @@ public: result_type operator()(const Arc_2& cv1, CGAL::Arr_curve_end ce1, const Arc_2& cv2, CGAL::Arr_curve_end ce2) const { - CERR("\ncompare_x_near_boundary: cv1: " << cv1 << "\n cv2: " << + CERR("\ncompare_x_at_limit: cv1: " << cv1 << "\n cv2: " << cv2 << "; end1: " << ce1 << "; end2: " << ce2 << "\n"); /*CGAL::Arr_boundary_type bnd1 = boundary(end1), bnd2 = cv2.boundary(ce2);*/ @@ -2270,87 +2314,92 @@ public: implemented"); } - - CGAL::Comparison_result res; - if (cv1.is_singular() && cv1.is_singular()) { - if (loc1 < loc2) { - return CGAL::SMALLER; - } - if (loc1 > loc2) { - return CGAL::LARGER; - } - // both ends lie at the same singularity => need special handling - // but x-order doesn't matter - } else { // establish x-order - res = Curved_kernel_via_analysis_2::instance(). - kernel().compare_1_object()( - cv1.curve_end_x(ce1), - cv2.curve_end_x(ce2) - ); - // x-coordinate comparison is enough for these cases - // we assume that either both curve ends lie on disc or neither of - // them - if (res != CGAL::EQUAL || - (cv1.is_on_disc() && cv1.is_on_disc())) { - CERR("result: " << res << "\n"); - return res; - } - } - // now we either +/-oo case: ARR_MIN_END > vertical > ARR_MAX_END - // or both ends lie at the same singularity: these cases can be - // handled simultaneously - if (cv1.is_vertical()) { - if (!cv2.is_vertical()) { - return (ce2 == CGAL::ARR_MIN_END ? - CGAL::SMALLER : CGAL::LARGER); - } - // both are vertical - if (loc1 == loc2) { // both ends converge to the same infinity - return CGAL::EQUAL; - } - return (loc1 == CGAL::ARR_BOTTOM_BOUNDARY ? - CGAL::SMALLER : CGAL::LARGER); - } - - if (cv2.is_vertical()) { - return (ce1 == CGAL::ARR_MIN_END ? CGAL::LARGER : CGAL::SMALLER); - } - - // otherwise: both ends have asymptotic behaviour or singularity - if (ce1 == ce2) { // both ends approach asymptote from one side - - if(loc1 == loc2) { // need special y-comparison - Coordinate_1 x0(cv1.curve_end_x(ce1)); - res = cv1._compare_arc_numbers( - cv2, CGAL::ARR_INTERIOR, x0, - (ce1 == CGAL::ARR_MIN_END ? - CGAL::POSITIVE : CGAL::NEGATIVE) - ); - if ((ce1 == CGAL::ARR_MAX_END && - loc1 == CGAL::ARR_TOP_BOUNDARY) || - (ce1 == CGAL::ARR_MIN_END && - loc1 == CGAL::ARR_BOTTOM_BOUNDARY)) { - res = -res; - } - CERR("result: " << res << "\n"); - return res; - } - // else: order can be determined without y-comparison - //(loc1 == CGAL::ARR_BOTTOM_BOUNDARY ? CGAL::SMALLER : - res = CGAL::EQUAL; - //CGAL::LARGER); - CERR("result: " << res << "\n"); - return res; - } - // curve ends approach vertical asymptote (or singularity) from - // different sides => no comparisons required - res = (ce1 == CGAL::ARR_MIN_END ? CGAL::LARGER : CGAL::SMALLER); + CGAL::Comparison_result res = Curved_kernel_via_analysis_2::instance(). + kernel().compare_1_object()( + cv1.curve_end_x(ce1), + cv2.curve_end_x(ce2) + ); CERR("result: " << res << "\n"); return res; } }; +/*!\brief + * Functor that compares x-coordinates near the top or bottom boundary + */ +template < class CurvedKernelViaAnalysis_2 > +class Compare_x_near_limit_2 : public +Curved_kernel_via_analysis_2_functor_base< CurvedKernelViaAnalysis_2 > { + +public: + //! this instance' first template parameter + typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2; + + //! the base type + typedef + Curved_kernel_via_analysis_2_functor_base< Curved_kernel_via_analysis_2 > + Base; + + CGAL_CKvA_2_GRAB_BASE_FUNCTOR_TYPES + + //! the result type + typedef CGAL::Comparison_result result_type; + + //! the arity of the functor + + Compare_x_near_limit_2(Curved_kernel_via_analysis_2 *kernel) : + Base(kernel) { + } + + /*! Compare the x-coordinates of 2 arcs ends near the top or bottom + * boundary of the parameter space + * \param cv1 the first arc. + * \param cv2 the second arc. + * \param ce the arc end indicator - + * ARR_MIN_END - the minimal end of curves or + * ARR_MAX_END - the maximal end of curves. + * \return the second comparison result: + * SMALLER - x(cv1, ce) \< x(cv2, ce); + * EQUAL - x(cv1, ce) = x(cv2, ce); + * LARGER - x(cv1, ce) > x(cv2, ce). + * + * \pre the ce1 end of the arc cv1 lies on a boundary. + * \pre the ce2 end of the arc cv2 lies on a boundary. + * \pre both curve ends are on the same boundary + */ + result_type operator()(const Arc_2& cv1, const Arc_2& cv2, + CGAL::Arr_curve_end ce) const { + + CERR("\ncompare_x_near_limit: cv1: " << cv1 << "\n cv2: " << + cv2 << "; ce: " << ce << "\n"); + + CGAL::Arr_parameter_space + loc1 = cv1.location(ce), + loc2 = cv2.location(ce); + CGAL_precondition(cv1.is_on_bottom_top(loc1)); + CGAL_precondition(cv1.is_on_bottom_top(loc2)); + CGAL_precondition(cv1.compare_x_at_limit(ce, cv2, ce) == CGAL::EQUAL); + + CGAL_precondition(loc1 == loc2); + + Coordinate_1 x0(cv1.curve_end_x(ce)); + CGAL::Comparison_result res = cv1._compare_arc_numbers( + cv2, CGAL::ARR_INTERIOR, x0, + (ce == CGAL::ARR_MIN_END ? + CGAL::POSITIVE : CGAL::NEGATIVE) + ); + if ((ce == CGAL::ARR_MAX_END && + loc1 == CGAL::ARR_TOP_BOUNDARY) || + (ce == CGAL::ARR_MIN_END && + loc1 == CGAL::ARR_BOTTOM_BOUNDARY)) { + res = opposite(res); + } + CERR("result: " << res << "\n"); + return res; + } +}; + /*!\brief * Functor to construct a point on a curve @@ -2672,8 +2721,10 @@ public: // bottom-top CGAL_CKvA_2_functor_pred(Parameter_space_in_y_2, parameter_space_in_y_2_object); - CGAL_CKvA_2_functor_pred(Compare_x_near_boundary_2, - compare_x_near_boundary_2_object); + CGAL_CKvA_2_functor_pred(Compare_x_at_limit_2, + compare_x_at_limit_2_object); + CGAL_CKvA_2_functor_pred(Compare_x_near_limit_2, + compare_x_near_limit_2_object); CGAL_CKvA_2_functor_cons(X_extreme_points_2, x_extreme_points_2_object); CGAL_CKvA_2_functor_cons(Y_extreme_points_2, y_extreme_points_2_object); diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h index eb9d0323da2..9a26e0d6568 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Curved_kernel_via_analysis_2_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2008 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2007,2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or @@ -95,10 +95,10 @@ public: typedef CGAL::Tag_false Has_do_intersect_category; - typedef Arr_open_side_tag Arr_left_side_category; - typedef Arr_open_side_tag Arr_bottom_side_category; - typedef Arr_open_side_tag Arr_top_side_category; - typedef Arr_open_side_tag Arr_right_side_category; + typedef Arr_open_side_tag Left_side_category; + typedef Arr_open_side_tag Bottom_side_category; + typedef Arr_open_side_tag Top_side_category; + typedef Arr_open_side_tag Right_side_category; //!@} diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Fig_stream_Curve_renderer_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Fig_stream_Curve_renderer_2.h index d8356e847af..a2deb8a45a0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Fig_stream_Curve_renderer_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Fig_stream_Curve_renderer_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Filtered_curved_kernel_via_analysis_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Filtered_curved_kernel_via_analysis_2_impl.h index dcef4af1f80..2890c5d8f1c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Filtered_curved_kernel_via_analysis_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Filtered_curved_kernel_via_analysis_2_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2008 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or @@ -107,6 +107,10 @@ public: } }; + +// TODO implement Compare_y_limit_on_boundary_2 + + template < class CurvedKernelViaAnalysis_2, class FunctorBase > class Compare_y_near_boundary_2 : public FunctorBase::Compare_y_near_boundary_2 { diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_arc_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_arc_2.h index 7c04be9bde0..ab9f430e0bf 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_arc_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2008 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2007,2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_point_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_point_2.h index 27be92578da..1f2ef476770 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_point_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Generic_point_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2008 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2007,2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Make_x_monotone_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Make_x_monotone_2.h index 251c098ba6d..903f6fc2b6b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Make_x_monotone_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Make_x_monotone_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2008 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2007,2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Non_x_monotone_arc_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Non_x_monotone_arc_2.h index 9d18b79fa2e..214f8204083 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Non_x_monotone_arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Non_x_monotone_arc_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2008 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Point_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Point_2.h index c0b2ccc39ba..c9c233d1354 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Point_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Point_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2010 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2007,2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or @@ -784,13 +784,19 @@ public: // befriending the functors +#if defined(_MSC_VER) #define CGAL_BEFRIEND_CKvA_2_FUNCTOR(Z) \ - friend class Curved_kernel_via_analysis_2::Z; \ - friend class Curved_kernel_via_analysis_2_Functors::Z< Curved_kernel_via_analysis_2 >; + friend typename Curved_kernel_via_analysis_2::Z; \ + friend typename Curved_kernel_via_analysis_2_Functors::Z< Curved_kernel_via_analysis_2 > +#else +#define CGAL_BEFRIEND_CKvA_2_FUNCTOR(Z) \ + friend class Curved_kernel_via_analysis_2::Z; \ + friend class Curved_kernel_via_analysis_2_Functors::Z< Curved_kernel_via_analysis_2 > +#endif - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Construct_point_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_x_2) - CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_xy_2) + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Construct_point_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_x_2); + CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_xy_2); #undef CGAL_BEFRIEND_CKvA_2_FUNCTOR diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Qt_widget_Curve_renderer_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Qt_widget_Curve_renderer_2.h index 40e66b0dc08..3c60a765471 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Qt_widget_Curve_renderer_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Qt_widget_Curve_renderer_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2008 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Sweep_curves_adapter_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Sweep_curves_adapter_2.h index 772c1715d7a..713a4bb3581 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Sweep_curves_adapter_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Sweep_curves_adapter_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2008 Max-Planck-Institute Saarbruecken (Germany), +// Copyright (c) 2007,2008,2009,2010,2011 Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or @@ -117,12 +117,12 @@ public: return (loc1 == CGAL::ARR_LEFT_BOUNDARY ? CGAL::SMALLER : CGAL::LARGER); return (_m_adapter->kernel(). - compare_y_near_boundary_2_object()(arc, p2.arc(), end)); + compare_y_curve_ends_2_object()(arc, p2.arc(), end)); } // compare curve ends at +/-oo in y if(Native_arc_2::is_on_bottom_top(loc2)) { CGAL::Comparison_result res = (_m_adapter->kernel(). - compare_x_near_boundary_2_object() + compare_x_curve_ends_2_object() (arc, end, p2.arc(), p2.curve_end())); if(res == CGAL::EQUAL && end == p2.curve_end() && loc1 != loc2) { @@ -143,8 +143,6 @@ public: CGAL::SMALLER); else { // point is p1, arc is p2 - //res = _m_adapter->kernel(). - // compare_x_near_boundary_2_object()(pt, arc, end); // compares a finite point with a curve end at y=+/-oo: res = _m_adapter->kernel().kernel().compare_1_object() (pt.x(), arc.curve_end_x(end)); @@ -254,7 +252,7 @@ public: if(Native_arc_2::is_on_left_right(locp)) { CGAL_precondition(locp == cv.arc().location(end)); // compare two curve ends at +/-oo in x - return _m_adapter->kernel().compare_y_near_boundary_2_object() + return _m_adapter->kernel().compare_y_curve_ends_2_object() (p.arc(), cv.arc(), end); } // p.arc() has vertical asymptote; cases: @@ -295,7 +293,7 @@ public: // compare either two asymptotic ends or one vertical arc + asymptote // check whether result need to be reversed CGAL::Comparison_result res = - (_m_adapter->kernel().compare_x_near_boundary_2_object() + (_m_adapter->kernel().compare_x_curve_ends_2_object() (p.arc(), end, cv.arc(), end2)); if(locp == cv.arc().location(end2) && diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_traits.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_traits.h index 01edf0a0c3e..2503d229e9b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_traits.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_renderer_traits.h @@ -153,9 +153,9 @@ struct Curve_renderer_traits_base struct Rat_to_float { typedef Float result_type; - template - Float operator()(const Sqrt_extension& x) const { - typename CGAL::Coercion_traits, Float>::Cast + template + Float operator()(const Sqrt_extension& x) const { + typename CGAL::Coercion_traits, Float>::Cast cast; return cast(x); } @@ -502,9 +502,9 @@ struct Curve_renderer_traits struct Rat_to_float { typedef Float result_type; - template - Float operator()(const Sqrt_extension& x) const { - typename CGAL::Coercion_traits, Float>::Cast + template + Float operator()(const Sqrt_extension& x) const { + typename CGAL::Coercion_traits, Float>::Cast cast; return cast(x); } diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Arr_iostream.h b/Arrangement_on_surface_2/include/CGAL/IO/Arr_iostream.h index 4f15c231287..d180e551e24 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Arr_iostream.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Arr_iostream.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2007 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h b/Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h index 7894f849fec..d56874b8605 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Arr_text_formatter.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_2_reader.h b/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_2_reader.h index 1fc14f567f5..03f950c3bf1 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_2_reader.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_2_reader.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2007 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_2_writer.h b/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_2_writer.h index a45029e2c8f..adade33c4b3 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_2_writer.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_2_writer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2007 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_iostream.h b/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_iostream.h index efdcd0a7374..4b3411f878c 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_iostream.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_iostream.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2007 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_text_formatter.h b/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_text_formatter.h index 5da9e4c89d5..f2182747bdc 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_text_formatter.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Arr_with_history_text_formatter.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Arrangement_2_reader.h b/Arrangement_on_surface_2/include/CGAL/IO/Arrangement_2_reader.h index ff3026d88ca..d8848155cbc 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Arrangement_2_reader.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Arrangement_2_reader.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2007 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Arrangement_2_writer.h b/Arrangement_on_surface_2/include/CGAL/IO/Arrangement_2_writer.h index 7154c3cd3f0..6a40a9d5996 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Arrangement_2_writer.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Arrangement_2_writer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005-2007 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream.h b/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream.h index c32ed7e47f3..bdabe4c1a10 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream_Conic_arc_2.h b/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream_Conic_arc_2.h index c34f62667b8..7f1c7f5f698 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream_Conic_arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Fig_stream_Conic_arc_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Qt_widget_Conic_arc_2.h b/Arrangement_on_surface_2/include/CGAL/IO/Qt_widget_Conic_arc_2.h index 85b234f4975..90ba9fdaaac 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Qt_widget_Conic_arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Qt_widget_Conic_arc_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Qt_widget_Linear_object_2.h b/Arrangement_on_surface_2/include/CGAL/IO/Qt_widget_Linear_object_2.h index 77a42e6addd..1c9da9c81fb 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Qt_widget_Linear_object_2.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Qt_widget_Linear_object_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/IO/Qt_widget_Polyline_2.h b/Arrangement_on_surface_2/include/CGAL/IO/Qt_widget_Polyline_2.h index 3d6eb923994..6b908bc80aa 100644 --- a/Arrangement_on_surface_2/include/CGAL/IO/Qt_widget_Polyline_2.h +++ b/Arrangement_on_surface_2/include/CGAL/IO/Qt_widget_Polyline_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2.h index de789c54c40..08c9a32906b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h index d9bcc91cc04..845f7729f5e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_sl_visitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h index b55d87d2896..09ede1d7bf0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_basic_insertion_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -18,6 +18,7 @@ // Author(s) : Baruch Zukerman // Ron Wein // Efi Fogel +// Eric Berberich #ifndef CGAL_ARR_BASIC_INSERTION_TRAITS_2_H #define CGAL_ARR_BASIC_INSERTION_TRAITS_2_H @@ -60,18 +61,20 @@ public: typedef typename Traits_2::Equal_2 Base_equal_2; typedef typename Traits_2::Is_vertical_2 Base_is_vertical_2; + typedef typename Traits_2::Multiplicity Multiplicity; + typedef typename Traits_2::Has_do_intersect_category Has_do_intersect_category; - typedef typename internal::Arr_complete_left_side_tag< Traits_2 >::Tag - Arr_left_side_category; - typedef typename internal::Arr_complete_bottom_side_tag< Traits_2 >::Tag - Arr_bottom_side_category; - typedef typename internal::Arr_complete_top_side_tag< Traits_2 >::Tag - Arr_top_side_category; - typedef typename internal::Arr_complete_right_side_tag< Traits_2 >::Tag - Arr_right_side_category; + typedef typename internal::Arr_complete_left_side_category< Traits_2 >::Category + Left_side_category; + typedef typename internal::Arr_complete_bottom_side_category< Traits_2 >::Category + Bottom_side_category; + typedef typename internal::Arr_complete_top_side_category< Traits_2 >::Category + Top_side_category; + typedef typename internal::Arr_complete_right_side_category< Traits_2 >::Category + Right_side_category; /* Insertion is implemented as sweep-line visitor. The sweep-line algorithm * never uses Compare_y_at_x_left_2. @@ -177,7 +180,6 @@ public: typedef Ex_x_monotone_curve_2 X_monotone_curve_2; -#ifdef CGAL_SL_VERBOSE // For debugging purposes: friend std::ostream& operator<< (std::ostream& os, const X_monotone_curve_2& xcv) @@ -185,7 +187,6 @@ public: os << xcv.base(); return (os); } -#endif /*! * Nested extension of the point type. @@ -242,7 +243,6 @@ public: typedef Ex_point_2 Point_2; -#ifdef CGAL_SL_VERBOSE // For debugging purposes: friend std::ostream& operator<< (std::ostream& os, const Point_2& pt) @@ -250,7 +250,6 @@ public: os << pt.base(); return (os); } -#endif /*! A functor that obtains the left endpoint of an x-monotone curve. */ class Construct_min_vertex_2 { @@ -614,7 +613,86 @@ public: return Parameter_space_in_x_2 (m_base_traits); } - /*! A functor that compares the y-coordinates of curve ends near the + /*! A function object that determines whether an x-monotone curve or a + * point coincide with the vertical identification curve. + */ + class Is_on_x_identification_2 { + protected: + //! The base traits. + const Traits_2 * m_base; + + /*! Constructor. + * \param tr The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Is_on_x_identification_2 (const Traits_2 * tr) : m_base(tr) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_basic_insertion_traits_2; + + public: + bool operator()(const Point_2 & p) const + { + return m_base->is_on_x_identification_2_object() (p.base()); + } + + bool operator()(const X_monotone_curve_2 & xcv) const + { + return m_base->is_on_x_identification_2_object() (xcv.base()); + } + + }; + + /*! Obtain a Is_on_x_identification_2 function object */ + Is_on_x_identification_2 is_on_x_identification_2_object () const + { + return Is_on_x_identification_2 (m_base_traits); + } + + /*! A functor that compares the y-coordinates of two points on vertical + * boundaries. + */ + class Compare_y_on_boundary_2 + { + protected: + //! The base traits. + const Traits_2 * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_y_on_boundary_2 (const Traits_2 * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_basic_insertion_traits_2; + + public: + /*! Use tag dispatching to avoid compilation errors in case the functor + * is not defined + */ + Comparison_result operator() (const Point_2 & p1, + const Point_2 & p2) const + { + return m_base->compare_y_on_boundary_2_object()(p1.base(), p2.base()); + } + + }; + + /*! Obtain a Compare_y_on_boundary_2 object + */ + Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const + { + return Compare_y_on_boundary_2(m_base_traits); + } + + /*! A functor that compares the y-coordinates of curve ends near the * boundary of the parameter space. */ class Compare_y_near_boundary_2 { @@ -655,47 +733,6 @@ public: return Compare_y_near_boundary_2 (m_base_traits); } - /*! A functor that compares the y-coordinates of two points on vertical - * boundaries. - */ - class Compare_y_on_boundary_2 - { - protected: - //! The base traits. - const Traits_2 * m_base; - - /*! Constructor. - * \param base The base traits class. It must be passed, to handle non - * stateless traits objects, (which stores data). - * The constructor is declared private to allow only the functor - * obtaining function, which is a member of the nesting class, - * constructing it. - */ - Compare_y_on_boundary_2 (const Traits_2 * base) : m_base(base) {} - - //! Allow its functor obtaining function calling the private constructor. - friend class Arr_basic_insertion_traits_2; - - public: - /*! Use tag dispatching to avoid compilation errors in case the functor - * is not defined - */ - Comparison_result operator() (const Point_2 & p1, - const Point_2 & p2) const - { - return m_base->compare_y_on_boundary_2_object()(p1.base(), p2.base()); - } - - }; - - /*! Obtain a Compare_y_on_boundary_2 object - */ - Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const - { - return Compare_y_on_boundary_2(m_base_traits); - } - - // TODO Is_on_x_identification_2 // bottom-top @@ -745,10 +782,49 @@ public: return Parameter_space_in_y_2 (m_base_traits); } - /*! A functor that compares the x-coordinates of curve ends near the + /*! A function object that determines whether an x-monotone curve or a + * point coincide with the horizontal identification curve. + */ + class Is_on_y_identification_2 { + protected: + //! The base traits. + const Traits_2 * m_base; + + /*! Constructor. + * \param tr The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Is_on_y_identification_2 (const Traits_2 * tr) : m_base(tr) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_basic_insertion_traits_2; + + public: + bool operator()(const Point_2 & p) const + { + return m_base->is_on_y_identification_2_object() (p.base()); + } + + bool operator()(const X_monotone_curve_2 & xcv) const + { + return m_base->is_on_y_identification_2_object() (xcv.base()); + } + + }; + + /*! Obtain a Is_on_y_identification_2 function object */ + Is_on_y_identification_2 is_on_y_identification_2_object () const + { + return Is_on_y_identification_2 (m_base_traits); + } + + /*! A functor that compares the x-limits of curve ends on the * boundary of the parameter space. */ - class Compare_x_near_boundary_2 { + class Compare_x_at_limit_2 { protected: //! The base traits. const Traits_2 * m_base; @@ -760,7 +836,7 @@ public: * obtaining function, which is a member of the nesting class, * constructing it. */ - Compare_x_near_boundary_2 (const Traits_2 * base) : m_base(base) {} + Compare_x_at_limit_2 (const Traits_2 * base) : m_base(base) {} //! Allow its functor obtaining function calling the private constructor. friend class Arr_basic_insertion_traits_2; @@ -774,8 +850,8 @@ public: Arr_curve_end ce) const { - return m_base->compare_x_near_boundary_2_object() (p.base(), - xcv.base(), ce); + return m_base->compare_x_at_limit_2_object() (p.base(), + xcv.base(), ce); } /*! Use tag dispatching to avoid compilation errors in case the functor @@ -786,17 +862,60 @@ public: const X_monotone_curve_2 & xcv2, Arr_curve_end ce2) const { - return m_base->compare_x_near_boundary_2_object() (xcv1.base(), ce1, - xcv2.base(), ce2); + return m_base->compare_x_at_limit_2_object() (xcv1.base(), ce1, + xcv2.base(), ce2); } }; - /*! Obtain a Compare_x_near_boundary_2 object + /*! Obtain a Compare_x_at_limit_2 object */ - Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const + Compare_x_at_limit_2 compare_x_at_limit_2_object() const { - return Compare_x_near_boundary_2(m_base_traits); + return Compare_x_at_limit_2(m_base_traits); + } + + + /*! A functor that compares the x-coordinates of curve ends near the + * boundary of the parameter space. + */ + class Compare_x_near_limit_2 { + protected: + //! The base traits. + const Traits_2 * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_near_limit_2 (const Traits_2 * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_basic_insertion_traits_2; + + public: + + /*! Use tag dispatching to avoid compilation errors in case the functor + * is not defined + */ + Comparison_result operator() (const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + return m_base->compare_x_near_limit_2_object() (xcv1.base(), xcv2.base(), + ce); + } + + }; + + /*! Obtain a Compare_x_near_limit_2 object + */ + Compare_x_near_limit_2 compare_x_near_limit_2_object() const + { + return Compare_x_near_limit_2(m_base_traits); } /*! A functor that compares the x-coordinates of two points on vertical @@ -830,6 +949,24 @@ public: return m_base->compare_x_on_boundary_2_object()(p1.base(), p2.base()); } + /*! Use tag dispatching to avoid compilation errors in case the functor + * is not defined + */ + Comparison_result operator() (const Point_2 & pt, + const X_monotone_curve_2& xcv, Arr_curve_end ce) const + { + return m_base->compare_x_on_boundary_2_object()(pt.base(), xcv.base(), ce); + } + + /*! Use tag dispatching to avoid compilation errors in case the functor + * is not defined + */ + Comparison_result operator() (const X_monotone_curve_2& xcv1, Arr_curve_end ce1, + const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const + { + return m_base->compare_x_on_boundary_2_object()(xcv1.base(), ce1, xcv2.base(), ce2); + } + }; /*! Obtain a Compare_x_on_boundary_2 object @@ -839,7 +976,47 @@ public: return Compare_x_on_boundary_2(m_base_traits); } - // TODO Is_on_y_identification_2 + /*! A functor that compares the x-coordinates of curve ends near the + * boundary of the parameter space. + */ + class Compare_x_near_boundary_2 { + protected: + //! The base traits. + const Traits_2 * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle non + * stateless traits objects, (which stores data). + * The constructor is declared private to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_near_boundary_2 (const Traits_2 * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the private constructor. + friend class Arr_basic_insertion_traits_2; + + public: + + /*! Use tag dispatching to avoid compilation errors in case the functor + * is not defined + */ + Comparison_result operator() (const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + return m_base->compare_x_near_boundary_2_object() (xcv1.base(), xcv2.base(), + ce); + } + + }; + + /*! Obtain a Compare_x_near_boundary_2 object + */ + Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const + { + return Compare_x_near_boundary_2(m_base_traits); + } }; diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h index b67b61260e2..5f8e867468d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_batched_pl_sl_visitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_event.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_event.h index d2368d24c5e..2311c2468cb 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_event.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_event.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under 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 76d43b11590..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 @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -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); diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_subcurve.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_subcurve.h index 0c282264f17..d09ae5f8029 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_subcurve.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_subcurve.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h index 8ff9a82969c..9efe515ad07 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_default_overlay_traits_base.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h index 03075d57898..e5892428343 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_insertion_sl_visitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_insertion_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_insertion_traits_2.h index da3671c9bad..11cb3328f1c 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_insertion_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_insertion_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -50,15 +50,16 @@ public: typedef typename Base::Halfedge_handle Halfedge_handle; typedef typename Base::Base_point_2 Base_point_2; typedef typename Base::Point_2 Point_2; + typedef typename Base::Multiplicity Multiplicity; typedef typename Base::Has_left_category Has_left_category; typedef typename Base::Has_do_intersect_category Has_do_intersect_category; // should be ok, as basic_insertion (=Base) completes incomplete tags - typedef typename Base::Arr_left_side_category Arr_left_side_category; - typedef typename Base::Arr_bottom_side_category Arr_bottom_side_category; - typedef typename Base::Arr_top_side_category Arr_top_side_category; - typedef typename Base::Arr_right_side_category Arr_right_side_category; + typedef typename Base::Left_side_category Left_side_category; + typedef typename Base::Bottom_side_category Bottom_side_category; + typedef typename Base::Top_side_category Top_side_category; + typedef typename Base::Right_side_category Right_side_category; /* Insertion is implemented as sweep-line visitor. The sweep-line algorithm * never performs merging of curves. Therefore, AreMergeable_2 and diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h index 2e9b5646ba8..f4c7f78610e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_sl_visitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_subcurve.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_subcurve.h index a09a339a4a6..ce192d93e13 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_subcurve.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_subcurve.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h index 4408d7e81d4..02bd3a81618 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_overlay_traits_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -65,6 +65,7 @@ public: typedef typename Traits_2::X_monotone_curve_2 Base_x_monotone_curve_2; typedef typename Traits_2::Point_2 Base_point_2; + typedef typename Traits_2::Multiplicity Multiplicity; typedef typename Traits_2::Compare_x_2 Base_compare_x_2; typedef typename Traits_2::Compare_xy_2 Base_compare_xy_2; @@ -80,14 +81,14 @@ public: typedef typename Traits_2::Has_do_intersect_category Has_do_intersect_category; - typedef typename internal::Arr_complete_left_side_tag< Traits_2 >::Tag - Arr_left_side_category; - typedef typename internal::Arr_complete_bottom_side_tag< Traits_2 >::Tag - Arr_bottom_side_category; - typedef typename internal::Arr_complete_top_side_tag< Traits_2 >::Tag - Arr_top_side_category; - typedef typename internal::Arr_complete_right_side_tag< Traits_2 >::Tag - Arr_right_side_category; + typedef typename internal::Arr_complete_left_side_category< Traits_2 >::Category + Left_side_category; + typedef typename internal::Arr_complete_bottom_side_category< Traits_2 >::Category + Bottom_side_category; + typedef typename internal::Arr_complete_top_side_category< Traits_2 >::Category + Top_side_category; + typedef typename internal::Arr_complete_right_side_category< Traits_2 >::Category + Right_side_category; /* Overlay is implemented as sweep-line visitor. The sweep-line algorithm * never uses Compare_y_at_x_left_2, and it never performs merging of curves. @@ -244,7 +245,7 @@ public: typedef Ex_x_monotone_curve_2 X_monotone_curve_2; -#ifdef CGAL_SL_VERBOSE + // For debugging purposes: friend std::ostream& operator<< (std::ostream& os, const X_monotone_curve_2& xcv) @@ -252,7 +253,7 @@ public: os << xcv.base(); return (os); } -#endif + /*! \class * Nested extension of the point type. @@ -356,7 +357,7 @@ public: typedef Ex_point_2 Point_2; -#ifdef CGAL_SL_VERBOSE + // For debugging purposes: friend std::ostream& operator<< (std::ostream& os, const Point_2& pt) @@ -364,7 +365,7 @@ public: os << pt.base(); return (os); } -#endif + /*! A functor that computes intersections between x-monotone curves. */ class Intersect_2 { @@ -988,7 +989,88 @@ public: }; - /*! A functor that compares the y-coordinates of curve ends near the + /*! Obtain an Parameter_space_in_x_2 functor object. */ + Parameter_space_in_x_2 parameter_space_in_x_2_object () const + { + return Parameter_space_in_x_2 (m_base_traits); + } + + /*! A function object that determines whether an x-monotone curve or a + * point coincide with the vertical identification curve. + */ + class Is_on_x_identification_2 { + protected: + //! The base traits. + const Traits_2 * m_base; + + /*! Constructor. + * The constructor is declared protected to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Is_on_x_identification_2 (const Traits_2 * tr) : m_base (tr) {} + + //! Allow its functor obtaining function calling the protected constructor. + friend class Arr_overlay_traits_2; + + public: + Arr_parameter_space operator() (const Point_2 & p) const + { + return m_base->is_on_x_identification_2_object() (p.base()); + } + + Arr_parameter_space operator() (const X_monotone_curve_2 & xcv) const + { + return m_base->is_on_x_identification_2_object() (xcv.base()); + } + + }; + + /*! Obtain an Is_on_x_identification_2 functor object. */ + Is_on_x_identification_2 is_on_x_identification_2_object () const + { + return Is_on_x_identification_2 (m_base_traits); + } + + /*! A functor that compares the y-values of pointss on the + * boundary of the parameter space. + */ + class Compare_y_on_boundary_2 { + protected: + //! The base traits. + const Traits_2 * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle the + * case it is not stateless (e.g., it stores data). + * The constructor is declared protected to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_y_on_boundary_2(const Traits_2 * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the protected constructor. + friend class Arr_overlay_traits_2; + + public: + Comparison_result operator() (const Point_2 & pt1, + const Point_2 & pt2) const + { + return m_base->compare_y_on_boundary_2_object()(pt1.base(), pt2.base()); + } + }; + + /*! Obtain a Compare_y_on_boundary_2 functor. */ + Compare_y_on_boundary_2 compare_y_on_boundary_2_object () const + { + return Compare_y_on_boundary_2(m_base_traits); + } + + /*! A functor that compares the y-coordinates of curve ends near the * boundary of the parameter space. */ class Compare_y_near_boundary_2 { @@ -1028,17 +1110,9 @@ public: return Compare_y_near_boundary_2(m_base_traits); } - // TODO Compare_y_on_boundary_2 - // TODO Is_on_x_identification_2 // bottom-top - /*! Obtain an Parameter_space_in_x_2 functor object. */ - Parameter_space_in_x_2 parameter_space_in_x_2_object () const - { - return Parameter_space_in_x_2 (m_base_traits); - } - /*! A functor that determines whether an endpoint of an x-monotone arc lies * on a boundary of the parameter space along the y axis. */ @@ -1084,6 +1158,182 @@ public: return (Parameter_space_in_y_2 (m_base_traits)); } + /*! A function object that determines whether an x-monotone curve or a + * point coincide with the vertical identification curve. + */ + class Is_on_y_identification_2 { + protected: + //! The base traits. + const Traits_2 * m_base; + + /*! Constructor. + * The constructor is declared protected to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Is_on_y_identification_2 (const Traits_2 * tr) : m_base (tr) {} + + //! Allow its functor obtaining function calling the protected constructor. + friend class Arr_overlay_traits_2; + + public: + Arr_parameter_space operator() (const Point_2 & p) const + { + return m_base->is_on_y_identification_2_object() (p.base()); + } + + Arr_parameter_space operator() (const X_monotone_curve_2 & xcv) const + { + return m_base->is_on_y_identification_2_object() (xcv.base()); + } + + }; + + /*! Obtain an Is_on_y_identification_2 functor object. */ + Is_on_y_identification_2 is_on_y_identification_2_object () const + { + return Is_on_y_identification_2 (m_base_traits); + } + + /*! A functor that compares the x-limits of curve ends on the + * boundary of the parameter space. + */ + class Compare_x_at_limit_2 { + protected: + //! The base traits. + const Traits_2 * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle the + * case it is not stateless (e.g., it stores data). + * The constructor is declared protected to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_at_limit_2(const Traits_2 * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the protected constructor. + friend class Arr_overlay_traits_2; + + public: + Comparison_result operator()(const Point_2 & p, + const X_monotone_curve_2 & xcv, + Arr_curve_end ce) const + { + return m_base->compare_x_at_limit_2_object()(p.base(), + xcv.base(), ce); + } + + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + Arr_curve_end ce1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce2) const + { + return m_base->compare_x_at_limit_2_object()(xcv1.base(), ce1, + xcv2.base(), ce2); + } + + }; + + /*! Obtain a Compare_x_at_limit_2 functor. */ + Compare_x_at_limit_2 compare_x_at_limit_2_object () const + { + return Compare_x_at_limit_2(m_base_traits); + } + + /*! A functor that compares the x-coordinates of curve ends near the + * boundary of the parameter space. + */ + class Compare_x_near_limit_2 { + protected: + //! The base traits. + const Traits_2 * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle the + * case it is not stateless (e.g., it stores data). + * The constructor is declared protected to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_near_limit_2(const Traits_2 * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the protected constructor. + friend class Arr_overlay_traits_2; + + public: + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, + Arr_curve_end ce) const + { + return m_base->compare_x_near_limit_2_object()(xcv1.base(), + xcv2.base(), + ce); + } + + }; + + /*! Obtain a Compare_x_near_limit_2 functor. */ + Compare_x_near_limit_2 compare_x_near_limit_2_object () const + { + return Compare_x_near_limit_2(m_base_traits); + } + + /*! A functor that compares the y-values of pointss on the + * boundary of the parameter space. + */ + class Compare_x_on_boundary_2 { + protected: + //! The base traits. + const Traits_2 * m_base; + + /*! Constructor. + * \param base The base traits class. It must be passed, to handle the + * case it is not stateless (e.g., it stores data). + * The constructor is declared protected to allow only the functor + * obtaining function, which is a member of the nesting class, + * constructing it. + */ + Compare_x_on_boundary_2(const Traits_2 * base) : m_base(base) {} + + //! Allow its functor obtaining function calling the protected constructor. + friend class Arr_overlay_traits_2; + + public: + Comparison_result operator() (const Point_2 & pt1, + const Point_2 & pt2) const + { + return m_base->compare_x_on_boundary_2_object()(pt1.base(), pt2.base()); + } + + Comparison_result operator() (const Point_2 & pt, + const X_monotone_curve_2& xcv, Arr_curve_end ce) const + { + return m_base->compare_x_on_boundary_2_object()(pt.base(), xcv.base(), ce); + } + + Comparison_result operator() (const X_monotone_curve_2& xcv1, Arr_curve_end ce1, + const X_monotone_curve_2& xcv2, Arr_curve_end ce2) const + { + return m_base->compare_x_on_boundary_2_object()(xcv1.base(), ce1, xcv2.base(), ce2); + } + + }; + + /*! Obtain a Compare_x_on_boundary_2 functor. */ + Compare_x_on_boundary_2 compare_x_on_boundary_2_object () const + { + return Compare_x_on_boundary_2(m_base_traits); + } + /*! A functor that compares the x-coordinates of curve ends near the * boundary of the parameter space. */ @@ -1107,21 +1357,13 @@ public: Arrangement_blue_2>; public: - Comparison_result operator()(const Point_2 & p, - const X_monotone_curve_2 & xcv, + Comparison_result operator()(const X_monotone_curve_2 & xcv1, + const X_monotone_curve_2 & xcv2, Arr_curve_end ce) const { - return m_base->compare_x_near_boundary_2_object()(p.base(), - xcv.base(), ce); - } - - Comparison_result operator()(const X_monotone_curve_2 & xcv1, - Arr_curve_end ce1, - const X_monotone_curve_2 & xcv2, - Arr_curve_end ce2) const - { - return m_base->compare_x_near_boundary_2_object()(xcv1.base(), ce1, - xcv2.base(), ce2); + return m_base->compare_x_near_boundary_2_object()(xcv1.base(), + xcv2.base(), + ce); } }; @@ -1131,9 +1373,6 @@ public: { return Compare_x_near_boundary_2(m_base_traits); } - - // TODO Compare_x_on_boundary_2 - // TODO Is_on_y_identification_2 }; diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h index 2c9d9934d05..bf5649fb480 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_vert_decomp_sl_visitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2007 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under 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 3dd4b9f67bd..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2005, 2009 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2008,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -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. diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_debug.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_debug.h index a47d138a437..9017b6f91d1 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_debug.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_debug.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under 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 7130314c6c0..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 @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -382,6 +382,8 @@ template void Sweep_line_2:: _intersect (Subcurve *c1, Subcurve *c2) { + typedef typename Tr::Multiplicity Multiplicity; + CGAL_PRINT("Looking for intersection between:\n\t";) CGAL_SL_DEBUG(c1->Print();) CGAL_PRINT("\t";) @@ -415,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; } } @@ -464,7 +454,7 @@ _intersect (Subcurve *c1, Subcurve *c2) vector_inserter vi_last = vi_end; --vi_last; - if (object_cast > (&(*vi_last)) != NULL) + if (object_cast > (&(*vi_last)) != NULL) { CGAL_PRINT(" [Skipping common right endpoint...]\n";); --vi_end; @@ -500,7 +490,7 @@ _intersect (Subcurve *c1, Subcurve *c2) vector_inserter vi_last = vi_end; --vi_last; - if (object_cast > (&(*vi_last)) != NULL) + if (object_cast > (&(*vi_last)) != NULL) { CGAL_PRINT(" [Skipping common right endpoint on boundary...]\n";); --vi_end; @@ -509,11 +499,12 @@ _intersect (Subcurve *c1, Subcurve *c2) } } - const std::pair *xp_point; + 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)); + xp_point = object_cast > (&(*vi)); if (xp_point != NULL) { // Skip the intersection point if it is not larger than the current @@ -532,7 +523,7 @@ _intersect (Subcurve *c1, Subcurve *c2) Point_2 xp; unsigned int multiplicity = 0; - xp_point = object_cast > (&(*vi)); + xp_point = object_cast > (&(*vi)); if (xp_point != NULL) { xp = xp_point->first; diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h index 6c6ad23ad4b..f3ed1f771b0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_utils.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_visitors.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_visitors.h index a7e54926697..21d0a2abda7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_visitors.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_visitors.h @@ -1,4 +1,4 @@ -// Copyright (c) 1997 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_curve_pair.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_curve_pair.h index 884fe25b345..8f1edcf8abe 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_curve_pair.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_curve_pair.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_event.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_event.h index 2a1b531b851..865892812ef 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_event.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_event.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -58,14 +58,14 @@ public: typedef typename Traits_2::Point_2 Point_2; // should be ok, as Traits_ has already extended by Basic_sweep_line - typedef typename internal::Arr_complete_left_side_tag< Traits_2 >::Tag - Arr_left_side_category; - typedef typename internal::Arr_complete_bottom_side_tag< Traits_2 >::Tag - Arr_bottom_side_category; - typedef typename internal::Arr_complete_top_side_tag< Traits_2 >::Tag - Arr_top_side_category; - typedef typename internal::Arr_complete_right_side_tag< Traits_2 >::Tag - Arr_right_side_category; + typedef typename internal::Arr_complete_left_side_category< Traits_2 >::Category + Left_side_category; + typedef typename internal::Arr_complete_bottom_side_category< Traits_2 >::Category + Bottom_side_category; + typedef typename internal::Arr_complete_top_side_category< Traits_2 >::Category + Top_side_category; + typedef typename internal::Arr_complete_right_side_category< Traits_2 >::Category + Right_side_category; typedef Subcurve_ Subcurve; //template diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_functors.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_functors.h index bdba37ec04e..7ca75d65e1f 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_functors.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_functors.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -51,10 +51,10 @@ public: typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2; // should be ok, as Traits_2 is supposed to be the adaptor - typedef typename Traits_2::Arr_left_side_category Arr_left_side_category; - typedef typename Traits_2::Arr_bottom_side_category Arr_bottom_side_category; - typedef typename Traits_2::Arr_top_side_category Arr_top_side_category; - typedef typename Traits_2::Arr_right_side_category Arr_right_side_category; + typedef typename Traits_2::Left_side_category Left_side_category; + typedef typename Traits_2::Bottom_side_category Bottom_side_category; + typedef typename Traits_2::Top_side_category Top_side_category; + typedef typename Traits_2::Right_side_category Right_side_category; private: @@ -136,7 +136,7 @@ public: // given point and this curve end. Arr_curve_end ind = _curve_end(e2); Comparison_result res = - m_traits->compare_x_near_boundary_2_object()(pt, e2->curve(), ind); + m_traits->compare_x_point_curve_end_2_object()(pt, e2->curve(), ind); if (res != EQUAL) return (res); @@ -206,9 +206,9 @@ private: { // Both defined on the left boundary - compare them there. CGAL_assertion (ind == ARR_MIN_END); - - return (m_traits->compare_y_near_boundary_2_object() (cv, e2->curve(), - ind)); + + return + m_traits->compare_y_curve_ends_2_object() (cv, e2->curve(), ind); } // The curve end is obviously smaller. @@ -221,9 +221,9 @@ private: { // Both defined on the right boundary - compare them there. CGAL_assertion (ind == ARR_MAX_END); - - return (m_traits->compare_y_near_boundary_2_object() (cv, e2->curve(), - ind)); + + return (m_traits->compare_y_curve_ends_2_object() (cv, e2->curve(), + ind)); } // The curve end is obviously larger. @@ -242,13 +242,15 @@ private: CGAL_assertion (ps_y != ARR_INTERIOR); Comparison_result res; + Arr_curve_end ind2 = _curve_end(e2); + // Act according to the boundary sign of the event. if (e2->parameter_space_in_y() == ARR_BOTTOM_BOUNDARY) { - // Compare the x-positions of the two entities. - res = m_traits->compare_x_near_boundary_2_object() (cv, ind, e2->curve(), - _curve_end(e2)); + // Compare the x-positions of the two entities. + res = m_traits->compare_x_curve_ends_2_object() (cv, ind, + e2->curve(), ind2); if (res != EQUAL) return (res); @@ -264,9 +266,8 @@ private: if (e2->parameter_space_in_y() == ARR_TOP_BOUNDARY) { // Compare the x-positions of the two entities. - res = m_traits->compare_x_near_boundary_2_object() (cv, ind, e2->curve(), - _curve_end(e2)); - + res = m_traits->compare_x_curve_ends_2_object() (cv, ind, + e2->curve(), ind2); if (res != EQUAL) return (res); @@ -282,7 +283,7 @@ private: // If we reached here, e2 is not a boundary event and is associated with // a valid point. We compare the x-position of this point with the curve // end. - res = m_traits->compare_x_near_boundary_2_object() (e2->point(), cv, ind); + res = m_traits->compare_x_point_curve_end_2_object() (e2->point(), cv, ind); if (res != EQUAL) return (CGAL::opposite(res)); diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_subcurve.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_subcurve.h index 47824623b6e..736569f95c7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_subcurve.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_subcurve.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2_algorithms.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2_algorithms.h index 1eed6caad2d..11757fe80d9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2_algorithms.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2_algorithms.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include @@ -69,10 +69,10 @@ struct Default_arr_traits -struct Default_arr_traits > +template +struct Default_arr_traits > { - typedef CGAL::Arr_rational_arc_traits_2 Traits; + typedef CGAL::Arr_rational_function_traits_2 Traits; }; template diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_empty_visitor.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_empty_visitor.h index af8c4ad9845..7d8d41a35e6 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_empty_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_empty_visitor.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/graph_traits_Arrangement_2.h b/Arrangement_on_surface_2/include/CGAL/graph_traits_Arrangement_2.h index 95a0c271463..1c29c7962d1 100644 --- a/Arrangement_on_surface_2/include/CGAL/graph_traits_Arrangement_2.h +++ b/Arrangement_on_surface_2/include/CGAL/graph_traits_Arrangement_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/include/CGAL/graph_traits_Dual_Arrangement_2.h b/Arrangement_on_surface_2/include/CGAL/graph_traits_Dual_Arrangement_2.h index 2703e65cecf..6ef5934a68b 100644 --- a/Arrangement_on_surface_2/include/CGAL/graph_traits_Dual_Arrangement_2.h +++ b/Arrangement_on_surface_2/include/CGAL/graph_traits_Dual_Arrangement_2.h @@ -1,4 +1,4 @@ -// Copyright (c) 2005 Tel-Aviv University (Israel). +// Copyright (c) 2005,2007,2009,2010,2011 Tel-Aviv University (Israel). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h index 5c3a0da5b3b..2b5d0ea3a8d 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_base_test.h @@ -112,43 +112,43 @@ protected: Violation_type m_violation_tested; /*! Collect the data depending on obj_t */ - bool read_input(std::ifstream & is , Read_object_type obj_t); + bool read_input(std::ifstream& is, Read_object_type obj_t); /*! Execute a command */ - virtual bool exec(std::istringstream & str_stream, - const std::string & str_command, - bool & result) = 0; + virtual bool exec(std::istringstream& str_stream, + const std::string& str_command, + bool& result) = 0; /*! Perform the test */ - bool perform(std::ifstream & is); + bool perform(std::ifstream& is); /*! Skip comments */ - void skip_comments(std::ifstream & is, char * one_line); + void skip_comments(std::ifstream& is, char* one_line); - std::string remove_blanks(char * str); + std::string remove_blanks(char* str); - bool get_expected_boolean(std::istringstream & str_stream); + bool get_expected_boolean(std::istringstream& str_stream); - unsigned int get_expected_enum(std::istringstream & str_stream); + unsigned int get_expected_enum(std::istringstream& str_stream); - bool translate_boolean(std::string & str_value); + bool translate_boolean(std::string& str_value); - unsigned int translate_enumerator(std::string & str_value); + unsigned int translate_enumerator(std::string& str_value); std::pair - translate_int_or_text(std::string & str_value); + translate_int_or_text(std::string& str_value); std::pair - get_next_input(std::istringstream & str_stream); + get_next_input(std::istringstream& str_stream); /*! Print curve-end string */ - const char * curve_end_str(CGAL::Arr_curve_end cv_end) const + const char* curve_end_str(CGAL::Arr_curve_end cv_end) const { return (cv_end == CGAL::ARR_MIN_END) ? "MIN_END" : "MAX_END"; } /*! Print an error message */ - void print_error(const std::string & msg) + void print_error(const std::string& msg) { std::cerr << "Error: " << msg.c_str() << std::endl; } @@ -161,7 +161,7 @@ protected: } /*! Print information */ - void print_info(std::string & info, + void print_info(std::string& info, bool start_line = true, bool end_line = true) { if (start_line && !m_eol_printed) print_eol(); @@ -177,15 +177,15 @@ protected: } /*! Print expected answer and real answer */ - void print_answer(const std::string & exp, const std::string & real, - const std::string & str) + void print_answer(const std::string& exp, const std::string& real, + const std::string& str) { print_info(std::string("Expected ").append(str).append(": ").append(exp)); print_info(std::string("Obtained ").append(str).append(": ").append(real)); } /*! Compare two points */ - bool compare_points(const Point_2 & exp_answer, const Point_2 & real_answer) + bool compare_points(const Point_2& exp_answer, const Point_2& real_answer) { typename Traits::Equal_2 equal = m_traits.equal_2_object(); if (equal(exp_answer, real_answer)) return true; @@ -197,8 +197,8 @@ protected: } /*! Compare two x-monotone curves */ - bool compare_curves(const X_monotone_curve_2 & exp_answer, - const X_monotone_curve_2 & real_answer) + bool compare_curves(const X_monotone_curve_2& exp_answer, + const X_monotone_curve_2& real_answer) { typename Traits::Equal_2 equal = m_traits.equal_2_object(); if (equal(exp_answer, real_answer)) return true; @@ -210,9 +210,9 @@ protected: } /*! Compare two unsigned int */ - bool compare(const unsigned int & exp_answer, - const unsigned int & real_answer, - const char * str = "result") + bool compare(const unsigned int& exp_answer, + const unsigned int& real_answer, + const char* str = "result") { if (exp_answer == real_answer) return true; std::string exp_answer_str = boost::lexical_cast(exp_answer); @@ -222,74 +222,98 @@ protected: } template - bool read_point(stream & is, Point_2 &); + bool read_point(stream& is, Point_2&); template - bool read_xcurve(stream & is, X_monotone_curve_2 &); + bool read_xcurve(stream& is, X_monotone_curve_2&); template - bool read_curve(stream & is, Curve_2 &); + bool read_curve(stream& is, Curve_2&); //@{ /*! Test Compare_x_2 */ - bool compare_x_wrapper(std::istringstream & ); + bool compare_x_wrapper(std::istringstream& ); + + /*! Test Compare_x_near_limit_2 + */ + bool compare_x_near_limit_wrapper(std::istringstream& ); + bool compare_x_near_limit_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag); + bool compare_x_near_limit_wrapper_imp(std::istringstream&, + CGAL::Arr_use_traits_tag); + + /*! Test Compare_x_at_limit_2 + */ + bool compare_x_at_limit_wrapper(std::istringstream& ); + bool compare_x_at_limit_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag); + bool compare_x_at_limit_wrapper_imp(std::istringstream&, + CGAL::Arr_use_traits_tag); /*! Test Compare_x_near_boundary_2 */ - bool compare_x_near_boundary_wrapper(std::istringstream & ); - bool compare_x_near_boundary_wrapper_imp(std::istringstream &, + bool compare_x_near_boundary_wrapper(std::istringstream& ); + bool compare_x_near_boundary_wrapper_imp(std::istringstream&, CGAL::Arr_use_dummy_tag); - bool compare_x_near_boundary_wrapper_imp(std::istringstream &, + bool compare_x_near_boundary_wrapper_imp(std::istringstream&, CGAL::Arr_use_traits_tag); + /*! Test Compare_x_on_boundary_2 + */ + bool compare_x_on_boundary_wrapper(std::istringstream& ); + bool compare_x_on_boundary_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag); + bool compare_x_on_boundary_wrapper_imp(std::istringstream&, + CGAL::Arr_use_traits_tag); + /*! Test Compare_y_near_boundary_2 */ - bool compare_y_near_boundary_wrapper(std::istringstream & ); - bool compare_y_near_boundary_wrapper_imp(std::istringstream &, + bool compare_y_near_boundary_wrapper(std::istringstream& ); + bool compare_y_near_boundary_wrapper_imp(std::istringstream&, CGAL::Arr_use_dummy_tag); - bool compare_y_near_boundary_wrapper_imp(std::istringstream &, + bool compare_y_near_boundary_wrapper_imp(std::istringstream&, CGAL::Arr_use_traits_tag); /*! Test Parameter_space_in_x_2 */ - bool parameter_space_in_x_wrapper(std::istringstream & ); - bool parameter_space_in_x_wrapper_imp(std::istringstream &, + bool parameter_space_in_x_wrapper(std::istringstream& ); + bool parameter_space_in_x_wrapper_imp(std::istringstream&, CGAL::Arr_use_dummy_tag); - bool parameter_space_in_x_wrapper_imp(std::istringstream &, + bool parameter_space_in_x_wrapper_imp(std::istringstream&, CGAL::Arr_use_traits_tag); /*! Test Parameter_space_in_y_2 */ - bool parameter_space_in_y_wrapper(std::istringstream & ); - bool parameter_space_in_y_wrapper_imp(std::istringstream &, + bool parameter_space_in_y_wrapper(std::istringstream& ); + bool parameter_space_in_y_wrapper_imp(std::istringstream&, CGAL::Arr_use_dummy_tag); - bool parameter_space_in_y_wrapper_imp(std::istringstream &, + bool parameter_space_in_y_wrapper_imp(std::istringstream&, CGAL::Arr_use_traits_tag); /*! Compare_xy_2 */ - bool compare_xy_wrapper(std::istringstream & line); + bool compare_xy_wrapper(std::istringstream& line); /*! Tests Construct_min_vertex_2. * Degenerate case: vertical curve. */ - bool min_vertex_wrapper(std::istringstream & line); + bool min_vertex_wrapper(std::istringstream& line); /*! Tests Construct_max_vertex_2. * Degenerate case: vertical curve. */ - bool max_vertex_wrapper(std::istringstream & line); + bool max_vertex_wrapper(std::istringstream& line); - bool is_vertical_wrapper(std::istringstream & line); + bool is_vertical_wrapper(std::istringstream& line); /*! Tests Compare_y_at_x_2. * Return the location of the given point with respect to the input curve. * Degenerate cases: The point is an endpoint of the curve. * The curve is vertical. */ - bool compare_y_at_x_wrapper(std::istringstream & line); + bool compare_y_at_x_wrapper(std::istringstream& line); /*! Tests Compare_y_at_x_left_2. * Compare the y value of two x-monotone curves immediately to the left @@ -298,10 +322,10 @@ protected: * The curves coincide and vertical. * One of the curves is vertical. */ - bool compare_y_at_x_left_wrapper(std::istringstream & line); - bool compare_y_at_x_left_wrapper_imp(std::istringstream & line, + bool compare_y_at_x_left_wrapper(std::istringstream& line); + bool compare_y_at_x_left_wrapper_imp(std::istringstream& line, CGAL::Tag_false); - bool compare_y_at_x_left_wrapper_imp(std::istringstream & line, + bool compare_y_at_x_left_wrapper_imp(std::istringstream& line, CGAL::Tag_true); /*! Tests Compare_y_at_x_right_2. @@ -311,17 +335,17 @@ protected: * The curves coincide and vertical. * One of the curves is vertical. */ - bool compare_y_at_x_right_wrapper(std::istringstream & line); + bool compare_y_at_x_right_wrapper(std::istringstream& line); /*! Tests Equal_2::operator()(Point_2, Point_2). * Check whether two points are the same. */ - bool equal_points_wrapper(std::istringstream & line); + bool equal_points_wrapper(std::istringstream& line); /*! Tests Equal_2::operator()(X_monotone_curve_2, X_monotone_curve_2). * Check whether two x-monotone curves are the same. */ - bool equal_curves_wrapper(std::istringstream & line); + bool equal_curves_wrapper(std::istringstream& line); /*! Tests Make_x_monotone_2. * Cut the given curve into x-monotone subcurves and insert them into the @@ -330,7 +354,7 @@ protected: * segment is vertical. Both firt and last are vertical. An internal segment * is vertical. */ - bool make_x_monotone_wrapper(std::istringstream & line); + bool make_x_monotone_wrapper(std::istringstream& line); /*! Tests Intersect_2. * Find the intersections of the two given curves and insert them into the @@ -340,44 +364,44 @@ protected: * left) endpoint of one curve and the first (resp. last) segment of the * other coincide. */ - bool intersect_wrapper(std::istringstream & line); + bool intersect_wrapper(std::istringstream& line); /*! Tests Split_2. * Split a given x-monotone curve at a given point into two sub-curves. * Degenerate cases for polylines: the point and a polyline internal point * coincides. */ - bool split_wrapper(std::istringstream & line); + bool split_wrapper(std::istringstream& line); /*! Tests Are_mergeable_2. * Check whether it is possible to merge two given x-monotone curves. */ - bool are_mergeable_wrapper(std::istringstream & line); - bool are_mergeable_wrapper_imp(std::istringstream & line, CGAL::Tag_false); - bool are_mergeable_wrapper_imp(std::istringstream & line, CGAL::Tag_true); + bool are_mergeable_wrapper(std::istringstream& line); + bool are_mergeable_wrapper_imp(std::istringstream& line, CGAL::Tag_false); + bool are_mergeable_wrapper_imp(std::istringstream& line, CGAL::Tag_true); /*! Tests Merge_2. * Merge two given x-monotone curves into a single curve. */ - bool merge_wrapper(std::istringstream & line); - bool merge_wrapper_imp(std::istringstream & line, CGAL::Tag_false); - bool merge_wrapper_imp(std::istringstream & line, CGAL::Tag_true); + bool merge_wrapper(std::istringstream& line); + bool merge_wrapper_imp(std::istringstream& line, CGAL::Tag_false); + bool merge_wrapper_imp(std::istringstream& line, CGAL::Tag_true); /*! Tests Approximate_2. * Return an approximation of a point coordinate. */ - bool approximate_wrapper(std::istringstream & line); + bool approximate_wrapper(std::istringstream& line); /*! tests Construct_x_monotone_curve_2. * Return an x-monotone curve connecting the two given endpoints. */ - bool construct_x_monotone_curve_wrapper(std::istringstream & line); + bool construct_x_monotone_curve_wrapper(std::istringstream& line); //@} public: /*! Constructor */ - Traits_base_test(int argc, char * argv[]); + Traits_base_test(int argc, char* argv[]); /*! Destructor */ virtual ~Traits_base_test(); @@ -391,7 +415,7 @@ public: * Accepts test data file name. */ template -Traits_base_test::Traits_base_test(int argc, char * argv[]) : +Traits_base_test::Traits_base_test(int argc, char* argv[]) : m_eol_printed(true), m_abort_on_error(false) // run all tests { @@ -475,7 +499,7 @@ bool Traits_base_test::start() } template -bool Traits_base_test::read_input(std::ifstream & is, +bool Traits_base_test::read_input(std::ifstream& is, Read_object_type obj_t) { char one_line[1024]; @@ -525,7 +549,7 @@ bool Traits_base_test::read_input(std::ifstream & is, * command arguments. */ template -bool Traits_base_test::perform(std::ifstream & is) +bool Traits_base_test::perform(std::ifstream& is) { bool test_result = true; std::cout << "Performing test : traits type is " << m_traitstype @@ -623,8 +647,8 @@ bool Traits_base_test::perform(std::ifstream & is) * end of the line */ template -void Traits_base_test::skip_comments(std::ifstream & is, - char * one_line) +void Traits_base_test::skip_comments(std::ifstream& is, + char* one_line) { while (!is.eof()) { is.getline(one_line, 1024); @@ -635,7 +659,7 @@ void Traits_base_test::skip_comments(std::ifstream & is, /*! */ template -std::string Traits_base_test::remove_blanks(char * str) +std::string Traits_base_test::remove_blanks(char* str) { std::string result = ""; bool flag = false; @@ -661,7 +685,7 @@ std::string Traits_base_test::remove_blanks(char * str) */ template bool Traits_base_test:: -translate_boolean(std::string & str_value) +translate_boolean(std::string& str_value) { if (str_value == "TRUE") return true; return false; @@ -671,7 +695,7 @@ translate_boolean(std::string & str_value) */ template unsigned int -Traits_base_test::translate_enumerator(std::string & str_value) +Traits_base_test::translate_enumerator(std::string& str_value) { if (str_value == "LARGER" ) { return static_cast(CGAL::LARGER); @@ -688,7 +712,7 @@ Traits_base_test::translate_enumerator(std::string & str_value) */ template std::pair::Enum_type, unsigned int> -Traits_base_test::translate_int_or_text(std::string & str_value) +Traits_base_test::translate_int_or_text(std::string& str_value) { if (str_value == "MIN_END" ) { return std::pair(CURVE_END,CGAL::ARR_MIN_END); @@ -731,7 +755,7 @@ Traits_base_test::translate_int_or_text(std::string & str_value) template bool Traits_base_test:: -get_expected_boolean(std::istringstream & str_stream) +get_expected_boolean(std::istringstream& str_stream) { char buff[1024]; str_stream.getline( buff, 1024, '.'); @@ -744,7 +768,7 @@ get_expected_boolean(std::istringstream & str_stream) */ template unsigned int -Traits_base_test::get_expected_enum(std::istringstream & str_stream) +Traits_base_test::get_expected_enum(std::istringstream& str_stream) { char buff[1024]; str_stream.getline(buff, 1024, '.'); @@ -757,7 +781,7 @@ Traits_base_test::get_expected_enum(std::istringstream & str_stream) */ template std::pair::Enum_type, unsigned int> -Traits_base_test::get_next_input(std::istringstream & str_stream) +Traits_base_test::get_next_input(std::istringstream& str_stream) { char buff[1024]; do { @@ -771,7 +795,7 @@ Traits_base_test::get_next_input(std::istringstream & str_stream) template template bool Traits_base_test:: -read_point(stream & is, typename T_Traits::Point_2 & p) +read_point(stream& is, typename T_Traits::Point_2& p) { Basic_number_type x, y; is >> x >> y; @@ -782,7 +806,7 @@ read_point(stream & is, typename T_Traits::Point_2 & p) template template bool Traits_base_test:: -read_xcurve(stream & is, typename T_Traits::X_monotone_curve_2 & xcv) +read_xcurve(stream& is, typename T_Traits::X_monotone_curve_2& xcv) { Basic_number_type x1, y1, x2, y2; is >> x1 >> y1 >> x2 >> y2; @@ -796,8 +820,8 @@ read_xcurve(stream & is, typename T_Traits::X_monotone_curve_2 & xcv) template template bool -Traits_base_test::read_curve(stream & is, - typename T_Traits::Curve_2 & cv) +Traits_base_test::read_curve(stream& is, + typename T_Traits::Curve_2& cv) { Basic_number_type x1, y1, x2, y2; is >> x1 >> y1 >> x2 >> y2; @@ -808,8 +832,7 @@ Traits_base_test::read_curve(stream & is, return true; } -#if TEST_TRAITS == CORE_CONIC_TRAITS || \ - TEST_TRAITS == RATIONAL_ARC_TRAITS +#if TEST_TRAITS == CORE_CONIC_TRAITS // conic traits and rational traits use same number // type CORE:Expr so this code can be shared @@ -819,7 +842,7 @@ Traits_base_test::read_curve(stream & is, template <> template bool -Traits_base_test::read_point(stream & is, Point_2 & p) +Traits_base_test::read_point(stream& is, Point_2& p) { Rational rat_x,rat_y; is >> rat_x >> rat_y; @@ -837,7 +860,7 @@ Traits_base_test::read_point(stream & is, Point_2 & p) template <> template bool -Traits_base_test::read_point(stream & is, Point_2 & p) +Traits_base_test::read_point(stream& is, Point_2& p) { Basic_number_type x, y, z; is >> x >> y >> z; @@ -849,7 +872,7 @@ Traits_base_test::read_point(stream & is, Point_2 & p) template <> template bool -Traits_base_test::read_xcurve(stream & is, X_monotone_curve_2 & xcv) +Traits_base_test::read_xcurve(stream& is, X_monotone_curve_2& xcv) { Point_2 p1,p2; read_point(is, p1); @@ -863,7 +886,7 @@ Traits_base_test::read_xcurve(stream & is, X_monotone_curve_2 & xcv) template <> template bool -Traits_base_test::read_curve(stream & is, Curve_2 & cv) +Traits_base_test::read_curve(stream& is, Curve_2& cv) { Point_2 p1, p2; read_point(is, p1); @@ -876,22 +899,34 @@ Traits_base_test::read_curve(stream & is, Curve_2 & cv) #endif #if TEST_TRAITS == RATIONAL_ARC_TRAITS +/*! Read a point */ -/*! Read a xcurve */ template <> template bool -Traits_base_test::read_xcurve(stream & is, X_monotone_curve_2 & xcv) +Traits_base_test::read_point(stream& is, Point_2& p) { - Curve_2 tmp_cv; - if (!read_curve(is,tmp_cv)) - return false; - xcv=X_monotone_curve_2(tmp_cv); + Traits::Construct_point_2 construct_point_2 = m_traits.construct_point_2_object(); + + Rational x, y; + is >> x >> y ; + p = construct_point_2(x, y); return true; } template -bool read_coefficients(stream & is, Rat_vector & coeffs) +bool read_rational_to_real(stream& is, Algebraic_real_1& r) +{ + static Traits::Algebraic_kernel_d_1 algebraic_kernel; + Rational rat; + is >> rat; + r = algebraic_kernel.construct_algebraic_real_1_object()(rat); + return true; +} + + +template +bool read_coefficients(stream& is, Rat_vector& coeffs) { unsigned int num_coeffs; Rational rat; @@ -904,14 +939,119 @@ bool read_coefficients(stream & is, Rat_vector & coeffs) return true; } +/*! Read a xcurve */ +template <> +template +bool +Traits_base_test::read_xcurve(stream& is, X_monotone_curve_2& xcv) +{ + //curve constructor + const Traits::Construct_x_monotone_curve_2 construct_x_monotone_curve_2 + = m_traits.construct_x_monotone_curve_2_object(); + + // Get the arc type: + Rat_vector p_coeffs, q_coeffs; + Algebraic_real_1 src, trg; + int dir = 0; + char type; + is >> type; + if (type == 'a' || type == 'A') + { + //Default constructor + xcv = X_monotone_curve_2(); + return true; + } + else if (type == 'b' || type == 'B') + { + //Constructor of a whole polynomial curve + if (read_coefficients(is,p_coeffs)) + xcv = construct_x_monotone_curve_2(p_coeffs.begin(),p_coeffs.end()); + else + return false; + return true; + } + else if (type == 'c' || type == 'C') + { + //Constructor of a polynomial ray + if (!read_coefficients(is,p_coeffs)) + return false; + if (!read_rational_to_real(is,src)) + return false; + is >> dir; + xcv = construct_x_monotone_curve_2(p_coeffs.begin(),p_coeffs.end(), src, (dir == 0 ? false : true)); + return true; + } + else if (type == 'd' || type == 'D') + { + //Constructor of a polynomial arc + if (!read_coefficients(is,p_coeffs)) + return false; + if (!read_rational_to_real(is,src)) + return false; + if (!read_rational_to_real(is,trg)) + return false; + xcv = construct_x_monotone_curve_2(p_coeffs.begin(),p_coeffs.end(), src, trg); + return true; + } + else if (type == 'e' || type == 'E') + { + //Constructor of a whole rational function + if (!read_coefficients(is,p_coeffs)) + return false; + if (!read_coefficients(is,q_coeffs)) + return false; + xcv = construct_x_monotone_curve_2(p_coeffs.begin(),p_coeffs.end(), q_coeffs.begin(),q_coeffs.end()); + return true; + } + else if (type == 'f' || type == 'F') + { + //Constructor of a ray of a rational function + if (!read_coefficients(is,p_coeffs)) + return false; + if (!read_coefficients(is,q_coeffs)) + return false; + if (!read_rational_to_real(is,src)) + return false; + is >> dir; + xcv =construct_x_monotone_curve_2(p_coeffs.begin(),p_coeffs.end(), + q_coeffs.begin(),q_coeffs.end(), + src, (dir == 0 ? false : true)); + return true; + } + else if (type == 'g' || type == 'G') + { + //Constructor of a bounded rational arc + if (!read_coefficients(is, p_coeffs)) + return false; + if (!read_coefficients(is, q_coeffs)) + return false; + if (!read_rational_to_real(is,src)) + return false; + if (!read_rational_to_real(is,trg)) + return false; + + xcv = construct_x_monotone_curve_2( p_coeffs.begin(),p_coeffs.end(), + q_coeffs.begin(),q_coeffs.end(), + src, trg); + return true; + } + // If we reached here, we have an unknown rational arc type: + std::cerr << "Illegal rational arc type specification: " << type << "." + << std::endl; + return (false); +} + /*! Read a curve */ template <> template -bool Traits_base_test::read_curve(stream & is, Curve_2 & cv) -{ +bool Traits_base_test::read_curve(stream& is, Curve_2& cv) +{ + //curve constructor + const Traits::Construct_curve_2 construct_curve_2 = m_traits.construct_curve_2_object(); + // Get the arc type: Rat_vector p_coeffs, q_coeffs; - Algebraic src, trg; + Algebraic_real_1 src, trg; int dir = 0; char type; is >> type; @@ -925,7 +1065,7 @@ bool Traits_base_test::read_curve(stream & is, Curve_2 & cv) { //Constructor of a whole polynomial curve if (read_coefficients(is,p_coeffs)) - cv = Curve_2(p_coeffs); + cv = construct_curve_2(p_coeffs.begin(),p_coeffs.end()); else return false; return true; @@ -935,8 +1075,10 @@ bool Traits_base_test::read_curve(stream & is, Curve_2 & cv) //Constructor of a polynomial ray if (!read_coefficients(is,p_coeffs)) return false; - is >> src >> dir; - cv = Curve_2(p_coeffs ,src ,(dir == 0 ? false : true)); + if (!read_rational_to_real(is,src)) + return false; + is >> dir; + cv = construct_curve_2(p_coeffs.begin(),p_coeffs.end(), src, (dir == 0 ? false : true)); return true; } else if (type == 'd' || type == 'D') @@ -944,8 +1086,11 @@ bool Traits_base_test::read_curve(stream & is, Curve_2 & cv) //Constructor of a polynomial arc if (!read_coefficients(is,p_coeffs)) return false; - is >> src >> trg; - cv = Curve_2(p_coeffs ,src ,trg); + if (!read_rational_to_real(is,src)) + return false; + if (!read_rational_to_real(is,trg)) + return false; + cv = construct_curve_2(p_coeffs.begin(),p_coeffs.end(), src, trg); return true; } else if (type == 'e' || type == 'E') @@ -955,7 +1100,7 @@ bool Traits_base_test::read_curve(stream & is, Curve_2 & cv) return false; if (!read_coefficients(is,q_coeffs)) return false; - cv = Curve_2(p_coeffs ,q_coeffs); + cv = construct_curve_2(p_coeffs.begin(),p_coeffs.end(), q_coeffs.begin(),q_coeffs.end()); return true; } else if (type == 'f' || type == 'F') @@ -965,19 +1110,28 @@ bool Traits_base_test::read_curve(stream & is, Curve_2 & cv) return false; if (!read_coefficients(is,q_coeffs)) return false; - is >> src >> dir; - cv = Curve_2(p_coeffs ,q_coeffs ,src ,(dir == 0 ? false : true)); + if (!read_rational_to_real(is,src)) + return false; + is >> dir; + cv =construct_curve_2(p_coeffs.begin(),p_coeffs.end(), + q_coeffs.begin(),q_coeffs.end(), + src, (dir == 0 ? false : true)); return true; } else if (type == 'g' || type == 'G') { //Constructor of a bounded rational arc - if (!read_coefficients(is,p_coeffs)) + if (!read_coefficients(is, p_coeffs)) return false; - if (!read_coefficients(is,q_coeffs)) + if (!read_coefficients(is, q_coeffs)) return false; - is >> src >> trg; - cv = Curve_2(p_coeffs ,q_coeffs ,src ,trg); + if (!read_rational_to_real(is,src)) + return false; + if (!read_rational_to_real(is,trg)) + return false; + cv = construct_curve_2(p_coeffs.begin(),p_coeffs.end(), + q_coeffs.begin(),q_coeffs.end(), + src, trg); return true; } // If we reached here, we have an unknown rational arc type: @@ -994,7 +1148,7 @@ template <> template bool Traits_base_test:: -read_xcurve(stream & is, Traits::X_monotone_curve_2 & xcv) +read_xcurve(stream& is, Traits::X_monotone_curve_2& xcv) { unsigned int num_points; is >> num_points; @@ -1016,7 +1170,7 @@ read_xcurve(stream & is, Traits::X_monotone_curve_2 & xcv) template <> template bool -Traits_base_test::read_curve(stream & is, Traits::Curve_2 & cv) +Traits_base_test::read_curve(stream& is, Traits::Curve_2& cv) { unsigned int num_points; is >> num_points; @@ -1028,10 +1182,8 @@ Traits_base_test::read_curve(stream & is, Traits::Curve_2 & cv) Point_2 p(x, y); points.push_back(p); } - cv = - CGAL:: - Arr_polyline_traits_2::Curve_2(points.begin(), - points.end()); + cv = CGAL::Arr_polyline_traits_2::Curve_2(points.begin(), + points.end()); return true; } @@ -1040,7 +1192,7 @@ Traits_base_test::read_curve(stream & is, Traits::Curve_2 & cv) template <> template bool -Traits_base_test::read_xcurve(stream & is, X_monotone_curve_2 & xcv) +Traits_base_test::read_xcurve(stream& is, X_monotone_curve_2& xcv) { is >> xcv; return true; @@ -1049,7 +1201,7 @@ Traits_base_test::read_xcurve(stream & is, X_monotone_curve_2 & xcv) template <> template bool -Traits_base_test::read_curve(stream & is, Curve_2 & cv) +Traits_base_test::read_curve(stream& is, Curve_2& cv) { is >> cv; return true; @@ -1059,7 +1211,7 @@ Traits_base_test::read_curve(stream & is, Curve_2 & cv) /*! */ template -bool read_orientation(stream & is, CGAL::Orientation & orient) +bool read_orientation(stream& is, CGAL::Orientation& orient) { int i_orient; is >> i_orient; @@ -1070,7 +1222,7 @@ bool read_orientation(stream & is, CGAL::Orientation & orient) /*! */ template -bool read_app_point(stream & is, Point_2 & p) +bool read_app_point(stream& is, Point_2& p) { double x, y; is >> x >> y; @@ -1080,8 +1232,8 @@ bool read_app_point(stream & is, Point_2 & p) /*! */ template -bool read_orientation_and_end_points(stream & is, CGAL::Orientation & orient, - Point_2 & source, Point_2 & target) +bool read_orientation_and_end_points(stream& is, CGAL::Orientation& orient, + Point_2& source, Point_2& target) { // Read the orientation. if (!read_orientation(is, orient)) return false; @@ -1094,9 +1246,9 @@ bool read_orientation_and_end_points(stream & is, CGAL::Orientation & orient, /*! Read a circle or an ellipse */ template -bool read_ellipse(stream & is, bool & is_circle, Rat_circle & circle, - Rational & r, Rational & s, - Rational & t, Rational & u, Rational & v, Rational & w) +bool read_ellipse(stream& is, bool& is_circle, Rat_circle& circle, + Rational& r, Rational& s, + Rational& t, Rational& u, Rational& v, Rational& w) { // Read the ellipse (using the format "a b x0 y0"): // 2 2 @@ -1124,7 +1276,7 @@ bool read_ellipse(stream & is, bool & is_circle, Rat_circle & circle, /*! */ template -bool read_partial_ellipse(stream & is, Curve & cv) +bool read_partial_ellipse(stream& is, Curve& cv) { bool is_circle; // Is this a circle. Rat_circle circle; @@ -1143,7 +1295,7 @@ bool read_partial_ellipse(stream & is, Curve & cv) /*! */ template -bool read_full_ellipse(stream & is, Curve & cv) +bool read_full_ellipse(stream& is, Curve& cv) { bool is_circle; // Is this a circle. Rat_circle circle; @@ -1158,7 +1310,7 @@ bool read_full_ellipse(stream & is, Curve & cv) /*! Read a hyperbola */ template -bool read_hyperbola(stream & is, Curve & cv) +bool read_hyperbola(stream& is, Curve& cv) { // Read the hyperbola (using the format "a b x0 y0"): // 2 2 @@ -1188,7 +1340,7 @@ bool read_hyperbola(stream & is, Curve & cv) /*! Read a hyperbola */ template -bool read_parabola(stream & is, Curve & cv) +bool read_parabola(stream& is, Curve& cv) { // Read the parabola (using the format "c x0 y0"): // @@ -1217,7 +1369,7 @@ bool read_parabola(stream & is, Curve & cv) /*! */ template -bool read_segment(stream & is, Curve & cv) +bool read_segment(stream& is, Curve& cv) { // Read a segment, given by its endpoints (x1,y1) and (x2,y2); @@ -1235,7 +1387,7 @@ bool read_segment(stream & is, Curve & cv) /*! */ template -bool read_general_arc(stream & is, Curve & cv) +bool read_general_arc(stream& is, Curve& cv) { // Read a general conic, given by its coefficients . Rational r, s, t, u, v, w; // The conic coefficients. @@ -1264,7 +1416,7 @@ bool read_general_arc(stream & is, Curve & cv) is >> r2 >> s2 >> t2 >> u2 >> v2 >> w2; // Create the conic arc. - cv = Curve (r, s, t, u, v ,w, orient, + cv = Curve (r, s, t, u, v, w, orient, app_source, r1, s1, t1, u1, v1, w1, app_target, r2, s2, t2, u2, v2, w2); return true; @@ -1272,7 +1424,7 @@ bool read_general_arc(stream & is, Curve & cv) /*! */ template -bool read_general_curve(stream & is, Curve & cv) +bool read_general_curve(stream& is, Curve& cv) { Rational r, s, t, u, v, w; // The conic coefficients. // Read a general conic, given by its coefficients . @@ -1292,7 +1444,7 @@ template <> template bool Traits_base_test:: -read_xcurve(stream & is, X_monotone_curve_2 & xcv) +read_xcurve(stream& is, X_monotone_curve_2& xcv) { Curve_2 tmp_cv; if (!read_curve(is,tmp_cv)) @@ -1305,7 +1457,7 @@ read_xcurve(stream & is, X_monotone_curve_2 & xcv) template <> template bool -Traits_base_test::read_curve(stream & is, Curve_2 & cv) +Traits_base_test::read_curve(stream& is, Curve_2& cv) { // Get the arc type: char type; @@ -1357,10 +1509,10 @@ Traits_base_test::read_curve(stream & is, Curve_2 & cv) #elif TEST_TRAITS == CIRCLE_SEGMENT_TRAITS template -bool read_ort_point(stream & is, Point_2 & p) +bool read_ort_point(stream& is, Point_2& p) { bool is_rat; - typename Point_2::CoordNT ort_x , ort_y; + typename Point_2::CoordNT ort_x, ort_y; Number_type alpha,beta,gamma; is >> is_rat; if (is_rat) @@ -1384,7 +1536,7 @@ bool read_ort_point(stream & is, Point_2 & p) is >> alpha >> beta >> gamma; ort_y=Point_2::CoordNT(alpha,beta,gamma); } - p = Point_2(ort_x , ort_y); + p = Point_2(ort_x, ort_y); return true; } @@ -1392,7 +1544,7 @@ bool read_ort_point(stream & is, Point_2 & p) template <> template bool -Traits_base_test::read_xcurve(stream & is,X_monotone_curve_2 & xcv) +Traits_base_test::read_xcurve(stream& is,X_monotone_curve_2& xcv) { bool ans=true; char type; @@ -1404,7 +1556,7 @@ Traits_base_test::read_xcurve(stream & is,X_monotone_curve_2 & xcv) is >> l; ans &= read_ort_point(is, ps); ans &= read_ort_point(is, pt); - xcv=X_monotone_curve_2(l,ps,pt); + xcv=X_monotone_curve_2(l, ps, pt); return ans; } else if (type == 'y' || type == 'Y') @@ -1421,7 +1573,7 @@ Traits_base_test::read_xcurve(stream & is,X_monotone_curve_2 & xcv) is >> c; ans &= read_ort_point(is, ps); ans &= read_ort_point(is, pt); - xcv=X_monotone_curve_2(c,ps,pt,c.orientation()); + xcv=X_monotone_curve_2(c, ps, pt, c.orientation()); return ans; } // If we reached here, we have an unknown conic type: @@ -1434,7 +1586,7 @@ Traits_base_test::read_xcurve(stream & is,X_monotone_curve_2 & xcv) template <> template bool -Traits_base_test::read_curve(stream & is,Curve_2 & cv) +Traits_base_test::read_curve(stream& is,Curve_2& cv) { bool ans=true; char type; @@ -1520,7 +1672,7 @@ Traits_base_test::read_curve(stream & is,Curve_2 & cv) template <> template bool -Traits_base_test::read_point(stream & is, Point_2 & p) +Traits_base_test::read_point(stream& is, Point_2& p) { Rational rat_x,rat_y; is >> rat_x >> rat_y; @@ -1533,7 +1685,7 @@ Traits_base_test::read_point(stream & is, Point_2 & p) template <> template bool -Traits_base_test::read_xcurve(stream & is, X_monotone_curve_2 & xcv) +Traits_base_test::read_xcurve(stream& is, X_monotone_curve_2& xcv) { std::list x_objs; std::list::const_iterator xoit; @@ -1541,8 +1693,10 @@ Traits_base_test::read_xcurve(stream & is, X_monotone_curve_2 & xcv) is >> tmp_cv; Rational B_psx = Rational(tmp_cv.control_point(0).x()); Rational B_psy = Rational(tmp_cv.control_point(0).y()); - Rational B_ptx = Rational(tmp_cv.control_point(tmp_cv.number_of_control_points()-1).x()); - Rational B_pty = Rational(tmp_cv.control_point(tmp_cv.number_of_control_points()-1).y()); + Rational B_ptx = + Rational(tmp_cv.control_point(tmp_cv.number_of_control_points()-1).x()); + Rational B_pty = + Rational(tmp_cv.control_point(tmp_cv.number_of_control_points()-1).y()); Point_2 B_ps(B_psx, B_psy); Point_2 B_pt(B_ptx, B_pty); Traits::Make_x_monotone_2 make_x_monotone = @@ -1558,7 +1712,7 @@ Traits_base_test::read_xcurve(stream & is, X_monotone_curve_2 & xcv) template <> template bool -Traits_base_test::read_curve(stream & is, Curve_2 & cv) +Traits_base_test::read_curve(stream& is, Curve_2& cv) { is >> cv; return true; @@ -1570,7 +1724,7 @@ Traits_base_test::read_curve(stream & is, Curve_2 & cv) /*! Read an arc point */ template -bool read_arc_point(stream & is, typename T_Traits::Point_2 & p) +bool read_arc_point(stream& is, typename T_Traits::Point_2& p) { Basic_number_type x, y; is >> x >> y; @@ -1595,7 +1749,7 @@ bool is_deg_2(char c) TEST_TRAITS == CIRCULAR_LINE_ARC_TRAITS template -Circular_kernel::Line_arc_2 read_line(char type, stream & is) +Circular_kernel::Line_arc_2 read_line(char type, stream& is) { if (type == 'z' || type == 'Z') { @@ -1639,7 +1793,7 @@ Circular_kernel::Line_arc_2 read_line(char type, stream & is) #if TEST_TRAITS == CIRCULAR_ARC_TRAITS || \ TEST_TRAITS == CIRCULAR_LINE_ARC_TRAITS template -Circular_kernel::Circular_arc_2 read_arc(char type,stream & is) +Circular_kernel::Circular_arc_2 read_arc(char type,stream& is) { if (type == 'b' || type == 'B') { @@ -1685,7 +1839,7 @@ Circular_kernel::Circular_arc_2 read_arc(char type,stream & is) template <> template bool -Traits_base_test::read_point(stream & is, Point_2 & p) +Traits_base_test::read_point(stream& is, Point_2& p) { return read_arc_point(is, p); } @@ -1694,7 +1848,7 @@ Traits_base_test::read_point(stream & is, Point_2 & p) template <> template bool -Traits_base_test::read_xcurve(stream & is, X_monotone_curve_2 & xcv) +Traits_base_test::read_xcurve(stream& is, X_monotone_curve_2& xcv) { // Get the arc type: char type; @@ -1712,7 +1866,7 @@ Traits_base_test::read_xcurve(stream & is, X_monotone_curve_2 & xcv) template <> template bool -Traits_base_test::read_curve(stream & is, Curve_2 & cv) +Traits_base_test::read_curve(stream& is, Curve_2& cv) { // Get the arc type: char type; @@ -1731,7 +1885,7 @@ Traits_base_test::read_curve(stream & is, Curve_2 & cv) template <> template bool -Traits_base_test::read_point(stream & is, Point_2 & p) +Traits_base_test::read_point(stream& is, Point_2& p) { return read_arc_point(is, p); } @@ -1740,14 +1894,14 @@ Traits_base_test::read_point(stream & is, Point_2 & p) template <> template bool -Traits_base_test::read_xcurve(stream & is,X_monotone_curve_2 & xcv) +Traits_base_test::read_xcurve(stream& is,X_monotone_curve_2& xcv) { // Get the arc type: char type; is >> type; if (is_deg_2(type)) { - xcv=read_arc(type,is); + xcv=read_arc(type, is); return true; } return false; @@ -1757,7 +1911,7 @@ Traits_base_test::read_xcurve(stream & is,X_monotone_curve_2 & xcv) template <> template bool -Traits_base_test::read_curve(stream & is, Curve_2 & cv) +Traits_base_test::read_curve(stream& is, Curve_2& cv) { // Get the arc type: char type; @@ -1771,7 +1925,7 @@ Traits_base_test::read_curve(stream & is, Curve_2 & cv) } else if (is_deg_2(type)) { - cv=read_arc(type,is); + cv=read_arc(type, is); return true; } return false; @@ -1783,7 +1937,7 @@ Traits_base_test::read_curve(stream & is, Curve_2 & cv) template <> template bool -Traits_base_test::read_point(stream & is, Point_2 & p) +Traits_base_test::read_point(stream& is, Point_2& p) { return read_arc_point(is, p); } @@ -1792,7 +1946,7 @@ Traits_base_test::read_point(stream & is, Point_2 & p) template <> template bool -Traits_base_test::read_xcurve(stream & is,X_monotone_curve_2 & xcv) +Traits_base_test::read_xcurve(stream& is, X_monotone_curve_2& xcv) { // Get the arc type: char type; @@ -1802,7 +1956,7 @@ Traits_base_test::read_xcurve(stream & is,X_monotone_curve_2 & xcv) return true; } else if (is_deg_2(type)) { - xcv = X_monotone_curve_2(read_arc(type,is)); + xcv = X_monotone_curve_2(read_arc(type, is)); return true; } return false; @@ -1811,7 +1965,7 @@ Traits_base_test::read_xcurve(stream & is,X_monotone_curve_2 & xcv) /*! Read a general circular-line curve */ template <> template -bool Traits_base_test::read_curve(stream & is, Curve_2 & cv) +bool Traits_base_test::read_curve(stream& is, Curve_2& cv) { // Get the arc type: char type; @@ -1823,11 +1977,11 @@ bool Traits_base_test::read_curve(stream & is, Curve_2 & cv) return true; } else if (is_deg_1(type)) { - cv = Curve_2(read_line(type,is)); + cv = Curve_2(read_line(type, is)); return true; } else if (is_deg_2(type)) { - cv = read_arc(type,is); + cv = read_arc(type, is); return true; } return false; @@ -1845,7 +1999,7 @@ bool Traits_base_test::read_curve(stream & is, Curve_2 & cv) template <> template bool -Traits_base_test::read_point(stream & is, Point_2 & p) { +Traits_base_test::read_point(stream& is, Point_2& p) { Traits traits; Traits::Construct_point_2 construct_point_2 = traits.construct_point_2_object(); @@ -1855,25 +2009,25 @@ Traits_base_test::read_point(stream & is, Point_2 & p) { case 'i': { int x=0,y=0; is >> x >> y; - p=construct_point_2(x,y); + p=construct_point_2(x, y); break; } case 'b': { Traits::Bound x,y; is >> x >> y; - p=construct_point_2(x,y); + p=construct_point_2(x, y); break; } case 'c': { - Traits::Coefficient x,y; + Traits::Coefficient x, y; is >> x >> y; - p=construct_point_2(x,y); + p=construct_point_2(x, y); break; } case 'a': { - Traits::Algebraic_real_1 x,y; + Traits::Algebraic_real_1 x, y; is >> x >> y; - p=construct_point_2(x,y); + p=construct_point_2(x, y); break; } case 's': { @@ -1882,11 +2036,11 @@ Traits_base_test::read_point(stream & is, Point_2 & p) { Traits::X_monotone_curve_2 xcv; CGAL::swallow(is,'('); CGAL_assertion_code(bool check=) - read_xcurve(is,xcv); + read_xcurve(is, xcv); CGAL_assertion(check); CGAL::swallow(is,')'); - p=construct_point_2(x,xcv); + p=construct_point_2(x, xcv); break; } case 'g': { @@ -1898,11 +2052,11 @@ Traits_base_test::read_point(stream & is, Point_2 & p) { CGAL_assertion(check); int arcno=0; is >> arcno; - p=construct_point_2(x,c,arcno); + p=construct_point_2(x, c, arcno); break; } default: { - std::cout << "Expected i,b,c,a,s, or g , but got \"" << type << "\"" + std::cout << "Expected i, b, c, a, s, or g, but got \"" << type << "\"" << std::endl; return false; } @@ -1912,76 +2066,76 @@ Traits_base_test::read_point(stream & is, Point_2 & p) { template <> template -bool -Traits_base_test::read_xcurve(stream & is, - Traits::X_monotone_curve_2 & xcv) { +bool Traits_base_test::read_xcurve(stream& is, + Traits::X_monotone_curve_2& xcv) +{ Traits traits; Traits::Construct_x_monotone_segment_2 construct_segment_2 = traits.construct_x_monotone_segment_2_object(); char type; is >> type; switch(type) { - case '1': { - Curve_2 cv; - Point_2 end_left,end_right; - CGAL_assertion_code(bool check=) - read_curve(is,cv); - CGAL_assertion(check); - CGAL::swallow(is,'('); - CGAL_assertion_code(check=) - read_point(is,end_left); - CGAL_assertion(check); - CGAL::swallow(is,')'); - CGAL::swallow(is,'('); - CGAL_assertion_code(check=) - read_point(is,end_right); - CGAL_assertion(check); - CGAL::swallow(is,')'); - std::vector xcvs; - construct_segment_2(cv,end_left,end_right,std::back_inserter(xcvs)); - CGAL_assertion(xcvs.size()==1); - xcv=xcvs[0]; - break; - } - case '2': { - Curve_2 cv; - Point_2 p; - CGAL_assertion_code(bool check=) - read_curve(is,cv); - CGAL_assertion(check); - CGAL::swallow(is,'('); - CGAL_assertion_code(check=) - read_point(is,p); - CGAL_assertion(check); - CGAL::swallow(is,')'); - std::string site_of_p_string; - Traits::Site_of_point site_of_p; - is >> site_of_p_string; - if(site_of_p_string=="MIN_ENDPOINT") { - site_of_p=Traits::MIN_ENDPOINT; - } else if(site_of_p_string=="MAX_ENDPOINT") { - site_of_p=Traits::MAX_ENDPOINT; - } else { - CGAL_assertion(site_of_p_string=="POINT_IN_INTERIOR"); - site_of_p=Traits::POINT_IN_INTERIOR; + case '1': { + Curve_2 cv; + Point_2 end_left,end_right; + CGAL_assertion_code(bool check=) + read_curve(is,cv); + CGAL_assertion(check); + CGAL::swallow(is,'('); + CGAL_assertion_code(check=) + read_point(is,end_left); + CGAL_assertion(check); + CGAL::swallow(is,')'); + CGAL::swallow(is,'('); + CGAL_assertion_code(check=) + read_point(is,end_right); + CGAL_assertion(check); + CGAL::swallow(is,')'); + std::vector xcvs; + construct_segment_2(cv, end_left, end_right, std::back_inserter(xcvs)); + CGAL_assertion(xcvs.size() == 1); + xcv = xcvs[0]; + break; } - std::vector xcvs; - construct_segment_2(cv,p,site_of_p,std::back_inserter(xcvs)); - CGAL_assertion(xcvs.size()==1); - xcv=xcvs[0]; - break; - } - default: { - std::cout << "Expected 1 or 2, but got \"" << type << "\"" << std::endl; - return false; - } + case '2': { + Curve_2 cv; + Point_2 p; + CGAL_assertion_code(bool check=) + read_curve(is,cv); + CGAL_assertion(check); + CGAL::swallow(is,'('); + CGAL_assertion_code(check=) + read_point(is,p); + CGAL_assertion(check); + CGAL::swallow(is,')'); + std::string site_of_p_string; + Traits::Site_of_point site_of_p; + is >> site_of_p_string; + if (site_of_p_string=="MIN_ENDPOINT") { + site_of_p=Traits::MIN_ENDPOINT; + } else if (site_of_p_string=="MAX_ENDPOINT") { + site_of_p=Traits::MAX_ENDPOINT; + } else { + CGAL_assertion(site_of_p_string=="POINT_IN_INTERIOR"); + site_of_p=Traits::POINT_IN_INTERIOR; + } + std::vector xcvs; + construct_segment_2(cv, p, site_of_p, std::back_inserter(xcvs)); + CGAL_assertion(xcvs.size() == 1); + xcv = xcvs[0]; + break; + } + default: { + std::cout << "Expected 1 or 2, but got \"" << type << "\"" << std::endl; + return false; + } } return true; } template <> template -bool Traits_base_test::read_curve(stream & is, Curve_2 & cv) { +bool Traits_base_test::read_curve(stream& is, Curve_2& cv) { Traits traits; Traits::Polynomial_2 p; Traits::Construct_curve_2 construct_curve_2 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h index 554a0f171d4..340d68a1338 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_test.h @@ -21,7 +21,7 @@ #include "Traits_base_test.h" /*! Traits test */ -template +template class Traits_test : public Traits_base_test { private: typedef T_Traits Traits; @@ -33,14 +33,14 @@ private: typedef typename Traits::Curve_2 Curve_2; /*! A map between (strings) commands and (member functions) operations */ - typedef bool (Traits_test::* Wrapper)(std::istringstream &); + typedef bool(Traits_test::* Wrapper)(std::istringstream&); typedef std::map Wrapper_map; typedef typename Wrapper_map::iterator Wrapper_iter; Wrapper_map m_wrappers; - virtual bool exec(std::istringstream & str_stream, - const std::string & str_command, - bool & result) + virtual bool exec(std::istringstream& str_stream, + const std::string& str_command, + bool& result) { Wrapper_iter wi = m_wrappers.find(str_command); str_stream.clear(); @@ -56,30 +56,30 @@ private: /*! Test Compare_x_2 */ - bool compare_x_wrapper(std::istringstream &); + bool compare_x_wrapper(std::istringstream&); /*! Compare_xy_2 */ - bool compare_xy_wrapper(std::istringstream & line); + bool compare_xy_wrapper(std::istringstream& line); /*! Tests Construct_min_vertex_2. * Degenerate case: vertical curve. */ - bool min_vertex_wrapper(std::istringstream & line); + bool min_vertex_wrapper(std::istringstream& line); /*! Tests Construct_max_vertex_2. * Degenerate case: vertical curve. */ - bool max_vertex_wrapper(std::istringstream & line); + bool max_vertex_wrapper(std::istringstream& line); - bool is_vertical_wrapper(std::istringstream & line); + bool is_vertical_wrapper(std::istringstream& line); /*! Tests Compare_y_at_x_2. * Return the location of the given point with respect to the input curve. * Degenerate cases: The point is an endpoint of the curve. * The curve is vertical. */ - bool compare_y_at_x_wrapper(std::istringstream & line); + bool compare_y_at_x_wrapper(std::istringstream& line); /*! Tests Compare_y_at_x_left_2. * Compare the y value of two x-monotone curves immediately to the left @@ -88,10 +88,10 @@ private: * The curves coincide and vertical. * One of the curves is vertical. */ - bool compare_y_at_x_left_wrapper(std::istringstream & line); - bool compare_y_at_x_left_wrapper_imp(std::istringstream & line, + bool compare_y_at_x_left_wrapper(std::istringstream& line); + bool compare_y_at_x_left_wrapper_imp(std::istringstream& line, CGAL::Tag_false); - bool compare_y_at_x_left_wrapper_imp(std::istringstream & line, + bool compare_y_at_x_left_wrapper_imp(std::istringstream& line, CGAL::Tag_true); /*! Tests Compare_y_at_x_right_2. @@ -101,17 +101,17 @@ private: * The curves coincide and vertical. * One of the curves is vertical. */ - bool compare_y_at_x_right_wrapper(std::istringstream & line); + bool compare_y_at_x_right_wrapper(std::istringstream& line); /*! Tests Equal_2::operator()(Point_2, Point_2). * Check whether two points are the same. */ - bool equal_points_wrapper(std::istringstream & line); + bool equal_points_wrapper(std::istringstream& line); /*! Tests Equal_2::operator()(X_monotone_curve_2, X_monotone_curve_2). * Check whether two x-monotone curves are the same. */ - bool equal_curves_wrapper(std::istringstream & line); + bool equal_curves_wrapper(std::istringstream& line); /*! Tests Make_x_monotone_2. * Cut the given curve into x-monotone subcurves and insert them into the @@ -120,7 +120,7 @@ private: * segment is vertical. Both firt and last are vertical. An internal segment * is vertical. */ - bool make_x_monotone_wrapper(std::istringstream & line); + bool make_x_monotone_wrapper(std::istringstream& line); /*! Tests Intersect_2. * Find the intersections of the two given curves and insert them into the @@ -130,38 +130,38 @@ private: * left) endpoint of one curve and the first (resp. last) segment of the * other coincide. */ - bool intersect_wrapper(std::istringstream & line); + bool intersect_wrapper(std::istringstream& line); /*! Tests Split_2. * Split a given x-monotone curve at a given point into two sub-curves. * Degenerate cases for polylines: the point and a polyline internal point * coincides. */ - bool split_wrapper(std::istringstream & line); + bool split_wrapper(std::istringstream& line); /*! Tests Are_mergeable_2. * Check whether it is possible to merge two given x-monotone curves. */ - bool are_mergeable_wrapper(std::istringstream & line); - bool are_mergeable_wrapper_imp(std::istringstream & line, CGAL::Tag_false); - bool are_mergeable_wrapper_imp(std::istringstream & line, CGAL::Tag_true); + bool are_mergeable_wrapper(std::istringstream& line); + bool are_mergeable_wrapper_imp(std::istringstream& line, CGAL::Tag_false); + bool are_mergeable_wrapper_imp(std::istringstream& line, CGAL::Tag_true); /*! Tests Merge_2. * Merge two given x-monotone curves into a single curve. */ - bool merge_wrapper(std::istringstream & line); - bool merge_wrapper_imp(std::istringstream & line, CGAL::Tag_false); - bool merge_wrapper_imp(std::istringstream & line, CGAL::Tag_true); + bool merge_wrapper(std::istringstream& line); + bool merge_wrapper_imp(std::istringstream& line, CGAL::Tag_false); + bool merge_wrapper_imp(std::istringstream& line, CGAL::Tag_true); /*! Tests Approximate_2. * Return an approximation of a point coordinate. */ - bool approximate_wrapper(std::istringstream & line); + bool approximate_wrapper(std::istringstream& line); /*! tests Construct_x_monotone_curve_2. * Return an x-monotone curve connecting the two given endpoints. */ - bool construct_x_monotone_curve_wrapper(std::istringstream & line); + bool construct_x_monotone_curve_wrapper(std::istringstream& line); // ///////////////////////////////////////////////////////////////////////// // boundary-specific functors: @@ -171,26 +171,21 @@ private: /*! Test Parameter_space_in_x_2 */ - bool parameter_space_in_x_curve_end_wrapper(std::istringstream &); - bool parameter_space_in_x_curve_end_wrapper_imp(std::istringstream &, - CGAL::Arr_use_dummy_tag); - bool parameter_space_in_x_curve_end_wrapper_imp(std::istringstream &, - CGAL::Arr_use_traits_tag); - - // TODO Parameter_space_in_x_2(pt) - // TODO Parameter_space_in_x_2(xcv) + bool parameter_space_in_x_wrapper(std::istringstream&); + bool parameter_space_in_x_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag); + bool parameter_space_in_x_wrapper_imp(std::istringstream&, + CGAL::Arr_use_traits_tag); /*! Test Compare_y_near_boundary_2 */ - bool compare_y_near_boundary_curve_ends_wrapper(std::istringstream &); - bool compare_y_near_boundary_curve_ends_wrapper_imp(std::istringstream &, - CGAL::Arr_use_dummy_tag); - bool compare_y_near_boundary_curve_ends_wrapper_imp(std::istringstream &, - CGAL::Arr_use_traits_tag); + bool compare_y_near_boundary_wrapper(std::istringstream&); + bool compare_y_near_boundary_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag); + bool compare_y_near_boundary_wrapper_imp(std::istringstream&, + CGAL::Arr_use_traits_tag); - // TODO Compare_y_on_boundary_2(pt1, pt2) - // TODO Is_on_y_identification_2(pt) - // TODO Is_on_y_identification_2(xcv) + // TODO Is_on_y_identification_2 // ------------------------------------------------------------------------- @@ -198,40 +193,45 @@ private: /*! Test Parameter_space_in_y_2 */ - bool parameter_space_in_y_curve_end_wrapper(std::istringstream &); - bool parameter_space_in_y_curve_end_wrapper_imp(std::istringstream &, - CGAL::Arr_use_dummy_tag); - bool parameter_space_in_y_curve_end_wrapper_imp(std::istringstream &, - CGAL::Arr_use_traits_tag); + bool parameter_space_in_y_wrapper(std::istringstream&); + bool parameter_space_in_y_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag); + bool parameter_space_in_y_wrapper_imp(std::istringstream&, + CGAL::Arr_use_traits_tag); + + /*! Test Compare_x_near_limit_2 + */ + bool compare_x_near_limit_wrapper(std::istringstream&); + bool compare_x_near_limit_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag); + bool compare_x_near_limit_wrapper_imp(std::istringstream&, + CGAL::Arr_use_traits_tag); + + /*! Test Compare_x_at_limit_2 + */ + bool compare_x_at_limit_wrapper(std::istringstream&); + bool compare_x_at_limit_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag); + bool compare_x_at_limit_wrapper_imp(std::istringstream&, + CGAL::Arr_use_traits_tag); - // TODO Parameter_space_in_y_2(pt) - // TODO Parameter_space_in_y_2(xcv) - /*! Test Compare_x_near_boundary_2 */ - bool compare_x_near_boundary_point_curve_end_wrapper(std::istringstream &); - bool compare_x_near_boundary_point_curve_end_wrapper_imp( - std::istringstream &, - CGAL::Arr_use_dummy_tag - ); - bool compare_x_near_boundary_point_curve_end_wrapper_imp( - std::istringstream &, - CGAL::Arr_use_traits_tag - ); - - bool compare_x_near_boundary_curve_ends_wrapper(std::istringstream &); - bool compare_x_near_boundary_curve_ends_wrapper_imp( - std::istringstream &, - CGAL::Arr_use_dummy_tag - ); - bool compare_x_near_boundary_curve_ends_wrapper_imp( - std::istringstream &, - CGAL::Arr_use_traits_tag - ); + bool compare_x_near_boundary_wrapper(std::istringstream&); + bool compare_x_near_boundary_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag); + bool compare_x_near_boundary_wrapper_imp(std::istringstream&, + CGAL::Arr_use_traits_tag); - // TODO Compare_x_on_boundary_2(pt1, pt2) - // TODO Is_on_x_identification_2(pt) - // TODO Is_on_x_identification_2(xcv) + /*! Test Compare_x_on_boundary_2 + */ + bool compare_x_on_boundary_wrapper(std::istringstream&); + bool compare_x_on_boundary_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag); + bool compare_x_on_boundary_wrapper_imp(std::istringstream&, + CGAL::Arr_use_traits_tag); + + // TODO Is_on_x_identification_2 //@} @@ -247,7 +247,7 @@ public: * Constructor. * Accepts test data file name. */ -template +template Traits_test::Traits_test(int argc, char * argv[]) : Traits_base_test(argc, argv) { @@ -291,40 +291,40 @@ Traits_test::Traits_test(int argc, char * argv[]) : // left-right m_wrappers[std::string("parameter_space_x")] = - &Traits_test::parameter_space_in_x_curve_end_wrapper; - // TODO Parameter_space_in_x_2(pt) - // TODO Parameter_space_in_x_2(xcv) - m_wrappers[std::string("boundary_near_y")] = - &Traits_test::compare_y_near_boundary_curve_ends_wrapper; - // TODO Compare_y_on_boundary_2(pt1, pt2) - // TODO Is_on_y_identification_2(pt) - // TODO Is_on_y_identification_2(xcv) + &Traits_test::parameter_space_in_x_wrapper; + m_wrappers[std::string("compare_y_near_boundary")] = + &Traits_test::compare_y_near_boundary_wrapper; + + // TODO Is_on_y_identification_2 // bottom-top m_wrappers[std::string("parameter_space_y")] = - &Traits_test::parameter_space_in_y_curve_end_wrapper; - // TODO Parameter_space_in_y_2(pt) - // TODO Parameter_space_in_y_2(xcv) - m_wrappers[std::string("boundary_near_x")] = - &Traits_test::compare_x_near_boundary_curve_ends_wrapper; - // TODO split boundary_near_x in point+curve-end + curve-ends - // TODO Compare_x_on_boundary_2(pt1, pt2) - // TODO Is_on_x_identification_2(pt) - // TODO Is_on_x_identification_2(xcv) + &Traits_test::parameter_space_in_y_wrapper; + m_wrappers[std::string("compare_x_near_limit")] = + &Traits_test::compare_x_near_limit_wrapper; + m_wrappers[std::string("compare_x_at_limit")] = + &Traits_test::compare_x_at_limit_wrapper; + + m_wrappers[std::string("compare_x_near_boundary")] = + &Traits_test::compare_x_near_boundary_wrapper; + m_wrappers[std::string("compare_x_on_boundary")] = + &Traits_test::compare_x_on_boundary_wrapper; + + // TODO Is_on_x_identification_2 } /*! * Destructor. */ -template +template Traits_test::~Traits_test() {} /*! Test Compare_x_2 */ -template -bool Traits_test::compare_x_wrapper(std::istringstream & str_stream) +template +bool Traits_test::compare_x_wrapper(std::istringstream& str_stream) { unsigned int id1, id2; str_stream >> id1 >> id2; @@ -340,8 +340,8 @@ bool Traits_test::compare_x_wrapper(std::istringstream & str_stream) /*! Test Compare_xy_2 */ -template -bool Traits_test::compare_xy_wrapper(std::istringstream & str_stream) +template +bool Traits_test::compare_xy_wrapper(std::istringstream& str_stream) { unsigned int id1, id2; str_stream >> id1 >> id2; @@ -358,12 +358,12 @@ bool Traits_test::compare_xy_wrapper(std::istringstream & str_stream) /*! Tests Construct_min_vertex_2. * Degenerate case: vertical curve. */ -template -bool Traits_test::min_vertex_wrapper(std::istringstream & str_stream) +template +bool Traits_test::min_vertex_wrapper(std::istringstream& str_stream) { unsigned int id1, id2; str_stream >> id1 >> id2; - Point_2 & exp_answer = this->m_points[id2]; + Point_2& exp_answer = this->m_points[id2]; std::cout << "Test: min_vertex( " << this->m_xcurves[id1] << " ) ? " << exp_answer << " "; @@ -375,12 +375,12 @@ bool Traits_test::min_vertex_wrapper(std::istringstream & str_stream) /*! Tests Construct_max_vertex_2. * Degenerate case: vertical curve. */ -template -bool Traits_test::max_vertex_wrapper(std::istringstream & str_stream) +template +bool Traits_test::max_vertex_wrapper(std::istringstream& str_stream) { unsigned int id1, id2; str_stream >> id1 >> id2; - Point_2 & exp_answer = this->m_points[id2]; + Point_2& exp_answer = this->m_points[id2]; std::cout << "Test: max_vertex( " << this->m_xcurves[id1] << " ) ? " << exp_answer << " "; @@ -389,9 +389,9 @@ bool Traits_test::max_vertex_wrapper(std::istringstream & str_stream) return this->compare_points(exp_answer, real_answer); } -template +template bool -Traits_test::is_vertical_wrapper(std::istringstream & str_stream) +Traits_test::is_vertical_wrapper(std::istringstream& str_stream) { unsigned int id; str_stream >> id; @@ -408,9 +408,9 @@ Traits_test::is_vertical_wrapper(std::istringstream & str_stream) * Degenerate cases: The point is an endpoint of the curve. * The curve is vertical. */ -template +template bool -Traits_test::compare_y_at_x_wrapper(std::istringstream & str_stream) +Traits_test::compare_y_at_x_wrapper(std::istringstream& str_stream) { unsigned int id1, id2; str_stream >> id1 >> id2; @@ -431,29 +431,28 @@ Traits_test::compare_y_at_x_wrapper(std::istringstream & str_stream) * The curves coincide and vertical. * One of the curves is vertical. */ -template +template bool Traits_test:: -compare_y_at_x_left_wrapper(std::istringstream & str_stream) +compare_y_at_x_left_wrapper(std::istringstream& str_stream) { typedef typename T_Traits::Has_left_category Has_left_category; return compare_y_at_x_left_wrapper_imp(str_stream, Has_left_category()); } -template +template bool Traits_test:: -compare_y_at_x_left_wrapper_imp (std::istringstream &, CGAL::Tag_false) +compare_y_at_x_left_wrapper_imp(std::istringstream&, CGAL::Tag_false) { CGAL_error(); return false; } -template +template bool Traits_test:: -compare_y_at_x_left_wrapper_imp(std::istringstream & str_stream, - CGAL::Tag_true) +compare_y_at_x_left_wrapper_imp(std::istringstream& str_stream, CGAL::Tag_true) { unsigned int id1, id2, id3; str_stream >> id1 >> id2 >> id3; @@ -474,10 +473,10 @@ compare_y_at_x_left_wrapper_imp(std::istringstream & str_stream, * The curves coincide and vertical. * One of the curves is vertical. */ -template +template bool Traits_test:: -compare_y_at_x_right_wrapper(std::istringstream & str_stream) +compare_y_at_x_right_wrapper(std::istringstream& str_stream) { unsigned int id1, id2, id3; str_stream >> id1 >> id2 >> id3; @@ -495,9 +494,9 @@ compare_y_at_x_right_wrapper(std::istringstream & str_stream) /*! Tests Equal_2::operator()(Point_2, Point_2). * Check whether two points are the same. */ -template +template bool -Traits_test::equal_points_wrapper(std::istringstream & str_stream) +Traits_test::equal_points_wrapper(std::istringstream& str_stream) { unsigned int id1, id2; str_stream >> id1 >> id2; @@ -512,9 +511,9 @@ Traits_test::equal_points_wrapper(std::istringstream & str_stream) /*! Tests Equal_2::operator()(X_monotone_curve_2, X_monotone_curve_2). * Check whether two x-monotone curves are the same. */ -template +template bool -Traits_test::equal_curves_wrapper(std::istringstream & str_stream) +Traits_test::equal_curves_wrapper(std::istringstream& str_stream) { unsigned int id1, id2; str_stream >> id1 >> id2; @@ -533,9 +532,9 @@ Traits_test::equal_curves_wrapper(std::istringstream & str_stream) * segment is vertical. Both firt and last are vertical. An internal segment * is vertical. */ -template +template bool -Traits_test::make_x_monotone_wrapper(std::istringstream & str_stream) +Traits_test::make_x_monotone_wrapper(std::istringstream& str_stream) { typedef T_Traits Traits; typedef typename Traits::Point_2 Point_2; @@ -591,13 +590,14 @@ Traits_test::make_x_monotone_wrapper(std::istringstream & str_stream) * left) endpoint of one curve and the first (resp. last) segment of the * other coincide. */ -template -bool Traits_test::intersect_wrapper(std::istringstream & str_stream) +template +bool Traits_test::intersect_wrapper(std::istringstream& str_stream) { typedef T_Traits Traits; typedef typename Traits::Point_2 Point_2; typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2; typedef typename Traits::Curve_2 Curve_2; + typedef typename Traits::Multiplicity Multiplicity; unsigned int id1, id2; str_stream >> id1 >> id2; @@ -629,10 +629,10 @@ bool Traits_test::intersect_wrapper(std::istringstream & str_stream) } exp_type = 0; - typedef std::pair Point_2_pair; + typedef std::pair Point_2_pair; const Point_2_pair * pt_pair_ptr = CGAL::object_cast (&(object_vec[i])); - CGAL_assertion (pt_pair_ptr != NULL); + CGAL_assertion(pt_pair_ptr != NULL); if (!this->compare(type, exp_type, "type")) return false; if (!this->compare_points(this->m_points[id], (*pt_pair_ptr).first)) return false; @@ -648,8 +648,8 @@ bool Traits_test::intersect_wrapper(std::istringstream & str_stream) * Degenerate cases for polylines: the point and a polyline internal point * coincides. */ -template -bool Traits_test::split_wrapper(std::istringstream & str_stream) +template +bool Traits_test::split_wrapper(std::istringstream& str_stream) { typedef T_Traits Traits; typedef typename Traits::Point_2 Point_2; @@ -659,8 +659,8 @@ bool Traits_test::split_wrapper(std::istringstream & str_stream) unsigned int id1, id2, id3, id4; str_stream >> id1 >> id2 >> id3 >> id4; X_monotone_curve_2 cv1, cv2; - std::cout << "Test: split( " << this->m_xcurves[id1] << "," << this->m_points[id2] - << " ) ? "; + std::cout << "Test: split( " << this->m_xcurves[id1] << "," + << this->m_points[id2] << " ) ? "; this->m_traits.split_2_object()(this->m_xcurves[id1], this->m_points[id2], cv1, cv2); @@ -671,26 +671,26 @@ bool Traits_test::split_wrapper(std::istringstream & str_stream) /*! Tests Are_mergeable_2. * Check whether it is possible to merge two given x-monotone curves. */ -template +template bool -Traits_test::are_mergeable_wrapper(std::istringstream & str_stream) +Traits_test::are_mergeable_wrapper(std::istringstream& str_stream) { typedef typename T_Traits::Has_merge_category Has_merge_category; return are_mergeable_wrapper_imp(str_stream, Has_merge_category()); } -template +template bool Traits_test:: -are_mergeable_wrapper_imp(std::istringstream &, CGAL::Tag_false) +are_mergeable_wrapper_imp(std::istringstream&, CGAL::Tag_false) { CGAL_error(); return false; } -template +template bool Traits_test:: -are_mergeable_wrapper_imp(std::istringstream & str_stream, CGAL::Tag_true) +are_mergeable_wrapper_imp(std::istringstream& str_stream, CGAL::Tag_true) { unsigned int id1, id2; str_stream >> id1 >> id2; @@ -707,23 +707,23 @@ are_mergeable_wrapper_imp(std::istringstream & str_stream, CGAL::Tag_true) /*! Tests Merge_2. * Merge two given x-monotone curves into a single curve. */ -template -bool Traits_test::merge_wrapper(std::istringstream & str_stream) +template +bool Traits_test::merge_wrapper(std::istringstream& str_stream) { typedef typename T_Traits::Has_merge_category Has_merge_category; return merge_wrapper_imp(str_stream, Has_merge_category()); } -template -bool Traits_test::merge_wrapper_imp(std::istringstream &, +template +bool Traits_test::merge_wrapper_imp(std::istringstream&, CGAL::Tag_false) { CGAL_error(); return false; } -template -bool Traits_test::merge_wrapper_imp(std::istringstream & str_stream, +template +bool Traits_test::merge_wrapper_imp(std::istringstream& str_stream, CGAL::Tag_true) { typedef T_Traits Traits; @@ -742,9 +742,9 @@ bool Traits_test::merge_wrapper_imp(std::istringstream & str_stream, /*! Tests Approximate_2. * Return an approximation of a point coordinate. */ -template +template bool -Traits_test::approximate_wrapper(std::istringstream & ) +Traits_test::approximate_wrapper(std::istringstream& ) { return false; } @@ -752,9 +752,9 @@ Traits_test::approximate_wrapper(std::istringstream & ) /*! tests Construct_x_monotone_curve_2. * Return an x-monotone curve connecting the two given endpoints. */ -template +template bool Traits_test:: -construct_x_monotone_curve_wrapper(std::istringstream & ) +construct_x_monotone_curve_wrapper(std::istringstream& ) { return false; } @@ -769,40 +769,32 @@ construct_x_monotone_curve_wrapper(std::istringstream & ) /*! Test Parameter_space_in_x_2 */ -template +template bool Traits_test:: -parameter_space_in_x_curve_end_wrapper(std::istringstream & str_stream) +parameter_space_in_x_wrapper(std::istringstream& str_stream) { - typedef typename CGAL::internal::Arr_complete_left_side_tag< T_Traits >::Tag - Arr_left_side_category; - typedef typename CGAL::internal::Arr_complete_right_side_tag< T_Traits >::Tag - Arr_right_side_category; - - typedef CGAL::internal::Arr_left_right_implementation_dispatch< - Arr_left_side_category, Arr_right_side_category > LR; - - typedef typename LR::Parameter_space_in_x_2_curve_end_tag - Psx_2_curve_end_tag; - - return parameter_space_in_x_curve_end_wrapper_imp( - str_stream, Psx_2_curve_end_tag() - ); + typedef typename CGAL::internal::Arr_complete_left_side_category< T_Traits >::Category + Left_side_category; + typedef typename CGAL::internal::Arr_complete_right_side_category< T_Traits >::Category + Right_side_category; + typedef CGAL::internal::Arr_left_right_implementation_dispatch + LR; + typedef typename LR::Parameter_space_in_x_2_curve_end_tag Psx_tag; + return parameter_space_in_x_wrapper_imp(str_stream, Psx_tag()); } -template +template bool Traits_test:: -parameter_space_in_x_curve_end_wrapper_imp( - std::istringstream &, CGAL::Arr_use_dummy_tag -) +parameter_space_in_x_wrapper_imp(std::istringstream&, CGAL::Arr_use_dummy_tag) { CGAL_error(); return false; } -template +template bool Traits_test:: -parameter_space_in_x_curve_end_wrapper_imp (std::istringstream & str_stream, - CGAL::Arr_use_traits_tag) +parameter_space_in_x_wrapper_imp(std::istringstream& str_stream, + CGAL::Arr_use_traits_tag) { CGAL::Arr_parameter_space exp_answer, real_answer; unsigned int id; @@ -819,7 +811,7 @@ parameter_space_in_x_curve_end_wrapper_imp (std::istringstream & str_stream, next_input = this->get_next_input(str_stream); CGAL_assertion(next_input.first == Base::PARAMETER_SPACE); } else if (next_input.first == Base::PARAMETER_SPACE) { - std::cout << "Test: parameter_space_x( " << this->m_points[id] << " ) ? "; + std::cout << "Test: parameter_space_in_x( " << this->m_points[id] << " ) ? "; } else { CGAL_error(); return false; @@ -838,45 +830,34 @@ parameter_space_in_x_curve_end_wrapper_imp (std::istringstream & str_stream, return this->compare(exp_answer, real_answer); } -// TODO Parameter_space_in_x_2(pt) -// TODO Parameter_space_in_x_2(xcv) - /*! Test Compare_y_near_boundary_2 */ -template +template bool Traits_test:: -compare_y_near_boundary_curve_ends_wrapper(std::istringstream & str_stream) +compare_y_near_boundary_wrapper(std::istringstream& str_stream) { - typedef typename CGAL::internal::Arr_complete_left_side_tag< T_Traits >::Tag - Arr_left_side_category; - typedef typename CGAL::internal::Arr_complete_right_side_tag< T_Traits >::Tag - Arr_right_side_category; - - typedef CGAL::internal::Arr_left_right_implementation_dispatch< - Arr_left_side_category, Arr_right_side_category > LR; - - typedef typename LR::Compare_y_near_boundary_2_curve_ends_tag - Cmp_y_nb_2_curve_ends_tag; - - return compare_y_near_boundary_curve_ends_wrapper_imp( - str_stream, - Cmp_y_nb_2_curve_ends_tag() - ); + typedef typename CGAL::internal::Arr_complete_left_side_category< T_Traits >::Category + Left_side_category; + typedef typename CGAL::internal::Arr_complete_right_side_category< T_Traits >::Category + Right_side_category; + typedef CGAL::internal::Arr_left_right_implementation_dispatch + LR; + typedef typename LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_tag; + return compare_y_near_boundary_wrapper_imp(str_stream, Cmp_tag()); } -template +template bool Traits_test:: -compare_y_near_boundary_curve_ends_wrapper_imp(std::istringstream &, - CGAL::Arr_use_dummy_tag) +compare_y_near_boundary_wrapper_imp(std::istringstream&, CGAL::Arr_use_dummy_tag) { CGAL_error(); return false; } -template +template bool Traits_test:: -compare_y_near_boundary_curve_ends_wrapper_imp (std::istringstream & str_stream, - CGAL::Arr_use_traits_tag) +compare_y_near_boundary_wrapper_imp(std::istringstream& str_stream, + CGAL::Arr_use_traits_tag) { unsigned int id1, id2; str_stream >> id1 >> id2; @@ -885,7 +866,7 @@ compare_y_near_boundary_curve_ends_wrapper_imp (std::istringstream & str_stream, CGAL_assertion(next_input.first == Base::CURVE_END); CGAL::Arr_curve_end cv_end = static_cast(next_input.second); - std::cout << "Test: boundary_near_y( " << this->m_xcurves[id1] << " , " + std::cout << "Test: compare_y_near_boundary( " << this->m_xcurves[id1] << " , " << this->m_xcurves[id2]<< " , " << (cv_end == CGAL::ARR_MIN_END ? "MIN_END" : "MAX_END") << " ) ? "; next_input = this->get_next_input(str_stream); @@ -901,49 +882,39 @@ compare_y_near_boundary_curve_ends_wrapper_imp (std::istringstream & str_stream, return this->compare(exp_answer, real_answer); } -// TODO Compare_y_on_boundary_2(pt1, pt2) -// TODO Is_on_y_identification_2(pt) -// TODO Is_on_y_identification_2(xcv) +// TODO Is_on_y_identification_2 // --------------------------------------------------------------------------- // bottom-top /*! Test Parameter_space_in_y_2 */ -template +template bool Traits_test:: -parameter_space_in_y_curve_end_wrapper(std::istringstream & str_stream) +parameter_space_in_y_wrapper(std::istringstream& str_stream) { - typedef typename CGAL::internal::Arr_complete_bottom_side_tag< T_Traits >::Tag - Arr_bottom_side_category; - typedef typename CGAL::internal::Arr_complete_top_side_tag< T_Traits >::Tag - Arr_top_side_category; - - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< - Arr_bottom_side_category, Arr_top_side_category > BT; - - typedef typename BT::Parameter_space_in_y_2_curve_end_tag - Psy_2_curve_end_tag; - - return parameter_space_in_y_curve_end_wrapper_imp( - str_stream, Psy_2_curve_end_tag() - ); + typedef typename CGAL::internal::Arr_complete_bottom_side_category::Category + Bottom_side_category; + typedef typename CGAL::internal::Arr_complete_top_side_category::Category + Top_side_category; + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch + BT; + typedef typename BT::Parameter_space_in_y_2_curve_end_tag Psy_tag; + return parameter_space_in_y_wrapper_imp(str_stream, Psy_tag()); } -template +template bool Traits_test:: -parameter_space_in_y_curve_end_wrapper_imp( - std::istringstream &, CGAL::Arr_use_dummy_tag -) +parameter_space_in_y_wrapper_imp(std::istringstream&, CGAL::Arr_use_dummy_tag) { CGAL_error(); return false; } -template +template bool Traits_test:: -parameter_space_in_y_curve_end_wrapper_imp (std::istringstream & str_stream, - CGAL::Arr_use_traits_tag) +parameter_space_in_y_wrapper_imp(std::istringstream& str_stream, + CGAL::Arr_use_traits_tag) { unsigned int id; str_stream >> id; @@ -959,7 +930,7 @@ parameter_space_in_y_curve_end_wrapper_imp (std::istringstream & str_stream, next_input = this->get_next_input(str_stream); CGAL_assertion(next_input.first == Base::PARAMETER_SPACE); } else if (next_input.first == Base::PARAMETER_SPACE) { - std::cout << "Test: parameter_space_y( " << this->m_points[id] << " ) ? "; + std::cout << "Test: parameter_space_in_y( " << this->m_points[id] << " ) ? "; } else { CGAL_error(); return false; @@ -979,53 +950,104 @@ parameter_space_in_y_curve_end_wrapper_imp (std::istringstream & str_stream, return this->compare(exp_answer, real_answer); } -// TODO Parameter_space_in_y_2(pt) -// TODO Parameter_space_in_y_2(xcv) - -// TODO split boundary_near_x in point+curve-end + curve-ends - -template +/* Compare_x_near_limit_2 + */ +template bool Traits_test:: -compare_x_near_boundary_point_curve_end_wrapper ( - std::istringstream & str_stream) +compare_x_near_limit_wrapper(std::istringstream& str_stream) { - typedef typename CGAL::internal::Arr_complete_bottom_side_tag< T_Traits >::Tag - Arr_bottom_side_category; - typedef typename CGAL::internal::Arr_complete_top_side_tag< T_Traits >::Tag - Arr_top_side_category; - - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< - Arr_bottom_side_category, Arr_top_side_category > BT; - - typedef typename BT::Compare_x_near_boundary_2_curve_ends_tag - Cmp_x_nb_2_point_curve_end_tag; - - return compare_x_near_boundary_point_curve_end_wrapper_imp( - str_stream, - Cmp_x_nb_2_point_curve_end_tag() - ); + typedef typename CGAL::internal::Arr_complete_bottom_side_category::Category + Bottom_side_category; + typedef typename CGAL::internal::Arr_complete_top_side_category::Category + Top_side_category; + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch + BT; + typedef typename BT::Compare_x_near_limit_2_curve_ends_tag Cmp_tag; + return compare_x_near_limit_wrapper_imp(str_stream, Cmp_tag()); } -template +template bool Traits_test:: -compare_x_near_boundary_point_curve_end_wrapper_imp (std::istringstream &, - CGAL::Arr_use_dummy_tag) +compare_x_near_limit_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag) { CGAL_error(); return false; } -template +template bool Traits_test:: -compare_x_near_boundary_point_curve_end_wrapper_imp ( - std::istringstream & str_stream, - CGAL::Arr_use_traits_tag) +compare_x_near_limit_wrapper_imp(std::istringstream& str_stream, + CGAL::Arr_use_traits_tag) { + std::cout << "Test: compare_x_near_limit( "; + + unsigned int id1, id2; + // xcurve xcurve curve-end + str_stream >> id1 >> id2; + std::pair next_input = + this->get_next_input(str_stream); + CGAL_assertion(next_input.first == Base::CURVE_END); + CGAL::Arr_curve_end cv_end = + static_cast(next_input.second); + + std::cout << this->m_xcurves[id1] << ", " + << this->m_xcurves[id2] << " , " + << this->curve_end_str(cv_end) << " ) ? "; + + next_input = this->get_next_input(str_stream); + CGAL_assertion(next_input.first == Base::SIGN); + CGAL::Comparison_result exp_answer = + static_cast(next_input.second); + std::cout << (exp_answer == CGAL::SMALLER ? "SMALLER": + (exp_answer == CGAL::LARGER ? "LARGER":"EQUAL")) << " "; + + CGAL::Comparison_result real_answer = + this->m_traits.compare_x_near_limit_2_object() + (this->m_xcurves[id1], this->m_xcurves[id2], cv_end); + return this->compare(exp_answer, real_answer); +} + +/* Compare_x_at_limit + */ +template +bool Traits_test:: +compare_x_at_limit_wrapper(std::istringstream& str_stream) +{ + typedef typename CGAL::internal::Arr_complete_bottom_side_category::Category + Bottom_side_category; + typedef typename CGAL::internal::Arr_complete_top_side_category::Category + Top_side_category; + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch + BT; + typedef typename BT::Compare_x_at_limit_2_curve_ends_tag Cmp_tag1; + typedef typename BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_tag2; + typedef typename CGAL::internal::Or_traits::type Cmp_tag; + return compare_x_at_limit_wrapper_imp(str_stream, Cmp_tag()); +} + +template +bool Traits_test:: +compare_x_at_limit_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag) +{ + CGAL_error(); + return false; +} + +template +bool Traits_test:: +compare_x_at_limit_wrapper_imp(std::istringstream& str_stream, + CGAL::Arr_use_traits_tag) +{ + std::cout << "Test: compare_x_at_limit( "; + CGAL::Comparison_result real_answer; unsigned int id1, id2; // first argument must be a number (either a point or a xcurve) str_stream >> id1; - std::pair next_input = this->get_next_input(str_stream); + std::pair next_input = + this->get_next_input(str_stream); // second argument can be number or text (either xcurve or curve_end) bool curves_op = next_input.first == Base::NUMBER; CGAL::Arr_curve_end cv_end1 = CGAL::ARR_MIN_END, cv_end2 = CGAL::ARR_MIN_END; @@ -1035,7 +1057,8 @@ compare_x_near_boundary_point_curve_end_wrapper_imp ( next_input = this->get_next_input(str_stream); CGAL_assertion(next_input.first == Base::CURVE_END); cv_end1 = static_cast(next_input.second); - std::cout << "Test: boundary_near_x( " << this->m_points[id1] << " , " + + std::cout << this->m_points[id1] << " , " << this->m_xcurves[id2]<< " , " << this->curve_end_str(cv_end1) << " ) ? "; } @@ -1047,7 +1070,8 @@ compare_x_near_boundary_point_curve_end_wrapper_imp ( next_input = this->get_next_input(str_stream); CGAL_assertion(next_input.first == Base::CURVE_END); cv_end2 = static_cast(next_input.second); - std::cout << "Test: boundary_near_x( " << this->m_xcurves[id1] << ", " + + std::cout << this->m_xcurves[id1] << ", " << this->curve_end_str(cv_end1) << ", " << this->m_xcurves[id2] << " , " << this->curve_end_str(cv_end2) << " ) ? "; @@ -1062,53 +1086,114 @@ compare_x_near_boundary_point_curve_end_wrapper_imp ( (exp_answer == CGAL::LARGER ? "LARGER":"EQUAL")) << " "; real_answer = (curves_op) ? - this->m_traits.compare_x_near_boundary_2_object() + this->m_traits.compare_x_at_limit_2_object() (this->m_points[id1], this->m_xcurves[id2], cv_end1) : - this->m_traits.compare_x_near_boundary_2_object() - (this->m_xcurves[id1],cv_end1,this->m_xcurves[id2], cv_end2); + this->m_traits.compare_x_at_limit_2_object() + (this->m_xcurves[id1], cv_end1,this->m_xcurves[id2], cv_end2); return this->compare(exp_answer, real_answer); } - -template +/* Compare_x_near_boundary_2 + */ +template bool Traits_test:: -compare_x_near_boundary_curve_ends_wrapper (std::istringstream & str_stream) +compare_x_near_boundary_wrapper(std::istringstream& str_stream) { - typedef typename CGAL::internal::Arr_complete_bottom_side_tag< T_Traits >::Tag - Arr_bottom_side_category; - typedef typename CGAL::internal::Arr_complete_top_side_tag< T_Traits >::Tag - Arr_top_side_category; - - typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< - Arr_bottom_side_category, Arr_top_side_category > BT; - - typedef typename BT::Compare_x_near_boundary_2_curve_ends_tag - Cmp_x_nb_2_curve_ends_tag; - - return compare_x_near_boundary_curve_ends_wrapper_imp( - str_stream, Cmp_x_nb_2_curve_ends_tag() - ); + typedef typename CGAL::internal::Arr_complete_bottom_side_category::Category + Bottom_side_category; + typedef typename CGAL::internal::Arr_complete_top_side_category::Category + Top_side_category; + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch + BT; + typedef typename BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_tag; + return compare_x_near_boundary_wrapper_imp(str_stream, Cmp_tag()); } -template +template bool Traits_test:: -compare_x_near_boundary_curve_ends_wrapper_imp (std::istringstream &, - CGAL::Arr_use_dummy_tag) +compare_x_near_boundary_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag) { CGAL_error(); return false; } -template +template bool Traits_test:: -compare_x_near_boundary_curve_ends_wrapper_imp (std::istringstream & str_stream, - CGAL::Arr_use_traits_tag) +compare_x_near_boundary_wrapper_imp(std::istringstream& str_stream, + CGAL::Arr_use_traits_tag) { + std::cout << "Test: compare_x_near_boundary( "; + + unsigned int id1, id2; + // xcurve xcurve curve-end + str_stream >> id1 >> id2; + std::pair next_input = + this->get_next_input(str_stream); + CGAL_assertion(next_input.first == Base::CURVE_END); + CGAL::Arr_curve_end cv_end = + static_cast(next_input.second); + + std::cout << this->m_xcurves[id1] << ", " + << this->m_xcurves[id2] << " , " + << this->curve_end_str(cv_end) << " ) ? "; + + next_input = this->get_next_input(str_stream); + CGAL_assertion(next_input.first == Base::SIGN); + CGAL::Comparison_result exp_answer = + static_cast(next_input.second); + std::cout << (exp_answer == CGAL::SMALLER ? "SMALLER": + (exp_answer == CGAL::LARGER ? "LARGER":"EQUAL")) << " "; + + CGAL::Comparison_result real_answer = + this->m_traits.compare_x_near_boundary_2_object() + (this->m_xcurves[id1], this->m_xcurves[id2], cv_end); + return this->compare(exp_answer, real_answer); +} + +/* Compare_x_on_boundary + */ +template +bool Traits_test:: +compare_x_on_boundary_wrapper(std::istringstream& str_stream) +{ + typedef typename CGAL::internal::Arr_complete_bottom_side_category::Category + Bottom_side_category; + typedef typename CGAL::internal::Arr_complete_top_side_category::Category + Top_side_category; + typedef CGAL::internal::Arr_bottom_top_implementation_dispatch + BT; + typedef typename BT::Compare_x_on_boundary_2_points_tag Cmp_tag1; + typedef typename BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_tag2; + typedef typename BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_tag3; + typedef typename CGAL::internal::Or_traits::type Cmp_tag12; + typedef typename CGAL::internal::Or_traits::type Cmp_tag; + return compare_x_on_boundary_wrapper_imp(str_stream, Cmp_tag()); +} + +template +bool Traits_test:: +compare_x_on_boundary_wrapper_imp(std::istringstream&, + CGAL::Arr_use_dummy_tag) +{ + CGAL_error(); + return false; +} + +template +bool Traits_test:: +compare_x_on_boundary_wrapper_imp(std::istringstream& str_stream, + CGAL::Arr_use_traits_tag) +{ + // TBD: points + std::cout << "Test: compare_x_on_boundary( "; + CGAL::Comparison_result real_answer; unsigned int id1, id2; // first argument must be a number (either a point or a xcurve) str_stream >> id1; - std::pair next_input = this->get_next_input(str_stream); + std::pair next_input = + this->get_next_input(str_stream); // second argument can be number or text (either xcurve or curve_end) bool curves_op = next_input.first == Base::NUMBER; CGAL::Arr_curve_end cv_end1 = CGAL::ARR_MIN_END, cv_end2 = CGAL::ARR_MIN_END; @@ -1118,7 +1203,8 @@ compare_x_near_boundary_curve_ends_wrapper_imp (std::istringstream & str_stream, next_input = this->get_next_input(str_stream); CGAL_assertion(next_input.first == Base::CURVE_END); cv_end1 = static_cast(next_input.second); - std::cout << "Test: boundary_near_x( " << this->m_points[id1] << " , " + + std::cout << this->m_points[id1] << " , " << this->m_xcurves[id2]<< " , " << this->curve_end_str(cv_end1) << " ) ? "; } @@ -1130,7 +1216,8 @@ compare_x_near_boundary_curve_ends_wrapper_imp (std::istringstream & str_stream, next_input = this->get_next_input(str_stream); CGAL_assertion(next_input.first == Base::CURVE_END); cv_end2 = static_cast(next_input.second); - std::cout << "Test: boundary_near_x( " << this->m_xcurves[id1] << ", " + + std::cout << this->m_xcurves[id1] << ", " << this->curve_end_str(cv_end1) << ", " << this->m_xcurves[id2] << " , " << this->curve_end_str(cv_end2) << " ) ? "; @@ -1145,15 +1232,13 @@ compare_x_near_boundary_curve_ends_wrapper_imp (std::istringstream & str_stream, (exp_answer == CGAL::LARGER ? "LARGER":"EQUAL")) << " "; real_answer = (curves_op) ? - this->m_traits.compare_x_near_boundary_2_object() + this->m_traits.compare_x_on_boundary_2_object() (this->m_points[id1], this->m_xcurves[id2], cv_end1) : - this->m_traits.compare_x_near_boundary_2_object() - (this->m_xcurves[id1],cv_end1,this->m_xcurves[id2], cv_end2); + this->m_traits.compare_x_on_boundary_2_object() + (this->m_xcurves[id1], cv_end1,this->m_xcurves[id2], cv_end2); return this->compare(exp_answer, real_answer); } -// TODO Compare_x_on_boundary_2(pt1, pt2) -// TODO Is_on_x_identification_2(pt) -// TODO Is_on_x_identification_2(xcv) +// TODO Is_on_x_identification_2 #endif diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test deleted file mode 100755 index 5539aea7bbe..00000000000 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/bash - -./cgal_test_base diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base index 1b3a1845db1..a1c2641669d 100755 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base @@ -31,6 +31,7 @@ FULL_ERROR_DESCRIPTION_FILE=ProgramOutput.error.txt CARTESIAN_KERNEL=0 SIMPLE_CARTESIAN_KERNEL=1 +UNIVARIATE_ALGEBRAIC_KERNEL=2 SEGMENT_TRAITS=0 NON_CACHING_SEGMENT_TRAITS=1 @@ -63,31 +64,35 @@ LAZY_GMPZ_NT=12 LEDA_INT_NT=13 CGAL_GMPZ_NT=14 CORE_INT_NT=15 +CORE_RAT_NT=16 -COMPARE=3 -VERTEX=4 -IS_VERTICAL=5 -BOUNDARY_NEAR_X=6 -BOUNDARY_NEAR_Y=7 -PARAMETER_SPACE_X=8 -PARAMETER_SPACE_Y=9 -COMPARE_Y_AT_X=10 -COMPARE_Y_AT_X_LEFT=11 -COMPARE_Y_AT_X_RIGHT=12 -MAKE_X_MONOTONE=13 -INTERSECT=14 -SPLIT=15 -ARE_MERGEABLE=16 -MERGE=17 -ERRORS=18 -CONSTRUCTOR=19 -X_ON_IDENTIFICATION=20 -Y_ON_IDENTIFICATION=21 -IS_BOUNDED=22 -IS_IN_X_RANGE=23 -COMPARE_Y_POSITION=24 -IS_BETWEEN_CW=25 -COMPARE_CW_AROUND_POINT=26 +COMPARE=1 +VERTEX=2 +IS_VERTICAL=3 +COMPARE_Y_AT_X=4 +COMPARE_Y_AT_X_LEFT=5 +COMPARE_Y_AT_X_RIGHT=6 +MAKE_X_MONOTONE=7 +INTERSECT=8 +SPLIT=9 +ARE_MERGEABLE=10 +MERGE=11 +ERRORS=12 +CONSTRUCTOR=13 +COMPARE_X_AT_LIMIT=14 +COMPARE_X_NEAR_LIMIT=15 +COMPARE_X_ON_BOUNDARY=16 +COMPARE_X_NEAR_BOUNDARY=17 +COMPARE_Y_NEAR_BOUNDARY=18 +PARAMETER_SPACE_X=19 +PARAMETER_SPACE_Y=20 +X_ON_IDENTIFICATION=21 +Y_ON_IDENTIFICATION=22 +IS_BOUNDED=23 +IS_IN_X_RANGE=24 +COMPARE_Y_POSITION=25 +IS_BETWEEN_CW=26 +COMPARE_CW_AROUND_POINT=27 #---------------------------------------------------------------------# # configure @@ -321,8 +326,6 @@ execute_commands_old_structure() commands_indicator[COMPARE]=1 commands_indicator[VERTEX]=1 commands_indicator[IS_VERTICAL]=1 - commands_indicator[BOUNDARY_NEAR_X]=1 - commands_indicator[BOUNDARY_NEAR_Y]=1 commands_indicator[COMPARE_Y_AT_X]=1 commands_indicator[COMPARE_Y_AT_X_LEFT]=1 commands_indicator[COMPARE_Y_AT_X_RIGHT]=1 @@ -357,16 +360,6 @@ execute_commands_old_structure() data/empty.zero data/$1/is_vertical.xcv data/empty.zero \ data/$1/is_vertical $2 fi - if [ ${commands_indicator[$BOUNDARY_NEAR_X]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/empty.zero data/$1/boundary_near_x.xcv data/empty.zero \ - data/$1/boundary_near_x $2 - fi - if [ ${commands_indicator[$BOUNDARY_NEAR_Y]} -ne 0 ] ; then - run_trapped_test test_traits \ - data/empty.zero data/$1/boundary_near_y.xcv data/empty.zero \ - data/$1/boundary_near_y $2 - fi if [ ${commands_indicator[$COMPARE_Y_AT_X]} -ne 0 ] ; then run_trapped_test test_traits \ data/$1/compare_y_at_x.pt data/$1/compare_y_at_x.xcv \ @@ -432,8 +425,11 @@ execute_commands_new_structure() commands_indicator[COMPARE]=0 commands_indicator[VERTEX]=0 commands_indicator[IS_VERTICAL]=0 - commands_indicator[BOUNDARY_NEAR_X]=0 - commands_indicator[BOUNDARY_NEAR_Y]=0 + commands_indicator[COMPARE_X_AT_LIMIT]=0 + commands_indicator[COMPARE_X_NEAR_LIMIT]=0 + commands_indicator[COMPARE_X_ON_BOUNDARY]=0 + commands_indicator[COMPARE_X_NEAR_BOUNDARY]=0 + commands_indicator[COMPARE_Y_NEAR_BOUNDARY]=0 commands_indicator[PARAMETER_SPACE_X]=0 commands_indicator[PARAMETER_SPACE_Y]=0 commands_indicator[COMPARE_Y_AT_X]=0 @@ -467,13 +463,25 @@ execute_commands_new_structure() run_trapped_test test_traits data/$1/points \ data/$1/xcurves data/$1/curves data/$1/is_vertical $2 fi - if [ ${commands_indicator[$BOUNDARY_NEAR_X]} -ne 0 ] ; then + if [ ${commands_indicator[$COMPARE_X_AT_LIMIT]} -ne 0 ] ; then run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/boundary_near_x $2 + data/$1/xcurves data/$1/curves data/$1/compare_x_at_limit $2 fi - if [ ${commands_indicator[$BOUNDARY_NEAR_Y]} -ne 0 ] ; then + if [ ${commands_indicator[$COMPARE_X_NEAR_LIMIT]} -ne 0 ] ; then run_trapped_test test_traits data/$1/points \ - data/$1/xcurves data/$1/curves data/$1/boundary_near_y $2 + data/$1/xcurves data/$1/curves data/$1/compare_x_near_limit $2 + fi + if [ ${commands_indicator[$COMPARE_X_ON_BOUNDARY]} -ne 0 ] ; then + run_trapped_test test_traits data/$1/points \ + data/$1/xcurves data/$1/curves data/$1/compare_x_on_boundary $2 + fi + if [ ${commands_indicator[$COMPARE_X_NEAR_BOUNDARY]} -ne 0 ] ; then + run_trapped_test test_traits data/$1/points \ + data/$1/xcurves data/$1/curves data/$1/compare_x_near_boundary $2 + fi + if [ ${commands_indicator[$COMPARE_Y_NEAR_BOUNDARY]} -ne 0 ] ; then + run_trapped_test test_traits data/$1/points \ + data/$1/xcurves data/$1/curves data/$1/compare_y_near_boundary $2 fi if [ ${commands_indicator[$PARAMETER_SPACE_X]} -ne 0 ] ; then run_trapped_test test_traits data/$1/points \ @@ -531,10 +539,13 @@ execute_commands_traits_adaptor() # the new structure is not default, so this function executes only # commands that are given as arguments - commands_indicator[BOUNDARY_NEAR_X]=0 - commands_indicator[BOUNDARY_NEAR_Y]=0 commands_indicator[PARAMETER_SPACE_X]=0 commands_indicator[PARAMETER_SPACE_Y]=0 + commands_indicator[COMPARE_X_AT_LIMIT]=0 + commands_indicator[COMPARE_X_NEAR_LIMIT]=0 + commands_indicator[COMPARE_X_ON_BOUNDARY]=0 + commands_indicator[COMPARE_X_NEAR_BOUNDARY]=0 + commands_indicator[COMPARE_Y_NEAR_BOUNDARY]=0 commands_indicator[COMPARE_Y_AT_X_LEFT]=0 commands_indicator[ARE_MERGEABLE]=0 commands_indicator[MERGE]=0 @@ -556,16 +567,6 @@ execute_commands_traits_adaptor() done fi - if [ ${commands_indicator[$BOUNDARY_NEAR_X]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/boundary_near_x $2 - fi - if [ ${commands_indicator[$BOUNDARY_NEAR_Y]} -ne 0 ] ; then - run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ - data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ - data/test_adaptor/$1/boundary_near_y $2 - fi if [ ${commands_indicator[$PARAMETER_SPACE_X]} -ne 0 ] ; then run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ @@ -576,6 +577,33 @@ execute_commands_traits_adaptor() data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ data/test_adaptor/$1/parameter_space_y $2 fi + if [ ${commands_indicator[$COMPARE_X_AT_LIMIT]} -ne 0 ] ; then + run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ + data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ + data/test_adaptor/$1/compare_x_at_limit $2 + fi + if [ ${commands_indicator[$COMPARE_X_NEAR_LIMIT]} -ne 0 ] ; then + run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ + data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ + data/test_adaptor/$1/compare_x_near_limit $2 + fi + + if [ ${commands_indicator[$COMPARE_X_ON_BOUNDARY]} -ne 0 ] ; then + run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ + data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ + data/test_adaptor/$1/compare_x_on_boundary $2 + fi + if [ ${commands_indicator[$COMPARE_X_NEAR_BOUNDARY]} -ne 0 ] ; then + run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ + data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ + data/test_adaptor/$1/compare_x_near_boundary $2 + fi + + if [ ${commands_indicator[$COMPARE_Y_NEAR_BOUNDARY]} -ne 0 ] ; then + run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ + data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ + data/test_adaptor/$1/compare_y_near_boundary $2 + fi if [ ${commands_indicator[$COMPARE_Y_AT_X_LEFT]} -ne 0 ] ; then run_trapped_test test_traits_adaptor data/test_adaptor/$1/points \ data/test_adaptor/$1/xcurves data/test_adaptor/$1/curves \ @@ -656,8 +684,8 @@ test_linear_traits_adaptor() echo " ERROR: not executed test_traits_adaptor linear_traits" >> $ERRORFILE else execute_commands_traits_adaptor linear linear_traits_adaptor \ - COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE COMPARE_Y_POSITION \ - IS_BETWEEN_CW COMPARE_CW_AROUND_POINT + COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE \ + COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT fi clean_tests } @@ -673,8 +701,8 @@ test_spherical_arcs_traits_adaptor() echo " ERROR: not executed test_traits_adaptor spherical_arcs_traits" >> $ERRORFILE else execute_commands_traits_adaptor spherical_arcs spherical_arcs_traits_adaptor \ - COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE COMPARE_Y_POSITION \ - IS_BETWEEN_CW COMPARE_CW_AROUND_POINT + COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE \ + COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT fi clean_tests } @@ -691,7 +719,7 @@ test_segment_traits() else execute_commands_old_structure segments segment_traits \ VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT CONSTRUCTOR \ - BOUNDARY_NEAR_X BOUNDARY_NEAR_Y COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE + COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE execute_commands_new_structure segments segment_traits \ IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT ARE_MERGEABLE @@ -715,8 +743,7 @@ test_non_caching_segment_traits() else execute_commands_old_structure segments non_caching_segment_traits \ VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT CONSTRUCTOR \ - BOUNDARY_NEAR_X BOUNDARY_NEAR_Y COMPARE_Y_AT_X_RIGHT \ - ARE_MERGEABLE ERRORS + COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE ERRORS execute_commands_new_structure segments segment_traits \ IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT @@ -741,7 +768,7 @@ test_polyline_traits() else execute_commands_old_structure polylines polyline_traits \ CONSTRUCTOR COMPARE_Y_AT_X_LEFT \ - BOUNDARY_NEAR_X BOUNDARY_NEAR_Y COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE + COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE fi clean_tests } @@ -758,7 +785,7 @@ test_non_caching_polyline_traits() else execute_commands_old_structure polylines non_caching_polyline_traits \ CONSTRUCTOR COMPARE_Y_AT_X_LEFT \ - BOUNDARY_NEAR_X BOUNDARY_NEAR_Y COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE + COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE fi clean_tests } @@ -775,8 +802,8 @@ test_linear_traits() else execute_commands_old_structure linear/segments linear_traits.segments \ VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - COMPARE_Y_AT_X_RIGHT BOUNDARY_NEAR_X BOUNDARY_NEAR_Y CONSTRUCTOR ARE_MERGEABLE - + COMPARE_Y_AT_X_RIGHT CONSTRUCTOR ARE_MERGEABLE + execute_commands_new_structure linear/segments linear_traits.segments \ IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT @@ -786,7 +813,7 @@ test_linear_traits() execute_commands_old_structure linear/rays linear_traits.rays \ VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - COMPARE_Y_AT_X_RIGHT BOUNDARY_NEAR_X BOUNDARY_NEAR_Y CONSTRUCTOR ARE_MERGEABLE + COMPARE_Y_AT_X_RIGHT CONSTRUCTOR ARE_MERGEABLE execute_commands_new_structure linear/rays linear_traits.rays \ IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT @@ -796,9 +823,10 @@ test_linear_traits() data/empty.zero data/linear/rays/vertex linear_traits.rays execute_commands_new_structure linear/lines linear_traits.lines \ - IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT INTERSECT SPLIT MERGE \ - BOUNDARY_NEAR_X BOUNDARY_NEAR_Y PARAMETER_SPACE_X PARAMETER_SPACE_Y - + IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT INTERSECT \ + SPLIT MERGE \ + PARAMETER_SPACE_X PARAMETER_SPACE_Y \ + COMPARE_X_AT_LIMIT COMPARE_X_NEAR_LIMIT COMPARE_Y_NEAR_BOUNDARY fi clean_tests } @@ -815,7 +843,7 @@ test_conic_traits() else execute_commands_old_structure conics conic_traits \ INTERSECT SPLIT MERGE COMPARE_Y_AT_X_LEFT \ - BOUNDARY_NEAR_X BOUNDARY_NEAR_Y COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE + COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE execute_commands_new_structure conics conic_traits \ INTERSECT SPLIT MERGE @@ -839,7 +867,7 @@ test_line_arc_traits() else execute_commands_old_structure circular_lines line_arc_traits \ VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - ERRORS BOUNDARY_NEAR_X BOUNDARY_NEAR_Y COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE + ERRORS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE execute_commands_new_structure circular_lines line_arc_traits \ IS_VERTICAL COMPARE_Y_AT_X @@ -867,7 +895,7 @@ test_circular_arc_traits() else execute_commands_old_structure circular_arcs circular_arc_traits \ VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - ERRORS BOUNDARY_NEAR_X BOUNDARY_NEAR_Y COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE + ERRORS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE execute_commands_new_structure circular_arcs circular_arc_traits \ VERTEX IS_VERTICAL COMPARE_Y_AT_X @@ -887,7 +915,7 @@ test_circular_line_arc_traits() else execute_commands_old_structure circular_line_arcs circular_line_arc_traits \ VERTEX IS_VERTICAL CONSTRUCTOR COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - ERRORS BOUNDARY_NEAR_X BOUNDARY_NEAR_Y COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE + ERRORS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE execute_commands_new_structure circular_line_arcs circular_line_arc_traits \ IS_VERTICAL COMPARE_Y_AT_X @@ -911,7 +939,8 @@ test_circle_segments_traits() else execute_commands_old_structure circle_segments circle_segments_traits \ VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT \ - COMPARE_Y_AT_X_RIGHT BOUNDARY_NEAR_X BOUNDARY_NEAR_Y CONSTRUCTOR ARE_MERGEABLE + COMPARE_Y_AT_X_RIGHT CONSTRUCTOR ARE_MERGEABLE + run_trapped_test test_traits \ data/circle_segments/points data/circle_segments/xcurves.8 \ data/empty.zero data/circle_segments/vertex circle_segments_traits @@ -946,7 +975,7 @@ test_bezier_traits() else execute_commands_old_structure bezier bezier_traits \ COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT SPLIT \ - BOUNDARY_NEAR_X BOUNDARY_NEAR_Y CONSTRUCTOR ERRORS ARE_MERGEABLE + CONSTRUCTOR ERRORS ARE_MERGEABLE fi clean_tests } @@ -963,11 +992,13 @@ test_spherical_arc_traits() else execute_commands_old_structure spherical_arcs spherical_arc_traits \ COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT INTERSECT \ - BOUNDARY_NEAR_X BOUNDARY_NEAR_Y CONSTRUCTOR \ + CONSTRUCTOR \ COMPARE MAKE_X_MONOTONE SPLIT MERGE ERRORS ARE_MERGEABLE execute_commands_new_structure spherical_arcs spherical_arc_traits \ - INTERSECT BOUNDARY_NEAR_X BOUNDARY_NEAR_Y + INTERSECT \ + COMPARE_X_ON_BOUNDARY COMPARE_X_NEAR_BOUNDARY \ + COMPARE_Y_NEAR_BOUNDARY run_trapped_test test_traits \ data/spherical_arcs/compare.pt data/spherical_arcs/compare.xcv \ @@ -982,7 +1013,7 @@ test_spherical_arc_traits() test_rational_arc_traits() { # function executable number type kernel traits - compile_test test_traits $CORE_EXPR_NT $CARTESIAN_KERNEL $RATIONAL_ARC_TRAITS rational_arc_traits + compile_test test_traits $CORE_INT_NT $UNIVARIATE_ALGEBRAIC_KERNEL $RATIONAL_ARC_TRAITS rational_arc_traits if [ ${res} -eq 0 ] ; then echo " ERROR: not executed test_traits rational_arc_traits" >> $ERRORFILE else @@ -991,7 +1022,9 @@ test_rational_arc_traits() data/empty.zero data/compare rational_arc_traits execute_commands_new_structure rational_arcs rational_arc_traits \ - VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT SPLIT MERGE + VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT SPLIT MERGE \ + COMPARE_X_AT_LIMIT COMPARE_X_NEAR_LIMIT COMPARE_Y_NEAR_BOUNDARY + fi clean_tests } @@ -1086,9 +1119,9 @@ if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then fi -# if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then -# compile_and_run construction_test_suite_generator -# fi +if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then + compile_and_run construction_test_suite_generator +fi test_segment_traits test_non_caching_segment_traits @@ -1115,6 +1148,7 @@ test_algebraic_traits_leda compile_and_run test_insertion compile_and_run test_unbounded_rational_insertion +compile_and_run test_rational_function_traits_2 compile_and_run test_removal compile_and_run test_iso_verts @@ -1135,7 +1169,7 @@ test_segment_traits_adaptor test_linear_traits_adaptor test_spherical_arcs_traits_adaptor -#if any error occured then appened the the full error description file to error file +# if any error occured then appened the the full error description file to error file if [ -f $FULL_ERROR_DESCRIPTION_FILE ] ; then echo "******************** appending all error outputs ********************" >> $ERRORFILE diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/constructor.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/constructor.xcv index 034da1d0e4b..8f60e3d0012 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/constructor.xcv +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/constructor.xcv @@ -1,8 +1,8 @@ # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 0 1 1 -c 0 0 1 1 1 0 1 1 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 0 1 -1 -c 0 0 1 1 1 0 1 -1 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[1,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[-1,0,0] EXT[1,0,0] EXT[0,0,0] b 0 0 1 1 1/2 0 1/4 1 0 0 1/2 1/4 1 0 b 0 0 1 1 0 1/2 1/4 1 0 -1/2 0 1/4 1 0 b 0 0 1 1 -1/2 0 1/4 1 0 0 -1/2 1/4 1 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/intersect.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/intersect.xcv index 6e2cd334993..5f40385ed8e 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/intersect.xcv +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/intersect.xcv @@ -1,15 +1,15 @@ # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 1/2 1 1/2 +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 1/2 1 -1/2 +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/make_x_monotone.cv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/make_x_monotone.cv index 7b0a1327383..8f28fd5bdfc 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/make_x_monotone.cv +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/make_x_monotone.cv @@ -1,28 +1,28 @@ # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 0 1 1 -c 0 0 1 1 1 0 1 1 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 0 1 -1 -c 0 0 1 1 1 0 1 -1 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[1,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[-1,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 1/2 1 1/2 -c 1/2 0 1/4 1 1 1/2 1 1/2 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1/2 1 -1/2 -c 1/2 0 1/4 1 1 1/2 1 -1/2 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 -1/2 1 -1/2 -c -1/2 0 1/4 1 1 -1/2 1 -1/2 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1/2 1 1/2 -c -1/2 0 1/4 1 1 -1/2 1 1/2 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 0 1 1 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 0 1 0 -c 0 1/2 1/4 1 1 0 1 0 1 1/2 1 1/2 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 0 1 1 +c 0 1/2 1/4 1 EXT[0,0,0] EXT[1,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[1,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 0 1 -1 1 1/2 1 -1/2 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 0 1 0 -c 0 -1/2 1/4 1 1 0 1 0 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 0 1 -1 +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[-1,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[-1,0,0] # x^2+y^2=1 a 0 0 1 1 # (x-1/2)^2+y^2=1/4 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/make_x_monotone.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/make_x_monotone.xcv index a47e31b510b..4f0db884c85 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/make_x_monotone.xcv +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/make_x_monotone.xcv @@ -1,40 +1,40 @@ # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 0 1 1 -c 0 0 1 1 1 0 1 1 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 0 1 -1 -c 0 0 1 1 1 0 1 -1 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[1,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[-1,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 1/2 1 1/2 -c 1/2 0 1/4 1 1 1/2 1 1/2 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1/2 1 -1/2 -c 1/2 0 1/4 1 1 1/2 1 -1/2 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 -1/2 1 -1/2 -c -1/2 0 1/4 1 1 -1/2 1 -1/2 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1/2 1 1/2 -c -1/2 0 1/4 1 1 -1/2 1 1/2 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 0 1 1 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 0 1 0 -c 0 1/2 1/4 1 1 0 1 0 1 1/2 1 1/2 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 0 1 1 +c 0 1/2 1/4 1 EXT[0,0,0] EXT[1,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[1,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 0 1 -1 1 1/2 1 -1/2 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 0 1 0 -c 0 -1/2 1/4 1 1 0 1 0 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 0 1 -1 +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[-1,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[-1,0,0] # x^2+y^2=1 -c 0 0 1 1 1 -1 1 0 1 1 1 0 -c 0 0 1 1 1 1 1 0 1 -1 1 0 +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 0 1 0 1 1 1 0 -c 1/2 0 1/4 1 1 1 1 0 1 0 1 0 +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 1/2 1 1/2 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 -1/2 1 1/2 +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 1/2 1 -1/2 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 -1/2 1 -1/2 +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/split.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/split.xcv index f045a5a7da1..a7057267a63 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/split.xcv +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/split.xcv @@ -1,40 +1,40 @@ # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 0 1 1 -c 0 0 1 1 1 0 1 1 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 0 1 -1 -c 0 0 1 1 1 0 1 -1 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[1,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[-1,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 1/2 1 1/2 -c 1/2 0 1/4 1 1 1/2 1 1/2 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1/2 1 -1/2 -c 1/2 0 1/4 1 1 1/2 1 -1/2 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 -1/2 1 -1/2 -c -1/2 0 1/4 1 1 -1/2 1 -1/2 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1/2 1 1/2 -c -1/2 0 1/4 1 1 -1/2 1 1/2 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 0 1 1 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 0 1 0 -c 0 1/2 1/4 1 1 0 1 0 1 1/2 1 1/2 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 0 1 1 +c 0 1/2 1/4 1 EXT[0,0,0] EXT[1,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[1,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 0 1 -1 1 1/2 1 -1/2 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 0 1 0 -c 0 -1/2 1/4 1 1 0 1 0 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 0 1 -1 +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[-1,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[-1,0,0] # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 1/2 1 1/2 +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 1/2 1 -1/2 +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/xcurves b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/xcurves index 30af05a0b9f..7d9bce4fd21 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/xcurves +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_arcs/xcurves @@ -1,25 +1,25 @@ # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 0 1 1 -c 0 0 1 1 1 0 1 1 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 0 1 -1 -c 0 0 1 1 1 0 1 -1 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[1,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[-1,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 1/2 1 1/2 -c 1/2 0 1/4 1 1 1/2 1 1/2 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1/2 1 -1/2 -c 1/2 0 1/4 1 1 1/2 1 -1/2 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 -1/2 1 -1/2 -c -1/2 0 1/4 1 1 -1/2 1 -1/2 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1/2 1 1/2 -c -1/2 0 1/4 1 1 -1/2 1 1/2 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 0 1 1 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 0 1 0 -c 0 1/2 1/4 1 1 0 1 0 1 1/2 1 1/2 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 0 1 1 +c 0 1/2 1/4 1 EXT[0,0,0] EXT[1,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[1,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 0 1 -1 1 1/2 1 -1/2 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 0 1 0 -c 0 -1/2 1/4 1 1 0 1 0 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 0 1 -1 +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[-1,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[-1,0,0] diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/intersect.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/intersect.xcv index 8c81ec39042..efdaa443634 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/intersect.xcv +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/intersect.xcv @@ -1,18 +1,18 @@ # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 1/2 1 1/2 +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 1/2 1 -1/2 +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] l 0 0 2 2 l 2 0 0 2 l 0 0 2 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/make_x_monotone.cv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/make_x_monotone.cv index e8be720763d..72089f0072b 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/make_x_monotone.cv +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/make_x_monotone.cv @@ -1,36 +1,36 @@ # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 0 1 1 -c 0 0 1 1 1 0 1 1 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 0 1 -1 -c 0 0 1 1 1 0 1 -1 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[1,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[-1,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 1/2 1 1/2 -c 1/2 0 1/4 1 1 1/2 1 1/2 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1/2 1 -1/2 -c 1/2 0 1/4 1 1 1/2 1 -1/2 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 -1/2 1 -1/2 -c -1/2 0 1/4 1 1 -1/2 1 -1/2 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1/2 1 1/2 -c -1/2 0 1/4 1 1 -1/2 1 1/2 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 0 1 1 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 0 1 0 -c 0 1/2 1/4 1 1 0 1 0 1 1/2 1 1/2 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 0 1 1 +c 0 1/2 1/4 1 EXT[0,0,0] EXT[1,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[1,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 0 1 -1 1 1/2 1 -1/2 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 0 1 0 -c 0 -1/2 1/4 1 1 0 1 0 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 0 1 -1 +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[-1,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[-1,0,0] # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 1/2 1 1/2 +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 1/2 1 -1/2 +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] l 0 0 1 1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/make_x_monotone.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/make_x_monotone.xcv index e4d6be04c3a..d7a9d358539 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/make_x_monotone.xcv +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/make_x_monotone.xcv @@ -1,41 +1,41 @@ # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 0 1 1 -c 0 0 1 1 1 0 1 1 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 0 1 -1 -c 0 0 1 1 1 0 1 -1 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[1,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[-1,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 1/2 1 1/2 -c 1/2 0 1/4 1 1 1/2 1 1/2 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1/2 1 -1/2 -c 1/2 0 1/4 1 1 1/2 1 -1/2 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 -1/2 1 -1/2 -c -1/2 0 1/4 1 1 -1/2 1 -1/2 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1/2 1 1/2 -c -1/2 0 1/4 1 1 -1/2 1 1/2 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 0 1 1 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 0 1 0 -c 0 1/2 1/4 1 1 0 1 0 1 1/2 1 1/2 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 0 1 1 +c 0 1/2 1/4 1 EXT[0,0,0] EXT[1,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[1,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 0 1 -1 1 1/2 1 -1/2 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 0 1 0 -c 0 -1/2 1/4 1 1 0 1 0 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 0 1 -1 +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[-1,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[-1,0,0] # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 1/2 1 1/2 +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 1/2 1 -1/2 +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] l 0 0 1 1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/split.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/split.xcv index bbe47534159..9ed989fc871 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/split.xcv +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/split.xcv @@ -1,43 +1,43 @@ # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 0 1 1 -c 0 0 1 1 1 0 1 1 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 0 1 -1 -c 0 0 1 1 1 0 1 -1 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[1,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[-1,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 1/2 1 1/2 -c 1/2 0 1/4 1 1 1/2 1 1/2 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1/2 1 -1/2 -c 1/2 0 1/4 1 1 1/2 1 -1/2 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 -1/2 1 -1/2 -c -1/2 0 1/4 1 1 -1/2 1 -1/2 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1/2 1 1/2 -c -1/2 0 1/4 1 1 -1/2 1 1/2 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 0 1 1 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 0 1 0 -c 0 1/2 1/4 1 1 0 1 0 1 1/2 1 1/2 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 0 1 1 +c 0 1/2 1/4 1 EXT[0,0,0] EXT[1,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[1,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 0 1 -1 1 1/2 1 -1/2 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 0 1 0 -c 0 -1/2 1/4 1 1 0 1 0 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 0 1 -1 +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[-1,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[-1,0,0] # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 1/2 1 1/2 +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] EXT[1/2,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 1/2 1 -1/2 +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] l 0 0 2 0 l 0 0 1 0 l 1 0 2 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/xcurves b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/xcurves index 107ad7db4c4..48a7f8e7bd4 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/xcurves +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_line_arcs/xcurves @@ -92,27 +92,27 @@ l 1 1 1 0 # circles # # x^2+y^2=1 -c 0 0 1 1 1 1 1 0 1 0 1 1 -c 0 0 1 1 1 0 1 1 1 -1 1 0 -c 0 0 1 1 1 -1 1 0 1 0 1 -1 -c 0 0 1 1 1 0 1 -1 1 1 1 0 +c 0 0 1 1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[1,0,0] EXT[-1,0,0] EXT[0,0,0] +c 0 0 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] +c 0 0 1 1 EXT[0,0,0] EXT[-1,0,0] EXT[1,0,0] EXT[0,0,0] # (x-1/2)^2+y^2=1/4 -c 1/2 0 1/4 1 1 1 1 0 1 1/2 1 1/2 -c 1/2 0 1/4 1 1 1/2 1 1/2 1 0 1 0 -c 1/2 0 1/4 1 1 0 1 0 1 1/2 1 -1/2 -c 1/2 0 1/4 1 1 1/2 1 -1/2 1 1 1 0 +c 1/2 0 1/4 1 EXT[1,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 1/2 0 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[1,0,0] EXT[0,0,0] # (x+1/2)^2+y^2=1/4 -c -1/2 0 1/4 1 1 -1 1 0 1 -1/2 1 -1/2 -c -1/2 0 1/4 1 1 -1/2 1 -1/2 1 0 1 0 -c -1/2 0 1/4 1 1 0 1 0 1 -1/2 1 1/2 -c -1/2 0 1/4 1 1 -1/2 1 1/2 1 -1 1 0 +c -1/2 0 1/4 1 EXT[-1,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c -1/2 0 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c -1/2 0 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[-1,0,0] EXT[0,0,0] # (y-1/2)^2+x^2=1/4 -c 0 1/2 1/4 1 1 0 1 1 1 -1/2 1 1/2 -c 0 1/2 1/4 1 1 -1/2 1 1/2 1 0 1 0 -c 0 1/2 1/4 1 1 0 1 0 1 1/2 1 1/2 -c 0 1/2 1/4 1 1 1/2 1 1/2 1 0 1 1 +c 0 1/2 1/4 1 EXT[0,0,0] EXT[1,0,0] EXT[-1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[-1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[1/2,0,0] EXT[1/2,0,0] +c 0 1/2 1/4 1 EXT[1/2,0,0] EXT[1/2,0,0] EXT[0,0,0] EXT[1,0,0] # (y+1/2)^2+x^2=1/4 -c 0 -1/2 1/4 1 1 0 1 -1 1 1/2 1 -1/2 -c 0 -1/2 1/4 1 1 1/2 1 -1/2 1 0 1 0 -c 0 -1/2 1/4 1 1 0 1 0 1 -1/2 1 -1/2 -c 0 -1/2 1/4 1 1 -1/2 1 -1/2 1 0 1 -1 +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[-1,0,0] EXT[1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[0,0,0] +c 0 -1/2 1/4 1 EXT[0,0,0] EXT[0,0,0] EXT[-1/2,0,0] EXT[-1/2,0,0] +c 0 -1/2 1/4 1 EXT[-1/2,0,0] EXT[-1/2,0,0] EXT[0,0,0] EXT[-1,0,0] diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/constructor.xcv b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/constructor.xcv index 05ced9f3538..f5a933bedcc 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/constructor.xcv +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/circular_lines/constructor.xcv @@ -3,10 +3,10 @@ w 1 0 0 1 w 0 1 -1 0 w -1 0 0 -1 w 0 -1 1 0 -x 1 1 -1 1 1 1 0 1 0 1 1 -x -1 1 -1 1 0 1 1 1 -1 1 0 -x 1 1 1 1 -1 1 0 1 0 1 -1 -x -1 1 1 1 0 1 -1 1 1 1 0 +x 1 1 -1 EXT[1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[1,0,0] +x -1 1 -1 EXT[0,0,0] EXT[1,0,0] EXT[-1,0,0] EXT[0,0,0] +x 1 1 1 EXT[-1,0,0] EXT[0,0,0] EXT[0,0,0] EXT[-1,0,0] +x -1 1 1 EXT[0,0,0] EXT[-1,0,0] EXT[1,0,0] EXT[0,0,0] y 1 1 -1 1 0 -1 0 1 -1 y -1 1 -1 0 1 -1 1 0 1 y 1 1 1 1 0 1 0 1 1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/boundary_near_x b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/boundary_near_x deleted file mode 100644 index 3f6300617ba..00000000000 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/boundary_near_x +++ /dev/null @@ -1,72 +0,0 @@ -##vertical lines -boundary_near_x 1 MIN_END 1 MIN_END EQUAL -boundary_near_x 5 MIN_END 5 MIN_END EQUAL -boundary_near_x 7 MIN_END 7 MIN_END EQUAL -boundary_near_x 5 MIN_END 1 MIN_END SMALLER -boundary_near_x 5 MIN_END 7 MIN_END SMALLER -boundary_near_x 1 MIN_END 7 MIN_END SMALLER -boundary_near_x 1 MIN_END 5 MIN_END LARGER -boundary_near_x 7 MIN_END 5 MIN_END LARGER -boundary_near_x 7 MIN_END 1 MIN_END LARGER -# -boundary_near_x 1 MAX_END 1 MAX_END EQUAL -boundary_near_x 5 MAX_END 5 MAX_END EQUAL -boundary_near_x 7 MAX_END 7 MAX_END EQUAL -boundary_near_x 5 MAX_END 1 MAX_END SMALLER -boundary_near_x 5 MAX_END 7 MAX_END SMALLER -boundary_near_x 1 MAX_END 7 MAX_END SMALLER -boundary_near_x 1 MAX_END 5 MAX_END LARGER -boundary_near_x 7 MAX_END 5 MAX_END LARGER -boundary_near_x 7 MAX_END 1 MAX_END LARGER -# -boundary_near_x 1 MAX_END 1 MIN_END EQUAL -boundary_near_x 5 MAX_END 5 MIN_END EQUAL -boundary_near_x 7 MAX_END 7 MIN_END EQUAL -boundary_near_x 5 MAX_END 1 MIN_END SMALLER -boundary_near_x 5 MAX_END 7 MIN_END SMALLER -boundary_near_x 1 MAX_END 7 MIN_END SMALLER -boundary_near_x 1 MAX_END 5 MIN_END LARGER -boundary_near_x 7 MAX_END 5 MIN_END LARGER -boundary_near_x 7 MAX_END 1 MIN_END LARGER -# -boundary_near_x 1 MIN_END 1 MAX_END EQUAL -boundary_near_x 5 MIN_END 5 MAX_END EQUAL -boundary_near_x 7 MIN_END 7 MAX_END EQUAL -boundary_near_x 5 MIN_END 1 MAX_END SMALLER -boundary_near_x 5 MIN_END 7 MAX_END SMALLER -boundary_near_x 1 MIN_END 7 MAX_END SMALLER -boundary_near_x 1 MIN_END 5 MAX_END LARGER -boundary_near_x 7 MIN_END 5 MAX_END LARGER -boundary_near_x 7 MIN_END 1 MAX_END LARGER -# -boundary_near_x 1 MIN_END 1 MAX_END EQUAL -boundary_near_x 5 MIN_END 5 MAX_END EQUAL -boundary_near_x 7 MIN_END 7 MAX_END EQUAL -boundary_near_x 5 MIN_END 1 MAX_END SMALLER -boundary_near_x 5 MIN_END 7 MAX_END SMALLER -boundary_near_x 1 MIN_END 7 MAX_END SMALLER -boundary_near_x 1 MIN_END 5 MAX_END LARGER -boundary_near_x 7 MIN_END 5 MAX_END LARGER -boundary_near_x 7 MIN_END 1 MAX_END LARGER -# -boundary_near_x 1 MAX_END 1 MIN_END EQUAL -boundary_near_x 5 MAX_END 5 MIN_END EQUAL -boundary_near_x 7 MAX_END 7 MIN_END EQUAL -boundary_near_x 5 MAX_END 1 MIN_END SMALLER -boundary_near_x 5 MAX_END 7 MIN_END SMALLER -boundary_near_x 1 MAX_END 7 MIN_END SMALLER -boundary_near_x 1 MAX_END 5 MIN_END LARGER -boundary_near_x 7 MAX_END 5 MIN_END LARGER -boundary_near_x 7 MAX_END 1 MIN_END LARGER -# -boundary_near_x 4 1 MIN_END EQUAL -boundary_near_x 1 5 MIN_END EQUAL -boundary_near_x 7 7 MIN_END EQUAL -boundary_near_x 4 1 MAX_END EQUAL -boundary_near_x 1 5 MAX_END EQUAL -boundary_near_x 7 7 MAX_END EQUAL -# -boundary_near_x 7 5 MIN_END LARGER -boundary_near_x 1 7 MIN_END SMALLER -boundary_near_x 7 5 MAX_END LARGER -boundary_near_x 1 7 MAX_END SMALLER diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/boundary_near_y b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/boundary_near_y deleted file mode 100644 index daacf2c0f4d..00000000000 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/boundary_near_y +++ /dev/null @@ -1,43 +0,0 @@ -boundary_near_y 0 0 MIN_END EQUAL -boundary_near_y 2 2 MIN_END EQUAL -boundary_near_y 3 3 MIN_END EQUAL -boundary_near_y 4 4 MIN_END EQUAL -boundary_near_y 6 6 MIN_END EQUAL -# -boundary_near_y 0 0 MAX_END EQUAL -boundary_near_y 2 2 MAX_END EQUAL -boundary_near_y 3 3 MAX_END EQUAL -boundary_near_y 4 4 MAX_END EQUAL -boundary_near_y 6 6 MAX_END EQUAL -# -boundary_near_y 4 0 MAX_END SMALLER -boundary_near_y 4 6 MAX_END SMALLER -boundary_near_y 0 6 MAX_END SMALLER -# -boundary_near_y 0 4 MAX_END LARGER -boundary_near_y 6 4 MAX_END LARGER -boundary_near_y 6 0 MAX_END LARGER -# -boundary_near_y 4 0 MIN_END SMALLER -boundary_near_y 4 6 MIN_END SMALLER -boundary_near_y 0 6 MIN_END SMALLER -# -boundary_near_y 0 4 MIN_END LARGER -boundary_near_y 6 4 MIN_END LARGER -boundary_near_y 6 0 MIN_END LARGER -# -boundary_near_y 2 0 MIN_END LARGER -boundary_near_y 2 4 MIN_END LARGER -boundary_near_y 2 6 MIN_END LARGER -# -boundary_near_y 2 0 MAX_END SMALLER -boundary_near_y 2 4 MAX_END SMALLER -boundary_near_y 2 6 MAX_END SMALLER -# -boundary_near_y 3 0 MAX_END LARGER -boundary_near_y 3 4 MAX_END LARGER -boundary_near_y 3 6 MAX_END LARGER -# -boundary_near_y 3 0 MIN_END SMALLER -boundary_near_y 3 4 MIN_END SMALLER -boundary_near_y 3 6 MIN_END SMALLER diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_at_limit b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_at_limit new file mode 100644 index 00000000000..4b78577d195 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_at_limit @@ -0,0 +1,80 @@ +# a point and a vertical line +compare_x_at_limit 4 1 MIN_END EQUAL +compare_x_at_limit 4 1 MAX_END EQUAL +compare_x_at_limit 1 1 MIN_END SMALLER +compare_x_at_limit 1 1 MAX_END SMALLER +compare_x_at_limit 7 1 MIN_END LARGER +compare_x_at_limit 7 1 MAX_END LARGER +# +compare_x_at_limit 1 5 MIN_END EQUAL +compare_x_at_limit 1 5 MAX_END EQUAL +compare_x_at_limit 4 5 MIN_END LARGER +compare_x_at_limit 4 5 MAX_END LARGER +# a point and a vertical ray +compare_x_at_limit 4 15 MIN_END EQUAL +compare_x_at_limit 1 15 MIN_END SMALLER +compare_x_at_limit 7 15 MIN_END LARGER +compare_x_at_limit 4 13 MAX_END EQUAL +compare_x_at_limit 1 13 MAX_END SMALLER +compare_x_at_limit 7 13 MAX_END LARGER +# a vertical line and a vertical line +compare_x_at_limit 1 MIN_END 1 MIN_END EQUAL +compare_x_at_limit 5 MIN_END 5 MIN_END EQUAL +compare_x_at_limit 7 MIN_END 7 MIN_END EQUAL +compare_x_at_limit 5 MIN_END 1 MIN_END SMALLER +compare_x_at_limit 5 MIN_END 7 MIN_END SMALLER +compare_x_at_limit 1 MIN_END 7 MIN_END SMALLER +compare_x_at_limit 1 MIN_END 5 MIN_END LARGER +compare_x_at_limit 7 MIN_END 5 MIN_END LARGER +compare_x_at_limit 7 MIN_END 1 MIN_END LARGER +# +compare_x_at_limit 1 MAX_END 1 MAX_END EQUAL +compare_x_at_limit 5 MAX_END 5 MAX_END EQUAL +compare_x_at_limit 7 MAX_END 7 MAX_END EQUAL +compare_x_at_limit 5 MAX_END 1 MAX_END SMALLER +compare_x_at_limit 5 MAX_END 7 MAX_END SMALLER +compare_x_at_limit 1 MAX_END 7 MAX_END SMALLER +compare_x_at_limit 1 MAX_END 5 MAX_END LARGER +compare_x_at_limit 7 MAX_END 5 MAX_END LARGER +compare_x_at_limit 7 MAX_END 1 MAX_END LARGER +# +compare_x_at_limit 1 MAX_END 1 MIN_END EQUAL +compare_x_at_limit 5 MAX_END 5 MIN_END EQUAL +compare_x_at_limit 7 MAX_END 7 MIN_END EQUAL +compare_x_at_limit 5 MAX_END 1 MIN_END SMALLER +compare_x_at_limit 5 MAX_END 7 MIN_END SMALLER +compare_x_at_limit 1 MAX_END 7 MIN_END SMALLER +compare_x_at_limit 1 MAX_END 5 MIN_END LARGER +compare_x_at_limit 7 MAX_END 5 MIN_END LARGER +compare_x_at_limit 7 MAX_END 1 MIN_END LARGER +# +compare_x_at_limit 1 MIN_END 1 MAX_END EQUAL +compare_x_at_limit 5 MIN_END 5 MAX_END EQUAL +compare_x_at_limit 7 MIN_END 7 MAX_END EQUAL +compare_x_at_limit 5 MIN_END 1 MAX_END SMALLER +compare_x_at_limit 5 MIN_END 7 MAX_END SMALLER +compare_x_at_limit 1 MIN_END 7 MAX_END SMALLER +compare_x_at_limit 1 MIN_END 5 MAX_END LARGER +compare_x_at_limit 7 MIN_END 5 MAX_END LARGER +compare_x_at_limit 7 MIN_END 1 MAX_END LARGER +# +compare_x_at_limit 1 MIN_END 1 MAX_END EQUAL +compare_x_at_limit 5 MIN_END 5 MAX_END EQUAL +compare_x_at_limit 7 MIN_END 7 MAX_END EQUAL +compare_x_at_limit 5 MIN_END 1 MAX_END SMALLER +compare_x_at_limit 5 MIN_END 7 MAX_END SMALLER +compare_x_at_limit 1 MIN_END 7 MAX_END SMALLER +compare_x_at_limit 1 MIN_END 5 MAX_END LARGER +compare_x_at_limit 7 MIN_END 5 MAX_END LARGER +compare_x_at_limit 7 MIN_END 1 MAX_END LARGER +# +compare_x_at_limit 1 MAX_END 1 MIN_END EQUAL +compare_x_at_limit 5 MAX_END 5 MIN_END EQUAL +compare_x_at_limit 7 MAX_END 7 MIN_END EQUAL +compare_x_at_limit 5 MAX_END 1 MIN_END SMALLER +compare_x_at_limit 5 MAX_END 7 MIN_END SMALLER +compare_x_at_limit 1 MAX_END 7 MIN_END SMALLER +compare_x_at_limit 1 MAX_END 5 MIN_END LARGER +compare_x_at_limit 7 MAX_END 5 MIN_END LARGER +compare_x_at_limit 7 MAX_END 1 MIN_END LARGER +# diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_near_limit b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_near_limit new file mode 100644 index 00000000000..f7cb2ea70da --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_x_near_limit @@ -0,0 +1 @@ +compare_x_near_limit 1 1 MIN_END EQUAL diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_y_near_boundary b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_y_near_boundary new file mode 100644 index 00000000000..6e5f3700bd9 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/lines/compare_y_near_boundary @@ -0,0 +1,43 @@ +compare_y_near_boundary 0 0 MIN_END EQUAL +compare_y_near_boundary 2 2 MIN_END EQUAL +compare_y_near_boundary 3 3 MIN_END EQUAL +compare_y_near_boundary 4 4 MIN_END EQUAL +compare_y_near_boundary 6 6 MIN_END EQUAL +# +compare_y_near_boundary 0 0 MAX_END EQUAL +compare_y_near_boundary 2 2 MAX_END EQUAL +compare_y_near_boundary 3 3 MAX_END EQUAL +compare_y_near_boundary 4 4 MAX_END EQUAL +compare_y_near_boundary 6 6 MAX_END EQUAL +# +compare_y_near_boundary 4 0 MAX_END SMALLER +compare_y_near_boundary 4 6 MAX_END SMALLER +compare_y_near_boundary 0 6 MAX_END SMALLER +# +compare_y_near_boundary 0 4 MAX_END LARGER +compare_y_near_boundary 6 4 MAX_END LARGER +compare_y_near_boundary 6 0 MAX_END LARGER +# +compare_y_near_boundary 4 0 MIN_END SMALLER +compare_y_near_boundary 4 6 MIN_END SMALLER +compare_y_near_boundary 0 6 MIN_END SMALLER +# +compare_y_near_boundary 0 4 MIN_END LARGER +compare_y_near_boundary 6 4 MIN_END LARGER +compare_y_near_boundary 6 0 MIN_END LARGER +# +compare_y_near_boundary 2 0 MIN_END LARGER +compare_y_near_boundary 2 4 MIN_END LARGER +compare_y_near_boundary 2 6 MIN_END LARGER +# +compare_y_near_boundary 2 0 MAX_END SMALLER +compare_y_near_boundary 2 4 MAX_END SMALLER +compare_y_near_boundary 2 6 MAX_END SMALLER +# +compare_y_near_boundary 3 0 MAX_END LARGER +compare_y_near_boundary 3 4 MAX_END LARGER +compare_y_near_boundary 3 6 MAX_END LARGER +# +compare_y_near_boundary 3 0 MIN_END SMALLER +compare_y_near_boundary 3 4 MIN_END SMALLER +compare_y_near_boundary 3 6 MIN_END SMALLER diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_at_limit b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_at_limit new file mode 100644 index 00000000000..e67ef1ebcc4 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_at_limit @@ -0,0 +1,36 @@ +# a point and a vertical asymptote +compare_x_at_limit 1 16 MIN_END SMALLER +compare_x_at_limit 1 17 MAX_END SMALLER +compare_x_at_limit 1 18 MIN_END SMALLER +compare_x_at_limit 1 19 MAX_END SMALLER +# +compare_x_at_limit 7 16 MIN_END LARGER +compare_x_at_limit 7 17 MAX_END LARGER +compare_x_at_limit 7 18 MIN_END LARGER +compare_x_at_limit 7 19 MAX_END LARGER +# +compare_x_at_limit 4 16 MIN_END EQUAL +compare_x_at_limit 4 17 MAX_END EQUAL +compare_x_at_limit 4 18 MIN_END EQUAL +compare_x_at_limit 4 19 MAX_END EQUAL +# a vertical asymptote and a vertical asymptote +compare_x_at_limit 16 MIN_END 24 MIN_END SMALLER +compare_x_at_limit 17 MAX_END 25 MAX_END SMALLER +compare_x_at_limit 18 MIN_END 26 MIN_END SMALLER +compare_x_at_limit 19 MAX_END 27 MAX_END SMALLER +compare_x_at_limit 16 MIN_END 32 MIN_END LARGER +compare_x_at_limit 17 MAX_END 33 MAX_END LARGER +compare_x_at_limit 18 MIN_END 34 MIN_END LARGER +compare_x_at_limit 19 MAX_END 35 MAX_END LARGER +# +compare_x_at_limit 16 MIN_END 17 MAX_END EQUAL +compare_x_at_limit 16 MIN_END 18 MIN_END EQUAL +compare_x_at_limit 16 MIN_END 19 MAX_END EQUAL +compare_x_at_limit 17 MAX_END 18 MIN_END EQUAL +compare_x_at_limit 17 MAX_END 19 MAX_END EQUAL +compare_x_at_limit 18 MIN_END 19 MAX_END EQUAL +# +compare_x_at_limit 16 MIN_END 20 MIN_END EQUAL +compare_x_at_limit 17 MAX_END 21 MAX_END EQUAL +compare_x_at_limit 18 MIN_END 22 MIN_END EQUAL +compare_x_at_limit 19 MAX_END 23 MAX_END EQUAL diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_near_limit b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_near_limit new file mode 100644 index 00000000000..74eaf8c9f1d --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_x_near_limit @@ -0,0 +1,4 @@ +compare_x_near_limit 16 20 MIN_END SMALLER +compare_x_near_limit 18 22 MIN_END SMALLER +compare_x_near_limit 20 16 MIN_END LARGER +compare_x_near_limit 20 20 MIN_END EQUAL diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_y_near_boundary b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_y_near_boundary new file mode 100644 index 00000000000..196467e8430 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/compare_y_near_boundary @@ -0,0 +1,7 @@ +compare_y_near_boundary 17 19 MIN_END SMALLER +compare_y_near_boundary 17 15 MIN_END SMALLER +compare_y_near_boundary 19 15 MIN_END LARGER +# +compare_y_near_boundary 16 18 MAX_END LARGER +compare_y_near_boundary 16 15 MAX_END LARGER +compare_y_near_boundary 18 15 MAX_END SMALLER diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/curves b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/curves index 1b89b17621a..f2958f17fba 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/curves +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/curves @@ -1,7 +1,14 @@ +# 0: a +# 1: b 3 1 1 1 -c 3 0 1 1 0.5 0 -d 3 0 1 1 0.5 0.75 +# 2: +c 3 0 1 1 5/10 0 +# 3: +d 3 0 1 1 5/10 75/100 +# 4: e 3 1 0 0 3 1 1 0 -f 3 1 0 0 3 1 1 0 0.5 0 -g 3 1 0 0 3 1 1 0 0.2 0.75 +# 5: +f 3 1 0 0 3 1 1 0 5/10 0 +# 6: +g 3 1 0 0 3 1 1 0 2/10 75/100 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/xcurves b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/xcurves index 22937cce6d2..e1f808f6ea5 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/xcurves +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/rational_arcs/xcurves @@ -1,19 +1,80 @@ -e 1 1 3 1 0 1 -# 1/(-x^2+1) -f 1 1 3 1 0 -1 1 1 -f 1 1 3 1 0 -1 -1 0 -g 1 1 3 1 0 -1 -1 1 -# 1/(x^2-1) -g 1 1 3 -1 0 1 -0.9 0.9 -g 1 1 3 -1 0 1 -10 -1.1 -g 1 1 3 -1 0 1 1.1 10 -# x/(x^2+1) -g 2 0 1 3 1 0 1 -10 10 -# 1/(x^2-1) -f 1 1 3 1 0 -1 -2 0 -g 1 1 3 1 0 -1 -2 -1 -g 1 1 3 1 0 -1 -1 0 -g 1 1 3 1 0 -1 0 1 -g 1 1 3 1 0 -1 1 2 -f 1 1 3 1 0 -1 2 1 -e 1 -1 1 3 +# 0: 1/(1+x^2) +e 1 1 3 1 0 1 +# 1: 1/(-x^2+1) +f 1 1 3 1 0 -1 1 1 +# 2: 1/(1-x^2) +f 1 1 3 1 0 -1 -1 0 +# 3: 1/(1-x^2) +g 1 1 3 1 0 -1 -1 1 +# 4: 1/(x^2-1) +g 1 1 3 -1 0 1 -9/10 9/10 +# 5: 1/(-1+x^2) +g 1 1 3 -1 0 1 -10 -11/10 +# 6: 1/(-1+x^2) +g 1 1 3 -1 0 1 11/10 10 +# 7: x/(x^2+1) +g 2 0 1 3 1 0 1 -10 10 +# 8: 1/(x^2-1) +f 1 1 3 1 0 -1 -2 0 +# 9: 1/(1-x^2) +g 1 1 3 1 0 -1 -2 -1 +# 10: 1/(1-x^2) +g 1 1 3 1 0 -1 -1 0 +# 11: 1/(1-x^2) +g 1 1 3 1 0 -1 0 1 +# 12: 1/(1-x^2) +g 1 1 3 1 0 -1 1 2 +# 13: 1/(1-x^2) +f 1 1 3 1 0 -1 2 1 +# 14: 1/3 +e 1 -1 1 3 +# 15: 0 +e 1 0 1 1 +# 16: 1/x, x > 0 +f 1 1 2 0 1 0 1 +# 17: 1/x, x < 0 +f 1 1 2 0 1 0 0 +# 18: -1/x, x > 0 +f 1 -1 2 0 1 0 1 +# 18: -1/x, x < 0 +f 1 -1 2 0 1 0 0 +# 20: 1/x^2, x > 0 +f 1 1 3 0 0 1 0 1 +# 21: 1/x^2, x < 0 +f 1 1 3 0 0 1 0 0 +# 22: -1/x^2, x > 0 +f 1 -1 3 0 0 1 0 1 +# 23: -1/x^2, x < 0 +f 1 -1 3 0 0 1 0 0 +# 24: 1/(-1+x), x > 1 +f 1 1 2 -1 1 1 1 +# 25: 1/(-1+x), x < 1 +f 1 1 2 -1 1 1 0 +# 26: -1/(-1+x), x > 1 +f 1 -1 2 -1 1 1 1 +# 27: -1/(-1+x), x < 1 +f 1 -1 2 -1 1 1 0 +# 28: 1/(-1+x)^2, x > 1 +f 1 1 3 1 -2 1 1 1 +# 29: 1/(-1+x)^2, x < 1 +f 1 1 3 1 -2 1 1 0 +# 30: -1/(-1+x)^2, x > 1 +f 1 -1 3 1 -2 1 1 1 +# 31: -1/(-1+x)^2, x < 1 +f 1 -1 3 1 -2 1 1 0 +# 32: 1/(1+x), x > -1 +f 1 1 2 1 1 -1 1 +# 33: 1/(1+x), x < -1 +f 1 1 2 1 1 -1 0 +# 34: -1/(1+x), x > -1 +f 1 -1 2 1 1 -1 1 +# 35: -1/(1+x), x < -1 +f 1 -1 2 1 1 -1 0 +# 36: 1/(1+x)^2, x > -1 +f 1 1 3 1 2 1 -1 1 +# 37: 1/(1+x)^2, x < -1 +f 1 1 3 1 2 1 -1 0 +# 38: -1/(1+x)^2, x > -1 +f 1 -1 3 1 2 1 -1 1 +# 39: -1/(1+x)^2, x < -1 +f 1 -1 3 1 2 1 -1 0 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/boundary_near_x b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/boundary_near_x deleted file mode 100644 index c753f6db749..00000000000 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/boundary_near_x +++ /dev/null @@ -1,373 +0,0 @@ -boundary_near_x 8 MIN_END 8 MIN_END EQUAL -boundary_near_x 9 MIN_END 9 MIN_END EQUAL -boundary_near_x 32 MIN_END 32 MIN_END EQUAL -boundary_near_x 33 MIN_END 33 MIN_END EQUAL -boundary_near_x 64 MIN_END 64 MIN_END EQUAL -boundary_near_x 65 MIN_END 65 MIN_END EQUAL -boundary_near_x 92 MIN_END 92 MIN_END EQUAL -boundary_near_x 93 MIN_END 93 MIN_END EQUAL -# -boundary_near_x 0 8 MIN_END LARGER -boundary_near_x 0 9 MIN_END LARGER -boundary_near_x 0 32 MIN_END SMALLER -boundary_near_x 0 33 MIN_END SMALLER -boundary_near_x 0 64 MIN_END SMALLER -boundary_near_x 0 65 MIN_END SMALLER -boundary_near_x 0 92 MIN_END LARGER -boundary_near_x 0 93 MIN_END LARGER # -boundary_near_x 1 8 MIN_END LARGER -boundary_near_x 1 9 MIN_END LARGER -boundary_near_x 1 32 MIN_END SMALLER -boundary_near_x 1 33 MIN_END SMALLER -boundary_near_x 1 64 MIN_END SMALLER -boundary_near_x 1 65 MIN_END SMALLER -boundary_near_x 1 92 MIN_END SMALLER -boundary_near_x 1 93 MIN_END SMALLER # -boundary_near_x 2 8 MIN_END LARGER -boundary_near_x 2 9 MIN_END LARGER -boundary_near_x 2 32 MIN_END SMALLER -boundary_near_x 2 33 MIN_END SMALLER -boundary_near_x 2 64 MIN_END SMALLER -boundary_near_x 2 65 MIN_END SMALLER -boundary_near_x 2 92 MIN_END SMALLER -boundary_near_x 2 93 MIN_END SMALLER -# -boundary_near_x 3 8 MIN_END LARGER -boundary_near_x 3 9 MIN_END LARGER -boundary_near_x 3 32 MIN_END LARGER -boundary_near_x 3 33 MIN_END LARGER -boundary_near_x 3 64 MIN_END LARGER -boundary_near_x 3 65 MIN_END LARGER -boundary_near_x 3 92 MIN_END LARGER -boundary_near_x 3 93 MIN_END LARGER -# -boundary_near_x 4 8 MIN_END LARGER -boundary_near_x 4 9 MIN_END LARGER -boundary_near_x 4 32 MIN_END LARGER -boundary_near_x 4 33 MIN_END LARGER -boundary_near_x 4 64 MIN_END SMALLER -boundary_near_x 4 65 MIN_END SMALLER -boundary_near_x 4 92 MIN_END LARGER -boundary_near_x 4 93 MIN_END LARGER -# -boundary_near_x 5 8 MIN_END LARGER -boundary_near_x 5 9 MIN_END LARGER -boundary_near_x 5 32 MIN_END LARGER -boundary_near_x 5 33 MIN_END LARGER -boundary_near_x 5 64 MIN_END LARGER -boundary_near_x 5 65 MIN_END LARGER -boundary_near_x 5 92 MIN_END LARGER -boundary_near_x 5 93 MIN_END LARGER -# -boundary_near_x 6 8 MIN_END LARGER -boundary_near_x 6 9 MIN_END LARGER -boundary_near_x 6 32 MIN_END SMALLER -boundary_near_x 6 33 MIN_END SMALLER -boundary_near_x 6 64 MIN_END SMALLER -boundary_near_x 6 65 MIN_END SMALLER -boundary_near_x 6 92 MIN_END LARGER -boundary_near_x 6 93 MIN_END LARGER -# -boundary_near_x 7 8 MIN_END LARGER -boundary_near_x 7 9 MIN_END LARGER -boundary_near_x 7 32 MIN_END LARGER -boundary_near_x 7 33 MIN_END LARGER -boundary_near_x 7 64 MIN_END SMALLER -boundary_near_x 7 65 MIN_END SMALLER -boundary_near_x 7 92 MIN_END LARGER -boundary_near_x 7 93 MIN_END LARGER -# -boundary_near_x 8 8 MIN_END LARGER -boundary_near_x 8 9 MIN_END LARGER -boundary_near_x 8 32 MIN_END EQUAL -boundary_near_x 8 33 MIN_END EQUAL -boundary_near_x 8 64 MIN_END SMALLER -boundary_near_x 8 65 MIN_END SMALLER -boundary_near_x 8 92 MIN_END LARGER -boundary_near_x 8 93 MIN_END LARGER -# -boundary_near_x 9 8 MIN_END LARGER -boundary_near_x 9 9 MIN_END LARGER -boundary_near_x 9 32 MIN_END EQUAL -boundary_near_x 9 33 MIN_END EQUAL -boundary_near_x 9 64 MIN_END SMALLER -boundary_near_x 9 65 MIN_END SMALLER -boundary_near_x 9 92 MIN_END LARGER -boundary_near_x 9 93 MIN_END LARGER -# -boundary_near_x 10 8 MIN_END LARGER -boundary_near_x 10 9 MIN_END LARGER -boundary_near_x 10 32 MIN_END EQUAL -boundary_near_x 10 33 MIN_END EQUAL -boundary_near_x 10 64 MIN_END SMALLER -boundary_near_x 10 65 MIN_END SMALLER -boundary_near_x 10 92 MIN_END LARGER -boundary_near_x 10 93 MIN_END LARGER -# -boundary_near_x 11 8 MIN_END LARGER -boundary_near_x 11 9 MIN_END LARGER -boundary_near_x 11 32 MIN_END EQUAL -boundary_near_x 11 33 MIN_END EQUAL -boundary_near_x 11 64 MIN_END SMALLER -boundary_near_x 11 65 MIN_END SMALLER -boundary_near_x 11 92 MIN_END LARGER -boundary_near_x 11 93 MIN_END LARGER -# -boundary_near_x 16 8 MIN_END LARGER -boundary_near_x 16 9 MIN_END LARGER -boundary_near_x 16 32 MIN_END LARGER -boundary_near_x 16 33 MIN_END LARGER -boundary_near_x 16 64 MIN_END EQUAL -boundary_near_x 16 65 MIN_END EQUAL -boundary_near_x 16 92 MIN_END LARGER -boundary_near_x 16 93 MIN_END LARGER -# -boundary_near_x 17 8 MIN_END LARGER -boundary_near_x 17 9 MIN_END LARGER -boundary_near_x 17 32 MIN_END LARGER -boundary_near_x 17 33 MIN_END LARGER -boundary_near_x 17 64 MIN_END EQUAL -boundary_near_x 17 65 MIN_END EQUAL -boundary_near_x 17 92 MIN_END LARGER -boundary_near_x 17 93 MIN_END LARGER -# -boundary_near_x 18 8 MIN_END LARGER -boundary_near_x 18 9 MIN_END LARGER -boundary_near_x 18 32 MIN_END LARGER -boundary_near_x 18 33 MIN_END LARGER -boundary_near_x 18 64 MIN_END EQUAL -boundary_near_x 18 65 MIN_END EQUAL -boundary_near_x 18 92 MIN_END LARGER -boundary_near_x 18 93 MIN_END LARGER -# -boundary_near_x 19 8 MIN_END LARGER -boundary_near_x 19 9 MIN_END LARGER -boundary_near_x 19 32 MIN_END LARGER -boundary_near_x 19 33 MIN_END LARGER -boundary_near_x 19 64 MIN_END EQUAL -boundary_near_x 19 65 MIN_END EQUAL -boundary_near_x 19 92 MIN_END LARGER -boundary_near_x 19 93 MIN_END LARGER # -boundary_near_x 20 8 MIN_END LARGER -boundary_near_x 20 9 MIN_END LARGER -boundary_near_x 20 32 MIN_END SMALLER -boundary_near_x 20 33 MIN_END SMALLER -boundary_near_x 20 64 MIN_END SMALLER -boundary_near_x 20 65 MIN_END SMALLER -boundary_near_x 20 92 MIN_END EQUAL -boundary_near_x 20 93 MIN_END EQUAL -# -boundary_near_x 21 8 MIN_END LARGER -boundary_near_x 21 9 MIN_END LARGER -boundary_near_x 21 32 MIN_END SMALLER -boundary_near_x 21 33 MIN_END SMALLER -boundary_near_x 21 64 MIN_END SMALLER -boundary_near_x 21 65 MIN_END SMALLER -boundary_near_x 21 92 MIN_END EQUAL -boundary_near_x 21 93 MIN_END EQUAL -# -boundary_near_x 22 8 MIN_END LARGER -boundary_near_x 22 9 MIN_END LARGER -boundary_near_x 22 32 MIN_END SMALLER -boundary_near_x 22 33 MIN_END SMALLER -boundary_near_x 22 64 MIN_END SMALLER -boundary_near_x 22 65 MIN_END SMALLER -boundary_near_x 22 92 MIN_END EQUAL -boundary_near_x 22 93 MIN_END EQUAL -# -boundary_near_x 23 8 MIN_END LARGER -boundary_near_x 23 9 MIN_END LARGER -boundary_near_x 23 32 MIN_END SMALLER -boundary_near_x 23 33 MIN_END SMALLER -boundary_near_x 23 64 MIN_END SMALLER -boundary_near_x 23 65 MIN_END SMALLER -boundary_near_x 23 92 MIN_END EQUAL -boundary_near_x 23 93 MIN_END EQUAL -# -boundary_near_x 12 MAX_END 12 MAX_END EQUAL -boundary_near_x 13 MAX_END 13 MAX_END EQUAL -boundary_near_x 44 MAX_END 44 MAX_END EQUAL -boundary_near_x 45 MAX_END 45 MAX_END EQUAL -boundary_near_x 76 MAX_END 76 MAX_END EQUAL -boundary_near_x 77 MAX_END 77 MAX_END EQUAL -boundary_near_x 80 MAX_END 80 MAX_END EQUAL -boundary_near_x 81 MAX_END 81 MAX_END EQUAL -# -boundary_near_x 0 12 MAX_END SMALLER -boundary_near_x 0 13 MAX_END SMALLER -boundary_near_x 0 44 MAX_END SMALLER -boundary_near_x 0 45 MAX_END SMALLER -boundary_near_x 0 76 MAX_END SMALLER -boundary_near_x 0 77 MAX_END SMALLER -boundary_near_x 0 80 MAX_END LARGER -boundary_near_x 0 81 MAX_END LARGER -# -boundary_near_x 1 12 MAX_END SMALLER -boundary_near_x 1 13 MAX_END SMALLER -boundary_near_x 1 44 MAX_END SMALLER -boundary_near_x 1 45 MAX_END SMALLER -boundary_near_x 1 76 MAX_END SMALLER -boundary_near_x 1 77 MAX_END SMALLER -boundary_near_x 1 80 MAX_END SMALLER -boundary_near_x 1 81 MAX_END SMALLER -# -boundary_near_x 2 12 MAX_END SMALLER -boundary_near_x 2 13 MAX_END SMALLER -boundary_near_x 2 44 MAX_END SMALLER -boundary_near_x 2 45 MAX_END SMALLER -boundary_near_x 2 76 MAX_END SMALLER -boundary_near_x 2 77 MAX_END SMALLER -boundary_near_x 2 80 MAX_END SMALLER -boundary_near_x 2 81 MAX_END SMALLER -# -boundary_near_x 3 12 MAX_END SMALLER -boundary_near_x 3 13 MAX_END SMALLER -boundary_near_x 3 44 MAX_END LARGER -boundary_near_x 3 45 MAX_END LARGER -boundary_near_x 3 76 MAX_END LARGER -boundary_near_x 3 77 MAX_END LARGER -boundary_near_x 3 80 MAX_END LARGER -boundary_near_x 3 81 MAX_END LARGER -# -boundary_near_x 4 12 MAX_END SMALLER -boundary_near_x 4 13 MAX_END SMALLER -boundary_near_x 4 44 MAX_END LARGER -boundary_near_x 4 45 MAX_END LARGER -boundary_near_x 4 76 MAX_END SMALLER -boundary_near_x 4 77 MAX_END SMALLER -boundary_near_x 4 80 MAX_END LARGER -boundary_near_x 4 81 MAX_END LARGER -# -boundary_near_x 5 12 MAX_END SMALLER -boundary_near_x 5 13 MAX_END SMALLER -boundary_near_x 5 44 MAX_END LARGER -boundary_near_x 5 45 MAX_END LARGER -boundary_near_x 5 76 MAX_END LARGER -boundary_near_x 5 77 MAX_END LARGER -boundary_near_x 5 80 MAX_END LARGER -boundary_near_x 5 81 MAX_END LARGER -# -boundary_near_x 6 12 MAX_END SMALLER -boundary_near_x 6 13 MAX_END SMALLER -boundary_near_x 6 44 MAX_END SMALLER -boundary_near_x 6 45 MAX_END SMALLER -boundary_near_x 6 76 MAX_END SMALLER -boundary_near_x 6 77 MAX_END SMALLER -boundary_near_x 6 80 MAX_END LARGER -boundary_near_x 6 81 MAX_END LARGER -# -boundary_near_x 7 12 MAX_END SMALLER -boundary_near_x 7 13 MAX_END SMALLER -boundary_near_x 7 44 MAX_END LARGER -boundary_near_x 7 45 MAX_END LARGER -boundary_near_x 7 76 MAX_END SMALLER -boundary_near_x 7 77 MAX_END SMALLER -boundary_near_x 7 80 MAX_END LARGER -boundary_near_x 7 81 MAX_END LARGER -# -boundary_near_x 8 12 MAX_END SMALLER -boundary_near_x 8 13 MAX_END SMALLER -boundary_near_x 8 44 MAX_END EQUAL -boundary_near_x 8 45 MAX_END EQUAL -boundary_near_x 8 76 MAX_END SMALLER -boundary_near_x 8 77 MAX_END SMALLER -boundary_near_x 8 80 MAX_END LARGER -boundary_near_x 8 81 MAX_END LARGER -# -boundary_near_x 9 12 MAX_END SMALLER -boundary_near_x 9 13 MAX_END SMALLER -boundary_near_x 9 44 MAX_END EQUAL -boundary_near_x 9 45 MAX_END EQUAL -boundary_near_x 9 76 MAX_END SMALLER -boundary_near_x 9 77 MAX_END SMALLER -boundary_near_x 9 80 MAX_END LARGER -boundary_near_x 9 81 MAX_END LARGER -# -boundary_near_x 10 12 MAX_END SMALLER -boundary_near_x 10 13 MAX_END SMALLER -boundary_near_x 10 44 MAX_END EQUAL -boundary_near_x 10 45 MAX_END EQUAL -boundary_near_x 10 76 MAX_END SMALLER -boundary_near_x 10 77 MAX_END SMALLER -boundary_near_x 10 80 MAX_END LARGER -boundary_near_x 10 81 MAX_END LARGER -# -boundary_near_x 11 12 MAX_END SMALLER -boundary_near_x 11 13 MAX_END SMALLER -boundary_near_x 11 44 MAX_END EQUAL -boundary_near_x 11 45 MAX_END EQUAL -boundary_near_x 11 76 MAX_END SMALLER -boundary_near_x 11 77 MAX_END SMALLER -boundary_near_x 11 80 MAX_END LARGER -boundary_near_x 11 81 MAX_END LARGER # -boundary_near_x 16 12 MAX_END SMALLER -boundary_near_x 16 13 MAX_END SMALLER -boundary_near_x 16 44 MAX_END LARGER -boundary_near_x 16 45 MAX_END LARGER -boundary_near_x 16 76 MAX_END EQUAL -boundary_near_x 16 77 MAX_END EQUAL -boundary_near_x 16 80 MAX_END LARGER -boundary_near_x 16 81 MAX_END LARGER -# -boundary_near_x 17 12 MAX_END SMALLER -boundary_near_x 17 13 MAX_END SMALLER -boundary_near_x 17 44 MAX_END LARGER -boundary_near_x 17 45 MAX_END LARGER -boundary_near_x 17 76 MAX_END EQUAL -boundary_near_x 17 77 MAX_END EQUAL -boundary_near_x 17 80 MAX_END LARGER -boundary_near_x 17 81 MAX_END LARGER -# -boundary_near_x 18 12 MAX_END SMALLER -boundary_near_x 18 13 MAX_END SMALLER -boundary_near_x 18 44 MAX_END LARGER -boundary_near_x 18 45 MAX_END LARGER -boundary_near_x 18 76 MAX_END EQUAL -boundary_near_x 18 77 MAX_END EQUAL -boundary_near_x 18 80 MAX_END LARGER -boundary_near_x 18 81 MAX_END LARGER -# -boundary_near_x 19 12 MAX_END SMALLER -boundary_near_x 19 13 MAX_END SMALLER -boundary_near_x 19 44 MAX_END LARGER -boundary_near_x 19 45 MAX_END LARGER -boundary_near_x 19 76 MAX_END EQUAL -boundary_near_x 19 77 MAX_END EQUAL -boundary_near_x 19 80 MAX_END LARGER -boundary_near_x 19 81 MAX_END LARGER -# -boundary_near_x 20 12 MAX_END SMALLER -boundary_near_x 20 13 MAX_END SMALLER -boundary_near_x 20 44 MAX_END SMALLER -boundary_near_x 20 45 MAX_END SMALLER -boundary_near_x 20 76 MAX_END SMALLER -boundary_near_x 20 77 MAX_END SMALLER -boundary_near_x 20 80 MAX_END EQUAL -boundary_near_x 20 81 MAX_END EQUAL -# -boundary_near_x 21 12 MAX_END SMALLER -boundary_near_x 21 13 MAX_END SMALLER -boundary_near_x 21 44 MAX_END SMALLER -boundary_near_x 21 45 MAX_END SMALLER -boundary_near_x 21 76 MAX_END SMALLER -boundary_near_x 21 77 MAX_END SMALLER -boundary_near_x 21 80 MAX_END EQUAL -boundary_near_x 21 81 MAX_END EQUAL -# -boundary_near_x 22 12 MAX_END SMALLER -boundary_near_x 22 13 MAX_END SMALLER -boundary_near_x 22 44 MAX_END SMALLER -boundary_near_x 22 45 MAX_END SMALLER -boundary_near_x 22 76 MAX_END SMALLER -boundary_near_x 22 77 MAX_END SMALLER -boundary_near_x 22 80 MAX_END EQUAL -boundary_near_x 22 81 MAX_END EQUAL -# -boundary_near_x 23 12 MAX_END SMALLER -boundary_near_x 23 13 MAX_END SMALLER -boundary_near_x 23 44 MAX_END SMALLER -boundary_near_x 23 45 MAX_END SMALLER -boundary_near_x 23 76 MAX_END SMALLER -boundary_near_x 23 77 MAX_END SMALLER -boundary_near_x 23 80 MAX_END EQUAL -boundary_near_x 23 81 MAX_END EQUAL diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/boundary_near_y b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/boundary_near_y deleted file mode 100644 index 9733a175546..00000000000 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/boundary_near_y +++ /dev/null @@ -1,137 +0,0 @@ -boundary_near_y 0 1 MIN_END EQUAL -boundary_near_y 0 2 MIN_END EQUAL -boundary_near_y 0 3 MIN_END EQUAL -boundary_near_y 0 4 MIN_END EQUAL -boundary_near_y 0 5 MIN_END EQUAL -boundary_near_y 0 6 MIN_END EQUAL -boundary_near_y 0 7 MIN_END EQUAL -boundary_near_y 0 8 MIN_END EQUAL -boundary_near_y 0 9 MIN_END EQUAL -boundary_near_y 0 10 MIN_END EQUAL -boundary_near_y 0 11 MIN_END EQUAL -boundary_near_y 0 14 MIN_END EQUAL -boundary_near_y 0 15 MIN_END EQUAL -boundary_near_y 0 16 MIN_END EQUAL -boundary_near_y 0 17 MIN_END EQUAL -boundary_near_y 0 18 MIN_END EQUAL -boundary_near_y 0 19 MIN_END EQUAL -boundary_near_y 0 20 MIN_END EQUAL -boundary_near_y 0 21 MIN_END EQUAL -boundary_near_y 0 22 MIN_END EQUAL -boundary_near_y 0 23 MIN_END EQUAL -boundary_near_y 0 24 MIN_END EQUAL -boundary_near_y 0 25 MIN_END EQUAL -boundary_near_y 0 26 MIN_END EQUAL -boundary_near_y 0 27 MIN_END EQUAL -boundary_near_y 0 28 MIN_END EQUAL -boundary_near_y 0 29 MIN_END EQUAL -boundary_near_y 0 30 MIN_END EQUAL -boundary_near_y 0 31 MIN_END EQUAL -boundary_near_y 0 48 MIN_END SMALLER -boundary_near_y 0 49 MIN_END SMALLER -boundary_near_y 0 50 MIN_END SMALLER -boundary_near_y 0 51 MIN_END SMALLER -boundary_near_y 0 52 MIN_END LARGER -boundary_near_y 0 53 MIN_END LARGER -boundary_near_y 0 54 MIN_END LARGER -boundary_near_y 0 55 MIN_END LARGER -boundary_near_y 0 56 MIN_END SMALLER -boundary_near_y 0 57 MIN_END SMALLER -boundary_near_y 0 58 MIN_END SMALLER -boundary_near_y 0 59 MIN_END SMALLER -boundary_near_y 0 60 MIN_END LARGER -boundary_near_y 0 61 MIN_END LARGER -boundary_near_y 0 62 MIN_END LARGER -boundary_near_y 0 63 MIN_END LARGER # -boundary_near_y 0 0 MIN_END EQUAL -boundary_near_y 1 1 MIN_END EQUAL -boundary_near_y 2 2 MIN_END EQUAL -boundary_near_y 3 3 MIN_END EQUAL -boundary_near_y 4 4 MIN_END EQUAL -boundary_near_y 5 5 MIN_END EQUAL -boundary_near_y 6 6 MIN_END EQUAL -boundary_near_y 7 7 MIN_END EQUAL -boundary_near_y 8 8 MIN_END EQUAL -boundary_near_y 9 9 MIN_END EQUAL -boundary_near_y 10 10 MIN_END EQUAL -boundary_near_y 11 11 MIN_END EQUAL -boundary_near_y 14 14 MIN_END EQUAL -boundary_near_y 15 15 MIN_END EQUAL -boundary_near_y 16 16 MIN_END EQUAL -boundary_near_y 17 17 MIN_END EQUAL -boundary_near_y 18 18 MIN_END EQUAL -boundary_near_y 19 19 MIN_END EQUAL -boundary_near_y 20 20 MIN_END EQUAL -boundary_near_y 21 21 MIN_END EQUAL -boundary_near_y 22 22 MIN_END EQUAL -boundary_near_y 23 23 MIN_END EQUAL -boundary_near_y 24 24 MIN_END EQUAL -boundary_near_y 25 25 MIN_END EQUAL -boundary_near_y 26 26 MIN_END EQUAL -boundary_near_y 27 27 MIN_END EQUAL -boundary_near_y 28 28 MIN_END EQUAL -boundary_near_y 29 29 MIN_END EQUAL -boundary_near_y 30 30 MIN_END EQUAL -boundary_near_y 31 31 MIN_END EQUAL -boundary_near_y 48 48 MIN_END EQUAL -boundary_near_y 49 49 MIN_END EQUAL -boundary_near_y 50 50 MIN_END EQUAL -boundary_near_y 51 51 MIN_END EQUAL -boundary_near_y 52 52 MIN_END EQUAL -boundary_near_y 53 53 MIN_END EQUAL -boundary_near_y 54 54 MIN_END EQUAL -boundary_near_y 55 55 MIN_END EQUAL -boundary_near_y 56 56 MIN_END EQUAL -boundary_near_y 57 57 MIN_END EQUAL -boundary_near_y 58 58 MIN_END EQUAL -boundary_near_y 59 59 MIN_END EQUAL -boundary_near_y 60 60 MIN_END EQUAL -boundary_near_y 61 61 MIN_END EQUAL -boundary_near_y 62 62 MIN_END EQUAL -boundary_near_y 63 63 MIN_END EQUAL # -boundary_near_y 0 0 MAX_END EQUAL -boundary_near_y 1 1 MAX_END EQUAL -boundary_near_y 2 2 MAX_END EQUAL -boundary_near_y 3 3 MAX_END EQUAL -boundary_near_y 4 4 MAX_END EQUAL -boundary_near_y 5 5 MAX_END EQUAL -boundary_near_y 6 6 MAX_END EQUAL -boundary_near_y 7 7 MAX_END EQUAL -boundary_near_y 10 10 MAX_END EQUAL -boundary_near_y 11 11 MAX_END EQUAL -boundary_near_y 12 12 MAX_END EQUAL -boundary_near_y 13 13 MAX_END EQUAL -boundary_near_y 14 14 MAX_END EQUAL -boundary_near_y 15 15 MAX_END EQUAL -boundary_near_y 16 16 MAX_END EQUAL -boundary_near_y 17 17 MAX_END EQUAL -boundary_near_y 18 18 MAX_END EQUAL -boundary_near_y 19 19 MAX_END EQUAL -boundary_near_y 20 20 MAX_END EQUAL -boundary_near_y 21 21 MAX_END EQUAL -boundary_near_y 22 22 MAX_END EQUAL -boundary_near_y 23 23 MAX_END EQUAL -boundary_near_y 24 24 MAX_END EQUAL -boundary_near_y 25 25 MAX_END EQUAL -boundary_near_y 26 26 MAX_END EQUAL -boundary_near_y 27 27 MAX_END EQUAL -boundary_near_y 28 28 MAX_END EQUAL -boundary_near_y 29 29 MAX_END EQUAL -boundary_near_y 30 30 MAX_END EQUAL -boundary_near_y 31 31 MAX_END EQUAL -boundary_near_y 48 48 MAX_END EQUAL -boundary_near_y 49 49 MAX_END EQUAL -boundary_near_y 50 50 MAX_END EQUAL -boundary_near_y 51 51 MAX_END EQUAL -boundary_near_y 52 52 MAX_END EQUAL -boundary_near_y 53 53 MAX_END EQUAL -boundary_near_y 54 54 MAX_END EQUAL -boundary_near_y 55 55 MAX_END EQUAL -boundary_near_y 56 56 MAX_END EQUAL -boundary_near_y 57 57 MAX_END EQUAL -boundary_near_y 58 58 MAX_END EQUAL -boundary_near_y 59 59 MAX_END EQUAL -boundary_near_y 60 60 MAX_END EQUAL -boundary_near_y 61 61 MAX_END EQUAL -boundary_near_y 62 62 MAX_END EQUAL -boundary_near_y 63 63 MAX_END EQUAL # diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_x_near_boundary b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_x_near_boundary new file mode 100644 index 00000000000..1f5d37fbdf0 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_x_near_boundary @@ -0,0 +1 @@ +compare_x_near_boundary 32 33 MIN_END EQUAL diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_x_on_boundary b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_x_on_boundary new file mode 100644 index 00000000000..3f83fb731d4 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_x_on_boundary @@ -0,0 +1,252 @@ +compare_x_on_boundary 32 MIN_END 32 MIN_END EQUAL +compare_x_on_boundary 33 MIN_END 33 MIN_END EQUAL +compare_x_on_boundary 64 MIN_END 64 MIN_END EQUAL +compare_x_on_boundary 65 MIN_END 65 MIN_END EQUAL +compare_x_on_boundary 92 MIN_END 92 MIN_END EQUAL +compare_x_on_boundary 93 MIN_END 93 MIN_END EQUAL +compare_x_on_boundary 0 32 MIN_END SMALLER +compare_x_on_boundary 0 33 MIN_END SMALLER +compare_x_on_boundary 0 64 MIN_END SMALLER +compare_x_on_boundary 0 65 MIN_END SMALLER +compare_x_on_boundary 0 92 MIN_END LARGER +compare_x_on_boundary 0 93 MIN_END LARGER +compare_x_on_boundary 1 32 MIN_END SMALLER +compare_x_on_boundary 1 33 MIN_END SMALLER +compare_x_on_boundary 1 64 MIN_END SMALLER +compare_x_on_boundary 1 65 MIN_END SMALLER +compare_x_on_boundary 1 92 MIN_END SMALLER +compare_x_on_boundary 1 93 MIN_END SMALLER +compare_x_on_boundary 2 32 MIN_END SMALLER +compare_x_on_boundary 2 33 MIN_END SMALLER +compare_x_on_boundary 2 64 MIN_END SMALLER +compare_x_on_boundary 2 65 MIN_END SMALLER +compare_x_on_boundary 2 92 MIN_END SMALLER +compare_x_on_boundary 2 93 MIN_END SMALLER +compare_x_on_boundary 3 32 MIN_END LARGER +compare_x_on_boundary 3 33 MIN_END LARGER +compare_x_on_boundary 3 64 MIN_END LARGER +compare_x_on_boundary 3 65 MIN_END LARGER +compare_x_on_boundary 3 92 MIN_END LARGER +compare_x_on_boundary 3 93 MIN_END LARGER +compare_x_on_boundary 4 32 MIN_END LARGER +compare_x_on_boundary 4 33 MIN_END LARGER +compare_x_on_boundary 4 64 MIN_END SMALLER +compare_x_on_boundary 4 65 MIN_END SMALLER +compare_x_on_boundary 4 92 MIN_END LARGER +compare_x_on_boundary 4 93 MIN_END LARGER +compare_x_on_boundary 5 32 MIN_END LARGER +compare_x_on_boundary 5 33 MIN_END LARGER +compare_x_on_boundary 5 64 MIN_END LARGER +compare_x_on_boundary 5 65 MIN_END LARGER +compare_x_on_boundary 5 92 MIN_END LARGER +compare_x_on_boundary 5 93 MIN_END LARGER +compare_x_on_boundary 6 32 MIN_END SMALLER +compare_x_on_boundary 6 33 MIN_END SMALLER +compare_x_on_boundary 6 64 MIN_END SMALLER +compare_x_on_boundary 6 65 MIN_END SMALLER +compare_x_on_boundary 6 92 MIN_END LARGER +compare_x_on_boundary 6 93 MIN_END LARGER +compare_x_on_boundary 7 32 MIN_END LARGER +compare_x_on_boundary 7 33 MIN_END LARGER +compare_x_on_boundary 7 64 MIN_END SMALLER +compare_x_on_boundary 7 65 MIN_END SMALLER +compare_x_on_boundary 7 92 MIN_END LARGER +compare_x_on_boundary 7 93 MIN_END LARGER +compare_x_on_boundary 8 32 MIN_END EQUAL +compare_x_on_boundary 8 33 MIN_END EQUAL +compare_x_on_boundary 8 64 MIN_END SMALLER +compare_x_on_boundary 8 65 MIN_END SMALLER +compare_x_on_boundary 8 92 MIN_END LARGER +compare_x_on_boundary 8 93 MIN_END LARGER +compare_x_on_boundary 9 32 MIN_END EQUAL +compare_x_on_boundary 9 33 MIN_END EQUAL +compare_x_on_boundary 9 64 MIN_END SMALLER +compare_x_on_boundary 9 65 MIN_END SMALLER +compare_x_on_boundary 9 92 MIN_END LARGER +compare_x_on_boundary 9 93 MIN_END LARGER +compare_x_on_boundary 10 32 MIN_END EQUAL +compare_x_on_boundary 10 33 MIN_END EQUAL +compare_x_on_boundary 10 64 MIN_END SMALLER +compare_x_on_boundary 10 65 MIN_END SMALLER +compare_x_on_boundary 10 92 MIN_END LARGER +compare_x_on_boundary 10 93 MIN_END LARGER +compare_x_on_boundary 11 32 MIN_END EQUAL +compare_x_on_boundary 11 33 MIN_END EQUAL +compare_x_on_boundary 11 64 MIN_END SMALLER +compare_x_on_boundary 11 65 MIN_END SMALLER +compare_x_on_boundary 11 92 MIN_END LARGER +compare_x_on_boundary 11 93 MIN_END LARGER +compare_x_on_boundary 16 32 MIN_END LARGER +compare_x_on_boundary 16 33 MIN_END LARGER +compare_x_on_boundary 16 64 MIN_END EQUAL +compare_x_on_boundary 16 65 MIN_END EQUAL +compare_x_on_boundary 16 92 MIN_END LARGER +compare_x_on_boundary 16 93 MIN_END LARGER +compare_x_on_boundary 17 32 MIN_END LARGER +compare_x_on_boundary 17 33 MIN_END LARGER +compare_x_on_boundary 17 64 MIN_END EQUAL +compare_x_on_boundary 17 65 MIN_END EQUAL +compare_x_on_boundary 17 92 MIN_END LARGER +compare_x_on_boundary 17 93 MIN_END LARGER +compare_x_on_boundary 18 32 MIN_END LARGER +compare_x_on_boundary 18 33 MIN_END LARGER +compare_x_on_boundary 18 64 MIN_END EQUAL +compare_x_on_boundary 18 65 MIN_END EQUAL +compare_x_on_boundary 18 92 MIN_END LARGER +compare_x_on_boundary 18 93 MIN_END LARGER +compare_x_on_boundary 19 32 MIN_END LARGER +compare_x_on_boundary 19 33 MIN_END LARGER +compare_x_on_boundary 19 64 MIN_END EQUAL +compare_x_on_boundary 19 65 MIN_END EQUAL +compare_x_on_boundary 19 92 MIN_END LARGER +compare_x_on_boundary 19 93 MIN_END LARGER +compare_x_on_boundary 20 32 MIN_END SMALLER +compare_x_on_boundary 20 33 MIN_END SMALLER +compare_x_on_boundary 20 64 MIN_END SMALLER +compare_x_on_boundary 20 65 MIN_END SMALLER +compare_x_on_boundary 20 92 MIN_END EQUAL +compare_x_on_boundary 20 93 MIN_END EQUAL +compare_x_on_boundary 21 32 MIN_END SMALLER +compare_x_on_boundary 21 33 MIN_END SMALLER +compare_x_on_boundary 21 64 MIN_END SMALLER +compare_x_on_boundary 21 65 MIN_END SMALLER +compare_x_on_boundary 21 92 MIN_END EQUAL +compare_x_on_boundary 21 93 MIN_END EQUAL +compare_x_on_boundary 22 32 MIN_END SMALLER +compare_x_on_boundary 22 33 MIN_END SMALLER +compare_x_on_boundary 22 64 MIN_END SMALLER +compare_x_on_boundary 22 65 MIN_END SMALLER +compare_x_on_boundary 22 92 MIN_END EQUAL +compare_x_on_boundary 22 93 MIN_END EQUAL +compare_x_on_boundary 23 32 MIN_END SMALLER +compare_x_on_boundary 23 33 MIN_END SMALLER +compare_x_on_boundary 23 64 MIN_END SMALLER +compare_x_on_boundary 23 65 MIN_END SMALLER +compare_x_on_boundary 23 92 MIN_END EQUAL +compare_x_on_boundary 23 93 MIN_END EQUAL +compare_x_on_boundary 44 MAX_END 44 MAX_END EQUAL +compare_x_on_boundary 45 MAX_END 45 MAX_END EQUAL +compare_x_on_boundary 76 MAX_END 76 MAX_END EQUAL +compare_x_on_boundary 77 MAX_END 77 MAX_END EQUAL +compare_x_on_boundary 80 MAX_END 80 MAX_END EQUAL +compare_x_on_boundary 81 MAX_END 81 MAX_END EQUAL +compare_x_on_boundary 0 44 MAX_END SMALLER +compare_x_on_boundary 0 45 MAX_END SMALLER +compare_x_on_boundary 0 76 MAX_END SMALLER +compare_x_on_boundary 0 77 MAX_END SMALLER +compare_x_on_boundary 0 80 MAX_END LARGER +compare_x_on_boundary 0 81 MAX_END LARGER +compare_x_on_boundary 1 44 MAX_END SMALLER +compare_x_on_boundary 1 45 MAX_END SMALLER +compare_x_on_boundary 1 76 MAX_END SMALLER +compare_x_on_boundary 1 77 MAX_END SMALLER +compare_x_on_boundary 1 80 MAX_END SMALLER +compare_x_on_boundary 1 81 MAX_END SMALLER +compare_x_on_boundary 2 44 MAX_END SMALLER +compare_x_on_boundary 2 45 MAX_END SMALLER +compare_x_on_boundary 2 76 MAX_END SMALLER +compare_x_on_boundary 2 77 MAX_END SMALLER +compare_x_on_boundary 2 80 MAX_END SMALLER +compare_x_on_boundary 2 81 MAX_END SMALLER +compare_x_on_boundary 3 44 MAX_END LARGER +compare_x_on_boundary 3 45 MAX_END LARGER +compare_x_on_boundary 3 76 MAX_END LARGER +compare_x_on_boundary 3 77 MAX_END LARGER +compare_x_on_boundary 3 80 MAX_END LARGER +compare_x_on_boundary 3 81 MAX_END LARGER +compare_x_on_boundary 4 44 MAX_END LARGER +compare_x_on_boundary 4 45 MAX_END LARGER +compare_x_on_boundary 4 76 MAX_END SMALLER +compare_x_on_boundary 4 77 MAX_END SMALLER +compare_x_on_boundary 4 80 MAX_END LARGER +compare_x_on_boundary 4 81 MAX_END LARGER +compare_x_on_boundary 5 44 MAX_END LARGER +compare_x_on_boundary 5 45 MAX_END LARGER +compare_x_on_boundary 5 76 MAX_END LARGER +compare_x_on_boundary 5 77 MAX_END LARGER +compare_x_on_boundary 5 80 MAX_END LARGER +compare_x_on_boundary 5 81 MAX_END LARGER +compare_x_on_boundary 6 44 MAX_END SMALLER +compare_x_on_boundary 6 45 MAX_END SMALLER +compare_x_on_boundary 6 76 MAX_END SMALLER +compare_x_on_boundary 6 77 MAX_END SMALLER +compare_x_on_boundary 6 80 MAX_END LARGER +compare_x_on_boundary 6 81 MAX_END LARGER +compare_x_on_boundary 7 44 MAX_END LARGER +compare_x_on_boundary 7 45 MAX_END LARGER +compare_x_on_boundary 7 76 MAX_END SMALLER +compare_x_on_boundary 7 77 MAX_END SMALLER +compare_x_on_boundary 7 80 MAX_END LARGER +compare_x_on_boundary 7 81 MAX_END LARGER +compare_x_on_boundary 8 44 MAX_END EQUAL +compare_x_on_boundary 8 45 MAX_END EQUAL +compare_x_on_boundary 8 76 MAX_END SMALLER +compare_x_on_boundary 8 77 MAX_END SMALLER +compare_x_on_boundary 8 80 MAX_END LARGER +compare_x_on_boundary 8 81 MAX_END LARGER +compare_x_on_boundary 9 44 MAX_END EQUAL +compare_x_on_boundary 9 45 MAX_END EQUAL +compare_x_on_boundary 9 76 MAX_END SMALLER +compare_x_on_boundary 9 77 MAX_END SMALLER +compare_x_on_boundary 9 80 MAX_END LARGER +compare_x_on_boundary 9 81 MAX_END LARGER +compare_x_on_boundary 10 44 MAX_END EQUAL +compare_x_on_boundary 10 45 MAX_END EQUAL +compare_x_on_boundary 10 76 MAX_END SMALLER +compare_x_on_boundary 10 77 MAX_END SMALLER +compare_x_on_boundary 10 80 MAX_END LARGER +compare_x_on_boundary 10 81 MAX_END LARGER +compare_x_on_boundary 11 44 MAX_END EQUAL +compare_x_on_boundary 11 45 MAX_END EQUAL +compare_x_on_boundary 11 76 MAX_END SMALLER +compare_x_on_boundary 11 77 MAX_END SMALLER +compare_x_on_boundary 11 80 MAX_END LARGER +compare_x_on_boundary 11 81 MAX_END LARGER# +compare_x_on_boundary 16 44 MAX_END LARGER +compare_x_on_boundary 16 45 MAX_END LARGER +compare_x_on_boundary 16 76 MAX_END EQUAL +compare_x_on_boundary 16 77 MAX_END EQUAL +compare_x_on_boundary 16 80 MAX_END LARGER +compare_x_on_boundary 16 81 MAX_END LARGER +compare_x_on_boundary 17 44 MAX_END LARGER +compare_x_on_boundary 17 45 MAX_END LARGER +compare_x_on_boundary 17 76 MAX_END EQUAL +compare_x_on_boundary 17 77 MAX_END EQUAL +compare_x_on_boundary 17 80 MAX_END LARGER +compare_x_on_boundary 17 81 MAX_END LARGER +compare_x_on_boundary 18 44 MAX_END LARGER +compare_x_on_boundary 18 45 MAX_END LARGER +compare_x_on_boundary 18 76 MAX_END EQUAL +compare_x_on_boundary 18 77 MAX_END EQUAL +compare_x_on_boundary 18 80 MAX_END LARGER +compare_x_on_boundary 18 81 MAX_END LARGER +compare_x_on_boundary 19 44 MAX_END LARGER +compare_x_on_boundary 19 45 MAX_END LARGER +compare_x_on_boundary 19 76 MAX_END EQUAL +compare_x_on_boundary 19 77 MAX_END EQUAL +compare_x_on_boundary 19 80 MAX_END LARGER +compare_x_on_boundary 19 81 MAX_END LARGER +compare_x_on_boundary 20 44 MAX_END SMALLER +compare_x_on_boundary 20 45 MAX_END SMALLER +compare_x_on_boundary 20 76 MAX_END SMALLER +compare_x_on_boundary 20 77 MAX_END SMALLER +compare_x_on_boundary 20 80 MAX_END EQUAL +compare_x_on_boundary 20 81 MAX_END EQUAL +compare_x_on_boundary 21 44 MAX_END SMALLER +compare_x_on_boundary 21 45 MAX_END SMALLER +compare_x_on_boundary 21 76 MAX_END SMALLER +compare_x_on_boundary 21 77 MAX_END SMALLER +compare_x_on_boundary 21 80 MAX_END EQUAL +compare_x_on_boundary 21 81 MAX_END EQUAL +compare_x_on_boundary 22 44 MAX_END SMALLER +compare_x_on_boundary 22 45 MAX_END SMALLER +compare_x_on_boundary 22 76 MAX_END SMALLER +compare_x_on_boundary 22 77 MAX_END SMALLER +compare_x_on_boundary 22 80 MAX_END EQUAL +compare_x_on_boundary 22 81 MAX_END EQUAL +compare_x_on_boundary 23 44 MAX_END SMALLER +compare_x_on_boundary 23 45 MAX_END SMALLER +compare_x_on_boundary 23 76 MAX_END SMALLER +compare_x_on_boundary 23 77 MAX_END SMALLER +compare_x_on_boundary 23 80 MAX_END EQUAL +compare_x_on_boundary 23 81 MAX_END EQUAL diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_y_near_boundary b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_y_near_boundary new file mode 100644 index 00000000000..2c612e9ccdc --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/spherical_arcs/compare_y_near_boundary @@ -0,0 +1,138 @@ +compare_y_near_boundary 0 1 MIN_END EQUAL +compare_y_near_boundary 0 2 MIN_END EQUAL +compare_y_near_boundary 0 3 MIN_END EQUAL +compare_y_near_boundary 0 4 MIN_END EQUAL +compare_y_near_boundary 0 5 MIN_END EQUAL +compare_y_near_boundary 0 6 MIN_END EQUAL +compare_y_near_boundary 0 7 MIN_END EQUAL +compare_y_near_boundary 0 8 MIN_END EQUAL +compare_y_near_boundary 0 9 MIN_END EQUAL +compare_y_near_boundary 0 10 MIN_END EQUAL +compare_y_near_boundary 0 11 MIN_END EQUAL +compare_y_near_boundary 0 14 MIN_END EQUAL +compare_y_near_boundary 0 15 MIN_END EQUAL +compare_y_near_boundary 0 16 MIN_END EQUAL +compare_y_near_boundary 0 17 MIN_END EQUAL +compare_y_near_boundary 0 18 MIN_END EQUAL +compare_y_near_boundary 0 19 MIN_END EQUAL +compare_y_near_boundary 0 20 MIN_END EQUAL +compare_y_near_boundary 0 21 MIN_END EQUAL +compare_y_near_boundary 0 22 MIN_END EQUAL +compare_y_near_boundary 0 23 MIN_END EQUAL +compare_y_near_boundary 0 24 MIN_END EQUAL +compare_y_near_boundary 0 25 MIN_END EQUAL +compare_y_near_boundary 0 26 MIN_END EQUAL +compare_y_near_boundary 0 27 MIN_END EQUAL +compare_y_near_boundary 0 28 MIN_END EQUAL +compare_y_near_boundary 0 29 MIN_END EQUAL +compare_y_near_boundary 0 30 MIN_END EQUAL +compare_y_near_boundary 0 31 MIN_END EQUAL +compare_y_near_boundary 0 48 MIN_END SMALLER +compare_y_near_boundary 0 49 MIN_END SMALLER +compare_y_near_boundary 0 50 MIN_END SMALLER +compare_y_near_boundary 0 51 MIN_END SMALLER +compare_y_near_boundary 0 52 MIN_END LARGER +compare_y_near_boundary 0 53 MIN_END LARGER +compare_y_near_boundary 0 54 MIN_END LARGER +compare_y_near_boundary 0 55 MIN_END LARGER +compare_y_near_boundary 0 56 MIN_END SMALLER +compare_y_near_boundary 0 57 MIN_END SMALLER +compare_y_near_boundary 0 58 MIN_END SMALLER +compare_y_near_boundary 0 59 MIN_END SMALLER +compare_y_near_boundary 0 60 MIN_END LARGER +compare_y_near_boundary 0 61 MIN_END LARGER +compare_y_near_boundary 0 62 MIN_END LARGER +compare_y_near_boundary 0 63 MIN_END LARGER# +compare_y_near_boundary 0 0 MIN_END EQUAL +compare_y_near_boundary 1 1 MIN_END EQUAL +compare_y_near_boundary 2 2 MIN_END EQUAL +compare_y_near_boundary 3 3 MIN_END EQUAL +compare_y_near_boundary 4 4 MIN_END EQUAL +compare_y_near_boundary 5 5 MIN_END EQUAL +compare_y_near_boundary 6 6 MIN_END EQUAL +compare_y_near_boundary 7 7 MIN_END EQUAL +compare_y_near_boundary 8 8 MIN_END EQUAL +compare_y_near_boundary 9 9 MIN_END EQUAL +compare_y_near_boundary 10 10 MIN_END EQUAL +compare_y_near_boundary 11 11 MIN_END EQUAL +compare_y_near_boundary 14 14 MIN_END EQUAL +compare_y_near_boundary 15 15 MIN_END EQUAL +compare_y_near_boundary 16 16 MIN_END EQUAL +compare_y_near_boundary 17 17 MIN_END EQUAL +compare_y_near_boundary 18 18 MIN_END EQUAL +compare_y_near_boundary 19 19 MIN_END EQUAL +compare_y_near_boundary 20 20 MIN_END EQUAL +compare_y_near_boundary 21 21 MIN_END EQUAL +compare_y_near_boundary 22 22 MIN_END EQUAL +compare_y_near_boundary 23 23 MIN_END EQUAL +compare_y_near_boundary 24 24 MIN_END EQUAL +compare_y_near_boundary 25 25 MIN_END EQUAL +compare_y_near_boundary 26 26 MIN_END EQUAL +compare_y_near_boundary 27 27 MIN_END EQUAL +compare_y_near_boundary 28 28 MIN_END EQUAL +compare_y_near_boundary 29 29 MIN_END EQUAL +compare_y_near_boundary 30 30 MIN_END EQUAL +compare_y_near_boundary 31 31 MIN_END EQUAL +compare_y_near_boundary 48 48 MIN_END EQUAL +compare_y_near_boundary 49 49 MIN_END EQUAL +compare_y_near_boundary 50 50 MIN_END EQUAL +compare_y_near_boundary 51 51 MIN_END EQUAL +compare_y_near_boundary 52 52 MIN_END EQUAL +compare_y_near_boundary 53 53 MIN_END EQUAL +compare_y_near_boundary 54 54 MIN_END EQUAL +compare_y_near_boundary 55 55 MIN_END EQUAL +compare_y_near_boundary 56 56 MIN_END EQUAL +compare_y_near_boundary 57 57 MIN_END EQUAL +compare_y_near_boundary 58 58 MIN_END EQUAL +compare_y_near_boundary 59 59 MIN_END EQUAL +compare_y_near_boundary 60 60 MIN_END EQUAL +compare_y_near_boundary 61 61 MIN_END EQUAL +compare_y_near_boundary 62 62 MIN_END EQUAL +compare_y_near_boundary 63 63 MIN_END EQUAL# +compare_y_near_boundary 0 0 MAX_END EQUAL +compare_y_near_boundary 1 1 MAX_END EQUAL +compare_y_near_boundary 2 2 MAX_END EQUAL +compare_y_near_boundary 3 3 MAX_END EQUAL +compare_y_near_boundary 4 4 MAX_END EQUAL +compare_y_near_boundary 5 5 MAX_END EQUAL +compare_y_near_boundary 6 6 MAX_END EQUAL +compare_y_near_boundary 7 7 MAX_END EQUAL +compare_y_near_boundary 10 10 MAX_END EQUAL +compare_y_near_boundary 11 11 MAX_END EQUAL +compare_y_near_boundary 12 12 MAX_END EQUAL +compare_y_near_boundary 13 13 MAX_END EQUAL +compare_y_near_boundary 14 14 MAX_END EQUAL +compare_y_near_boundary 15 15 MAX_END EQUAL +compare_y_near_boundary 16 16 MAX_END EQUAL +compare_y_near_boundary 17 17 MAX_END EQUAL +compare_y_near_boundary 18 18 MAX_END EQUAL +compare_y_near_boundary 19 19 MAX_END EQUAL +compare_y_near_boundary 20 20 MAX_END EQUAL +compare_y_near_boundary 21 21 MAX_END EQUAL +compare_y_near_boundary 22 22 MAX_END EQUAL +compare_y_near_boundary 23 23 MAX_END EQUAL +compare_y_near_boundary 24 24 MAX_END EQUAL +compare_y_near_boundary 25 25 MAX_END EQUAL +compare_y_near_boundary 26 26 MAX_END EQUAL +compare_y_near_boundary 27 27 MAX_END EQUAL +compare_y_near_boundary 28 28 MAX_END EQUAL +compare_y_near_boundary 29 29 MAX_END EQUAL +compare_y_near_boundary 30 30 MAX_END EQUAL +compare_y_near_boundary 31 31 MAX_END EQUAL +compare_y_near_boundary 48 48 MAX_END EQUAL +compare_y_near_boundary 49 49 MAX_END EQUAL +compare_y_near_boundary 50 50 MAX_END EQUAL +compare_y_near_boundary 51 51 MAX_END EQUAL +compare_y_near_boundary 52 52 MAX_END EQUAL +compare_y_near_boundary 53 53 MAX_END EQUAL +compare_y_near_boundary 54 54 MAX_END EQUAL +compare_y_near_boundary 55 55 MAX_END EQUAL +compare_y_near_boundary 56 56 MAX_END EQUAL +compare_y_near_boundary 57 57 MAX_END EQUAL +compare_y_near_boundary 58 58 MAX_END EQUAL +compare_y_near_boundary 59 59 MAX_END EQUAL +compare_y_near_boundary 60 60 MAX_END EQUAL +compare_y_near_boundary 61 61 MAX_END EQUAL +compare_y_near_boundary 62 62 MAX_END EQUAL +compare_y_near_boundary 63 63 MAX_END EQUAL + diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_configuration.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_configuration.h index b91dec3efab..c4a96a7a819 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_configuration.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_configuration.h @@ -24,9 +24,11 @@ #define LEDA_INT_NT 13 #define CGAL_GMPZ_NT 14 #define CORE_INT_NT 15 +#define CORE_RAT_NT 16 #define CARTESIAN_KERNEL 0 #define SIMPLE_CARTESIAN_KERNEL 1 +#define UNIVARIATE_ALGEBRAIC_KERNEL 2 #define SEGMENT_TRAITS 0 #define NON_CACHING_SEGMENT_TRAITS 1 diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_kernel.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_kernel.h index 7077e2616db..eae8689762c 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_kernel.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_kernel.h @@ -12,6 +12,9 @@ #elif TEST_KERNEL == CARTESIAN_KERNEL #include +#elif TEST_KERNEL == UNIVARIATE_ALGEBRAIC_KERNEL +#include + #else #error No kernel (KERNEL) specified! #endif @@ -27,6 +30,10 @@ typedef CGAL::Simple_cartesian Kernel; typedef CGAL::Cartesian Kernel; #define KERNEL_TYPE "Cartesian" +#elif TEST_KERNEL == UNIVARIATE_ALGEBRAIC_KERNEL +typedef CGAL::Algebraic_kernel_d_1 Kernel; +#define KERNEL_TYPE "Univariate Algebraic" + #else #error No kernel (KERNEL) specified! #endif diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_number_type.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_number_type.h index a448688cd22..292fb790ed8 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_number_type.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_number_type.h @@ -64,6 +64,9 @@ #elif TEST_NT == CORE_INT_NT #include +#elif TEST_NT == CORE_RAT_NT //OS - new +#include + #else #error No Number Type (NT) specified! #endif @@ -176,6 +179,11 @@ typedef Basic_number_type Number_type; typedef Basic_number_type Ring_type; #define NUMBER_TYPE "CORE BigInt" +#elif TEST_NT == CORE_RAT_NT +typedef CGAL::CORE_arithmetic_kernel::Rational Basic_number_type; +typedef Basic_number_type Number_type; +typedef Basic_number_type Ring_type; +#define NUMBER_TYPE "CORE Rational" #else #error No Number Type (NT) Specified diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_rational_function_traits_2.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_rational_function_traits_2.cpp new file mode 100644 index 00000000000..d830411e96e --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_rational_function_traits_2.cpp @@ -0,0 +1,280 @@ +#include + +#include //NT +#include //Algebraic Kernel +#include //Traits +#include //Arrangement +#include +#include + +typedef CORE::BigInt Number_type; +typedef CGAL::Algebraic_kernel_d_1 AK1; +typedef CGAL::Arr_rational_function_traits_2 Traits_2; +typedef CGAL::Arrangement_2 Arrangement_2; + +int main(int argc, char* argv[]) +{ + + // testing that all types are present: + + // Traits + typedef Traits_2::Polynomial_1 Polynomial_1; + typedef Traits_2::Algebraic_real_1 Algebraic_real_1; + typedef Traits_2::Coefficient Coefficient; + typedef Traits_2::Bound Bound; + typedef Traits_2::Algebraic_kernel_d_1 Algebraic_kernel_d_1; + typedef Traits_2::Construct_curve_2 Construct_curve_2; + typedef Traits_2::Construct_x_monotone_curve_2 Construct_x_monotone_curve_2; + + // typedef induced by concept + + typedef Traits_2::Curve_2 Curve_2; + typedef Traits_2::X_monotone_curve_2 X_monotone_curve_2; + typedef Traits_2::Point_2 Point_2; + + typedef Traits_2::Compare_x_2 Compare_x_2; + typedef Traits_2::Compare_xy_2 Compare_xy_2; + typedef Traits_2::Construct_min_vertex_2 Construct_min_vertex_2; + typedef Traits_2::Construct_max_vertex_2 Construct_max_vertex_2; + typedef Traits_2::Is_vertical_2 Is_vertical_2; + typedef Traits_2::Compare_y_at_x_2 Compare_y_at_x_2; + typedef Traits_2::Compare_y_at_x_left_2 Compare_y_at_x_left_2; + typedef Traits_2::Compare_y_at_x_right_2 Compare_y_at_x_right_2; + typedef Traits_2::Equal_2 Equal_2; + typedef Traits_2::Parameter_space_in_x_2 Parameter_space_in_x_2; + typedef Traits_2::Parameter_space_in_y_2 Parameter_space_in_y_2; + typedef Traits_2::Compare_x_at_limit_2 Compare_x_at_limit_2; + typedef Traits_2::Compare_x_near_limit_2 Compare_x_near_limit_2; + typedef Traits_2::Compare_y_near_boundary_2 Compare_y_near_boundary_2; + typedef Traits_2::Intersect_2 Intersect_2; + typedef Traits_2::Split_2 Split_2; + typedef Traits_2::Are_mergeable_2 Are_mergeable_2; + typedef Traits_2::Merge_2 Merge_2; + typedef Traits_2::Make_x_monotone_2 Make_x_monotone_2; + typedef Traits_2::Approximate_2 Approximate_2; + + // construction traits + // default construction + { + Traits_2 traits; + const Algebraic_kernel_d_1* ak (traits.algebraic_kernel_d_1()); (void) ak; + } + + + // construction from pointer to AK + Algebraic_kernel_d_1 ak; + Traits_2 traits(&ak); + + + traits.cleanup_cache(); + + Construct_curve_2 construct_curve_2 = traits.construct_curve_2_object(); + + Polynomial_1 P(0); + Polynomial_1 Q(1); + Algebraic_real_1 one(1); + Algebraic_real_1 two(2); + { + typedef Construct_curve_2::Polynomial_1 Polynomial_1; + typedef Construct_curve_2::Algebraic_real_1 Algebraic_real_1; + typedef Construct_curve_2::Curve_2 Curve_2; + typedef Construct_curve_2::argument_type argument_type; + typedef Construct_curve_2::first_argument_type first_argument_type; + typedef Construct_curve_2::second_argument_type second_argument_type; + } + {Curve_2 curve = construct_curve_2(P);} + {Curve_2 curve = construct_curve_2(P,one,true);} + {Curve_2 curve = construct_curve_2(P,one,false);} + {Curve_2 curve = construct_curve_2(P,one,two);} + {Curve_2 curve = construct_curve_2(P,Q);} + {Curve_2 curve = construct_curve_2(P,Q,one,true);} + {Curve_2 curve = construct_curve_2(P,Q,one,false);} + //{Curve_2 curve = construct_curve_2(P,Q,one,two);} + {Curve_2 curve = construct_curve_2(P.begin(),P.end());} + {Curve_2 curve = construct_curve_2(P.begin(),P.end(),one,true);} + {Curve_2 curve = construct_curve_2(P.begin(),P.end(),one,false);} + {Curve_2 curve = construct_curve_2(P.begin(),P.end(),one,two);} + {Curve_2 curve = construct_curve_2(P.begin(),P.end());} + {Curve_2 curve = construct_curve_2(P.begin(),P.end(),Q.begin(),Q.end(),one,true);} + {Curve_2 curve = construct_curve_2(P.begin(),P.end(),Q.begin(),Q.end(),one,false);} + {Curve_2 curve = construct_curve_2(P.begin(),P.end(),Q.begin(),Q.end(),one,two);} + + + Construct_x_monotone_curve_2 + construct_x_monotone_curve_2 = traits.construct_x_monotone_curve_2_object(); + { + typedef Construct_x_monotone_curve_2::Polynomial_1 Polynomial_1; + typedef Construct_x_monotone_curve_2::Algebraic_real_1 Algebraic_real_1; + typedef Construct_x_monotone_curve_2::X_monotone_curve_2 X_monotone_curve_2; + typedef Construct_x_monotone_curve_2::argument_type argument_type; + typedef Construct_x_monotone_curve_2::first_argument_type first_argument_type; + typedef Construct_x_monotone_curve_2::second_argument_type second_argument_type; + } + + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P,one,true);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P,one,false);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P,one,two);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P,Q);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P,Q,one,true);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P,Q,one,false);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P,Q,one,two);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P.begin(),P.end());} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P.begin(),P.end(),one,true);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P.begin(),P.end(),one,false);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P.begin(),P.end(),one,two);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P.begin(),P.end());} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P.begin(),P.end(),Q.begin(),Q.end(),one,true);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P.begin(),P.end(),Q.begin(),Q.end(),one,false);} + {X_monotone_curve_2 x_monotone_curve = construct_x_monotone_curve_2(P.begin(),P.end(),Q.begin(),Q.end(),one,two);} + + { + typedef Curve_2::Polynomial_1 Polynomial_1; + typedef Curve_2::Algebraic_real_1 Algebraic_real_1; + } + + { + + Curve_2 curve = construct_curve_2(P,Q); + {Curve_2 dummy;} + {Curve_2 dummy(curve);} + {Curve_2 dummy = curve;} + + assert(CGAL::degree(curve.numerator()) >=0); + assert(CGAL::degree(curve.denominator())>=0); + assert(curve.is_continuous()); + assert(curve.left_parameter_space_in_x()==CGAL::ARR_LEFT_BOUNDARY); + assert(curve.right_parameter_space_in_x()==CGAL::ARR_RIGHT_BOUNDARY); + } + { + Curve_2 curve = construct_curve_2(P,one,two); + assert(CGAL::degree(curve.numerator()) >=0); + assert(CGAL::degree(curve.denominator())>=0); + assert(curve.is_continuous()); + assert(curve.left_parameter_space_in_x()==CGAL::ARR_INTERIOR); + assert(curve.right_parameter_space_in_x()==CGAL::ARR_INTERIOR); + assert(one == curve.left_x()); + assert(two == curve.right_x()); + } + // X_monotone_curve_2 + { + typedef X_monotone_curve_2::Polynomial_1 Polynomial_1; + typedef X_monotone_curve_2::Algebraic_real_1 Algebraic_real_1; + typedef X_monotone_curve_2::Point_2 Point_2; + + X_monotone_curve_2 xcurve= construct_x_monotone_curve_2(P,Q,one,two); + + {X_monotone_curve_2 dummy;} + {X_monotone_curve_2 dummy(xcurve);} + {X_monotone_curve_2 dummy = xcurve;} + + assert(CGAL::degree(xcurve.numerator()) >=0); + assert(CGAL::degree(xcurve.denominator())>=0); + assert(xcurve.source_parameter_space_in_x()==CGAL::ARR_INTERIOR); + assert(xcurve.source_parameter_space_in_y()==CGAL::ARR_INTERIOR); + xcurve.source(); + xcurve.target(); + xcurve.left(); + xcurve.right(); + xcurve.source_x(); + xcurve.target_x(); + xcurve.left_x(); + xcurve.right_x(); + assert(xcurve.is_left_to_right()); + } + + + // Point_2 + { + typedef Point_2::Polynomial_1 Polynomial_1; + typedef Point_2::Algebraic_real_1 Algebraic_real_1; + typedef Point_2::Bound Bound; + + X_monotone_curve_2 xcurve= construct_x_monotone_curve_2(P,Q,one,two); + Point_2 p = xcurve.left(); + Point_2 q = xcurve.right(); + + p.numerator(); + p.denominator(); + p.to_double(); + p.x(); + p.y(); + p.approximate_absolute_x(1); + p.approximate_absolute_y(1); + p.approximate_relative_x(1); + p.approximate_relative_y(1); + + {Point_2 dummy = p;} + {Point_2 dummy(p);} + } + + { + Arrangement_2 arr; + const Traits_2* traits = arr.traits();(void) traits; + } + + { + + const Traits_2 traits; + traits.cleanup_cache(); + assert( traits.cache().rat_func_map().size()==0); + assert( traits.cache().rat_pair_map().size()==0); + + Construct_curve_2 construct_curve_2 = traits.construct_curve_2_object(); + + Polynomial_1 x = CGAL::shift(Polynomial_1(1),1); + + { + std::vector curves; + std::vector xcurves; + std::vector points; + curves.push_back(construct_curve_2(Polynomial_1(1))); + curves.push_back(construct_curve_2(x*x-2)); + curves.push_back(construct_curve_2(x*x*x)); + curves.push_back(construct_curve_2(x*x*x,x*x-2)); + + + BOOST_FOREACH(const Curve_2& curve, curves){ + assert(CGAL::degree(curve.numerator())>=0); + } + CGAL::compute_subcurves(curves.begin(),curves.end(),std::back_inserter(xcurves),false,traits); + BOOST_FOREACH(const X_monotone_curve_2& xcurve, xcurves){ + assert(CGAL::degree(xcurve.numerator())>=0); + } + + CGAL::compute_intersection_points (curves.begin(),curves.end(),std::back_inserter(points),false,traits); + BOOST_FOREACH(const Point_2& point, points){ + assert(CGAL::degree(point.numerator())>=0); + } + } + traits.cleanup_cache(); + assert( traits.cache().rat_func_map().size()==0); + assert( traits.cache().rat_pair_map().size()==0); + { + std::vector curves; + std::vector xcurves; + std::vector points; + + curves.push_back(construct_curve_2(Polynomial_1(1))); + curves.push_back(construct_curve_2(x*x-2)); + curves.push_back(construct_curve_2(x*x*x)); + curves.push_back(construct_curve_2(x*x*x,x*x-2)); + + traits.cleanup_cache(); + BOOST_FOREACH(const Curve_2& curve, curves){ + assert(CGAL::degree(curve.numerator())>=0); + } + CGAL::compute_subcurves(curves.begin(),curves.end(),std::back_inserter(xcurves),false,traits); + BOOST_FOREACH(const X_monotone_curve_2& xcurve, xcurves){ + assert(CGAL::degree(xcurve.numerator())>=0); + } + CGAL::compute_intersection_points (curves.begin(),curves.end(),std::back_inserter(points),false,traits); + BOOST_FOREACH(const Point_2& point, points){ + assert(CGAL::degree(point.numerator())>=0); + } + std::sort(points.begin(),points.end(), traits.compare_xy_2_object()); + std::sort(points.begin(),points.end(), traits.compare_x_2_object()); + } + } + return 0; +} 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 6d1be4d61af..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 @@ -8,31 +8,31 @@ #include struct Traits1 { - typedef CGAL::Arr_open_side_tag Arr_left_side_category; - typedef CGAL::Arr_open_side_tag Arr_bottom_side_category; - typedef CGAL::Arr_open_side_tag Arr_top_side_category; - typedef CGAL::Arr_open_side_tag Arr_right_side_category; + typedef CGAL::Arr_open_side_tag Left_side_category; + typedef CGAL::Arr_open_side_tag Bottom_side_category; + typedef CGAL::Arr_open_side_tag Top_side_category; + typedef CGAL::Arr_open_side_tag Right_side_category; }; struct Traits2 { - typedef CGAL::Arr_open_side_tag Arr_left_side_category; - typedef CGAL::Arr_closed_side_tag Arr_bottom_side_category; - typedef CGAL::Arr_open_side_tag Arr_top_side_category; - typedef CGAL::Arr_open_side_tag Arr_right_side_category; + typedef CGAL::Arr_open_side_tag Left_side_category; + typedef CGAL::Arr_closed_side_tag Bottom_side_category; + typedef CGAL::Arr_open_side_tag Top_side_category; + typedef CGAL::Arr_open_side_tag Right_side_category; }; struct Traits3 { - typedef CGAL::Arr_open_side_tag Arr_left_side_category; - typedef CGAL::Arr_open_side_tag Arr_bottom_side_category; - typedef CGAL::Arr_closed_side_tag Arr_top_side_category; - typedef CGAL::Arr_open_side_tag Arr_right_side_category; + typedef CGAL::Arr_open_side_tag Left_side_category; + typedef CGAL::Arr_open_side_tag Bottom_side_category; + typedef CGAL::Arr_closed_side_tag Top_side_category; + typedef CGAL::Arr_open_side_tag Right_side_category; }; struct Traits4 { - typedef CGAL::Arr_open_side_tag Arr_left_side_category; - typedef CGAL::Arr_open_side_tag Arr_bottom_side_category; - typedef CGAL::Arr_open_side_tag Arr_top_side_category; - typedef CGAL::Arr_closed_side_tag Arr_right_side_category; + typedef CGAL::Arr_open_side_tag Left_side_category; + typedef CGAL::Arr_open_side_tag Bottom_side_category; + typedef CGAL::Arr_open_side_tag Top_side_category; + typedef CGAL::Arr_closed_side_tag Right_side_category; }; struct Traits5 { @@ -271,39 +271,39 @@ int main () assert(ident12() == false); - BOOST_STATIC_ASSERT( - (boost::is_same< CGAL::internal::Arr_complete_left_side_tag< Traits5 >::Tag, + CGAL_static_assertion( + (boost::is_same< CGAL::internal::Arr_complete_left_side_category< Traits5 >::Category, CGAL::Arr_oblivious_side_tag >::value) ); - BOOST_STATIC_ASSERT( - (boost::is_same< CGAL::internal::Arr_complete_left_side_tag< Traits1 >::Tag, + CGAL_static_assertion( + (boost::is_same< CGAL::internal::Arr_complete_left_side_category< Traits1 >::Category, CGAL::Arr_open_side_tag >::value) ); - BOOST_STATIC_ASSERT( - (boost::is_same::Tag, + CGAL_static_assertion( + (boost::is_same::Category, CGAL::Arr_oblivious_side_tag >::value) ); - BOOST_STATIC_ASSERT( - (boost::is_same::Tag, + CGAL_static_assertion( + (boost::is_same::Category, CGAL::Arr_open_side_tag >::value) ); - BOOST_STATIC_ASSERT( - (boost::is_same< CGAL::internal::Arr_complete_top_side_tag< Traits5 >::Tag, + CGAL_static_assertion( + (boost::is_same< CGAL::internal::Arr_complete_top_side_category< Traits5 >::Category, CGAL::Arr_oblivious_side_tag >::value) ); - BOOST_STATIC_ASSERT( - (boost::is_same< CGAL::internal::Arr_complete_top_side_tag< Traits1 >::Tag, + CGAL_static_assertion( + (boost::is_same< CGAL::internal::Arr_complete_top_side_category< Traits1 >::Category, CGAL::Arr_open_side_tag >::value) ); - BOOST_STATIC_ASSERT( - (boost::is_same< CGAL::internal::Arr_complete_right_side_tag< Traits5 >::Tag, + CGAL_static_assertion( + (boost::is_same< CGAL::internal::Arr_complete_right_side_category< Traits5 >::Category, CGAL::Arr_oblivious_side_tag >::value) ); - BOOST_STATIC_ASSERT( - (boost::is_same< CGAL::internal::Arr_complete_right_side_tag< Traits1 >::Tag, + CGAL_static_assertion( + (boost::is_same< CGAL::internal::Arr_complete_right_side_category< Traits1 >::Category, CGAL::Arr_open_side_tag >::value) ); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits.h b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits.h index fe4759844db..46b14b41d50 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits.h +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits.h @@ -54,8 +54,10 @@ #include #elif TEST_TRAITS == RATIONAL_ARC_TRAITS -#include -#include +//#include //OS - new +//#include +#include + #elif TEST_TRAITS == ALGEBRAIC_TRAITS #include @@ -162,14 +164,24 @@ typedef CGAL::Arr_geodesic_arc_on_sphere_traits_2 Traits; #define TRAITS_TYPE "Spherical Arc" #elif TEST_TRAITS == RATIONAL_ARC_TRAITS -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Arr_rational_arc_traits_2 Traits; -typedef Traits::Rat_vector Rat_vector; -typedef Traits::Point_2 Point_2; + +// TODO: This is for old Ron's traits---remove. +//typedef CGAL::CORE_algebraic_number_traits Nt_traits; //OS - new +//typedef Nt_traits::Rational Rational; +//typedef Nt_traits::Algebraic Algebraic; +//typedef CGAL::Arr_rational_arc_traits_2 Traits; +//typedef Traits::Rat_vector Rat_vector; +//typedef Traits::Point_2 Point_2; +//#define TRAITS_TYPE "Rational Arc" + +typedef CGAL::Arr_rational_function_traits_2 Traits; +typedef Traits::Rational Rational; +typedef Traits::Algebraic_real_1 Algebraic_real_1; +typedef Traits::Point_2 Point_2; +typedef Traits::Rat_vector Rat_vector; #define TRAITS_TYPE "Rational Arc" + #elif TEST_TRAITS == ALGEBRAIC_TRAITS typedef CGAL::Arr_algebraic_segment_traits_2 Traits; typedef Traits::Point_2 Point_2; diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_dispatching.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_dispatching.cpp index 7e454fe7162..6e74a55f079 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_dispatching.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_traits_dispatching.cpp @@ -38,16 +38,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 0); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 0); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 0); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 0); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 0); } { // Arr_left_right_implementation_dispatch oblivious-open @@ -61,16 +61,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 0); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 0); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 0); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } { // Arr_left_right_implementation_dispatch oblivious-contracted @@ -84,16 +84,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 1); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 0); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 0); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } { // Arr_left_right_implementation_dispatch oblivious-closed @@ -107,16 +107,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 1); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 1); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 1); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } // open-oblivious @@ -136,16 +136,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 0); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 0); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 0); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } { // Arr_left_right_implementation_dispatch open-open @@ -159,16 +159,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 0); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 0); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 0); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } { // Arr_left_right_implementation_dispatch open-contracted @@ -182,16 +182,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 1); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 0); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 0); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } { // Arr_left_right_implementation_dispatch open-closed @@ -205,16 +205,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 1); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 1); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 1); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } // contracted-oblivious @@ -233,16 +233,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 1); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 0); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 0); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } { // Arr_left_right_implementation_dispatch contracted-open @@ -256,16 +256,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 1); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 0); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 0); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } { // Arr_left_right_implementation_dispatch contracted-contracted @@ -279,16 +279,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 1); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 0); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 0); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } { // Arr_left_right_implementation_dispatch contracted-closed @@ -302,16 +302,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 1); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 1); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 1); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } // closed-oblivious @@ -330,16 +330,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 1); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 1); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 1); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } { // Arr_left_right_implementation_dispatch closed-open @@ -353,16 +353,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 1); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 1); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 1); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } { // Arr_left_right_implementation_dispatch closed-contracted @@ -376,16 +376,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 1); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 1); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 1); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } { // Arr_left_right_implementation_dispatch closed-closed @@ -399,16 +399,16 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 1); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 1); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 0); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 0); + + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 1); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); } @@ -425,18 +425,17 @@ int main () typedef LR::Parameter_space_in_x_2_point_tag Psx_2_point; assert(dispatch(Psx_2_point()) == 0); - typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; - assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); - - typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; - assert(dispatch(Cmp_y_ob_2_points()) == 1); - typedef LR::Is_on_y_identification_2_curve_tag Ioyi_2_curve; assert(dispatch(Ioyi_2_curve()) == 1); typedef LR::Is_on_y_identification_2_point_tag Ioyi_2_point; assert(dispatch(Ioyi_2_point()) == 1); - } + typedef LR::Compare_y_on_boundary_2_points_tag Cmp_y_ob_2_points; + assert(dispatch(Cmp_y_ob_2_points()) == 1); + + typedef LR::Compare_y_near_boundary_2_curve_ends_tag Cmp_y_nb_2_curve_ends; + assert(dispatch(Cmp_y_nb_2_curve_ends()) == 1); + } //////////////// // bottom-top // @@ -458,19 +457,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 0); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 0); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 0); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 0); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 0); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 0); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 0); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 0); } { // Arr_bottom_top_implementation_dispatch oblivious-open @@ -484,19 +490,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 0); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 0); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 0); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 0); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 0); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 0); } { // Arr_bottom_top_implementation_dispatch oblivious-contracted @@ -510,19 +523,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 1); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 0); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 0); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 1); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 1); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } { // Arr_bottom_top_implementation_dispatch oblivious-closed @@ -536,19 +556,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 1); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 1); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 1); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 0); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 0); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } // open-oblivious @@ -559,7 +586,7 @@ int main () // Arr_bottom_top_implementation_dispatch open-oblivious typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_open_side_tag, CGAL::Arr_oblivious_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -567,19 +594,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 0); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 0); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 0); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 0); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 0); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 0); } { // Arr_bottom_top_implementation_dispatch open-open @@ -593,25 +627,32 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 0); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 0); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 0); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 0); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 0); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 0); } { // Arr_bottom_top_implementation_dispatch open-contracted typedef CGAL::internal::Arr_bottom_top_implementation_dispatch< CGAL::Arr_open_side_tag, CGAL::Arr_contracted_side_tag > BT; - + typedef BT::Parameter_space_in_y_2_curve_end_tag Psy_2_curve_end; assert(dispatch(Psy_2_curve_end()) == 1); typedef BT::Parameter_space_in_y_2_curve_tag Psy_2_curve; @@ -619,19 +660,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 1); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 0); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 0); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 1); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 1); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } { // Arr_bottom_top_implementation_dispatch open-closed @@ -645,19 +693,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 1); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 1); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 1); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 0); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 0); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } // contracted-oblivious @@ -676,19 +731,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 1); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 0); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 0); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 1); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 1); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } { // Arr_bottom_top_implementation_dispatch contracted-open @@ -702,19 +764,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 1); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 0); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 0); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 1); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 1); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } { // Arr_bottom_top_implementation_dispatch contracted-contracted @@ -728,19 +797,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 1); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 0); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 0); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 1); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 1); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } { // Arr_bottom_top_implementation_dispatch contracted-closed @@ -754,19 +830,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 1); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 1); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 1); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 1); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 1); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } // closed-oblivious @@ -785,19 +868,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 1); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 1); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 1); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 0); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 0); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } { // Arr_bottom_top_implementation_dispatch closed-open @@ -811,19 +901,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 1); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 1); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 1); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 1); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 1); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 1); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 0); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 0); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } { // Arr_bottom_top_implementation_dispatch closed-contracted @@ -837,19 +934,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 1); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 1); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 1); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 1); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 1); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } { // Arr_bottom_top_implementation_dispatch closed-closed @@ -863,19 +967,26 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 1); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 1); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 0); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 0); + + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 1); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 0); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 0); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); } // identified-identified @@ -891,21 +1002,27 @@ int main () typedef BT::Parameter_space_in_y_2_point_tag Psy_2_point; assert(dispatch(Psy_2_point()) == 0); - typedef BT::Compare_x_near_boundary_2_point_curve_end_tag - Cmp_x_nb_2_point_curve_end; - assert(dispatch(Cmp_x_nb_2_point_curve_end()) == 1); - typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; - assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); - - typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; - assert(dispatch(Cmp_x_ob_2_points()) == 1); - typedef BT::Is_on_x_identification_2_curve_tag Ioxi_2_curve; assert(dispatch(Ioxi_2_curve()) == 1); typedef BT::Is_on_x_identification_2_point_tag Ioxi_2_point; assert(dispatch(Ioxi_2_point()) == 1); - } + typedef BT::Compare_x_at_limit_2_point_curve_end_tag Cmp_x_al_2_point_curve_end; + assert(dispatch(Cmp_x_al_2_point_curve_end()) == 0); + typedef BT::Compare_x_at_limit_2_curve_ends_tag Cmp_x_al_2_curve_ends; + assert(dispatch(Cmp_x_al_2_curve_ends()) == 0); + typedef BT::Compare_x_near_limit_2_curve_ends_tag Cmp_x_nl_2_curve_ends; + assert(dispatch(Cmp_x_nl_2_curve_ends()) == 0); + + typedef BT::Compare_x_on_boundary_2_points_tag Cmp_x_ob_2_points; + assert(dispatch(Cmp_x_ob_2_points()) == 1); + typedef BT::Compare_x_on_boundary_2_point_curve_end_tag Cmp_x_ob_2_point_curve_end; + assert(dispatch(Cmp_x_ob_2_point_curve_end()) == 0); + typedef BT::Compare_x_on_boundary_2_curve_ends_tag Cmp_x_ob_2_curve_ends; + assert(dispatch(Cmp_x_ob_2_curve_ends()) == 0); + typedef BT::Compare_x_near_boundary_2_curve_ends_tag Cmp_x_nb_2_curve_ends; + assert(dispatch(Cmp_x_nb_2_curve_ends()) == 1); + } return EXIT_SUCCESS; } diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_unbounded_rational_insertion.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_unbounded_rational_insertion.cpp index e6a37a33097..ebef725b9c5 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_unbounded_rational_insertion.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_unbounded_rational_insertion.cpp @@ -32,49 +32,42 @@ int main () } #else -#include -#include -#include +#include +#include +#include #include -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Cartesian Alg_kernel; -typedef CGAL::Arr_rational_arc_traits_2 Traits_2; -typedef Traits_2::Point_2 Point_2; -typedef Traits_2::Curve_2 Rational_arc_2; -typedef Traits_2::Rat_vector Rat_vector; -typedef std::list Rat_arcs_list; -typedef CGAL::Arrangement_2 Arrangement_2; +typedef CORE::BigInt Number_type; +typedef CGAL::Algebraic_kernel_d_1 AK1; +typedef CGAL::Arr_rational_function_traits_2 Traits_2; -int main () +typedef Traits_2::Curve_2 Curve_2; +typedef Traits_2::Polynomial_1 Polynomial_1; +typedef Traits_2::Algebraic_real_1 Alg_real_1; + +typedef CGAL::Arrangement_2 Arrangement_2; + +int main() { - std::list arcs; + // Traits class object + AK1 ak1; + Traits_2 traits(&ak1); + // constructor for rational functions + Traits_2::Construct_curve_2 construct = traits.construct_curve_2_object(); + + // a polynomial representing x .-) + Polynomial_1 x = CGAL::shift(Polynomial_1(1),1); + // Create the rational function y = 1 / ((x - 2)(x - 5)) = 1 / (x^2 - 7x + 10) - // Create the rational function y = 1 / ((2 - x)(x - 5)) = 1 / (-x^2 + 7x - 10) - Rat_vector P1(1); - P1[0] = 1; + Polynomial_1 P1(1); + Polynomial_1 P2(-1); + Polynomial_1 Q = x*x - 7*x + 10; - Rat_vector Q1(3); - Rat_vector Q2(3); - Q1[2] = 1; Q1[1] = -7; Q1[0] = 10; - Q2[2] = -1; Q2[1] = 7; Q2[0] = -10; + Curve_2 c1 = construct(P1, Q, Alg_real_1(2), Alg_real_1(5)); + Curve_2 c2 = construct(P2, Q, Alg_real_1(2), Alg_real_1(5)); - Rational_arc_2 c1(P1, Q1, Algebraic(2), Algebraic(5)); - Rational_arc_2 c2(P1, Q2, Algebraic(2), Algebraic(5)); - - // Construct the arrangement of the six arcs. - Arrangement_2 arr; - insert (arr, c1); - insert (arr, c2); - - if (!arr.is_valid()) { - std::cerr << "The arrangement is not valid!" << std::endl; - return -1; - } - + // Output const char * names[5] = { "number of vertices", "number of vertices at infinity", @@ -83,13 +76,23 @@ int main () "number of unbounded faces" }; - Arrangement_2::Size expected_sizes[] = {0, 4, 2, 3, 3}; + Arrangement_2::Size expected_sizes[] = {0, 2, 1, 2, 2}; + + // Construct the 1st arrangement. + Arrangement_2 arr1(&traits); + insert(arr1, c1); + + if (!arr1.is_valid()) { + std::cerr << "The first arrangement is not valid!" << std::endl; + return -1; + } + Arrangement_2::Size sizes[5]; - sizes[0] = arr.number_of_vertices(); - sizes[1] = arr.number_of_vertices_at_infinity(); - sizes[2] = arr.number_of_edges(); - sizes[3] = arr.number_of_faces(); - sizes[4] = arr.number_of_unbounded_faces(); + sizes[0] = arr1.number_of_vertices(); + sizes[1] = arr1.number_of_vertices_at_infinity(); + sizes[2] = arr1.number_of_edges(); + sizes[3] = arr1.number_of_faces(); + sizes[4] = arr1.number_of_unbounded_faces(); unsigned int i; int result = 0; @@ -103,6 +106,34 @@ int main () } } + // If a failure has already occured, abort. + if (result < 0) return result; + + // Construct the 2nd arrangement. + Arrangement_2 arr2(&traits); + insert(arr2, c2); + + if (!arr1.is_valid()) { + std::cerr << "The first arrangement is not valid!" << std::endl; + return -1; + } + + sizes[0] = arr1.number_of_vertices(); + sizes[1] = arr1.number_of_vertices_at_infinity(); + sizes[2] = arr1.number_of_edges(); + sizes[3] = arr1.number_of_faces(); + sizes[4] = arr1.number_of_unbounded_faces(); + + for (i = 0; i < 5; ++ i) { + if (expected_sizes[i] != sizes[i]) { + std::cerr << names[i] << ": " << sizes[i] << ", expected: " + << expected_sizes[i] << std::endl; + result = -1; + } else { + std::cout << names[i] << ": " << sizes[i] << std::endl; + } + } + return result; } diff --git a/BGL/doc_tex/BGL/PkgDescription.tex b/BGL/doc_tex/BGL/PkgDescription.tex index 199cb7cbc22..0992951b147 100644 --- a/BGL/doc_tex/BGL/PkgDescription.tex +++ b/BGL/doc_tex/BGL/PkgDescription.tex @@ -1,5 +1,5 @@ \begin{ccPkgDescription}{CGAL and the Boost Graph Library\label{Pkg:BGL}} -\ccPkgHowToCiteCgal{cgal:cfw-cbgl-11} +\ccPkgHowToCiteCgal{cgal:cfw-cbgl-11b} \ccPkgSummary{This package provides a framework for interfacing \cgal\ data structures with the algorithms of the {\sc BGL}. It allows to run diff --git a/BGL/doc_tex/BGL_ref/HalfedgeGraph.tex b/BGL/doc_tex/BGL_ref/HalfedgeGraph.tex index d9d09a5e005..25fdbfc5452 100644 --- a/BGL/doc_tex/BGL_ref/HalfedgeGraph.tex +++ b/BGL/doc_tex/BGL_ref/HalfedgeGraph.tex @@ -30,7 +30,7 @@ for the vertices and edges such that the ordered edges do not intersect. \ccRefines -\ccAnchor{http://www.boost.org/libs/graph/doc/IncidenceGraph.html}{IncidenceGraph}\\ +\ccAnchor{http://www.boost.org/libs/graph/doc/BidirectionalGraph.html}{BidirectionalGraph}\\ \ccAnchor{http://www.boost.org/libs/graph/doc/PropertyGraph.html}{PropertyGraph} A model of \ccRefName\ must have the {\em interior properties} diff --git a/BGL/include/CGAL/boost/graph/halfedge_graph_traits_Polyhedron_3.h b/BGL/include/CGAL/boost/graph/halfedge_graph_traits_Polyhedron_3.h index 763e5d8dbb4..3f6f52c8b66 100644 --- a/BGL/include/CGAL/boost/graph/halfedge_graph_traits_Polyhedron_3.h +++ b/BGL/include/CGAL/boost/graph/halfedge_graph_traits_Polyhedron_3.h @@ -96,21 +96,21 @@ opposite_edge( typename boost::graph_traits< Polyhedron_3 const>::ed template typename boost::graph_traits< Polyhedron_3 const>::edge_descriptor -next_edge_ccw( typename boost::graph_traits< Polyhedron_3 const>::edge_descriptor outedge +next_edge_ccw( typename boost::graph_traits< Polyhedron_3 const>::edge_descriptor inedge , Polyhedron_3 const& ) { HalfedgeDS_items_decorator< Polyhedron_3 > D ; - return D.get_prev(outedge)->opposite(); + return D.get_prev(inedge->opposite()); } template typename boost::graph_traits< Polyhedron_3 const>::edge_descriptor -next_edge_cw( typename boost::graph_traits< Polyhedron_3 const>::edge_descriptor outedge +next_edge_cw( typename boost::graph_traits< Polyhedron_3 const>::edge_descriptor inedge , Polyhedron_3 const& ) { - return outedge->opposite()->next(); + return inedge->next()->opposite(); } @@ -168,22 +168,22 @@ opposite_edge( typename boost::graph_traits< Polyhedron_3 >::edge_de template typename boost::graph_traits< Polyhedron_3 >::edge_descriptor -next_edge_ccw( typename boost::graph_traits< Polyhedron_3 >::edge_descriptor outedge +next_edge_ccw( typename boost::graph_traits< Polyhedron_3 >::edge_descriptor inedge , Polyhedron_3& ) { HalfedgeDS_items_decorator< Polyhedron_3 > D ; - return D.get_prev(outedge)->opposite(); + return D.get_prev(inedge->opposite()); } template typename boost::graph_traits< Polyhedron_3 >::edge_descriptor -next_edge_cw( typename boost::graph_traits< Polyhedron_3 >::edge_descriptor outedge +next_edge_cw( typename boost::graph_traits< Polyhedron_3 >::edge_descriptor inedge , Polyhedron_3& ) { - return outedge->opposite()->next(); + return inedge->next()->opposite(); } diff --git a/BGL/test/BGL/halfedge_graph_traits_Polyhedron_3.cpp b/BGL/test/BGL/halfedge_graph_traits_Polyhedron_3.cpp index 20e92b332ab..97910e76b1b 100644 --- a/BGL/test/BGL/halfedge_graph_traits_Polyhedron_3.cpp +++ b/BGL/test/BGL/halfedge_graph_traits_Polyhedron_3.cpp @@ -137,8 +137,8 @@ bool test_aux ( Graph& aG ) CHECK_EQUAL(oe,e->opposite()); CHECK_EQUAL(ne,e->next()); CHECK_EQUAL(pe,e->prev()); - CHECK_EQUAL(ccwe,e->prev()->opposite()); - CHECK_EQUAL(cwe,e->opposite()->next()); + CHECK_EQUAL(ccwe,e->opposite()->prev()); + CHECK_EQUAL(cwe,e->next()->opposite()); vertex_descriptor s = source(e,aG); vertex_descriptor t = target(e,aG); diff --git a/Boolean_set_operations_2/demo/Boolean_set_operations_2/Qt_widget_get_circ_polygon.h b/Boolean_set_operations_2/demo/Boolean_set_operations_2/Qt_widget_get_circ_polygon.h index 12898bf3ab6..cb5de3f2613 100644 --- a/Boolean_set_operations_2/demo/Boolean_set_operations_2/Qt_widget_get_circ_polygon.h +++ b/Boolean_set_operations_2/demo/Boolean_set_operations_2/Qt_widget_get_circ_polygon.h @@ -220,7 +220,7 @@ namespace CGAL if(m_pgn.is_empty()) return; const Arc_point_2& first_point = m_pgn.curves_begin()->source(); - CGAL_assertion(first_point.x().is_rational() && first_point.y().is_rational()); + CGAL_assertion(!first_point.x().is_extended() && !first_point.y().is_extended()); FT xs = first_point.x().alpha(); FT ys = first_point.y().alpha(); m_pgn.push_back(X_monotone_curve_2(m_last_of_poly, Point_2(xs, ys))); @@ -284,7 +284,7 @@ namespace CGAL *widget << Segment_2(m_rubber, m_last_of_poly); const Arc_point_2& last_point = last->source(); - CGAL_assertion(last_point.x().is_rational() && last_point.y().is_rational()); + CGAL_assertion(!last_point.x().is_extended() && !last_point.y().is_extended()); FT xs = last_point.x().alpha(); FT ys = last_point.y().alpha(); @@ -338,7 +338,7 @@ namespace CGAL *widget << Segment_2(m_rubber, m_last_of_poly); const Arc_point_2& last_point = first->source(); - CGAL_assertion(last_point.x().is_rational() && last_point.y().is_rational()); + CGAL_assertion(!last_point.x().is_extended() && !last_point.y().is_extended()); FT xs = last_point.x().alpha(); FT ys = last_point.y().alpha(); @@ -509,7 +509,7 @@ namespace CGAL if(is_last_curve) { const Arc_point_2& first_point = m_pgn.curves_begin()->source(); - CGAL_assertion(first_point.x().is_rational() && first_point.y().is_rational()); + CGAL_assertion(!first_point.x().is_extended() && !first_point.y().is_extended()); FT xs = first_point.x().alpha(); FT ys = first_point.y().alpha(); rubber_curve = X_monotone_curve_2(m_last_of_poly, Point_2(xs, ys)); diff --git a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/boolean_operations_2.cpp b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/boolean_operations_2.cpp index 02add64e9ea..b345af1663f 100644 --- a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/boolean_operations_2.cpp +++ b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/boolean_operations_2.cpp @@ -943,7 +943,7 @@ bool read_bezier ( QString aFileName, Bezier_polygon_set& rSet, Bezier_region_so if ( bezier_polygons.size() > 1 ) { - for ( Bezier_polygon_vector::const_iterator it = CGAL::successor(bezier_polygons.begin()) + for ( Bezier_polygon_vector::const_iterator it = CGAL::cpp0x::next(bezier_polygons.begin()) ; it != bezier_polygons.end() ; ++ it ) diff --git a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/GraphicsViewCircularPolygonInput.h b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/GraphicsViewCircularPolygonInput.h index 1b1f5fa794d..32741314db6 100644 --- a/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/GraphicsViewCircularPolygonInput.h +++ b/Boolean_set_operations_2/demo/Boolean_set_operations_2_GraphicsView/include/CGAL/Qt/GraphicsViewCircularPolygonInput.h @@ -380,8 +380,8 @@ namespace Qt { { Arc_point const& first_point = xcvs.front().source(); Arc_point const& last_point = xcvs.back ().target(); - CGAL_assertion(first_point.x().is_rational() && first_point.y().is_rational()); - CGAL_assertion(last_point. x().is_rational() && last_point .y().is_rational()); + CGAL_assertion(!first_point.x().is_extended() && !first_point.y().is_extended()); + CGAL_assertion(!last_point. x().is_extended() && !last_point .y().is_extended()); FT fxs = first_point.x().alpha(); FT fys = first_point.y().alpha(); FT lxs = last_point .x().alpha(); diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/PkgDescription.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/PkgDescription.tex index 86434f6fb78..3fd6049c201 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/PkgDescription.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/PkgDescription.tex @@ -1,6 +1,6 @@ \begin{ccPkgDescription}{2D Regularized Boolean Set-Operations\label{Pkg:BooleanSetOperations2}} -\ccPkgHowToCiteCgal{cgal:fwzh-rbso2-11} +\ccPkgHowToCiteCgal{cgal:fwzh-rbso2-11b} \ccPkgSummary{ This package consists of the implementation of Boolean set-operations on point sets bounded by weakly x-monotone curves in 2-dimensional diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_def.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_def.tex index 6a369b421d2..55fdc39adbe 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_def.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_def.tex @@ -55,7 +55,7 @@ polygon vertices is referred to as the polygon \textbf{(outer) boundary}. \item A \textbf{Relatively simple} polygon allows vertices with a degree$>$2, but all of its edges are disjoint in their interior. Furthermore, it must be an orientable polygon. Namely when it is inserted into an arrangement and its outer boundary is traversed, the same face is adjacent to all of the halfedges (no crossing over any curve during the traversal). %\textbf{insert relativelySimplePolygon.tex}\\ -Note that while polygon C has the same curves as polygon B, traversal of the curves leads to crossing over a previouly traversed curve, and is therefore neither simple nor relatively simple. +Note that while polygon C has the same curves as polygon B, traversal of the curves leads to crossing over a previously traversed curve, and is therefore neither simple nor relatively simple. %\textbf{insert NotRelativelySimplePolygon.tex}\\ \\ \item A polygon in our context must be relatively simple and its outer boundary vertices must be ordered in a counterclockwise direction around the interior of the polygon. @@ -98,7 +98,7 @@ In our context, a polygon must uphold the following conditions:\\ \begin{enumerate} \item\textit{Closed Boundary} - the polygon's outer boundary must be a connected sequence of curves, that start and end at the same vertex. \item \textit{Simplicity} - the polygon must be simple. -\item \textit{Orientaion} - the polygon's outer boundary must be \textit{counter-clockwise oriented}. +\item \textit{Orientation} - the polygon's outer boundary must be \textit{counter-clockwise oriented}. \end{enumerate} diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_general.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_general.tex index 3462d813172..cd00bd8c977 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_general.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_general.tex @@ -250,10 +250,10 @@ The class-template \ccc{Gps_traits_2} models the concept \ccc{GeneralPolygonSetTraits_2}, and can be used to instantiate the class template \ccc{General_polygon_set_2}. -It serves as an adapter for a geoemtric traits class, which models the +It serves as an adapter for a geometric traits class, which models the concept \ccc{ArrangementDirectionalXMonotoneTraits_2}. It can be used for performing set-operations on general polygons. -The implementation of the adapetr is rather simple, as it is derived +The implementation of the adapter is rather simple, as it is derived from the instantiated template-parameter \ccc{ArrXMonotoneTraits_2} inheriting its necessary types and methods. It further exploits the methods provided by the instantiated parameter diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_intro.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_intro.tex index fc05d91e843..5b084d07246 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_intro.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_intro.tex @@ -61,6 +61,6 @@ in more depth. In Section~\ref{bso_sec:bso_lin} we focus on Boolean set-operations on linear polygons, introducing the notion of polygons with holes and of a general polygon set. Section~\ref{bso_sec:bso_gen} introduces general polygons. -We first discuss polygons whose edges are either line segements or circular +We first discuss polygons whose edges are either line segments or circular arcs and then explain how to construct and use general polygons whose edges can be arbitrary weakly $x$-monotone curves. diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_linear.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_linear.tex index e17d8e2d5c3..d33437a3927 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_linear.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2/bso_linear.tex @@ -5,7 +5,7 @@ The basic library of \cgal\ includes the \ccc{Polygon_2} class-template that represents a linear polygon in the plane. The polygon is represented by its vertices stored in a container of objects of type \ccc{Kernel::Point_2}. The polygon edges are line -segments (\ccc{Kenrel::Segment_2} objects) between adjacent points in +segments (\ccc{Kernel::Segment_2} objects) between adjacent points in the container. By default, the \ccc{Container} is a vector of \ccc{Kernel::Point_2} objects. @@ -37,7 +37,7 @@ computes the union of two polygons is called \ccc{join()}, since the word \ccc{union} is reserved in \CC.} \ccc{difference()}, \ccc{symmetric_difference()} and the predicate \ccc{do_intersect()} that accept two \ccc{Polygon_2} objects as their input. We explain how -these functions should be used throught several examples in the +these functions should be used through several examples in the following sections. % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -151,7 +151,7 @@ upside-down triangle. In general, there are many ways to arrive at a particular point set. However, the set of polygons with holes obtained through the application of any sequence of operations is unique. The set depicted on the right is represented as a single -polygon having a triangular outer boundary with a single triangluar +polygon having a triangular outer boundary with a single triangular hole in its interior --- and not as three triangles that have no holes at all. As a general rule, if two point sets are connected, then they belong to the same polygon with holes. @@ -233,7 +233,7 @@ output polygons to its associated container. \subsubsection{Example --- Joining and Intersecting Simple Polygons\label{bso_sssec:ex_simple_bops}} % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The following example demonstartes the usage of the free functions +The following example demonstrates the usage of the free functions \ccc{join()} and \ccc{intersect()} for computing the union and the intersection of the two simple polygons depicted in Figure~\ref{fig:simple}~(b). The example uses the auxiliary function @@ -245,7 +245,7 @@ the header file \ccc{print_utils.h} under the examples folder. % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \subsubsection{Operations on Polygons with Holes\label{bso_sssec:pwh_bops}} % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -We have demonstrated that free functions that perform boolean set operations on simple polygons may output polygons with holes. In addition to these functions, the Boolean set-operations package provides the following overriden free functions that accept +We have demonstrated that free functions that perform boolean set operations on simple polygons may output polygons with holes. In addition to these functions, the Boolean set-operations package provides the following overridden free functions that accept \ccc{General_polygon_with_holes_2} objects as their input - %Having introduced polygons with holes and explained how the free functions %output such objects, it is only natural to perform operations on sets that @@ -284,7 +284,7 @@ contains of five holes: \ccIncludeExampleCode{Boolean_set_operations_2/symmetric_difference.cpp} -In some cases it is convinient to connect the outer boundary of a +In some cases it is convenient to connect the outer boundary of a polygon with holes with the holes inside it. The function \ccc{connect_holes()} accepts a polygon with holes, and connects the topmost vertex in each hole with the polygon @@ -331,7 +331,7 @@ into the set using the \ccc{insert()} method, as long as the inserted polygons and the existing polygons in the set are disjoint. The \ccc{Polygon_set_2} class also provides access functions for accessing the polygons with holes it contains, and a few queries. The -most improtant query is \ccc{S.oriented_side(q)}, which determined +most important query is \ccc{S.oriented_side(q)}, which determined whether the query point $q$ is contained in the interior of the set $S$, lies on the boundary of the set, or neither. @@ -347,8 +347,8 @@ functions. Member functions of the \ccc{General_polygon_set_2} that perform Boolean set-operations come in two flavors: for example, \ccc{S.join(P, Q)} -computes the union of $P$ and $Q$ and assigned the reuslt to $S$, while -\ccc{S.join(P)} preformes the operation $S \longleftarrow S \cup P$. +computes the union of $P$ and $Q$ and assigned the result to $S$, while +\ccc{S.join(P)} performs the operation $S \longleftarrow S \cup P$. Similarly, \ccc{S.complement(P)} sets $S$ to be the complement of $P$, while $S.complement()$ simply negates the set $S$. @@ -358,7 +358,7 @@ while $S.complement()$ simply negates the set $S$. The free functions reviewed in Section~\ref{bso_ssec:polygons_with_holes} serve as a wrapper for the polygon-set class, and are only provided for -convinience. A typical such function constructs a pair of +convenience. A typical such function constructs a pair of \ccc{General_polygon_set_2} objects, invokes the appropriate method to apply the desired Boolean operation, and transforms the resulting polygon set to the required output format. Thus, when several 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 diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Boolean_set_operations_2.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Boolean_set_operations_2.tex index 07124850d78..dcd4a312407 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Boolean_set_operations_2.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Boolean_set_operations_2.tex @@ -6,7 +6,7 @@ %============ An instance of the \ccClassTemplateName\ class-template represents a point set in the plane. An \ccc{Arrangement_2} data structure is used -internaly to represent the point set. The class template provides +internally to represent the point set. The class template provides methods to apply Boolean-set operations on pairs of instances of \ccc{Boolean_set_operations_2} and a few other utility methods. At this point only regularized Boolean-set operations are implemented. @@ -122,8 +122,8 @@ with holes type.} \ccMethod{void difference(const Boolean_set_operations_2& bops);} {computes the difference between this and \ccc{bops}.} -\ccMethod{void symetric_difference(const Boolean_set_operations_2& bops);} - {computes the symetric difference between this and \ccc{bops}.} +\ccMethod{void symmetric_difference(const Boolean_set_operations_2& bops);} + {computes the symmetric difference between this and \ccc{bops}.} \ccPredicates % =========== diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_difference.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_difference.tex index dfa4d9f9766..021e158b31f 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_difference.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_difference.tex @@ -112,7 +112,7 @@ OutputIterator difference(const General_polygon_with_holes_2 & p1, % polygons (or general polygons with holes) given in the first range, and % another set given in the second range. (The value type of the input iterator % is used to distinguish between the two types.) The result, represented -% by a set of general poygon with holes, is inserted into an output container +% by a set of general polygon with holes, is inserted into an output container % through a given output iterator \ccc{oi}. The output iterator is % returned. The value type of the \ccc{OutputIterator} is % \ccc{General_polygon_with_holes_2}.} diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_intersection.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_intersection.tex index 41cb8d8d516..2f10fa88932 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_intersection.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_intersection.tex @@ -111,7 +111,7 @@ OutputIterator intersection(InputIterator begin, InputIterator end, {Computes the intersection of the general polygons (or general polygons with holes) in the given range. (The value type of the input iterator is used to distinguish between the two.) The result, represented by a set -of general poygon with holes, is inserted into an output container +of general polygon with holes, is inserted into an output container through a given output iterator \ccc{oi}. The output iterator is returned. The value type of the \ccc{OutputIterator} is \ccc{Traits::Polygon_with_holes_2}.} @@ -125,7 +125,7 @@ OutputIterator intersection(InputIterator1 pgn_begin1, OutputIterator oi);} {Computes the intersection of the general polygons and general polygons with holes in the given two ranges. The result, represented by a set -of general poygon with holes, is inserted into an output container +of general polygon with holes, is inserted into an output container through a given output iterator \ccc{oi}. The output iterator is returned. The value type of the \ccc{OutputIterator} is \ccc{Traits::Polygon_with_holes_2}.} diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_join.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_join.tex index a7401e57c61..057cef5daad 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_join.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_join.tex @@ -109,7 +109,7 @@ OutputIterator join(InputIterator begin, InputIterator end, {Computes the union of the general polygons (or general polygons with holes) in the given range. (The value type of the input iterator is used to distinguish between the two.) The result, represented by a set -of general poygon with holes, is inserted into an output container +of general polygon with holes, is inserted into an output container through a given output iterator \ccc{oi}. The output iterator is returned. The value type of the \ccc{OutputIterator} is \ccc{Traits::Polygon_with_holes_2}.} @@ -121,7 +121,7 @@ OutputIterator join(InputIterator1 pgn_begin1, InputIterator1 pgn_end1, OutputIterator oi);} {Computes the union of the general polygons and general polygons with holes in the given two ranges. The result, represented by a set -of general poygon with holes, is inserted into an output container +of general polygon with holes, is inserted into an output container through a given output iterator \ccc{oi}. The output iterator is returned. The value type of the \ccc{OutputIterator} is \ccc{Traits::Polygon_with_holes_2}.} diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_symmetric_difference.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_symmetric_difference.tex index a218fd0bdc9..334452d353f 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_symmetric_difference.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Bso_symmetric_difference.tex @@ -119,7 +119,7 @@ polygons with holes) in the given range. A point is contained in the symmetric difference, if and only if it is contained in odd number of input polygons. (The value type of the input iterator is used to distinguish between the two.) The result, represented by a set -of general poygon with holes, is inserted into an output container +of general polygon with holes, is inserted into an output container through a given output iterator \ccc{oi}. The output iterator is returned. The value type of the \ccc{OutputIterator} is \ccc{Traits::Polygon_with_holes_2}.} @@ -134,7 +134,7 @@ OutputIterator symmetric_difference(InputIterator1 pgn_begin1, {Computes the union of the general polygons and general polygons with holes in the given two ranges. A point is contained in the symmetric difference, if and only if it is contained in odd number of -input polygons. The result, represented by a set of general poygon with +input polygons. The result, represented by a set of general polygon with holes, is inserted into an output container through a given output iterator \ccc{oi}. The output iterator is returned. The value type of the \ccc{OutputIterator} is \ccc{Traits::Polygon_with_holes_2}.} diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygonSetDcel.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygonSetDcel.tex index 76b0cdcfd38..c79d1a46dc0 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygonSetDcel.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygonSetDcel.tex @@ -57,7 +57,7 @@ defined. \ccCreationVariable{dcel} % ======================= \ccConstructor{Arr_dcel();} - {constructs an empty \dcel\ with one unbouned face.} + {constructs an empty \dcel\ with one unbounded face.} \ccMethod{Face* assign (const Self& other, const Face *uf);}{% assigns the contents of the \ccc{other} \dcel\, whose unbounded face diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygonSetTraits_2.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygonSetTraits_2.tex index bbb405b8a37..b06d5c9d7b0 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygonSetTraits_2.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/GeneralPolygonSetTraits_2.tex @@ -86,7 +86,7 @@ $x$-monotone curves. It uses the operator\\ \ccMethod{Construct_holes construct_holes_object() const;} {returns a functor that obtains begin/end iterators over a container of holes.} -\ccMethod{Is_unbounded construct_is_unbounded_object();} {returns a functor that detemines if the polygon with holes is unbounded} +\ccMethod{Is_unbounded construct_is_unbounded_object();} {returns a functor that determines if the polygon with holes is unbounded} \ccHasModels diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/General_polygon_2.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/General_polygon_2.tex index 8e00a60fe4f..da67a1b5b31 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/General_polygon_2.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/General_polygon_2.tex @@ -10,14 +10,14 @@ The class \ccRefName\ models the concept \ccc{GeneralPolygon_2}. It represents a simple general-polygon. It is parameterized with the type \ccc{ArrTraits} that models the concept -\ccc{ArrangementDirectionalXMonotoneTraits}. The latter is a refinment +\ccc{ArrangementDirectionalXMonotoneTraits}. The latter is a refinement of the concept \ccc{ArrangementXMonotoneTraits_2}. In addition to the requirements of the concept \ccc{ArrangementXMonotoneTraits_2}, a model of the concept \ccc{ArrangementDirectionalXMonotoneTraits} must support the following functions: \begin{itemize} \item Given an $x$-monotone curve, construct its opposite curve. -\item Given an $x$-monotone curve, compare its two endpoints lexigroaphically. +\item Given an $x$-monotone curve, compare its two endpoints lexicographically. \end{itemize} This class supports a few convenient operations in addition to the diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/General_polygon_set_2.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/General_polygon_set_2.tex index f32fc6b2a2d..27a46170d73 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/General_polygon_set_2.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/General_polygon_set_2.tex @@ -188,7 +188,7 @@ void insert(InputIterator1 pgn_begin, InputIterator1 pgn_end, \ccMethod{void complement(const Polygon_set_2 & other);} {computes the complement of \ccc{other}. - \ccVar\ is overriden by the result.} + \ccVar\ is overridden by the result.} % \ccMethod{void complement(const Polygon_2 & pgn);} % {computes the complement of \ccc{pgn}.} @@ -346,7 +346,7 @@ void do_intersect(InputIterator1 pgn_begin, InputIterator1 pgn_end, \ccMethod{bool locate(const Point_2 & p, Polygon_with_holes_2 & pgn);} {obtains a polygon with holes that contains the query point \ccc{p}, if exists, through \ccc{pgn}, and returns \ccc{true}. - Otherwise, returns \ccc{flase}.} + Otherwise, returns \ccc{false}.} \ccMethod{Oriented_side oriented_side(const Point_2 & q);} {returns either the constant \ccc{ON_ORIENTED_BOUNDARY}, diff --git a/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp b/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp index f1d859964a5..92107e6a470 100644 --- a/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp +++ b/Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp @@ -166,7 +166,7 @@ bool read_bezier ( char const* aFileName, Bezier_polygon_set& rSet ) if ( polygons.size() > 1 ) { Bezier_polygon_vector::const_iterator it; - for ( it = CGAL::successor(polygons.begin()); it != polygons.end(); + for ( it = CGAL::cpp0x::next(polygons.begin()); it != polygons.end(); ++ it ) pwh.add_hole(*it); } diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h index d322c86da5a..2bfdf2ced14 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_meta_traits.h @@ -142,34 +142,37 @@ class Gps_agg_meta_traits : typedef typename Traits::Has_merge_category Has_merge_category; typedef typename Traits::Has_do_intersect_category Has_do_intersect_category; - typedef typename Arrangement::Arr_left_side_category Arr_left_side_category; - typedef typename Arrangement::Arr_bottom_side_category Arr_bottom_side_category; - typedef typename Arrangement::Arr_top_side_category Arr_top_side_category; - typedef typename Arrangement::Arr_right_side_category Arr_right_side_category; + typedef typename Arrangement::Left_side_category Left_side_category; + typedef typename Arrangement::Bottom_side_category Bottom_side_category; + typedef typename Arrangement::Top_side_category Top_side_category; + typedef typename Arrangement::Right_side_category Right_side_category; + + typedef typename Traits::Multiplicity Multiplicity; + // a side is either oblivious or open (unbounded) BOOST_MPL_ASSERT( (boost::mpl::or_< - boost::is_same< Arr_left_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_left_side_category, Arr_open_side_tag > > + boost::is_same< Left_side_category, Arr_oblivious_side_tag >, + boost::is_same< Left_side_category, Arr_open_side_tag > > ) ); BOOST_MPL_ASSERT( (boost::mpl::or_< - boost::is_same< Arr_bottom_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_bottom_side_category, Arr_open_side_tag > > + boost::is_same< Bottom_side_category, Arr_oblivious_side_tag >, + boost::is_same< Bottom_side_category, Arr_open_side_tag > > ) ); BOOST_MPL_ASSERT( (boost::mpl::or_< - boost::is_same< Arr_top_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_top_side_category, Arr_open_side_tag > > + boost::is_same< Top_side_category, Arr_oblivious_side_tag >, + boost::is_same< Top_side_category, Arr_open_side_tag > > ) ); BOOST_MPL_ASSERT( (boost::mpl::or_< - boost::is_same< Arr_right_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_right_side_category, Arr_open_side_tag > > + boost::is_same< Right_side_category, Arr_oblivious_side_tag >, + boost::is_same< Right_side_category, Arr_open_side_tag > > ) ); @@ -217,7 +220,7 @@ class Gps_agg_meta_traits : // are already at the same arrangement. } - const std::pair *base_pt; + const std::pair *base_pt; const Base_X_monotone_curve_2 *overlap_cv; OutputIterator oi_end; if(m_base_cmp_xy(m_base_ctr_min_v(cv1.base()), @@ -230,7 +233,7 @@ class Gps_agg_meta_traits : // the extenede X_monotone_curve_2 for(; oi != oi_end; ++oi) { - base_pt = object_cast >(&(*oi)); + base_pt = object_cast >(&(*oi)); if (base_pt != NULL) { diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h index 83b090365e6..439b3bfc66a 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op.h @@ -122,9 +122,6 @@ public: { std::list curves_list; - typename Meta_traits::Compare_endpoints_xy_2 cmp_endpoints = - m_traits->compare_endpoints_xy_2_object(); - unsigned int n_inf_pgn = 0; // number of infinte polygons (arrangement // with a contained unbounded face unsigned int n_pgn = 0; // number of polygons (arrangements) diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h index 57b6da6f380..cc9c8fadf89 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_agg_op_visitor.h @@ -38,10 +38,10 @@ class Gps_agg_op_base_visitor : // TODO derive (helper) from topology traits class typename boost::mpl::if_< boost::is_same< typename Arr_are_all_sides_oblivious_tag< - typename Traits::Arr_left_side_category, - typename Traits::Arr_bottom_side_category, - typename Traits::Arr_top_side_category, - typename Traits::Arr_right_side_category + typename Traits::Left_side_category, + typename Traits::Bottom_side_category, + typename Traits::Top_side_category, + typename Traits::Right_side_category >::result, Arr_all_sides_oblivious_tag >, Arr_bounded_planar_construction_helper::result, Arr_all_sides_oblivious_tag >, Arr_bounded_planar_construction_helpercompare_endpoints_xy_2_object(); - Construct_opposite_2 ctr_opp = m_traits->construct_opposite_2_object(); for (Edge_const_iterator eci = arr.edges_begin(); eci != arr.edges_end(); diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h index 24b2be01448..f4f91a1c443 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_simplifier_traits.h @@ -138,6 +138,7 @@ public: typedef typename Base::X_monotone_curve_2 X_monotone_curve_2; typedef typename Base::Point_2 Point_2; + typedef typename Base::Multiplicity Multiplicity; typedef typename Base::Curve_data Curve_data; typedef typename Base::Point_data Point_data; @@ -212,7 +213,7 @@ public: // return (oi); // } //} - const std::pair *base_pt; + const std::pair *base_pt; const Base_X_monotone_curve_2 *overlap_cv; OutputIterator oi_end; if(m_base_cmp_xy(m_ctr_min_v(cv1.base()), @@ -225,7 +226,7 @@ public: // the extenede X_monotone_curve_2 for(; oi != oi_end; ++oi) { - base_pt = object_cast >(&(*oi)); + base_pt = object_cast >(&(*oi)); if (base_pt != NULL) { diff --git a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h index d3712f6cb8c..75b1756cd77 100644 --- a/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h +++ b/Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_traits_decorator.h @@ -31,6 +31,7 @@ public: typedef Traits_ Base; typedef typename Base::X_monotone_curve_2 Base_X_monotone_curve_2; typedef typename Base::Point_2 Base_Point_2; + typedef typename Base::Multiplicity Multiplicity; typedef Gps_traits_decorator Self; @@ -53,34 +54,34 @@ public: typedef typename Base::Has_merge_category Has_merge_category; typedef typename Base::Has_do_intersect_category Has_do_intersect_category; - typedef typename Base::Arr_left_side_category Arr_left_side_category; - typedef typename Base::Arr_bottom_side_category Arr_bottom_side_category; - typedef typename Base::Arr_top_side_category Arr_top_side_category; - typedef typename Base::Arr_right_side_category Arr_right_side_category; + typedef typename Base::Left_side_category Left_side_category; + typedef typename Base::Bottom_side_category Bottom_side_category; + typedef typename Base::Top_side_category Top_side_category; + typedef typename Base::Right_side_category Right_side_category; // a side is either oblivious or open (unbounded) BOOST_MPL_ASSERT( (boost::mpl::or_< - boost::is_same< Arr_left_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_left_side_category, Arr_open_side_tag > > + boost::is_same< Left_side_category, Arr_oblivious_side_tag >, + boost::is_same< Left_side_category, Arr_open_side_tag > > ) ); BOOST_MPL_ASSERT( (boost::mpl::or_< - boost::is_same< Arr_bottom_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_bottom_side_category, Arr_open_side_tag > > + boost::is_same< Bottom_side_category, Arr_oblivious_side_tag >, + boost::is_same< Bottom_side_category, Arr_open_side_tag > > ) ); BOOST_MPL_ASSERT( (boost::mpl::or_< - boost::is_same< Arr_top_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_top_side_category, Arr_open_side_tag > > + boost::is_same< Top_side_category, Arr_oblivious_side_tag >, + boost::is_same< Top_side_category, Arr_open_side_tag > > ) ); BOOST_MPL_ASSERT( (boost::mpl::or_< - boost::is_same< Arr_right_side_category, Arr_oblivious_side_tag >, - boost::is_same< Arr_right_side_category, Arr_open_side_tag > > + boost::is_same< Right_side_category, Arr_oblivious_side_tag >, + boost::is_same< Right_side_category, Arr_open_side_tag > > ) ); @@ -461,7 +462,7 @@ public: const X_monotone_curve_2& cv2, OutputIterator oi) const { - const std::pair *base_pt; + const std::pair *base_pt; const Base_X_monotone_curve_2 *overlap_cv; OutputIterator oi_end; @@ -475,7 +476,7 @@ public: // the extenede X_monotone_curve_2 for(; oi != oi_end; ++oi) { - base_pt = object_cast >(&(*oi)); + base_pt = object_cast >(&(*oi)); if (base_pt != NULL) { diff --git a/Box_intersection_d/doc_tex/Box_intersection_d/PkgDescription.tex b/Box_intersection_d/doc_tex/Box_intersection_d/PkgDescription.tex index f755b4b1228..c60287dfbc9 100644 --- a/Box_intersection_d/doc_tex/Box_intersection_d/PkgDescription.tex +++ b/Box_intersection_d/doc_tex/Box_intersection_d/PkgDescription.tex @@ -1,6 +1,6 @@ \begin{ccPkgDescription}{Intersecting Sequences of dD Iso-oriented Boxes\label{Pkg:BoxIntersectionD}} -\ccPkgHowToCiteCgal{cgal:kmz-isiobd-11} +\ccPkgHowToCiteCgal{cgal:kmz-isiobd-11b} \ccPkgSummary{ An efficient algorithm for finding all intersecting pairs for large numbers of iso-oriented boxes, in order to apply a user defined callback 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/CGAL_ipelets/doc_tex/CGAL_ipelets/PkgDescription.tex b/CGAL_ipelets/doc_tex/CGAL_ipelets/PkgDescription.tex index becc1d0edf3..afcedb611ff 100644 --- a/CGAL_ipelets/doc_tex/CGAL_ipelets/PkgDescription.tex +++ b/CGAL_ipelets/doc_tex/CGAL_ipelets/PkgDescription.tex @@ -1,6 +1,6 @@ \begin{ccPkgDescription}{CGAL Ipelets \label{Pkg:CGALIpelets}} -\ccPkgHowToCiteCgal{cgal:lp-gi-11} +\ccPkgHowToCiteCgal{cgal:lp-gi-11b} \ccPkgSummary{This package provides a generic framework to easily write ipelets (plug-in's) using \cgal{} for the the Ipe extensible drawing editor.} diff --git a/CGALimageIO/demo/CGALimageIO/CMakeLists.txt b/CGALimageIO/demo/CGALimageIO/CMakeLists.txt index bae0cdad183..0dbff9bf359 100644 --- a/CGALimageIO/demo/CGALimageIO/CMakeLists.txt +++ b/CGALimageIO/demo/CGALimageIO/CMakeLists.txt @@ -30,13 +30,17 @@ endforeach() find_package(CGAL REQUIRED ImageIO) include( ${CGAL_USE_FILE} ) find_package(VTK QUIET) +find_package(Qt3-patched QUIET) -if(VTK_FOUND) +if(QT3_FOUND AND VTK_FOUND) add_definitions(-DCGAL_USE_VTK) include(${VTK_USE_FILE}) + add_definitions(${QT3_DEFINITIONS}) + if(VTK_USE_QVTK) include_directories( ${VTK_QT_INCLUDE_DIR} ) + include_directories( ${QT3_INCLUDE_DIR} ) add_executable( image_to_vtk_viewer image_to_vtk_viewer.cpp ) add_to_cached_list( CGAL_EXECUTABLE_TARGETS image_to_vtk_viewer ) @@ -48,12 +52,16 @@ if(VTK_FOUND) vtkCommon ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_QT_QT_LIBRARY} + ${QT3_LIBRARIES} ) else(VTK_USE_QVTK) message(STATUS "NOTICE: This demo needs QVTK, and will not be compiled.") endif(VTK_USE_QVTK) -else(VTK_FOUND) - - message(STATUS "NOTICE: This demo needs VTK, and will not be compiled.") - -endif(VTK_FOUND) +else() + if(NOT VTK_FOUND) + message(STATUS "NOTICE: This demo needs VTK, and will not be compiled.") + endif() + if(NOT QT3_FOUND) + message(STATUS "NOTICE: This demo needs Qt3, and will not be compiled.") + endif() +endif() diff --git a/CGALimageIO/include/CGAL/ImageIO.h b/CGALimageIO/include/CGAL/ImageIO.h index a6a1538650b..78e08fbca59 100644 --- a/CGALimageIO/include/CGAL/ImageIO.h +++ b/CGALimageIO/include/CGAL/ImageIO.h @@ -21,7 +21,7 @@ #ifndef IMAGEIO_H #define IMAGEIO_H -#include +#include #include diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b768c31f2b..94e613318cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,9 +22,25 @@ if ( ${CGAL_SCM_NAME} STREQUAL "svn" ) find_program(SVN_EXECUTABLE svn DOC "subversion command line client") - # TODO detect name - set ( CGAL_SCM_BRANCH_NAME "n/a" ) + function(Subversion_GET_URL dir variable) + # use svnversion + execute_process(COMMAND "${SVN_EXECUTABLE}" info --xml "${dir}" + OUTPUT_VARIABLE ${variable} + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX REPLACE ".*([^<]+).*" "\\1" ${variable} "${${variable}}") + if(NOT variable) + message("Warning: can not get the Subversion URL of directory ${dir}") + endif() + set(${variable} ${${variable}} PARENT_SCOPE) + endfunction(Subversion_GET_URL) + Subversion_GET_URL("${CGAL_INSTALLATION_PACKAGE_DIR}" CGAL_INSTALLATION_SVN_URL) + # Remove the "/Installation" suffix. + string(REGEX REPLACE "(.*)/Installation" "\\1" CGAL_TMP_SVN_BRANCH_NAME "${CGAL_INSTALLATION_SVN_URL}") + # Remove the prefix of the URL "https://scm.gforge.inria.fr/". + string(REGEX REPLACE "[a-z+]+://[a-z0-9.]+" "" CGAL_TMP_SVN_BRANCH_NAME "${CGAL_TMP_SVN_BRANCH_NAME}") + + set ( CGAL_SCM_BRANCH_NAME "${CGAL_TMP_SVN_BRANCH_NAME}" ) endif() if ( ${CGAL_SCM_NAME} STREQUAL "git" ) diff --git a/Cartesian_kernel/include/CGAL/Cartesian.h b/Cartesian_kernel/include/CGAL/Cartesian.h index 41af5cf7b48..2f777fff961 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian.h +++ b/Cartesian_kernel/include/CGAL/Cartesian.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000,2001,2002,2003 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000,2001,2002,2003 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_2.h index 203665fe95f..5555e001353 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_3.h index 88c0a7c6d73..378fa0681a4 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_2.h index ed191ef776b..6ba5dccbe20 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_3.h index 8f4df059fbe..57e7cfd8381 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Aff_transformation_rep_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Cartesian_base.h b/Cartesian_kernel/include/CGAL/Cartesian/Cartesian_base.h index 93a6646f9e0..07e683619e1 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Cartesian_base.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Cartesian_base.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000-2004 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000-2004 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h index a935cd03497..8ef2e4a6119 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 1997-2004 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 1997-2004 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h index b5890a3adfa..6eefb666ae7 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Data_accessor_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Data_accessor_2.h index 75458992dbc..2690483b67b 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Data_accessor_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Data_accessor_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Direction_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Direction_2.h index 420743d4dd5..1230fefce8f 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Direction_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Direction_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Direction_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Direction_3.h index a1a0230d7db..464a4863cde 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Direction_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Direction_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h index cb76f9b1045..fa0e209daa3 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Iso_cuboid_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Iso_rectangle_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Iso_rectangle_2.h index b4b2f3fe8f3..11257265122 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Iso_rectangle_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Iso_rectangle_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Line_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Line_2.h index 92ccf5f8910..349cad04df4 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Line_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Line_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Line_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Line_3.h index b54406ea9b8..15273826ee9 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Line_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Line_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Plane_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Plane_3.h index abbe413a25c..ec4ebfff3fd 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Plane_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Plane_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Point_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Point_2.h index 9bd8e0abfd2..dd5e75a165e 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Point_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Point_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h index 197e0c6c196..aa415e8346e 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Point_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Ray_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Ray_2.h index 65614ba1e2e..e49d295111f 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Ray_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Ray_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Ray_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Ray_3.h index 31c9918557c..bb52e5a8202 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Ray_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Ray_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Rotation_rep_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Rotation_rep_2.h index 293fe8be0ac..6b53c342051 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Rotation_rep_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Rotation_rep_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_2.h index 042d6aac726..f3fd4aedf1e 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_3.h index 5bb1b123779..2455b6c465c 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Scaling_rep_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Segment_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Segment_2.h index 264965ecd3f..427e8086ad1 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Segment_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Segment_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h index 9ab9eb54cfa..d4bd4cfe43c 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Segment_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h index 72a9a531a9b..4751027cd45 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Sphere_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Tetrahedron_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Tetrahedron_3.h index 0845ff7d7a7..1488f458c1a 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Tetrahedron_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Tetrahedron_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 @@ -161,7 +162,7 @@ TetrahedronC3:: bounded_side(const typename TetrahedronC3::Point_3 &p) const { return R().bounded_side_3_object() - (static_cast(*this), p); + (static_cast(*this), p); } template < class R > diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_2.h index 02223b0baaf..8bc7aa12ef5 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_3.h index 8da458e3985..8b9e3c31008 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Translation_rep_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Triangle_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Triangle_2.h index 41122319499..6713b6bd6b6 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Triangle_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Triangle_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Triangle_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Triangle_3.h index 111b2c48534..7b26ac9a348 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Triangle_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Triangle_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 @@ -130,7 +131,7 @@ TriangleC3:: has_on(const typename TriangleC3::Point_3 &p) const { return R().has_on_3_object() - (static_cast(*this), p); + (static_cast(*this), p); } template < class R > diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h b/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h index e38614eb047..ba9af055ff8 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Vector_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h index f5b22dfce83..f460b8cfc3a 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Vector_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/basic_constructions_2.h b/Cartesian_kernel/include/CGAL/Cartesian/basic_constructions_2.h index c4a7f97d017..658becfa25e 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/basic_constructions_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/basic_constructions_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/basic_constructions_3.h b/Cartesian_kernel/include/CGAL/Cartesian/basic_constructions_3.h index 7a6ece0f3d3..ea7398e933b 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/basic_constructions_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/basic_constructions_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/ft_constructions_2.h b/Cartesian_kernel/include/CGAL/Cartesian/ft_constructions_2.h index fbd4a67a219..80e8c0c7ff6 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/ft_constructions_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/ft_constructions_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/ft_constructions_3.h b/Cartesian_kernel/include/CGAL/Cartesian/ft_constructions_3.h index f4f33df3450..e171ebb4e0e 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/ft_constructions_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/ft_constructions_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index e59b8c0db1e..18180330912 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -1,8 +1,9 @@ -// Copyright (c) 1999-2005 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 1999-2005 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/line_constructions_2.h b/Cartesian_kernel/include/CGAL/Cartesian/line_constructions_2.h index 798abb435ff..9d3d2aab450 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/line_constructions_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/line_constructions_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/plane_constructions_3.h b/Cartesian_kernel/include/CGAL/Cartesian/plane_constructions_3.h index 1b7892e32ef..3ba2034b564 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/plane_constructions_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/plane_constructions_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/point_constructions_2.h b/Cartesian_kernel/include/CGAL/Cartesian/point_constructions_2.h index ef84def3793..7ce9eb8f33c 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/point_constructions_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/point_constructions_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/point_constructions_3.h b/Cartesian_kernel/include/CGAL/Cartesian/point_constructions_3.h index c880a8a6ee8..22f748297ad 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/point_constructions_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/point_constructions_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_directions_2.h b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_directions_2.h index 739cf89d199..8d547927f3f 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_directions_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_directions_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_planes_3.h b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_planes_3.h index 05af1ba6a2f..938f0f829a2 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_planes_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_planes_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_2.h b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_2.h index e662d1039d3..b3f7cd18d55 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_2.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_3.h b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_3.h index 0de9df816a2..91f855dc705 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/predicates_on_points_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian/solve_3.h b/Cartesian_kernel/include/CGAL/Cartesian/solve_3.h index 36fa642945e..e4df4c681b5 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/solve_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/solve_3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/Cartesian_converter.h b/Cartesian_kernel/include/CGAL/Cartesian_converter.h index 8275270d454..a077cd5de5c 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian_converter.h +++ b/Cartesian_kernel/include/CGAL/Cartesian_converter.h @@ -1,8 +1,9 @@ -// Copyright (c) 2001-2004 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2001-2004 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 @@ -103,14 +104,20 @@ public: #include - if (const std::vector * ptr = object_cast >(&obj)) { - std::vector res; - res.reserve((*ptr).size()); - for(unsigned int i=0; i < (*ptr).size(); i++){ - res.push_back(operator()((*ptr)[i])); - } - return make_object(res); +#define CGAL_Kernel_obj(X) \ + if (const std::vector * ptr = object_cast >(&obj)) { \ + std::vector res; \ + res.reserve((*ptr).size()); \ + for(unsigned int i=0; i < (*ptr).size(); i++){ \ + res.push_back(operator()((*ptr)[i])); \ + } \ + return make_object(res); \ } + + CGAL_Kernel_obj(Point_2) + CGAL_Kernel_obj(Point_3) +#undef CGAL_Kernel_obj + CGAL_error_msg("Cartesian_converter is unable to determine what is wrapped in the Object"); return Object(); diff --git a/Cartesian_kernel/include/CGAL/Simple_cartesian.h b/Cartesian_kernel/include/CGAL/Simple_cartesian.h index 13a6160d241..8f84d30dd2e 100644 --- a/Cartesian_kernel/include/CGAL/Simple_cartesian.h +++ b/Cartesian_kernel/include/CGAL/Simple_cartesian.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000-2004 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000-2004 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h index 482b10d6014..967a394a2ad 100644 --- a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h index 986af988388..5ec4a96f378 100644 --- a/Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h +++ b/Cartesian_kernel/include/CGAL/constructions/kernel_ftC3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h index 67ef5102bdd..8685593ff3a 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC2.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h index f238bcea859..e892b0832f3 100644 --- a/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h +++ b/Cartesian_kernel/include/CGAL/predicates/kernel_ftC3.h @@ -1,8 +1,9 @@ -// Copyright (c) 2000 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2000 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/GNUmakefile b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/GNUmakefile deleted file mode 100644 index 23192efc1b4..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/GNUmakefile +++ /dev/null @@ -1,72 +0,0 @@ -# Created by the script cgal_create_makefile -# This is the makefile for compiling a CGAL application. - -#---------------------------------------------------------------------# -# include platform specific settings -#---------------------------------------------------------------------# -# Choose the right include file from the /make directory. - -# CGAL_MAKEFILE = ENTER_YOUR_INCLUDE_MAKEFILE_HERE -include $(CGAL_MAKEFILE) - -#---------------------------------------------------------------------# -# compiler flags -#---------------------------------------------------------------------# - -CXXFLAGS = \ - -I../../include \ - -I../../../Algebraic_kernel_for_circles/include \ - $(CGAL_CXXFLAGS) \ - $(LONG_NAME_PROBLEM_CXXFLAGS) #\ -# -fmessage-length=0 - -#---------------------------------------------------------------------# -# linker flags -#---------------------------------------------------------------------# - -LIBPATH = \ - $(CGAL_LIBPATH) - -LDFLAGS = \ - $(LONG_NAME_PROBLEM_LDFLAGS) \ - $(CGAL_LDFLAGS) - -#---------------------------------------------------------------------# -# target entries -#---------------------------------------------------------------------# - -all: \ - demo$(EXE_EXT) - -demo.moc: demo.cpp - ${QT_MOC} -o demo.moc $< - -Qt_widget_get_arc.moc: Qt_widget_get_arc.h - $(QT_MOC) -o Qt_widget_get_arc.moc $< - -Qt_widget_get_segment.moc: Qt_widget_get_segment.h - $(QT_MOC) -o Qt_widget_get_segment.moc $< - - -demo$(EXE_EXT): demo.moc demo$(OBJ_EXT) Qt_widget_get_arc$(OBJ_EXT) Qt_widget_get_segment$(OBJ_EXT) - $(CGAL_CXX) $(LIBPATH) $(EXE_OPT)demo demo$(OBJ_EXT) Qt_widget_get_arc$(OBJ_EXT) Qt_widget_get_segment$(OBJ_EXT) $(LDFLAGS) - -Qt_widget_get_arc$(OBJ_EXT): Qt_widget_get_arc.cpp Qt_widget_get_arc.moc - $(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) Qt_widget_get_arc.cpp - -Qt_widget_get_segment$(OBJ_EXT): Qt_widget_get_segment.cpp Qt_widget_get_segment.moc - $(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) Qt_widget_get_segment.cpp - - -clean: \ - demo.clean \ - Qt_widget_get_arc.clean \ - Qt_widget_get_segment.clean - -#---------------------------------------------------------------------# -# suffix rules -#---------------------------------------------------------------------# - -.cpp$(OBJ_EXT): - $(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) $< - diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/Qt_widget_get_arc.cpp b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/Qt_widget_get_arc.cpp deleted file mode 100644 index a58d1ea084d..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/Qt_widget_get_arc.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France) and -// Max-Planck-Institute Saarbruecken (Germany). -// All rights reserved. -// -// $URL$ -// $Id$ -// -// Authors : Sylvain Pion, Radu Ursu -// -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (CGAL - Effective Computational Geometry for Curves and Surfaces) - -#include - - -#include "Qt_widget_get_arc.h" - -//void Qt_widget_get_arc_helper::new_object_time(){}; - -#include "Qt_widget_get_arc.moc" - diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/Qt_widget_get_arc.h b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/Qt_widget_get_arc.h deleted file mode 100644 index e7db627a685..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/Qt_widget_get_arc.h +++ /dev/null @@ -1,408 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France) and -// Max-Planck-Institute Saarbruecken (Germany). -// All rights reserved. -// -// $URL$ -// $Id$ -// -// Authors : Sylvain Pion, Radu Ursu -// -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (CGAL - Effective Computational Geometry for Curves and Surfaces) - -// file : include/CGAL/IO/Qt_widget_get_arc.h - -#ifndef CGAL_QT_WIDGET_GET_ARC_H -#define CGAL_QT_WIDGET_GET_ARC_H - -#include -#include -#include -#include - -#ifndef CGAL_QT_WIDGET_GET_POINT_BUTTON -#define CGAL_QT_WIDGET_GET_POINT_BUTTON Qt::LeftButton -#endif - -namespace CGAL { - -namespace internal { - -class Qt_widget_get_arc_helper - : public CGAL::Qt_widget_layer -{ -Q_OBJECT - -public: - - Qt_widget_get_arc_helper(QObject* parent = 0, const char* name = 0) - : Qt_widget_layer(parent, name) {} - - virtual void got_it() { emit new_object_time(); } - -signals: - void new_object_time(); -}; - -} // namespace internal - -template -class Qt_widget_get_arc - : public internal::Qt_widget_get_arc_helper -{ - typedef typename R::FT FT; - typedef typename R::Circle_2 Circle; - typedef typename R::Circular_arc_2 Circular_arc_2; - typedef typename R::Segment_2 Segment; - typedef typename R::Line_2 Line; - typedef typename R::Point_2 Point; - -public: - - Qt_widget_get_arc(const QCursor c=QCursor(Qt::crossCursor), - QObject* parent = 0, const char* name = 0) - : internal::Qt_widget_get_arc_helper(parent, name), - cursor(c), firstpoint(false), - firsttime(true), secondpoint(false), thirdpoint(false), - clockwise(false) - {} - - void draw() - { - if (secondpoint) { - *widget << CGAL::GREEN << introduced_circle; - if (thirdpoint){ - *widget << CGAL::BLUE << Segment(Point(x1, y1), first_point); - } - } - firsttime = true; - } - -private: - - bool is_pure(Qt::ButtonState s) { - return ! ((s & Qt::ControlButton) || - (s & Qt::ShiftButton) || - (s & Qt::AltButton)); - } - - void mousePressEvent(QMouseEvent *e) - { - if (e->button() == CGAL_QT_WIDGET_GET_POINT_BUTTON - && !firstpoint - && is_pure(e->state())) - { - FT x, y; - widget->x_real(e->x(), x); - widget->y_real(e->y(), y); - x1 = x; - y1 = y; - x2 = x; - y2 = y; - firstpoint = true; - center = Point(x, y); - } else if (e->button() == CGAL_QT_WIDGET_GET_POINT_BUTTON - && !secondpoint && is_pure(e->state())) - { - FT x, y; - widget->x_real(e->x(), x); - widget->y_real(e->y(), y); - introduced_circle = Circle(Point(x1,y1), - squared_distance(Point(x1, y1), Point(x,y))); - secondpoint = true; - firsttime = true; - on_the_boundary = Point(x, y); - } else if (e->button() == CGAL_QT_WIDGET_GET_POINT_BUTTON - && !thirdpoint && is_pure(e->state())){ - FT x, y; - widget->x_real(e->x(), x); - widget->y_real(e->y(), y); - first_point = Point(x, y); - thirdpoint = true; - firsttime = true; - } else if (e->button() == CGAL_QT_WIDGET_GET_POINT_BUTTON){ - FT x, y; - widget->x_real(e->x(), x); - widget->y_real(e->y(), y); - second_point = Point(x, y); - firstpoint = false; secondpoint = false; thirdpoint = false; - firsttime = true; - got_it(); - } - } - - void keyPressEvent(QKeyEvent *e) - { - switch ( e->key() ) { - case Key_Escape: // key_escape - if (firstpoint && !secondpoint) - { - firstpoint = false; - RasterOp old_raster = widget->rasterOp(); - QColor old_color = widget->color(); - widget->lock(); - widget->setRasterOp(XorROP); - *widget << CGAL::GREEN; - *widget << Circle(Point(x1,y1), - squared_distance(Point(x1, y1), Point(x2,y2))); - widget->setRasterOp(old_raster); - widget->setColor(old_color); - widget->unlock(); - firsttime = true; - } - break; - case Key_C: - if(thirdpoint){ - clockwise = !clockwise; - if(!firsttime){ - //draw the arc - QColor old_color = widget->color(); - RasterOp old_raster = widget->rasterOp(); - //save the initial raster mode - widget->setRasterOp(XorROP); - widget->lock(); - *widget << CGAL::RED; - int x_screen = widget->x_pixel(CGAL::to_double(center.x())); - int y_screen = widget->y_pixel(CGAL::to_double(center.y())); - int x_screen_b = widget->x_pixel(CGAL::to_double(on_the_boundary.x())); - int y_screen_b = widget->y_pixel(CGAL::to_double(on_the_boundary.y())); - int radius = (int)sqrt(CGAL::to_double((x_screen_b - x_screen) * - (x_screen_b - x_screen) + - (y_screen_b - y_screen) * - (y_screen_b - y_screen))); - double diff = 180/3.1415926; - - double a = atan2( to_double(first_point.y() - center.y()), - to_double(first_point.x() - center.x())); - double a2p = atan2( to_double(y2 - center.y()), - to_double(x2 - center.x())); - if(!clockwise){double tempa = a; a = a2p; a2p = tempa;} - - double alen2; - if(a2p > a) - alen2 = a2p - a; - else - alen2 = 2 * 3.1415926 + a2p - a; - - widget->get_painter().drawArc(x_screen - radius, - y_screen - radius, - 2 * radius, 2 * radius, - (int)(a * diff * 16), - (int)(alen2 * diff * 16)); - a = atan2( to_double(first_point.y() - center.y()), - to_double(first_point.x() - center.x())); - double a2 = atan2( to_double(y2 - center.y()), - to_double(x2 - center.x())); - if(clockwise){double tempa = a; a = a2; a2 = tempa;} - double alen; - if(a2 > a) - alen = a2 - a; - else - alen = 2 * 3.1415926 + a2 - a; - - widget->get_painter().drawArc(x_screen - radius, - y_screen - radius, - 2 * radius, 2 * radius, - (int)(a * diff * 16), - (int)(alen * diff * 16)); - widget->unlock(); - widget->setRasterOp(old_raster); - widget->setColor(old_color); - } - } - break; - }//endswitch - } - - void leaveEvent(QEvent *) - { - if (firstpoint && !secondpoint) - { - QColor old_color = widget->color(); - RasterOp old_raster = widget->rasterOp(); //save the initial raster mode - - widget->lock(); - widget->setRasterOp(XorROP); - *widget << CGAL::GREEN << Circle(Point(x1,y1), - squared_distance(Point(x1, y1), - Point(x2,y2))); - widget->unlock(); - widget->setRasterOp(old_raster); - widget->setColor(old_color); - firsttime = true; - } - } - - void mouseMoveEvent(QMouseEvent *e) - { - if (firstpoint==true && !secondpoint) - { - FT x, y; - widget->x_real(e->x(), x); - widget->y_real(e->y(), y); - QColor old_color = widget->color(); - RasterOp old_raster = widget->rasterOp();//save the initial raster mode - widget->setRasterOp(XorROP); - widget->lock(); - *widget << CGAL::GREEN; - if(!firsttime) - *widget << Circle(Point(x1,y1), - squared_distance(Point(x1, y1), Point(x2,y2))); - *widget << Circle(Point(x1,y1), - squared_distance(Point(x1, y1), Point(x,y))); - widget->unlock(); - widget->setRasterOp(old_raster); - widget->setColor(old_color); - - //save the last coordinates to redraw the screen - x2 = x; - y2 = y; - firsttime = false; - } else if(secondpoint || thirdpoint){ - FT x, y; - widget->x_real(e->x(), x); - widget->y_real(e->y(), y); - QColor old_color = widget->color(); - RasterOp old_raster = widget->rasterOp();//save the initial raster mode - widget->setRasterOp(XorROP); - widget->lock(); - *widget << CGAL::BLUE; - if(!firsttime) - *widget << Segment(Point(x1,y1),Point(x2,y2)); - - *widget << Segment(Point(x1,y1),Point(x,y)); - widget->unlock(); - widget->setRasterOp(old_raster); - widget->setColor(old_color); - //save the last coordinates to redraw the screen - - if(thirdpoint){ - //draw the arc - QColor old_color = widget->color(); - RasterOp old_raster = widget->rasterOp();//save the initial raster mode - widget->setRasterOp(XorROP); - widget->lock(); - *widget << CGAL::RED; - - int x_screen = widget->x_pixel(CGAL::to_double(center.x())); - int y_screen = widget->y_pixel(CGAL::to_double(center.y())); - int x_screen_b = widget->x_pixel(CGAL::to_double(on_the_boundary.x())); - int y_screen_b = widget->y_pixel(CGAL::to_double(on_the_boundary.y())); - - int radius = (int)sqrt(CGAL::to_double((x_screen_b - x_screen) * - (x_screen_b - x_screen) + - (y_screen_b - y_screen) * - (y_screen_b - y_screen))); - - double diff = 180/3.1415926; - - double a = atan2( to_double(first_point.y() - center.y()), - to_double(first_point.x() - center.x())); - - double a2 = atan2( to_double(y - center.y()), - to_double(x - center.x())); - if(clockwise){double tempa = a; a = a2; a2 = tempa;} - double alen; - if(a2 > a) - alen = a2 - a; - else - alen = 2 * 3.1415926 + a2 - a; - - if(!firsttime){ - double a = atan2( to_double(first_point.y() - center.y()), - to_double(first_point.x() - center.x())); - double a2p = atan2( to_double(y2 - center.y()), - to_double(x2 - center.x())); - if(clockwise){double tempa = a; a = a2p; a2p = tempa;} - - double alen2; - if(a2p > a) - alen2 = a2p - a; - else - alen2 = 2 * 3.1415926 + a2p - a; - - widget->get_painter().drawArc(x_screen - radius, - y_screen - radius, - 2 * radius, 2 * radius, - (int)(a * diff * 16), - (int)(alen2 * diff * 16)); - } - - widget->get_painter().drawArc(x_screen - radius, - y_screen - radius, - 2 * radius, 2 * radius, - (int)(a * diff * 16), - (int)(alen * diff * 16)); - widget->unlock(); - widget->setRasterOp(old_raster); - widget->setColor(old_color); - } - x2 = x; - y2 = y; - firsttime = false; - } - } - -public: - - Circular_arc_2 get_circular_arc() { - //Circle circ (introduced_circle.center(), - //introduced_circle.squared_radius()); - Circle circ = introduced_circle; - - if (clockwise) - std::swap(first_point, second_point); - - Line l1 (first_point, center); - Line l2 (second_point, center); - - return Circular_arc_2 (circ, - l1, CGAL::compare_xy(first_point, center) == CGAL::SMALLER, - l2, CGAL::compare_xy(second_point, center) == CGAL::SMALLER); - } - -private: - - void activating() - { - oldpolicy = widget->focusPolicy(); - widget->setFocusPolicy(QWidget::StrongFocus); - oldcursor = widget->cursor(); - widget->setCursor(cursor); - } - - void deactivating() - { - widget->setFocusPolicy(oldpolicy); - widget->setCursor(oldcursor); - firstpoint = false; - } - - QCursor cursor; - QCursor oldcursor; - - FT x1, //the X of the first point - y1; //the Y of the first point - FT x2, //the old second point's X - y2; //the old second point's Y - bool firstpoint, //true if the user left clicked once - firsttime; //true if the line is not drawn - bool secondpoint;//true after the secons point - bool thirdpoint; //true after the third point - - Circle introduced_circle; - Point center; - Point on_the_boundary; - - Point first_point; - Point second_point; - - bool clockwise; - - QWidget::FocusPolicy oldpolicy; -}; - -} // namespace CGAL - -#endif // CGAL_QT_WIDGET_GET_ARC_H diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/Qt_widget_get_segment.cpp b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/Qt_widget_get_segment.cpp deleted file mode 100644 index 9f26fec2d64..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/Qt_widget_get_segment.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France) and -// Max-Planck-Institute Saarbruecken (Germany). -// All rights reserved. -// -// $URL$ -// $Id$ -// -// Authors : Radu Ursu -// -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (CGAL - Effective Computational Geometry for Curves and Surfaces) - -#include - - -#include "Qt_widget_get_segment.h" - -//void Qt_widget_get_arc_helper::new_object_time(){}; - -#include "Qt_widget_get_segment.moc" - diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/Qt_widget_get_segment.h b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/Qt_widget_get_segment.h deleted file mode 100644 index 457d0016dbe..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/Qt_widget_get_segment.h +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France) and -// Max-Planck-Institute Saarbruecken (Germany). -// All rights reserved. -// -// $URL$ -// $Id$ -// -// Authors : Radu Ursu -// -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (CGAL - Effective Computational Geometry for Curves and Surfaces) - -#ifndef CGAL_QT_WIDGET_GET_SEGMENT_H -#define CGAL_QT_WIDGET_GET_SEGMENT_H - -#include -#include -//#include "Qt_widget_get_arc.h" - -#ifndef CGAL_QT_WIDGET_GET_POINT_BUTTON -#define CGAL_QT_WIDGET_GET_POINT_BUTTON Qt::LeftButton -#endif - - -namespace CGAL { - -namespace internal { - -class Qt_widget_get_segment_helper - : public CGAL::Qt_widget_layer -{ -Q_OBJECT - -public: - - Qt_widget_get_segment_helper(QObject* parent = 0, const char* name = 0) - : Qt_widget_layer(parent, name) {} - - virtual void got_it() { emit new_object_time(); } - -signals: - void new_object_time(); -}; - -} // namespace internal - - -template -class Qt_widget_get_segment : public internal::Qt_widget_get_segment_helper -{ -public: - typedef typename R::Point_2 Point; - typedef typename R::Segment_2 Segment; - typedef typename R::Line_arc_2 Line_arc_2; - typedef typename R::FT FT; - - Qt_widget_get_segment(const QCursor c=QCursor(Qt::crossCursor), - QObject* parent = 0, const char* name = 0) - : internal::Qt_widget_get_segment_helper(parent, name), - cursor(c), firstpoint(false), - firsttime(true){}; - -protected: - bool is_pure(Qt::ButtonState s){ - if((s & Qt::ControlButton) || - (s & Qt::ShiftButton) || - (s & Qt::AltButton)) - return 0; - else - return 1; - } - - void mousePressEvent(QMouseEvent *e) - { - if(e->button() == CGAL_QT_WIDGET_GET_POINT_BUTTON - && !firstpoint - && is_pure(e->state())) - { - FT x, y; - widget->x_real(e->x(), x); - widget->y_real(e->y(), y); - x1 = x; - y1 = y; - x2 = x; - y2 = y; - firstpoint = TRUE; - } else if(e->button() == CGAL_QT_WIDGET_GET_POINT_BUTTON - && is_pure(e->state())){ - FT x, y; - widget->x_real(e->x(), x); - widget->y_real(e->y(), y); - if(x1!=x || y1!=y) { - widget->new_object( - make_object(Segment(Point(x1,y1),Point(x,y)))); - firstpoint = FALSE; - } - got_it(); - } - } - - void keyPressEvent(QKeyEvent *e) - { - switch ( e->key() ) { - case Key_Escape: // key_escape - if(firstpoint) - { - firstpoint = false; - RasterOp old_raster = widget->rasterOp(); - QColor old_color = widget->color(); - widget->lock(); - widget->setRasterOp(XorROP); - *widget << CGAL::GREEN; - *widget << Segment(Point(x1,y1), Point(x2,y2)); - widget->setRasterOp(old_raster); - widget->setColor(old_color); - widget->unlock(); - firsttime = true; - } - break; - }//endswitch - } - - void leaveEvent(QEvent *) - { - if(firstpoint) - { - RasterOp old_raster = widget->rasterOp();//save the initial raster mode - QColor old_color = widget->color(); - widget->lock(); - widget->setRasterOp(XorROP); - *widget << CGAL::GREEN; - *widget << Segment(Point(x1,y1), Point(x2,y2)); - widget->setRasterOp(old_raster); - widget->setColor(old_color); - widget->unlock(); - firsttime = true; - } - } - void mouseMoveEvent(QMouseEvent *e) - { - if(firstpoint) - { - FT x, y; - widget->x_real(e->x(), x); - widget->y_real(e->y(), y); - RasterOp old_raster = widget->rasterOp();//save the initial raster mode - QColor old_color = widget->color(); - widget->setRasterOp(XorROP); - widget->lock(); - *widget << CGAL::GREEN; - if(!firsttime) - *widget << Segment(Point(x1,y1),Point(x2,y2)); - *widget << Segment(Point(x1,y1),Point(x,y)); - widget->unlock(); - widget->setRasterOp(old_raster); - widget->setColor(old_color); - - //save the last coordinates to redraw the screen - x2 = x; - y2 = y; - firsttime = false; - } - }; - -public: - - Line_arc_2 get_line_arc() { - return Line_arc_2(Point(x1,y1), - Point(x2,y2)); - - } - - void activating() - { - oldpolicy = widget->focusPolicy(); - widget->setFocusPolicy(QWidget::StrongFocus); - oldcursor = widget->cursor(); - widget->setCursor(cursor); - }; - - void deactivating() - { - widget->setFocusPolicy(oldpolicy); - widget->setCursor(oldcursor); - firstpoint = false; - }; - - QCursor oldcursor; - QCursor cursor; - - FT x1, //the X of the first point - y1; //the Y of the first point - FT x2, //the old second point's X - y2; //the old second point's Y - bool firstpoint, //true if the user left clicked once - firsttime; //true if the line is not drawn - QWidget::FocusPolicy oldpolicy; -};//end class - -} // namespace CGAL - -#endif // CGAL_QT_WIDGET_GET_SEGMENT_H diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/README b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/README deleted file mode 100644 index b8d158ab15f..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/README +++ /dev/null @@ -1,3 +0,0 @@ -demo allows to enter line segments and circular arcs -and computes the arrangement -it also allows to read .dxf files (autocad format) diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/demo.cpp b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/demo.cpp deleted file mode 100644 index 6e6ddeb4ad1..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/demo.cpp +++ /dev/null @@ -1,415 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France) -// All rights reserved. -// -// $URL$ -// $Id$ -// -// Authors : Monique Teillaud, Sylvain Pion, Pedro Machado, Radu Ursu -// -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (CGAL - Effective Computational Geometry for Curves and Surfaces) - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "Qt_widget_get_segment.h" -#include "Qt_widget_get_arc.h" -#include "sweeper.xpm" -#include "trash.xpm" -#include "get_arc.xpm" -#include "lines_icon.xpm" - -#include -#include -#include - -typedef CGAL::Quotient NT; - - -typedef CGAL::Cartesian Linear_k; - -typedef CGAL::Algebraic_kernel_for_circles_2_2 Algebraic_k; -typedef CGAL::Circular_kernel_2 Circular_k; - -typedef Circular_k::Line_arc_2 Line_arc_2; -typedef Circular_k::Segment_2 Segment; -typedef Circular_k::Circular_arc_2 Circular_arc_2; -typedef Circular_k::Circular_arc_point_2 Circular_arc_point_2; - -typedef std::vector ArcContainer; - -const QString my_title_string("CGAL :: " - "Intersecting Circles, Line Arcs, Circular Arcs"); - -class Qt_layer_show_intersections - : public CGAL::Qt_widget_layer -{ - ArcContainer _ac; - bool show_intersections; - -public: - - Qt_layer_show_intersections() - : _ac(), show_intersections(true) {} - - void swap_show() { show_intersections = ! show_intersections; } - - const ArcContainer & arc_container() const { return _ac; } - ArcContainer & arc_container() { return _ac; } - - void draw() - { - if (!show_intersections) - return; - *widget << CGAL::RED; - int l = _ac.size(); - - for(int i=0; i res; - Circular_arc_2 ca1, ca2; - Line_arc_2 la1, la2; - if(assign(ca1, _ac[i])) { - if(assign(ca2, _ac[j])) { - CGAL::intersection(ca1, ca2, std::back_inserter(res)); - } else { - CGAL::intersection(ca1, la2, std::back_inserter(res)); - } - } else { - if(assign(ca2, _ac[j])) { - CGAL::intersection(la1, ca2, std::back_inserter(res)); - } else { - CGAL::intersection(la1, la2, std::back_inserter(res)); - } - } - for(unsigned k=0; k pair; - Circular_arc_2 ca; - Line_arc_2 la; - if(assign(pair, res[k])) *widget << pair.first; - else if(assign(ca, res[k])) *widget << ca; - else if(assign(la, res[k])) { - *widget << Segment(Circular_k::Point_2(to_double(la.source().x()), - to_double(la.source().y())), - Circular_k::Point_2(to_double(la.target().x()), - to_double(la.target().y()))); - } - } - } - } - } -}; - -struct Qt_layer_show_ch - : public CGAL::Qt_widget_layer -{ - ArcContainer _ac; - bool show_arcs; - -public: - - Qt_layer_show_ch() - : show_arcs(true) {} - - const ArcContainer & arc_container() const { return _ac; } - - ArcContainer & arc_container() { return _ac; } - - void swap_show() { show_arcs = ! show_arcs; } - - void draw() - { - if (!show_arcs) - return; - *widget << CGAL::BLUE; - int l = _ac.size(); - for (int i=0; istart( 200, FALSE ); - - QPopupMenu * file = new QPopupMenu( this ); - menuBar()->insertItem( "&File", file ); - file->insertItem("&New", this, SLOT(new_instance()), CTRL+Key_N); - file->insertItem("New &Window", this, SLOT(new_window()), CTRL+Key_W); - file->insertSeparator(); - file->insertItem("Print", widget, SLOT(print_to_ps()), CTRL+Key_P); - file->insertSeparator(); - file->insertItem( "&Close", this, SLOT(close()), CTRL+Key_X ); - file->insertItem( "&Quit", qApp, SLOT( closeAllWindows() ), CTRL+Key_Q ); - - QPopupMenu * help = new QPopupMenu( this ); - menuBar()->insertItem( "&Help", help ); - help->insertItem("How To", this, SLOT(howto()), Key_F1); - help->insertSeparator(); - help->insertItem("&About", this, SLOT(about()), CTRL+Key_A ); - help->insertItem("About &Qt", this, SLOT(aboutQt()) ); - - stoolbar = new CGAL::Qt_widget_standard_toolbar (widget, this, "ST"); - - QToolBar * layers_toolbar = new QToolBar("Tools", this, - QMainWindow::Top, TRUE, "Tools"); - - QToolButton * show_intersections_button = - new QToolButton(QPixmap((const char**)::sweeper_xpm ), - "Showing Intersections", - 0, - this, - SLOT(show_intersections()), - layers_toolbar, - "Showing Intersections"); - - widget->attach(&show_intersections_layer); - connect(show_intersections_button, SIGNAL(stateChanged(int)), - &show_intersections_layer, SLOT(stateChanged(int))); - - QToolButton * show_container_button = - new QToolButton(QPixmap((const char**)::get_arc), - "Show Original arcs", - 0, - this, - SLOT(show_original_arcs()), - layers_toolbar, - "Show Original arcs"); - show_container_button->setToggleButton(true); - - show_container_button->toggle(); - connect(show_container_button, SIGNAL(stateChanged(int)), - &testlayer, SLOT(stateChanged(int))); - - QToolButton * line_circle_button = - new QToolButton(QPixmap((const char**)::lines_icon), - "Use Line", - 0, - this, - SLOT(change_line_circle()), - layers_toolbar, - "Use Circular arc"); - - line_circle_button->setToggleButton(true); - arc_circle = true; - - QToolButton * clear_button = - new QToolButton(QPixmap((const char**)trash), - "Clear", - 0, - this, - SLOT(clear_container()), - layers_toolbar, - "Clear"); - - connect(clear_button, SIGNAL(stateChanged(int)), - &testlayer, SLOT(stateChanged(int))); - - *widget << CGAL::LineWidth(2) << CGAL::BackgroundColor(CGAL::WHITE); - - resize(w,h); - widget->set_window(-1, 1, -1, 1); - widget->setMouseTracking(TRUE); - - // layers - widget->attach(&testlayer); - get_arc_layer = new CGAL::Qt_widget_get_arc; - get_segment_layer = new CGAL::Qt_widget_get_segment; - widget->attach(get_arc_layer); - connect(get_arc_layer, SIGNAL(new_object_time()), this, SLOT(get_arc())); - connect(get_segment_layer, SIGNAL(new_object_time()), - this, SLOT(get_arc())); - } - -public slots: - - void new_instance() - { - widget->lock(); - widget->clear_history(); - widget->set_window(-1.1, 1.1, -1.1, 1.1); - widget->unlock(); - something_changed = true; - } - - void get_arc() - { - CGAL::Object o; - if (arc_circle) { - Circular_arc_2 ca = get_arc_layer->get_circular_arc(); - o = make_object(ca); - } - else { - Line_arc_2 la = get_segment_layer->get_line_arc(); - o = make_object(la); - } - arc_container().push_back(o); - intersections_container().push_back(o); - something_changed = true; - widget->redraw(); - } - - void show_original_arcs() - { - testlayer.swap_show(); - something_changed = true; - widget->redraw(); - } - - void show_intersections() - { - show_intersections_layer.swap_show(); - something_changed = true; - widget->redraw(); - } - - void change_line_circle(){ - arc_circle = ! arc_circle; - if(arc_circle){ - widget->detach(get_segment_layer); - widget->attach(get_arc_layer); - } - else{ - widget->detach(get_arc_layer); - widget->attach(get_segment_layer); - } - something_changed = true; - widget->redraw(); - } - - void clear_container() - { - arc_container().clear(); - intersections_container().clear(); - something_changed = true; - widget->redraw(); - } - -private slots: - - void about() - { - QMessageBox::about(this, my_title_string, - "This is a demo of the CGAL's Circular_kernel_2.\n Particularly, the intersection functionality."); - } - - void aboutQt() - { - QMessageBox::aboutQt(this, my_title_string); - } - - void howto() - { - CGAL::Qt_help_window *help = - new CGAL::Qt_help_window("help/index.html", ".", 0, "help viewer"); - help->resize(400, 400); - help->setCaption("Demo HowTo"); - help->show(); - } - - void new_window() - { - MyWindow *ed = new MyWindow(500, 500); - ed->setCaption("Layer"); - ed->widget->clear_history(); - ed->widget->set_window(-1.1, 1.1, -1.1, 1.1); - ed->show(); - something_changed = true; - } - - void timer_done() - { - if (something_changed) - widget->redraw(); - something_changed = false; - } - -private: - bool arc_circle; - - const ArcContainer & arc_container() const - { return testlayer.arc_container(); } - - ArcContainer & arc_container() - { return testlayer.arc_container(); } - - const ArcContainer & intersections_container() const - { return show_intersections_layer.arc_container(); } - - ArcContainer & intersections_container() - { return show_intersections_layer.arc_container(); } - - CGAL::Qt_widget *widget; - CGAL::Qt_widget_standard_toolbar *stoolbar; - bool something_changed; - Qt_layer_show_ch testlayer; - Qt_layer_show_intersections show_intersections_layer; - CGAL::Qt_widget_get_segment *get_segment_layer; - CGAL::Qt_widget_get_arc *get_arc_layer; -}; - -#include "demo.moc" - -int -main(int argc, char **argv) -{ - QApplication app(argc, argv); - MyWindow widget(800, 700); - app.setMainWidget(&widget); - widget.setCaption(my_title_string); - widget.setMouseTracking(TRUE); -#if !defined (__POWERPC__) - QPixmap cgal_icon = QPixmap((const char**)demoicon_xpm); - widget.setIcon(cgal_icon); -#endif - widget.show(); - return app.exec(); -} - diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/get_arc.xpm b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/get_arc.xpm deleted file mode 100644 index 69e73962635..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/get_arc.xpm +++ /dev/null @@ -1,283 +0,0 @@ -/* XPM */ -static const char *get_arc[] = { -/* width height num_colors chars_per_pixel */ -" 33 33 243 2", -/* colors */ -".. c #ffffff", -".# c #04827e", -".a c #9c260c", -".b c #9c8230", -".c c #e4c22c", -".d c #44422c", -".e c #c49a2c", -".f c #0402fc", -".g c #440344", -".h c #c4c2c4", -".i c #446a6c", -".j c #042424", -".k c #046261", -".l c #e4e3e4", -".m c #84827a", -".n c #242424", -".o c #244644", -".p c #746637", -".q c #8c5614", -".r c #645224", -".s c #ecfab4", -".t c #849294", -".u c #045250", -".v c #243234", -".w c #6c7474", -".x c #c4b234", -".y c #d4d294", -".z c #9ca69c", -".A c #240224", -".B c #fcfe04", -".C c #f4f2f4", -".D c #9c9764", -".E c #ecd614", -".F c #840284", -".G c #043232", -".H c #047273", -".I c #b4b3b4", -".J c #041214", -".K c #544624", -".L c #646664", -".M c #34341c", -".N c #c41ac4", -".O c #e4bc34", -".P c #fcfedc", -".Q c #f4c634", -".R c #848e94", -".S c #4c5254", -".T c #343a24", -".U c #044a4a", -".V c #444b47", -".W c #542654", -".X c #847a24", -".Y c #9c927c", -".Z c #1c5a54", -".0 c #ccd2cc", -".1 c #4c7674", -".2 c #045c5b", -".3 c #acacac", -".4 c #645e44", -".5 c #dcdadc", -".6 c #ac8a34", -".7 c #dcca9c", -".8 c #1c3634", -".9 c #746d67", -"#. c #cc32cc", -"## c #04fe04", -"#a c #c4a834", -"#b c #c4ccc8", -"#c c #1c6a64", -"#d c #342214", -"#e c #3c4234", -"#f c #747a7c", -"#g c #bc9638", -"#h c #047d7b", -"#i c #141614", -"#j c #ecb654", -"#k c #f4faf8", -"#l c #1c021c", -"#m c #948250", -"#n c #74121c", -"#o c #546464", -"#p c #042b2b", -"#q c #046d6b", -"#r c #8c9a9c", -"#s c #0c5250", -"#t c #043c3b", -"#u c #343335", -"#v c #f4cd39", -"#w c #4c5e5c", -"#x c #84766c", -"#y c #0c0b0b", -"#z c #7c827c", -"#A c #044546", -"#B c #8c867e", -"#C c #a4aca5", -"#D c #bcbbbc", -"#E c #345654", -"#F c #ec02ec", -"#G c #948a7c", -"#H c #545353", -"#I c #4c4b4a", -"#J c #d4dad4", -"#K c #cccccc", -"#L c #fcfefc", -"#M c #dcce24", -"#N c #444442", -"#O c #e4eae4", -"#P c #7c6e4c", -"#Q c #fcf8ac", -"#R c #04565c", -"#S c #d4b25c", -"#T c #fcf6fa", -"#U c #ac9664", -"#V c #fcde24", -"#W c #ac02ac", -"#X c #041a14", -"#Y c #646a64", -"#Z c #f4ba2c", -"#0 c #8c8d8c", -"#1 c #343a3c", -"#2 c #847e4c", -"#3 c #d4d4d4", -"#4 c #047e84", -"#5 c #04fefc", -"#6 c #f422f4", -"#7 c #cc0a04", -"#8 c #7caaa4", -"#9 c #8c5a8c", -"a. c #b426b4", -"a# c #640264", -"aa c #2c1614", -"ab c #5c362c", -"ac c #2c8284", -"ad c #bcb254", -"ae c #2c7674", -"af c #dcb224", -"ag c #9c9c9c", -"ah c #dc1edc", -"ai c #342a1c", -"aj c #f40ef4", -"ak c #5c3a5c", -"al c #bcb684", -"am c #546a64", -"an c #6c6654", -"ao c #947624", -"ap c #f4b644", -"aq c #8c6e8c", -"ar c #94967c", -"as c #2c2d2c", -"at c #640e64", -"au c #ecd634", -"av c #7c8e8c", -"aw c #544a44", -"ax c #e4ca44", -"ay c #845e14", -"az c #344a49", -"aA c #fc02fc", -"aB c #bc02bc", -"aC c #142a2c", -"aD c #dcba3c", -"aE c #c4a22c", -"aF c #6c6e44", -"aG c #f4c244", -"aH c #5c5d5c", -"aI c #7c6e7c", -"aJ c #2c5e5f", -"aK c #1c1e1c", -"aL c #e4be4c", -"aM c #345e5c", -"aN c #645a14", -"aO c #dcdedc", -"aP c #bc9e2c", -"aQ c #8c5a2c", -"aR c #949294", -"aS c #8c7a24", -"aT c #0c1e24", -"aU c #1c3e3c", -"aV c #ecde2c", -"aW c #fcfeac", -"aX c #dcb23c", -"aY c #bca264", -"aZ c #e4ce34", -"a0 c #cca23c", -"a1 c #a4862c", -"a2 c #4c4634", -"a3 c #4c024c", -"a4 c #4c6664", -"a5 c #2c4848", -"a6 c #a4a6a4", -"a7 c #a49660", -"a8 c #bcb6bc", -"a9 c #3c3224", -"b. c #ecbe37", -"b# c #5c225c", -"ba c #547a7c", -"bb c #b48e3c", -"bc c #cca638", -"bd c #7c7d7c", -"be c #1c1a1c", -"bf c #5c625c", -"bg c #0c2e2c", -"bh c #3c3634", -"bi c #fcce34", -"bj c #a48e34", -"bk c #ececec", -"bl c #6c6d6c", -"bm c #3c3b3c", -"bn c #a49ea4", -"bo c #c49e3c", -"bp c #04666c", -"bq c #848284", -"br c #f4f6b4", -"bs c #747574", -"bt c #ecda24", -"bu c #04363c", -"bv c #b4acac", -"bw c #949c9c", -"bx c #54545c", -"by c #041e24", -"bz c #8c8e94", -"bA c #d4d6dc", -"bB c #8c7e34", -"bC c #ecc234", -"bD c #2c322c", -"bE c #8c028c", -"bF c #0c120c", -"bG c #f402f4", -"bH c #6c026c", -"bI c #fcc24c", -"bJ c #3c2e2c", -"bK c #544634", -"bL c #fcfeec", -"bM c #3c4244", -"bN c #5c4a44", -"bO c #e4dedc", -"bP c #04463c", -"bQ c #046664", -"bR c #244a4c", -"bS c #045653", -"bT c #f4f6f4", -"bU c #043634", -"bV c #047674", -"bW c #044e4b", -/* pixels */ -"...........................................f.f.f.f................", -"...........................................f.f.f.f................", -"...........................................f.f.f..................", -"...........................................f.f.f..................", -".........................................f.f......................", -".........................................f.f......................", -".........................................f.f......................", -".......................................f.f........................", -".......................................f.f........................", -".....................................f.f..........................", -".....................................f.f..........................", -"....................#################L.f..........................", -"..................#################L#L.B..........................", -"................######.............f#L.B.B...........f.f..........", -"..............####...............f.f.f...B.B.....f.f.f.f.f........", -"............######...............f.f.....B#L#5#5.f.f.f............", -"............####.................f.f...f.f#5#5#5.f................", -"............####.................f.f...f.f#5#5#5.f................", -"............####...............f.f.f.f.f.f#5####..................", -"............####...................f.f.f..######..................", -"............####...................f......######..................", -"............####..........................######..................", -"............####..........................######..................", -"............######......................########..................", -"..............####......................####......................", -"................######..............######........................", -"..................######################..........................", -"....................##################............................", -"..................................................................", -"..................................................................", -"..................................................................", -"..................................................................", -".................................................................." -}; diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/get_arc.jpeg b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/get_arc.jpeg deleted file mode 100644 index b532d3a097a..00000000000 Binary files a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/get_arc.jpeg and /dev/null differ diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/index.html b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/index.html deleted file mode 100644 index 330fc18c119..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/index.html +++ /dev/null @@ -1,101 +0,0 @@ - - - - Circular Kernel 2D - - - -

How to use the

"Circular Kernel 2D"

Demo

-
-This demo illustrates the intersection functionality provided by the CGAL's Circular_kernel_2. -

-You can easily input circular arcs and segments using the mouse. The first click is the center -of the supporting circle, the second will select the radius, then you have -to enter two rays delimiting the arc. Pressing the 'c' key while entering -the second ray will take the opposite arc (the yellow part). -

- -Clicking in this icon will toggle the intersections visibility. -

- -To erase the content of the arcs container, just click on the trash. -

- -Toggling this button will change the object you are inserting between circular arcs and segments. -

- -This button toggles the display of the arcs container. -

- -
- Plus the Usual Functionality of a Qt_widget demo: -


- -

 

-

 

-

 

-

 

- -

-  

-

-  

-

- Reset application

- Press Ctrl+N combination keys or go to File menu and choose "New". - The triangulation will be erased, the window's viewport will be set - to default. (-1, 1, -1, 1) - -

-  

-

-  

-

- Create a new window

- Press Ctrl+W combination keys or go to File menu and choose "New Window". - A new window will appear, modifying the viewport to make the - triangulation fit in the new window. - -

-  

-

-  

-

- Print

- Press Ctrl+P combination keys or go to File menu and choose "Print". - The visible area on the screen will be outputed to the print device - of your choice. - - -

-  

-

-  

-

- Close the current window -

- Press Ctrl+X combination keys or go to File menu and choose "Close". - You may do it for any window other than the initial one, this operation - will close only the one you have choosen. If you do this for the initial - parent window, it will close the others too. - -

-  

-

-  

-

- Quit the application

- Press Ctrl+Q combination keys or go to File menu and choose "Quit". - When you quit the application, all the windows you have created will - be destroyed. - -
-
- - diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/planar_map_icon.jpeg b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/planar_map_icon.jpeg deleted file mode 100644 index fe39a1113b7..00000000000 Binary files a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/planar_map_icon.jpeg and /dev/null differ diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/sweeper.jpeg b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/sweeper.jpeg deleted file mode 100644 index d3517197a1a..00000000000 Binary files a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/sweeper.jpeg and /dev/null differ diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/trash.jpeg b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/trash.jpeg deleted file mode 100644 index 741c13b57dd..00000000000 Binary files a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/help/trash.jpeg and /dev/null differ diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/lines_icon.xpm b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/lines_icon.xpm deleted file mode 100644 index 9576eced83f..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/lines_icon.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static const char *lines_icon[]={ -"32 32 3 1", -"a c #00ff00", -"# c #ff0000", -". c #ffffff", -"................................", -"................................", -"..............##................", -"..............##................", -"...##........a..................", -"...##.......a...................", -".....a.....a.......##...........", -"......a...a........##...........", -".......a##.........a.......##...", -"........##........a........##...", -".......a.a.......a........a.....", -"......a...a.....a........a......", -".....a.....a...a........a.......", -"....a.......a##........a........", -"...a.........##.......a.........", -".##.........a.a......a..........", -".##........a...a....a...........", -"..........a.....a..a............", -".........a.......##.............", -"........a........##.............", -".......a........a..a............", -"......a........a....a...........", -".....##.......a......a..........", -".....##......a........a.........", -"............a..........##.......", -"...........##..........##.......", -"...........##...................", -"................................", -"................................", -"................................", -"................................", -"................................"}; diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/planar_map_icon.xpm b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/planar_map_icon.xpm deleted file mode 100644 index fc0ab607514..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/planar_map_icon.xpm +++ /dev/null @@ -1,43 +0,0 @@ -/* XPM */ -static const char *planar_map_icon[] = { -/* width height num_colors chars_per_pixel */ -" 33 33 3 1", -/* colors */ -". c #ffffff", -"# c #00ff00", -"a c #ff0000", -/* pixels */ -".................................", -".................................", -".................................", -".................................", -".................########........", -"................##.......aa......", -"...............#.........aa......", -".........######..................", -"........#.....###................", -".......#.....#..##...............", -".......#....aa...aa..............", -"......aa....aa...aa..............", -"......aa.....#...................", -"...........##########............", -"..........##..#.....##...........", -".........#....##......#...aa.....", -"........#......##......#.#aa.....", -".......#.........########........", -".......#................#........", -"......#..................#.......", -"......#.................aa.......", -".....aa.................aa.......", -".....aa..........................", -"......#..........................", -"......#..........................", -".......#.........................", -".......#.........................", -"........#........................", -".........aa......................", -".........aa......................", -".................................", -".................................", -"................................." -}; diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/sweeper.xpm b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/sweeper.xpm deleted file mode 100644 index 9be4d27e7ea..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/sweeper.xpm +++ /dev/null @@ -1,278 +0,0 @@ -/* XPM */ -static const char *sweeper_xpm[] = { -/* columns rows colors chars-per-pixel */ -"32 32 240 2", -" c #020100", -". c #01020a", -"X c #000b02", -"o c #0c0000", -"O c #0c0c02", -"+ c #0c0c0c", -"@ c #020013", -"# c #0e0d13", -"$ c #001300", -"% c #04150f", -"& c #051610", -"* c #0f1813", -"= c #130102", -"- c #110902", -"; c #140f0b", -": c #1a0000", -"> c #19060a", -", c #1d0a00", -"< c #1a0f0d", -"1 c #19120a", -"2 c #131313", -"3 c #1d1c1d", -"4 c #030224", -"5 c #09072f", -"6 c #121332", -"7 c #261d00", -"8 c #310000", -"9 c #2d1924", -"0 c #321f23", -"q c #23250f", -"w c #252316", -"e c #312c0f", -"r c #3b2d00", -"t c #232323", -"y c #282725", -"u c #212e34", -"i c #2f3833", -"p c #3c292d", -"a c #3e293a", -"s c #363022", -"d c gray20", -"f c #3c3b39", -"g c #334f1f", -"h c #394251", -"j c #412718", -"k c #473f1b", -"l c #4c3d14", -"z c #553d01", -"x c #433f22", -"c c #4d383f", -"v c #6c2900", -"b c #6b3e43", -"n c #554011", -"m c #65511f", -"M c #7e700d", -"N c #747323", -"B c #706343", -"V c #786c52", -"C c #608e50", -"Z c #a42200", -"A c #a92812", -"S c #876a0c", -"D c #82611c", -"F c #896f32", -"G c #8b7a36", -"H c #967027", -"J c #907f39", -"K c #aa6a09", -"L c #a0701b", -"P c #80724b", -"I c #96735f", -"U c #ce001e", -"Y c #f40000", -"T c #ff1200", -"R c #8a8200", -"E c #9a801f", -"W c #938022", -"Q c #9f8e36", -"! c #a88a06", -"~ c #b08713", -"^ c #a48020", -"/ c #a5812d", -"( c #a08d26", -") c #a58c2a", -"_ c #b69838", -"` c #bca32c", -"' c #baa43e", -"] c #b2b437", -"[ c #8d814d", -"{ c #8e8a40", -"} c #918150", -"| c #a68945", -" . c #ad9b47", -".. c #b6844f", -"X. c #a8956d", -"o. c #ac9b65", -"O. c #a59b77", -"+. c #b09c67", -"@. c #b3aa41", -"#. c #b4b54d", -"$. c #b2b84e", -"%. c #b8b147", -"&. c #b4ba58", -"*. c #bea565", -"=. c #c59620", -"-. c #c09d27", -";. c #c49b2f", -":. c #c39738", -">. c #c59e35", -",. c #cfa10d", -"<. c #cfb800", -"1. c #d8bd0c", -"2. c #c3a123", -"3. c #c3a32a", -"4. c #cba037", -"5. c #cfa43c", -"6. c #c8a831", -"7. c #c6b42c", -"8. c #c9b12b", -"9. c #cab133", -"0. c #dea524", -"q. c #dcaf2e", -"w. c #d1a835", -"e. c #deaf3b", -"r. c #ddb82c", -"t. c #e1a42f", -"y. c #e4b62f", -"u. c #e1ba30", -"i. c #e3bd3e", -"p. c #eebe38", -"a. c #f5b93f", -"s. c #c09840", -"d. c #c4a344", -"f. c #c4a04c", -"g. c #cda452", -"h. c #c0b752", -"j. c #c7b950", -"k. c #d4ad4e", -"l. c #d0ab51", -"z. c #dea558", -"x. c #d1be46", -"c. c #ddb345", -"v. c #d6b357", -"b. c #c1b971", -"n. c #d6ac7a", -"m. c #e7984b", -"M. c #e0aa46", -"N. c #e4ba41", -"B. c #ecb445", -"V. c #ffbc48", -"C. c #cfc818", -"Z. c #c2c633", -"A. c #cdc43b", -"S. c #eecd0e", -"D. c #eadc09", -"F. c #e9dc1e", -"G. c #f6c31c", -"H. c #fcc81d", -"J. c #f4dc00", -"K. c #fed112", -"L. c #e1c03b", -"P. c #e8c83f", -"I. c #e8d82d", -"U. c #f3c42e", -"Y. c #fbc421", -"T. c #ffc02f", -"R. c #ffc92f", -"E. c #f4c831", -"W. c #fac736", -"Q. c #ffce37", -"!. c #f1d124", -"~. c #fddc2d", -"^. c #f8d134", -"/. c #e3eb1c", -"(. c #ecf000", -"). c #f3fb00", -"_. c #fcff03", -"`. c #ffff0a", -"'. c #f6fe13", -"]. c #d3c34a", -"[. c #dbce4c", -"{. c #dbc45a", -"}. c #d0d04c", -"|. c #e1d34c", -" X c #f4c541", -".X c #f5c44a", -"XX c #f5c840", -"oX c #f1cb4c", -"OX c #fccc43", -"+X c #ffcf4d", -"@X c #ffc655", -"#X c #ffd340", -"$X c #ffd74b", -"%X c #e4c364", -"&X c #e6dd76", -"*X c #ffc466", -"=X c #ffe14e", -"-X c #ffe375", -";X c #8f8e8c", -":X c #8d9d93", -">X c #9d9181", -",X c #989292", -" :Xv. mXbXvXxXNXmXrXNXNXNX", -"NXNXxXmXNXNXxXNXfXNXMXaXNXNX X o ,Xl.X nXbXnXNXNXMXNXNXNXcXNX", -"rXNXNXvXNXNXxXMXNX7XjXNXbX3 x qX y l. 0 uXmXmXxXNXiXNXNXMXNXNX", -"NXrXNXNXxXNXNXNXmXhXMXNXNXO 0X&XMX- ;Xc bXnXvXmXNXNXNXNXxXMXNXNX", -"xX2 3 + + + O . @ dXr [.%XmX* X NXmXNXbXNXxXNXNXNXNXNXxX", -"tX5 zXnXmXzXNXmXmX6XmXh $ T Y 6 v !.F.= mXhXlXNXNXNXNXNXNXNXNXNX", -"lX Z.'.(.)._.)./.`.J.XXg : U A 8 -X].o mXMXzXpXNXNXNXNXNXNXNXNX", -"mXo A.8.c.~.Q.u.=X<.@Xz.` {.z Z b : , mXNXMXzXNXNXNXNXNXNXNXNXNX", -"NX= R D.S.Q.*X$XG.R.P.y.T.K s u : o mXmXrXNXMXNXNXNXNXNXNXNXNXNX", -"mXo *.2X3X.X0.Y.|.a.H.K.W.L D C NXmXxXMXNXNXmXNXNXNXNXNXNXNXNX", -"bXpX+ } ( l.1XXXW.}.+XoXN H Q I X NXNXNXzXNXmXNXNXNXNXNXNXNXNXNX", -"zXzXX 9 .I.i.I.M.,.C.B./ ] t._ . MXzXNXNXMXNXvXNXNXNXNXNXNXNXNX", -"mXmXmXa M 7.n.g.Q Q.V.m.u.1.x...4 hXzXNXmXNXMXMXNXNXNXNXNXNXNXNX", -"NXNXNX q O.o.F ! i.q.OXU.E.r.-. NXNXNXvXNXxXNXNXNXNXNXNXNXNXNX", -"NXNXxXbXX e l l 9.6.w..Xp.W.i.>.+ xXxXNXmXNXNXNXNXNXNXNXNXNXNXNX", -"NXNXNXNXhXw = V ) E ^ d.e.=.c.:. NXNXNXrXNXNXiXNXNXNXNXNXNXNXNX", -"vXvXNXiXNXNXf 1 G J | s.>.~ 5.4. NXNXNXxXMXNXNXNXNXNXNXNXNXNXNX", -"NXNXNXNXpXbXNX# 7 B X.*.S ` 3.3.t NXxXMXNXMXcXNXNXNXNXNXNXNXNXNX", -"NXMXxXNXNXNXNXcXMX1 O.V J W ' ) + NXNXcXNXNXxXNXNXNXNXNXNXNXNXNX", -"yXNXNXNXNXMXNXNXMXcX s k P o.m d rXNXxXMXNXNXNXNXNXNXNXNXNXNXNX", -"MXbXNXNXkXMXkXMXNXNXmXNXO o = o xXNXMXNXNXNXxXNXNXNXNXNXNXNXNXNX" -}; diff --git a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/trash.xpm b/Circular_kernel_2/demo/Circular_kernel_2/Qt3/trash.xpm deleted file mode 100644 index d31badbfc34..00000000000 --- a/Circular_kernel_2/demo/Circular_kernel_2/Qt3/trash.xpm +++ /dev/null @@ -1,194 +0,0 @@ -/* XPM */ -static const char *trash[] = { -/* width height num_colors chars_per_pixel */ -" 33 33 154 2", -/* colors */ -".. c #040204", -".# c #048274", -".a c #044234", -".b c #444244", -".c c #042624", -".d c #046654", -".e c #8c8284", -".f c #b4c2bc", -".g c #047264", -".h c #3c4a34", -".i c #242224", -".j c #a4a6a4", -".k c #04524c", -".l c #04767c", -".m c #040a04", -".n c #1c1a1c", -".o c #04322c", -".p c #041a1c", -".q c #e4e2e4", -".r c #044a3c", -".s c #646a64", -".t c #14120c", -".u c #047a6c", -".v c #140a0c", -".w c #046a64", -".x c #040a14", -".y c #043a24", -".z c #4c5254", -".A c #045a44", -".B c #047e7c", -".C c #048284", -".D c #ecf2ec", -".E c #0c0204", -".F c #bcbabc", -".G c #044244", -".H c #142224", -".I c #84929c", -".J c #0c120c", -".K c #3c3a34", -".L c #aca6a4", -".M c #044a4c", -".N c #f4fafc", -".O c #ccbebc", -".P c #0c1a1c", -".Q c #046a74", -".R c #94928c", -".S c #4c4a4c", -".T c #042e2c", -".U c #046264", -".V c #041214", -".W c #047274", -".X c #2c2a2c", -".Y c #04525c", -".Z c #04323c", -".0 c #043a3c", -".1 c #4c5a54", -".2 c #045a54", -".3 c #acaeac", -".4 c #9c9a9c", -".5 c #040604", -".6 c #048674", -".7 c #047a7c", -".8 c #040e04", -".9 c #041e1c", -"#. c #747674", -"## c #046e64", -"#a c #0c0e14", -"#b c #0c0604", -"#c c #bcbebc", -"#d c #044e4c", -"#e c #fcfafc", -"#f c #0c463c", -"#g c #04160c", -"#h c #bcc2bc", -"#i c #04766c", -"#j c #043634", -"#k c #04161c", -"#l c #043e34", -"#m c #b4bebc", -"#n c #047e8c", -"#o c #048684", -"#p c #f4f2f4", -"#q c #044644", -"#r c #b4aab4", -"#s c #0c0e0c", -"#t c #ccc2c4", -"#u c #949694", -"#v c #544a4c", -"#w c #046664", -"#x c #342e2c", -"#y c #5c5e5c", -"#z c #045e54", -"#A c #04020c", -"#B c #04827c", -"#C c #444644", -"#D c #042a2c", -"#E c #04120c", -"#F c #04726c", -"#G c #3c4e54", -"#H c #242624", -"#I c #9caea4", -"#J c #04564c", -"#K c #047684", -"#L c #040a0c", -"#M c #241a24", -"#N c #043234", -"#O c #eceeec", -"#P c #6c6e6c", -"#Q c #b4b2b4", -"#R c #1c221c", -"#S c #545a5c", -"#T c #545254", -"#U c #acaaac", -"#V c #c4bec4", -"#W c #2c2e24", -"#X c #043e44", -"#Y c #040e14", -"#Z c #0c7674", -"#0 c #f4fefc", -"#1 c #046e74", -"#2 c #4c4e4c", -"#3 c #041614", -"#4 c #047674", -"#5 c #04363c", -"#6 c #9c9e9c", -"#7 c #fcfefc", -"#8 c #f4f6f4", -"#9 c #041a24", -"a. c #044a44", -"a# c #047a74", -"aa c #046a6c", -"ab c #b4b6b4", -"ac c #045a4c", -"ad c #047e84", -"ae c #04828c", -"af c #bcbac4", -"ag c #3c3a3c", -"ah c #0c0a0c", -"ai c #044a54", -"aj c #c4c2c4", -"ak c #042e34", -"al c #04060c", -"am c #04867c", -"an c #047a84", -"ao c #040e0c", -"ap c #041e24", -"aq c #047e74", -"ar c #046e6c", -"as c #0c060c", -"at c #044e54", -"au c #041624", -"av c #04464c", -"aw c #04666c", -"ax c #045e5c", -/* pixels */ -"#7#7#7#7#7#7#7#7#7#7#7#7#7#e#U#y#2.S.z#c.q.K#8#7#7#7#7#7#7#7#7#7#7", -"#7#7#7#7#7#7#7#7#7#7#7.Dal#Y.Zawa##B#Ba.#R.F.b#e#7#7#7#7#7#7#7#7#7", -"#7#7#7#7#7#7#7#7#7#7#T.5.B.B.B.Bad.Bad.G#6#C#cah.s#7#7#7#7#7#7#7#7", -"#7#7#7#7#7#7#7#7#7#e#u#qad#Bad#B.B#Bad.7.W#N...f.E..#8#7#7#7#7#7#7", -"#7#7#7#7#7#7#7#7#7#T.F.9ad.B.B.Bad.B.B.B.B.B.B.8#V#L.5.h#7#7#7#7#7", -"#7#7#7#7#7#7#7#7#7.5.F#a.B.B.C.B#Bad#B.B.C.Bad.B#5.F#1.Y.t#7#7#7#7", -"#7#7#7#7#7#7#7#7#7.c#Maf#9#B.Bad.B.B.Bad.B.B.B.B#G.La#.B#4.v#7#7#7", -"#7#7#7#7#7#7#7#7#D#B.Bab.eak.C#B.B.C.B#B.B#B.C.B.d#1.B.B#B.7al#e#7", -"#7#7#7#7#7#7#7#7.G.B.C#E#h.H.5ad.Bad.Bad.B.B.Bad#B.B#Bad.B#Badas#e", -"#7#7#7#7#7#e.5...7.B.C.Bao#t#I#A.B#B#B.B#Bad#B.B.B.C.B.B.B.B#B#4#m", -"#7#7#7#7#7#T.X#maq.B.B.B.W..#h#Q..#D.Bad.B.B.Bad#B.Bad#Bad.Bad#B..", -"#7#7#7#7#7agah#S.0.C.B.C.Ca#.5#r#c.1...0.B.C#B.Bad#B.B.B.B#B.B#k#C", -"#7#7#7#7#7.Oap.P#c#lad.B.C.7aq#g.5#m#c#H..#Yai.B.B.B#n.C#4.V...b.3", -"#7#7#7#7#7.D.7.B#h.Had.Bad..alan#w#A#L#Qaj#m#v...5.....5.m#.ab#P.5", -"#7#7#7#7#7ap.B#4#c#f.C.B.B.B.9.B.5.5a##j.5....#g.8.t#b#b#A.5..#e#7", -"#7#7#7#e#O#x.B.7.E#k.B#B.Bar.y.W.7.Q.7acal#Ba#.Baq#B.B.7#B..#u#7#7", -"#7#7#7#7#s.R.#.W.M.gad#B.C#A.B#B.7.m.Balar.u.u.Z.B.#al.6.c.4#7#7#7", -"#7#7#7#u#r#A.x.m.uad#Bad.w##.B.C#3aa.C.B.Madatarawakaa#lah#7#7#7#7", -"#7#7#7#H.j#Z#B.Ma#.B.B.B#L.B.C#B.madad.7#A#B.C..aq#B....#7#7#7#7#7", -"#7#e.F#c..#B.7#L.C#Bad#F.M.Bad#Yadad.C.5#4.B.T.kad#j...j#7#7#7#7#7", -"#7#7.X.Eaq.B..#F.C.Bam#A#B#oax.A.Ban.T##.C#F.p.C#B..#8#7#7#7#7#7#7", -"#7#p.I.radax#d.C.B.Bau#ian.B.8ad.7.B.5.Bad...Ba#...J#7#7#7#7#7#7#7", -"#7as.5.C.B.5#B.B.B#X.5an#Bao#1.B.Calaqad.x#F#o.5..#7#7#7#7#7#7#7#7", -".s..acad.a.B.C.C.C...l#B.B.p#B.B#Y#k.C.kaoan#Y.m#7#7#7#7#7#7#7#7#7", -".n.a.B#Bal.Bad.B#k#wadad..#Bad.C.5.B.B#A#Baq...N#7#7#7#7#7#7#7#7#7", -"#2#w#jao.o.Bad.l...B.B#d.k.B.Bal.7.Cal.B.C..ah#7#7#7#7#7#7#7#7#7#7", -"#0.5.Bak.W.Ca#...C#Bad...Bad#q.y.C.o.0am.V..#7#7#7#7#7#7#7#7#7#7#7", -"#7#8al.C.m.5#A.w#1ar.5an#B.9..ae#Lao.B.5.E#7#7#7#7#7#7#7#7#7#7#7#7", -"#7#7.3#9#Bav#o#Y#J.E.d.W.7..#B.T#k.C.c...D#7#7#7#7#7#7#7#7#7#7#7#7", -"#7#7#7#W#L#4.B.B..#K#z.Walan.W...C##.5#e#7#7#7#7#7#7#7#7#7#7#7#7#7", -"#7#7#7#7#8#A.Wad.7.B#i..#d#Y...B.U...j#7#7#7#7#7#7#7#7#7#7#7#7#7#7", -"#7#7#7#7#7#7.5...2.B.Canan#N#F.....i#7#7#7#7#7#7#7#7#7#7#7#7#7#7#7", -"#7#7#7#7#7#7#7#7.K...5a.a#.Ba#.m#.#7#7#7#7#7#7#7#7#7#7#7#7#7#7#7#7" -}; diff --git a/Circular_kernel_2/doc_tex/Circular_kernel_2/PkgDescription.tex b/Circular_kernel_2/doc_tex/Circular_kernel_2/PkgDescription.tex index 136cf850e9d..4b3e378d66b 100644 --- a/Circular_kernel_2/doc_tex/Circular_kernel_2/PkgDescription.tex +++ b/Circular_kernel_2/doc_tex/Circular_kernel_2/PkgDescription.tex @@ -1,5 +1,5 @@ \begin{ccPkgDescription}{2D Circular Geometry Kernel \label{Pkg:CircularKernel2}} -\ccPkgHowToCiteCgal{cgal:cpt-cgk2-11} +\ccPkgHowToCiteCgal{cgal:cpt-cgk2-11b} \ccPkgSummary{ This package is an extension of the linear \cgal\ kernel. It offers functionalities on circles, circular arcs and line segments in the diff --git a/Circular_kernel_2/doc_tex/Circular_kernel_2_ref/Polynomial_for_circles_2_2.tex b/Circular_kernel_2/doc_tex/Circular_kernel_2_ref/Polynomial_for_circles_2_2.tex index 56263c1916f..19c48c36aef 100644 --- a/Circular_kernel_2/doc_tex/Circular_kernel_2_ref/Polynomial_for_circles_2_2.tex +++ b/Circular_kernel_2/doc_tex/Circular_kernel_2_ref/Polynomial_for_circles_2_2.tex @@ -8,7 +8,7 @@ \ccSeeAlso -\ccRefIdfierPage{CGAL::Root_of_2}\\ +\ccRefIdfierPage{CGAL::Sqrt_extension}\\ \ccRefIdfierPage{AlgebraicKernelForCircles} \end{ccRefClass} diff --git a/Circular_kernel_2/doc_tex/Circular_kernel_2_ref/intro.tex b/Circular_kernel_2/doc_tex/Circular_kernel_2_ref/intro.tex index 9cdbb1ed4fa..2ebb8a6f757 100644 --- a/Circular_kernel_2/doc_tex/Circular_kernel_2_ref/intro.tex +++ b/Circular_kernel_2/doc_tex/Circular_kernel_2_ref/intro.tex @@ -158,7 +158,7 @@ \subsubsection*{Roots of Polynomials} -\ccRefIdfierPage{CGAL::Root_of_2}\\ +\ccRefIdfierPage{CGAL::Sqrt_extension}\\ \ccRefIdfierPage{CGAL::Root_for_circles_2_2} \ccRefIdfierPage{CGAL::Root_of_traits_2} diff --git a/Circular_kernel_2/dont_submit b/Circular_kernel_2/dont_submit index b24fd5929fe..7534b694e73 100644 --- a/Circular_kernel_2/dont_submit +++ b/Circular_kernel_2/dont_submit @@ -1,13 +1,5 @@ -Qt3 TODO changes -GNUmakefile -examples/Circular_kernel_2/makefile -bench -Benchmarks -include/CGAL/Filtered_hexagon_circular_kernel_2.h -include/CGAL/Filtered_hexagon_circular_kernel_2 -Lazy_circular_kernel_2.h -Lazy_circular_kernel_constructions.h -old_lazy +benchmark + diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_type_equality_wrapper.h b/Circular_kernel_2/include/CGAL/Circular_kernel_type_equality_wrapper.h index dd236732e46..7fe1ce6c06b 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_type_equality_wrapper.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_type_equality_wrapper.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include namespace CGAL { @@ -49,13 +49,10 @@ struct Circular_kernel_type_equality_wrapper typedef CGAL::Line_arc_2 Line_arc_2; typedef CGAL::Circular_arc_point_2 Circular_arc_point_2; - //typedef CGAL::Root_of_2 Root_of_2; - - //Something has to be done with these 3, maybe a lazy Algebraic kernel? + //Something has to be done with these 3, maybe a lazy Algebraic kernel? //typedef Polynomial_for_circles_2_2 Polynomial_for_circles_2_2; //typedef Polynomial_1_2 Polynomial_1_2; - //typedef Root_of_2 Root_of_2; }; } //namespace CGAL diff --git a/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2.h b/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2.h deleted file mode 100644 index 235e0e20298..00000000000 --- a/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2.h +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// 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) : Monique Teillaud, Sylvain Pion, Pedro Machado - -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (ECG - Effective Computational Geometry for Curves and Surfaces) -// and a STREP (FET Open) Project under Contract No IST-006413 -// (ACS -- Algorithms for Complex Shapes) - - -#ifndef CGAL_FILTERED_HEXAGON_CIRCULAR_KERNEL_2_H -#define CGAL_FILTERED_HEXAGON_CIRCULAR_KERNEL_2_H - -#include -#include -#include - -namespace CGAL { - -template - class Filtered_hexagon_circular_kernel_2 : public CK { - - public: - - typedef Filtered_hexagon_circular_kernel_2 Self; - typedef Circular_arc_with_hexagon_2 Circular_arc_2; - typedef Line_arc_with_hexagon_2 Line_arc_2; - typedef CK Circular_kernel; - typedef typename CK::Algebraic_kernel Algebraic_kernel; - typedef typename CK::RT RT; - typedef typename CK::FT FT; - typedef typename CK::Root_of_2 Root_of_2; - typedef typename CK::Root_for_circles_2_2 Root_for_circles_2_2; -// typedef typename CK::Polynomial_for_circles_2_2 Polynomial_for_circles_2_2; -// typedef typename CK::Polynomial_1_2 Polynomial_1_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Circle_2 Circle_2; - typedef typename CK::Conic_2 Conic_2; - typedef typename CK::Point_2 Point_2; - typedef typename CK::Circular_arc_2 Rcirc_arc_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Line_arc_2 Rline_arc_2; - typedef typename CK::Construct_circle_2 Construct_circle_2; - typedef typename CK::Get_equation Get_equation; - - - - typedef typename CK::Compare_x_2 Compare_x_2; - typedef typename CK::Compare_y_2 Compare_y_2; - typedef typename CK::Compare_xy_2 Compare_xy_2; - typedef typename CK::Compute_circular_x_2 Compute_circular_x_2; - typedef typename CK::Compute_circular_y_2 Compute_circular_y_2; - typedef Hexagon_functors::Construct_circular_source_vertex_2 Construct_circular_source_vertex_2; - typedef Hexagon_functors::Construct_circular_target_vertex_2 Construct_circular_target_vertex_2; - typedef Hexagon_functors::Construct_circular_min_vertex_2 Construct_circular_min_vertex_2; - typedef Hexagon_functors::Construct_circular_max_vertex_2 Construct_circular_max_vertex_2; - typedef Hexagon_functors::Has_on_2 Has_on_2; - typedef Hexagon_functors::Compare_y_at_x_2 Compare_y_at_x_2; - typedef Hexagon_functors::Compare_y_to_right_2 Compare_y_to_right_2; - typedef Hexagon_functors::Do_overlap_2 Do_overlap_2; - typedef Hexagon_functors::Equal_2 Equal_2; - typedef Hexagon_functors::In_x_range_2 In_x_range_2; - typedef Hexagon_functors::Make_x_monotone_2 Make_x_monotone_2; - typedef Hexagon_functors::Intersect_2 Intersect_2; - typedef Hexagon_functors::Split_2 Split_2; - typedef Hexagon_functors::Is_vertical_2 Is_vertical_2; - - - - - - - Get_equation - get_equation_object() const - { return CK().get_equation_object(); } - - Construct_circle_2 - construct_circle_2_object() const - { return CK().construct_circle_2_object(); } - - Compare_x_2 - compare_x_2_object() const - { return CK().compare_x_2_object(); } - - Compare_y_2 - compare_y_2_object() const - { return CK().compare_y_2_object(); } - - Compare_xy_2 - compare_xy_2_object() const - { return CK().compare_xy_2_object(); } - - Construct_circular_source_vertex_2 - construct_circular_source_vertex_2_object() const - { return Construct_circular_source_vertex_2(); } - - Construct_circular_target_vertex_2 - construct_circular_target_vertex_2_object() const - { return Construct_circular_target_vertex_2(); } - - Construct_circular_min_vertex_2 - construct_circular_min_vertex_2_object() const - { return Construct_circular_min_vertex_2(); } - - Construct_circular_max_vertex_2 - construct_circular_max_vertex_2_object() const - { return Construct_circular_max_vertex_2(); } - - Has_on_2 - has_on_2_object() const - { return Has_on_2(); } - - - Compare_y_at_x_2 - compare_y_at_x_2_object() const - { return Compare_y_at_x_2(); } - - Compare_y_to_right_2 - compare_y_to_right_2_object() const - { return Compare_y_to_right_2(); } - - Do_overlap_2 - do_overlap_2_object() const - { return Do_overlap_2(); } - - Equal_2 - equal_2_object() const - { return Equal_2(); } - - In_x_range_2 - in_x_range_2_object() const - { return In_x_range_2(); } - - Make_x_monotone_2 - make_x_monotone_2_object() const - { return Make_x_monotone_2(); } - - Intersect_2 - intersect_2_object() const - { return Intersect_2(); } - - - Split_2 - split_2_object() const - { return Split_2(); } - - Is_vertical_2 - is_vertical_2_object() const - { return Is_vertical_2(); } -}; - -} //namespace CGAL - -#endif // CGAL_FILTERED_HEXAGON_CIRCULAR_KERNEL_2_H diff --git a/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2/Circular_arc_with_hexagon_2.h b/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2/Circular_arc_with_hexagon_2.h deleted file mode 100644 index 53b4e548c40..00000000000 --- a/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2/Circular_arc_with_hexagon_2.h +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// 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) : Monique Teillaud, Sylvain Pion, Constantinos Tsirogiannis , Pedro Machado - -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (ECG - Effective Computational Geometry for Curves and Surfaces) -// and a STREP (FET Open) Project under Contract No IST-006413 -// (ACS -- Algorithms for Complex Shapes) - -#ifndef CGAL_CIRCULAR_ARC_WITH_HEXAGON_2_H -#define CGAL_CIRCULAR_ARC_WITH_HEXAGON_2_H - -#include -#include -#include -#include -#include -#include -#include - -namespace CGAL { - - -template < class HK, - class Container = std::vector > > > -class Circular_arc_with_hexagon_2 { - - typedef typename HK::Circular_kernel CK; - typedef typename CK::FT FT; - typedef typename CK::RT RT; - typedef typename CK::Point_2 Point_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Circle_2 Circle_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Root_of_2 Root_of_2; - typedef CK R; - typedef CGAL::Simple_cartesian > FK; - typedef CGAL::Circular_kernel_2< FK,CGAL::Algebraic_kernel_for_circles_2_2 > CK2; - typedef CGAL::Circular_kernel_converter Conv; - - -public: - - ///////////TYPE DEFINITIONS///////////// - - typedef typename Container::iterator Hexagon_iterator; - typedef typename Container::const_iterator Hexagon_const_iterator; - typedef Polygon_2< Simple_cartesian > Hexagon; - - - ///////////Construction///////////// - - Circular_arc_with_hexagon_2(){} - - Circular_arc_with_hexagon_2(const Circle_2 &c) - : P_arc(c) - {} - - Circular_arc_with_hexagon_2(const Circle_2 &support, - const Line_2 &l1, const bool b_l1, - const Line_2 &l2, const bool b_l2) - : P_arc(support,l1,b_l1,l2,b_l2) - {} - - - Circular_arc_with_hexagon_2(const Circle_2 &c, - const Circle_2 &c1, const bool b_1, - const Circle_2 &c2, const bool b_2) - : P_arc(c,c1,b_1,c2,b_2) - {} - - - Circular_arc_with_hexagon_2(const Circular_arc_2 &A, const bool b, - const Circle_2 &ccut, const bool b_cut) - : P_arc(A, b, ccut, b_cut) - {} - - - Circular_arc_with_hexagon_2(const Point_2 &start, - const Point_2 &middle, - const Point_2 &end) - : P_arc(start, middle, end) - {} - - - Circular_arc_with_hexagon_2(const Circle_2 &support, - const Point_2 &begin, - const Point_2 &end) - : P_arc(support, begin, end) - {} - - - Circular_arc_with_hexagon_2(const Circle_2 &support, - const Circular_arc_point_2 &begin, - const Circular_arc_point_2 &end) - : P_arc(support, begin, end) - {} - - Circular_arc_with_hexagon_2(const Circular_arc_2 &a) - : P_arc(a) - {} - - - - //////////Predicates////////// - - bool is_x_monotone() const - { return P_arc.is_x_monotone();} - - bool is_y_monotone() const - { return P_arc.is_y_monotone();} - - bool on_upper_part() const - { return P_arc.on_upper_part();} - - - //////////Accessors/////////// - - const Circular_arc_2& arc () const - { return P_arc ;} - - Hexagon_iterator hexagons_begin() - { return hexagons.begin();} - - Hexagon_iterator hexagons_end() - { return hexagons.end();} - - - Hexagon_const_iterator hexagons_begin() const - { return hexagons.begin();} - - Hexagon_const_iterator hexagons_end() const - { return hexagons.end();} - - unsigned hexagon_no() const - { return hexagons.size();} - - - ///Interface of the inner arc/// - - typename Qualified_result_of::type - left() const - { return typename HK::Construct_circular_min_vertex_2()(*this);} - - typename Qualified_result_of::type - right() const - { return typename HK::Construct_circular_max_vertex_2()(*this);} - - typename Qualified_result_of::type - source() const - {return typename HK::Construct_circular_source_vertex_2()(*this);} - - typename Qualified_result_of::type - target() const - {return typename HK::Construct_circular_target_vertex_2()(*this);} - - const Circle_2 & supporting_circle() const - { return P_arc.supporting_circle();} - - const Point_2 & center() const - { return P_arc.center();} - - const FT & squared_radius() const - { return P_arc.squared_radius();} - - Bbox_2 bbox() const - { return P_arc.bbox();} - - - ///Specific check used for hexagon construction/// - - bool has_no_hexagons() const - { return hexagons.empty();} - - - ///Hexagon construction/// - - void construct_hexagons() const - { - CGAL_assertion(has_no_hexagons()); - - typedef typename boost::mpl::if_, \ - Hexagon_construction_with_interval_2, \ - Hexagon_construction_on_lazy_kernel_2 >::type Construct; - - Construct()(P_arc,std::back_inserter(hexagons)); - } - - - private: - - Circular_arc_2 P_arc; - mutable Container hexagons; - - -}; // Circular_arc_with_hexagon_2 - - - - template < typename HK > - std::ostream & - operator<<(std::ostream & os, const Circular_arc_with_hexagon_2 &a) - { - // The output format is : - // - supporting circle - // - circle c1 - // - bool b1 - // - circle c2 - // - bool b2 - return os << a.arc() << " "; - } - - template < typename HK > - std::istream & - operator>>(std::istream & is, Circular_arc_with_hexagon_2 &a) - { - typedef typename HK::Circular_kernel CK; - typename CK::Circle_2 s; - typename CK::Circular_arc_point_2 p1; - typename CK::Circular_arc_point_2 p2; - is >> s >> p1 >> p2 ; - if (is) - a = Circular_arc_with_hexagon_2(s, p1, p2); - return is; - } - - template < typename HK > - std::ostream & - print(std::ostream & os, const Circular_arc_with_hexagon_2 &a) - { - return os << "Circular_arc_2( " << std::endl - << "left : " << a.arc().left() << " , " << std::endl - << "right : " << a.arc().right() << " , " << std::endl - << "upper part : " << a.arc().on_upper_part() << std::endl - << " [[ approximate circle is (x,y,r) : " - << to_double(a.arc().supporting_circle().center().x()) << " " - << to_double(a.arc().supporting_circle().center().y()) << " " - << std::sqrt(to_double(a.arc().supporting_circle() - .squared_radius())) - << " ]]" << std::endl; - } - -} //namespace CGAL - -#endif // CGAL_CIRCULAR_ARC_WITH_HEXAGON_2_H diff --git a/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2/Line_arc_with_hexagon_2.h b/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2/Line_arc_with_hexagon_2.h deleted file mode 100644 index ac0b14f7272..00000000000 --- a/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2/Line_arc_with_hexagon_2.h +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// 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) : Monique Teillaud, Sylvain Pion, Constantinos Tsirogiannis , Pedro Machado - -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (ECG - Effective Computational Geometry for Curves and Surfaces) -// and a STREP (FET Open) Project under Contract No IST-006413 -// (ACS -- Algorithms for Complex Shapes) - -#ifndef CGAL_LINE_ARC_WITH_HEXAGON_2_H -#define CGAL_LINE_ARC_WITH_HEXAGON_2_H - -#include -#include -#include -#include -#include -#include - -namespace CGAL { - -template < class HK > -class Line_arc_with_hexagon_2 { - - typedef typename HK::Circular_kernel CK; - typedef typename CK::FT FT; - typedef typename CK::RT RT; - typedef typename CK::Point_2 Point_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Segment_2 Segment_2; - typedef typename CK::Circle_2 Circle_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Root_of_2 Root_of_2; - typedef CK R; - typedef CGAL::Simple_cartesian > FK; - typedef CGAL::Circular_kernel_2< FK,CGAL::Algebraic_kernel_for_circles_2_2 > CK2; - typedef CGAL::Circular_kernel_converter Conv; - - -public: - - ///////////TYPE DEFINITIONS///////////// - - typedef Line_arc_2 Encapsulated_arc_type; - typedef Polygon_2< Simple_cartesian > Hexagon; - typedef Hexagon* Hexagon_iterator; - typedef const Hexagon * Hexagon_const_iterator; - - - ///////////Construction///////////// - - Line_arc_with_hexagon_2(){} - - Line_arc_with_hexagon_2(const Line_2 &support, - const Circle_2 &l1, const bool b_l1, - const Circle_2 &l2, const bool b_l2) - : P_arc(support,l1,b_l1,l2,b_l2), hxgn(NULL) - {} - - - Line_arc_with_hexagon_2(const Line_2 &support, - const Line_2 &l1, - const Line_2 &l2) - : P_arc(support,l1,l2), hxgn(NULL) - {} - - Line_arc_with_hexagon_2(const Line_2 &support, - const Circular_arc_point_2 &begin, - const Circular_arc_point_2 &end) - : P_arc(support, begin, end) , hxgn(NULL) - {} - - - Line_arc_with_hexagon_2(const Segment_2 &s) - : P_arc(s) , hxgn(NULL) - {} - - - Line_arc_with_hexagon_2(const Point_2 &p1, - const Point_2 &p2) - : P_arc(p1,p2) , hxgn(NULL) - {} - - - Line_arc_with_hexagon_2(const Line_arc_2 &a) - : P_arc(a) , hxgn(NULL) - {} - - - - //////////Predicates////////// - - bool is_vertical() const - { return P_arc.is_vertical();} - - //////////Accessors/////////// - - const Line_arc_2& arc () const - { return P_arc ;} - - Hexagon_iterator hexagons_begin() - { return hxgn;} - - Hexagon_iterator hexagons_end() - { return ( (has_no_hexagons())? NULL: hxgn+1);} - - Hexagon_const_iterator hexagons_begin() const - { return hxgn;} - - Hexagon_const_iterator hexagons_end() const - { return ( (has_no_hexagons())? NULL: hxgn+1);} - - unsigned hexagon_no() const - { return ( (has_no_hexagons())? 0 : 1);} - - - ///Interface of the inner arc/// - - typename Qualified_result_of::type - left() const - { return P_arc.left();} - - typename Qualified_result_of::type - right() const - { return P_arc.right();} - - typename Qualified_result_of::type - source() const - { - return typename R::Construct_circular_source_vertex_2()(this->arc()); - } - - typename Qualified_result_of::type - target() const - { - return typename R::Construct_circular_target_vertex_2()(this->arc()); - } - - const Line_2 & supporting_line() const - { return P_arc.supporting_line();} - - Bbox_2 bbox() const - { return P_arc.bbox();} - - - ///Specific check used for hexagon construction/// - - bool has_no_hexagons() const - { return (hxgn==NULL);} - - - ///Hexagon construction/// - - void construct_hexagons() const - { - - typedef typename boost::mpl::if_, \ - Hexagon_construction_with_interval_2, \ - Hexagon_construction_on_lazy_kernel_2 >::type Construct; - hxgn = new Hexagon(Construct()(P_arc)); - } - - - private: - - Line_arc_2 P_arc; - mutable Hexagon *hxgn; - - -}; // Line_arc_with_hexagon_2 - - - - template < typename HK > - std::ostream & - operator<<(std::ostream & os, const Line_arc_with_hexagon_2 &a) - { - // The output format is : - // Supporting line - // Source endpoint - // Target endpoint - return os << a.arc() << " "; - } - - template < typename HK > - std::istream & - operator>>(std::istream & is, Line_arc_with_hexagon_2 &a) - { - typedef typename HK::Circular_kernel CK; - typename CK::Line_2 s; - typename CK::Circular_arc_point_2 p1; - typename CK::Circular_arc_point_2 p2; - is >> s >> p1 >> p2 ; - if (is) - a = Line_arc_with_hexagon_2(s, p1, p2); - return is; - } - -} //namespace CGAL - -#endif // CGAL_LINE_ARC_WITH_HEXAGON_2_H diff --git a/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2/hexagon_filtered_predicates.h b/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2/hexagon_filtered_predicates.h deleted file mode 100644 index 3e0b589b485..00000000000 --- a/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2/hexagon_filtered_predicates.h +++ /dev/null @@ -1,708 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// 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) : Monique Teillaud, Sylvain Pion, Constantinos Tsirogiannis , Pedro Machado - -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (ECG - Effective Computational Geometry for Curves and Surfaces) -// and a STREP (FET Open) Project under Contract No IST-006413 -// (ACS -- Algorithms for Complex Shapes) - -#ifndef CGAL_HEXAGON_FILTERED_PREDICATES_H -#define CGAL_HEXAGON_FILTERED_PREDICATES_H - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace CGAL { - -namespace Hexagon_functors { - - -template -class In_x_range_2 - { - typedef typename HK::Circular_kernel CK; - typedef typename HK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename HK::Circular_arc_2 Circular_arc_2; - typedef typename HK::Line_arc_2 Line_arc_2; - - public: - - typedef bool result_type; - - private: - - template - result_type - _in_x_range_2(const Arc_2 &a, const Circular_arc_point_2 &p) const - { - std::pair pr; - - if(a.has_no_hexagons()) - a.construct_hexagons(); - - typename Arc_2::Hexagon_const_iterator hips; - - pr = to_interval(p.x()); - - hips=a.hexagons_begin(); - - while(hips!=a.hexagons_end()) - { - if( (pr.second >= (*(*hips).left_vertex()).x() && - pr.second <= (*(*hips).right_vertex()).x() ) || - (pr.first >= (*(*hips).left_vertex()).x() && - pr.first <= (*(*hips).right_vertex()).x() ) ) - return CK().in_x_range_2_object()( a.arc() ,p); - - hips++; - } - - return false; - } - - public: - - result_type - operator()( const Circular_arc_2 &a, const Circular_arc_point_2 &p) const - { - CGAL_precondition( a.arc().is_x_monotone()); - return _in_x_range_2(a,p); - } - - result_type - operator()( const Line_arc_2 &a, const Circular_arc_point_2 &p) const - {return _in_x_range_2(a,p);} - - - }; - -template -class Construct_circular_source_vertex_2 - { - typedef typename HK::Circular_kernel CK; - typedef typename HK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename HK::Circular_arc_2 Circular_arc_2; - - public: - - typedef Circular_arc_point_2 result_type; - - template - result_type - operator()(const T& a) const - {return CK().construct_circular_source_vertex_2_object()(a.arc());} - - }; - - -template -class Construct_circular_target_vertex_2 - { - typedef typename HK::Circular_kernel CK; - typedef typename HK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename HK::Circular_arc_2 Circular_arc_2; - - public: - - typedef Circular_arc_point_2 result_type; - - template - result_type - operator()(const T& a) const - {return CK().construct_circular_target_vertex_2_object()(a.arc());} - - }; - - - -template -class Construct_circular_min_vertex_2 - { - typedef typename HK::Circular_kernel CK; - typedef typename HK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename HK::Circular_arc_2 Circular_arc_2; - - public: - - typedef Circular_arc_point_2 result_type; - - template - result_type - operator()(const T& a) const - { return CK().construct_circular_min_vertex_2_object()(a.arc());} - - }; - -template -class Construct_circular_max_vertex_2 - { - typedef typename HK::Circular_kernel CK; - typedef typename HK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename HK::Circular_arc_2 Circular_arc_2; - - public: - - typedef Circular_arc_point_2 result_type; - - template - result_type - operator()(const T& a) const - { return CK().construct_circular_max_vertex_2_object()(a.arc()); } - - }; - - -template -class Has_on_2 - { - typedef typename HK::Circular_kernel CK; - typedef typename HK::Circular_arc_2 Circular_arc_2; - typedef typename HK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename HK::Line_arc_2 Line_arc_2; - - public: - - typedef bool result_type; - - private: - - template - result_type - _has_on_2(const Arc_2 &a, const Circular_arc_point_2 &p) const - { - //Just for the time being - return CK().has_on_2_object()(a.arc(),p); - } - - public: - - result_type - operator()( const Circular_arc_2 &a,const Circular_arc_point_2 &p ) const - { - CGAL_precondition( a.arc().is_x_monotone()); - return _has_on_2(a,p); - } - - result_type - operator()( const Line_arc_2 &a, const Circular_arc_point_2 &p ) const - {return _has_on_2(a,p);} - -}; - - -template -class Is_vertical_2 - { - typedef typename HK::Circular_kernel CK; - typedef typename HK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename HK::Circular_arc_2 Circular_arc_2; - - public: - - typedef bool result_type; - - template - result_type - operator()(const T& a) const - { return CK().is_vertical_2_object()(a.arc()); } - }; - - - - -template -class Compare_y_at_x_2 - { - typedef typename HK::Circular_kernel CK; - typedef typename HK::Circular_arc_2 Circular_arc_2; - typedef typename HK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename HK::Line_arc_2 Line_arc_2; - typedef typename Circular_arc_2::Hexagon Hexagon; - typedef typename Simple_cartesian::Point_2 Point_2; //Attention!!! - typedef Exact_predicates_inexact_constructions_kernel EK; - - public: - - typedef Comparison_result result_type; - - private: - - template - result_type - _compare_y_at_x_2(const Circular_arc_point_2 &p,const Arc_2 &a) const - { - CGAL_precondition_code(bool tmp=In_x_range_2()(a,p)); - CGAL_precondition(tmp ); - - if(a.has_no_hexagons()) - a.construct_hexagons(); - - Comparison_result rel_pos=EQUAL; - Bbox_2 bb = p.bbox(); - - Hexagon pnt_vec; - - pnt_vec.push_back(Point_2(bb.xmin(),bb.ymin())); - pnt_vec.push_back(Point_2(bb.xmin(),bb.ymax())); - pnt_vec.push_back(Point_2(bb.xmax(),bb.ymax())); - pnt_vec.push_back(Point_2(bb.xmax(),bb.ymin())); - - typename Arc_2::Hexagon_const_iterator hips=a.hexagons_begin(); - - while(hips!=a.hexagons_end()) - { - if( !(bb.xmin() > hips->right_vertex()->x() || bb.xmax() < hips->left_vertex()->x()) ) - if(bb.ymin() > hips->top_vertex()->y()) - rel_pos=LARGER; - else if(bb.ymax() < hips->bottom_vertex()->y()) - rel_pos=SMALLER; - else - { - rel_pos=EQUAL; - Hexagon hxgn= *hips; - if(internal::_do_intersect_hexagon_2(hxgn,pnt_vec)) - return CK().compare_y_at_x_2_object()(p,a.arc()); - - - EK::Point_2 a1(hxgn[0].x(),hxgn[0].y()), - a2(hxgn[1].x(),hxgn[1].y()), - a3(pnt_vec[0].x(),pnt_vec[0].y()); - - if ( EK().orientation_2_object()(a1,a2,a3)==RIGHT_TURN) - rel_pos=SMALLER; - else - rel_pos=LARGER; - - } - - hips++; - } - - return rel_pos; - } - - public: - - result_type - operator()( const Circular_arc_point_2 &p,const Circular_arc_2 &a ) const - { - CGAL_kernel_precondition( a.arc().is_x_monotone()); - return _compare_y_at_x_2(p,a); - } - - result_type - operator()( const Circular_arc_point_2 &p,const Line_arc_2 &a ) const - {return _compare_y_at_x_2(p,a);} - -}; - - - -template -class Equal_2 - { - typedef typename HK::Circular_kernel CK; - typedef typename HK::Circular_arc_2 Circular_arc_2; - typedef typename HK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename HK::Line_arc_2 Line_arc_2; - - public: - - typedef bool result_type; - - private: - - template - result_type - _equal_2(const Arc_2 &a,const Arc_2 &b) const - { - if(a.has_no_hexagons()) - a.construct_hexagons(); - - if(b.has_no_hexagons()) - b.construct_hexagons(); - - if(a.hexagon_no() != b.hexagon_no()) - return false; - - typename Arc_2::Hexagon_const_iterator hips=a.hexagons_begin(), - bips=b.hexagons_begin(); - - while(hips!=a.hexagons_end()) - { - if(hips->size()!=bips->size()) - return false; - - for(int j=0;j< hips->size() ;j++) - if( (*hips)[j]!=(*bips)[j] ) - return false; - - hips++; - bips++; - } - - return CK().equal_2_object()( a.arc(),b.arc() ); - - } - - public: - - result_type - operator()( const Circular_arc_point_2 &a , - const Circular_arc_point_2 &b ) const - { return CK().equal_2_object()(a,b);} - - result_type - operator()( const Circular_arc_2 &a , const Circular_arc_2 &b ) const - { - CGAL_precondition( a.arc().is_x_monotone()); - CGAL_precondition( b.arc().is_x_monotone()); - return _equal_2(a,b); - } - - result_type - operator()( const Line_arc_2 &a , - const Line_arc_2 &b ) const - { return _equal_2(a,b);} - - result_type - operator()( const Circular_arc_2 &a , - const Line_arc_2 &b ) const - { return false;} - - result_type - operator()( const Line_arc_2 &a , - const Circular_arc_2 &b ) const - { return false;} - -}; - - -template -class Do_overlap_2 - { - typedef typename HK::Circular_kernel CK; - typedef typename HK::Circular_arc_2 Circular_arc_2; - typedef typename HK::Line_arc_2 Line_arc_2; - - public: - - typedef bool result_type; - - private: - - template - result_type - _do_overlap_2(const Arc_2 &a, const Arc_2 &b) const - { - if(a.has_no_hexagons()) - a.construct_hexagons(); - - if(b.has_no_hexagons()) - b.construct_hexagons(); - - if(internal::do_intersect_hexagons_2( a.hexagons_begin(),a.hexagons_end(),b.hexagons_begin(),b.hexagons_end() ) ) - return CK().do_overlap_2_object()(a.arc(),b.arc()); - - return false; - } - - - public: - - result_type - operator()( const Circular_arc_2 &a , const Circular_arc_2 &b ) const - { - CGAL_precondition( a.arc().is_x_monotone()); - CGAL_precondition( b.arc().is_x_monotone()); - return _do_overlap_2(a,b); - } - - result_type - operator()( const Line_arc_2 &a , - const Line_arc_2 &b ) const - { return _do_overlap_2(a,b);} - - result_type - operator()( const Circular_arc_2 &a , - const Line_arc_2 &b ) const - { return false;} - - result_type - operator()( const Line_arc_2 &a , - const Circular_arc_2 &b ) const - { return false;} - -}; - - -// This predicate cannot be filtered - - template < class HK > - class Compare_y_to_right_2 - { - typedef typename HK::Circular_kernel CK; - typedef typename HK::Circular_arc_2 Circular_arc_2; - typedef typename HK::Circular_arc_point_2 Circular_arc_point_2; - - public: - typedef Comparison_result result_type; - - template - result_type - operator()(const T1 &a1, - const T2 &a2, - const Circular_arc_point_2 &p) const - { return CK().compare_y_to_right_2_object()(a1.arc(), a2.arc(), p); } - - }; - - - - - - template < class HK > - class Make_x_monotone_2 - { - typedef typename HK::Circular_kernel CK; - typedef typename HK::Rcirc_arc_2 Rcirc_arc_2; - typedef typename HK::Circular_arc_2 Circular_arc_2; - typedef typename HK::Line_arc_2 Line_arc_2; - - public: - // typedef OutputIterator result_type; - - template < class OutputIterator > - OutputIterator - operator()(const Circular_arc_2 &A, OutputIterator res) - { - std::vector vec; - - CK().make_x_monotone_2_object()(A.arc(), std::back_inserter(vec) ); - - for(unsigned i=0; i(&vec.at(i)); - - CGAL_assertion(tmp_arc!=NULL); - - *res++ = make_object( Circular_arc_2(*tmp_arc) ); - } - - return res; - } - - template < class OutputIterator > - OutputIterator - operator()(const Line_arc_2 &A, OutputIterator res) - { - *res++ = make_object(A); - return res; - } - }; - - - template < class HK > - class Intersect_2 - { - public: - - typedef typename HK::Circular_kernel CK; - typedef typename HK::Circular_arc_2 Circular_arc_2; - typedef typename HK::Rcirc_arc_2 Rcirc_arc_2; - typedef typename HK::Rline_arc_2 Rline_arc_2; - typedef typename HK::Circle_2 Circle; - typedef typename HK::Line_arc_2 Line_arc_2; - - template < class OutputIterator > - OutputIterator - operator()(const Circle & c1, const Circle & c2, OutputIterator res) - { return CK().intersect_2_object()(c1,c2,res); } - - template < class OutputIterator > - OutputIterator - operator()(const Circular_arc_2 & c1, const Circular_arc_2 & c2, - OutputIterator res) - { - if(c1.has_no_hexagons()) - c1.construct_hexagons(); - - if(c2.has_no_hexagons()) - c2.construct_hexagons(); - - if(!internal::do_intersect_hexagons_2(c1.hexagons_begin(),c1.hexagons_end(), - c2.hexagons_begin(),c2.hexagons_end()) ) - return res; - - std::vector vec; - - CK().intersect_2_object()(c1.arc(),c2.arc(),std::back_inserter(vec)); - - for(unsigned i=0; i(&vec.at(i)) )!=NULL ) - *res++ = make_object( Circular_arc_2(*tmp_arc) ); - else - *res++ = vec.at(i); - } - - return res; - - - } - - template < class OutputIterator > - OutputIterator - operator()(const Line_arc_2 & c1, const Line_arc_2 & c2, - OutputIterator res) - { - if(c1.has_no_hexagons()) - c1.construct_hexagons(); - - if(c2.has_no_hexagons()) - c2.construct_hexagons(); - - if(!internal::do_intersect_hexagons_2(c1.hexagons_begin(),c1.hexagons_end(),c2.hexagons_begin(),c2.hexagons_end()) ) - return res; - - - std::vector vec; - - CK().intersect_2_object()(c1.arc(),c2.arc(),std::back_inserter(vec)); - - for(unsigned i=0; i(&vec.at(i)) )!=NULL ) - *res++ = make_object( Line_arc_2(*tmp_arc) ); - else - *res++ = vec.at(i); - } - - return res; - } - - template < class OutputIterator > - OutputIterator - operator()(const Circular_arc_2 & c1, const Line_arc_2 & c2, - OutputIterator res) - { - if(c1.has_no_hexagons()) - c1.construct_hexagons(); - - if(c2.has_no_hexagons()) - c2.construct_hexagons(); - - if(!internal::do_intersect_hexagons_2(c1.hexagons_begin(),c1.hexagons_end(),c2.hexagons_begin(),c2.hexagons_end()) ) - return res; - - - std::vector vec; - - CK().intersect_2_object()(c1.arc(),c2.arc(),std::back_inserter(vec)); - - for(unsigned i=0; i(&vec.at(i)) )!=NULL ) - *res++ = make_object( Circular_arc_2(*tmp_arc) ); - else if ( (tmp_line=object_cast(&vec.at(i)) )!=NULL ) - *res++ = make_object( Line_arc_2(*tmp_line) ); - else - *res++ = vec.at(i); - } - - return res; - - } - - template < class OutputIterator > - OutputIterator - operator()(const Line_arc_2 & c1, const Circular_arc_2 & c2, - OutputIterator res) - { - return operator()(c2,c1,res); - } - - - }; - - - template < class HK > - class Split_2 - { - - typedef typename HK::Circular_kernel CK; - typedef typename HK::Rcirc_arc_2 Rcirc_arc_2; - typedef typename HK::Rline_arc_2 Rline_arc_2; - typedef typename HK::Circular_arc_2 Circular_arc_2; - typedef typename HK::Line_arc_2 Line_arc_2; - typedef typename HK::Circular_arc_point_2 Circular_arc_point_2; - - public: - typedef void result_type; - - result_type - operator()(const Circular_arc_2 &A, - const Circular_arc_point_2 &p, - Circular_arc_2 &ha1, Circular_arc_2 &ha2) const - { - Rcirc_arc_2 ca1 , ca2; - - CK().split_2_object()(A.arc(), p, ca1, ca2); - - ha1=Circular_arc_2(ca1); - ha2=Circular_arc_2(ca2); - } - - result_type - operator()(const Line_arc_2 &A, - const Circular_arc_point_2 &p, - Line_arc_2 &ha1, Line_arc_2 &ha2) const - { - Rline_arc_2 ca1 , ca2; - - CK().split_2_object()(A.arc(), p, ca1, ca2); - - ha1=Line_arc_2(ca1); - ha2=Line_arc_2(ca2); - } - - }; - - - -} //Hexagon_functors - -} //namespace CGAL - -#endif // CGAL_HEXAGON_FILTERED_PREDICATES_H diff --git a/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2/hexagon_primitives.h b/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2/hexagon_primitives.h deleted file mode 100644 index 224471dbdae..00000000000 --- a/Circular_kernel_2/include/CGAL/Filtered_hexagon_circular_kernel_2/hexagon_primitives.h +++ /dev/null @@ -1,575 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// 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) : Monique Teillaud, Sylvain Pion, Constantinos Tsirogiannis , Pedro Machado - -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (ECG - Effective Computational Geometry for Curves and Surfaces) -// and a STREP (FET Open) Project under Contract No IST-006413 -// (ACS -- Algorithms for Complex Shapes) - -#ifndef CGAL_HEXAGON_PRIMITIVES_H -#define CGAL_HEXAGON_PRIMITIVES_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace CGAL{ - namespace internal{ - -using CGAL::CircularFunctors::advanced_make_xy_monotone; - -CGAL::Polygon_2 < CGAL::Simple_cartesian< double > > - construct_polygon_from_bbox(const CGAL::Bbox_2& bb ) - { - typedef CGAL::Simple_cartesian< double > dK; - typedef dK::Point_2 Point_2; - - CGAL::Polygon_2 < dK > pgn; - - - pgn.insert(pgn.vertices_end(),Point_2(bb.xmin(), bb.ymin())); - pgn.insert(pgn.vertices_end(),Point_2(bb.xmax(), bb.ymin())); - pgn.insert(pgn.vertices_end(),Point_2(bb.xmax(), bb.ymax())); - pgn.insert(pgn.vertices_end(),Point_2(bb.xmin(), bb.ymax())); - - return pgn; - } - - -template -CGAL::Polygon_2 < CGAL::Simple_cartesian< double > > - construct_bounding_hexagon_for_line_arc_2( const typename CK::Line_arc_2 &a) - { - typedef typename CK::Line_arc_2 Line_arc_2; - typedef CGAL::Simple_cartesian dK; - typedef dK::Point_2 Point_2; - typedef CGAL::Polygon_2 Polygon_2; - - CGAL::Bbox_2 src_bb= a.source().bbox(), - trgt_bb= a.target().bbox(); - - if( (src_bb.xmin()<=trgt_bb.xmin() && src_bb.xmax()>=trgt_bb.xmax()) || - (src_bb.ymin()<=trgt_bb.ymin() && src_bb.ymax()>=trgt_bb.ymax()) || - (src_bb.xmin()>=trgt_bb.xmin() && src_bb.xmax()<=trgt_bb.xmax()) || - (src_bb.ymin()>=trgt_bb.ymin() && src_bb.ymax()<=trgt_bb.ymax()) ) - - return construct_polygon_from_bbox(src_bb+trgt_bb); - - Polygon_2 pgn; - - bool tmp; - - if( (tmp=(src_bb.xmin()trgt_bb.ymax())) || - (trgt_bb.xmin()src_bb.ymax())) - { - CGAL::Bbox_2 bb1=(tmp)? src_bb : trgt_bb, - bb2=(tmp)? trgt_bb : src_bb; - - pgn.push_back(Point_2(bb1.xmin(),bb1.ymin())); - pgn.push_back(Point_2(bb2.xmin(),bb2.ymin())); - pgn.push_back(Point_2(bb2.xmax(),bb2.ymin())); - pgn.push_back(Point_2(bb2.xmax(),bb2.ymax())); - pgn.push_back(Point_2(bb1.xmax(),bb1.ymax())); - pgn.push_back(Point_2(bb1.xmin(),bb1.ymax())); - } - else if( ( tmp=(src_bb.xmin() -CGAL::Polygon_2 < CGAL::Simple_cartesian< double > > - construct_bounding_hexagon_2( const Nested_pair &n) - { - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef CGAL::Simple_cartesian dK; - typedef dK::Point_2 Point_2; - typedef CGAL::Polygon_2 Polygon_2; - typedef dK::Line_2 Line_2; - typedef dK::Direction_2 Direction_2; - typedef dK::Vector_2 Vector_2; - typedef typename CK::Root_of_2 Root_of_2; - typedef typename CK::FT FT; - - - Polygon_2 plgn; - - const Circular_arc_2 *a=CGAL::object_cast(&n.first); - - - // For these and the is_on_ booleans it is required to use a lazy nt - CGAL_assertion(a->is_x_monotone()); - CGAL_assertion(a->is_y_monotone()); - - - CGAL::Bbox_2 left_bb(a->left().bbox()), - right_bb(a->right().bbox()); - - - double ymin=(left_bb.ymin()right_bb.ymax())?left_bb.ymax():right_bb.ymax(); - - - bool is_on_upper_part=n.second.first; - bool is_on_left_side =n.second.second ; - - - // Define a hypothetical worst case center (_a,_b) - double _a= (is_on_left_side)? right_bb.xmin() : left_bb.xmax() , _b; - - if(is_on_upper_part) - _b= (is_on_left_side)? left_bb.ymax(): right_bb.ymax(); - else - _b= (is_on_left_side)? left_bb.ymin(): right_bb.ymin(); - - - //Define a worst case radius - double r1= (is_on_left_side)? right_bb.xmin()-left_bb.xmin(): - right_bb.xmax()-left_bb.xmax(); - double r2= (is_on_upper_part)? right_bb.ymax()-left_bb.ymax(): - left_bb.ymin()-right_bb.ymin(); - - if(!is_on_left_side) - r2=-r2; - - Interval_nt<> rad= CGAL::max(r1,r2); - Interval_nt<> sqr2=sqrt(Interval_nt<>(2)); - Interval_nt<> _tngx= (is_on_left_side)? Interval_nt<>(_a)-rad/sqr2: - Interval_nt<>(_a)+rad/sqr2; - Interval_nt<> _tngy= (is_on_upper_part)? Interval_nt<>(_b)+rad/sqr2: - Interval_nt<>(_b)-rad/sqr2; - - double tngx= (is_on_left_side)? to_interval(_tngx).first: - to_interval(_tngx).second; - double tngy= (is_on_upper_part)? to_interval(_tngy).second: - to_interval(_tngy).first; - - // Indicate direction - double dir= ((is_on_upper_part==is_on_left_side)? 1:-1); - CGAL::Interval_nt<> space(to_interval(tngy-dir*tngx).first,to_interval(tngy-dir*tngx).second); - - double x1= (is_on_left_side)?left_bb.xmin():right_bb.xmax(); - double y2; - - if(is_on_upper_part) - y2= (is_on_left_side)? right_bb.ymax(): left_bb.ymax(); - else - y2= (is_on_left_side)? right_bb.ymin(): left_bb.ymin(); - - - CGAL::Interval_nt<> _y1= dir*x1+space; - CGAL::Interval_nt<> _x2= (y2-space)*dir; - - double y1=(is_on_upper_part)? to_interval(_y1).second: to_interval(_y1).first; - double x2=(is_on_left_side)? to_interval(_x2).first: to_interval(_x2).second; - - - //Points 1 & 2 or just the 1st one - - if (x2right_bb.xmax()||y1ymax) - plgn.push_back(Point_2(((is_on_left_side)?left_bb.xmin():right_bb.xmax()), - ((is_on_upper_part)? ymax : ymin))); - else if (is_on_left_side){ - plgn.push_back(Point_2(x1,y1)); - plgn.push_back(Point_2(x2,y2)); - } else{ - plgn.push_back(Point_2(x2,y2)); - plgn.push_back(Point_2(x1,y1)); - } - - //Point 3 -- we get it through the righmost endpoint - if(is_on_upper_part==is_on_left_side) - plgn.push_back(Point_2(right_bb.xmax(),right_bb.ymax())); - else - plgn.push_back(Point_2(right_bb.xmax(),right_bb.ymin())); - - - if(is_on_upper_part && is_on_left_side && - (right_bb.ymin()<=left_bb.ymin() || left_bb.xmax()>=right_bb.xmax() ) ) - plgn.push_back(Point_2(right_bb.xmax(), left_bb.ymin())); - else if(is_on_upper_part && !is_on_left_side && - (left_bb.ymin()<=right_bb.ymin() || right_bb.xmin()<= left_bb.xmin())) - plgn.push_back(Point_2(left_bb.xmin(), right_bb.ymin())); - else if(!is_on_upper_part && is_on_left_side && - (right_bb.ymax()>=left_bb.ymax() || left_bb.xmax()>=right_bb.xmax())) - plgn.push_back(Point_2(right_bb.xmax(), left_bb.ymax())); - else if(!is_on_upper_part && !is_on_left_side && - (left_bb.ymax()>=right_bb.ymax() || right_bb.xmin()<= left_bb.xmin())) - plgn.push_back(Point_2(left_bb.xmin(), right_bb.ymax())); - else - { - - // Point 4 - double _x1,_y1; - if(is_on_left_side) - _x1=right_bb.xmax(); - else - _x1=right_bb.xmin(); - - if(is_on_upper_part) - _y1=right_bb.ymin(); - else - _y1=right_bb.ymax(); - - plgn.push_back(Point_2(_x1,_y1)); - - - //Point 5 - - if(is_on_left_side) - _x1=left_bb.xmax(); - else - _x1=left_bb.xmin(); - - if(is_on_upper_part) - _y1=left_bb.ymin(); - else - _y1=left_bb.ymax(); - - plgn.push_back(Point_2(_x1,_y1)); - } - - - //Point 6 - if(is_on_upper_part==is_on_left_side) - plgn.push_back(Point_2(left_bb.xmin(),left_bb.ymin())); - else - plgn.push_back(Point_2(left_bb.xmin(),left_bb.ymax())); - - - //Reverse (except the last one) the order of the vertices if the hexagon - //is on the upper part , so that all the hexagons - //appear with their vertices in counterclockwise order - - if(is_on_upper_part) - { - std::stack stck; - int siz=plgn.size(); - - for(int i=0;i -Output_iterator construct_bounding_hexagons_2(const typename CK::Circular_arc_2 &a, Output_iterator res) - { - - typedef std::pair< bool,bool > Position; - typedef std::pair Verbose_type; - typedef std::vector Xy_mon_vector; - typedef CGAL::Simple_cartesian K; - typedef std::vector< CGAL::Polygon_2 > Polygon_vector; - - Xy_mon_vector xy_arcs; - Polygon_vector polygons; - - advanced_make_xy_monotone(a,std::back_inserter(xy_arcs)); - - - for(unsigned int i=0;i(xy_arcs.at(i)); - - return res; - - } - - bool _inner_intersect_hexagon_predicate(const CGAL::Polygon_2 > &a, - const CGAL::Polygon_2 > &b) - { - - typedef Simple_cartesian CK; - typedef CK::RT RT; - typedef CK::Point_2 Point_2; - typedef CGAL::Polygon_2 Polygon_2; - typedef Simple_cartesian > intrv_CK; - typedef intrv_CK::Line_2 intrv_Line_2; - typedef intrv_CK::Point_2 intrv_Point_2; - - - bool pred=(a[0].x()!=a[1].x() && a[0].y()!=a[1].y()); - - Interval_nt<> d1=a[0].x(),d2=a[0].y(); - Interval_nt<> e1=a[1].x(),e2=a[1].y(); - intrv_Point_2 a0( d1, d2 ); - intrv_Point_2 a1( e1, e2 ); - - intrv_Line_2 tmp_ln(a0,a1); - - - if(pred && !tmp_ln.is_vertical()) - { - int i; - - for(i=0;i app_y=tmp_ln.y_at_x(b[i].x()).pair(); - - if(b[i].y()>=app_y.first ) - if(i==0) - break; - else - return true; - } - - if(i!=0) - return false; - - } - - - //Condition implied: the segment used for testing is vertical - if(a[2+pred].x()==a[3+pred].x()) - return true; - - Interval_nt<> d12=a[2+pred].x(),d22=a[2+pred].y(); - Interval_nt<> e12=a[3+pred].x(),e22=a[3+pred].y(); - intrv_Point_2 a2( d12, d22 ); - intrv_Point_2 a3( e12, e22 ); - - intrv_Line_2 tmp_ln2(a2,a3); - - for(int i=0;i app_y=tmp_ln2.y_at_x(b[i].x()).pair(); - - if(b[i].y()<=app_y.second ) - return true; - } - - return false; - -} - - -bool _do_intersect_hexagon_2(const CGAL::Polygon_2 > &p1, - const CGAL::Polygon_2 > &p2) - { - typedef Simple_cartesian CK; - typedef CK::RT RT; - typedef CK::Point_2 Point_2; - typedef CGAL::Polygon_2 Polygon_2; - typedef Simple_cartesian > intrv_CK; - typedef intrv_CK::Line_2 intrv_Line_2; - typedef intrv_CK::Point_2 intrv_Point_2; - - Polygon_2 a,b; - bool intersect,tmp=0; - Point_2 frst,scnd; - - int size1=p1.size(), - size2=p2.size(); - - if(size1==4 && size2==4) - return true; - - if(size1==4) - { - a=p2; - b=p1; - } else if (size2==4) - { - a=p1; - b=p2; - } else - { - - CGAL::Bbox_2 test1(p1.left_vertex()->x(),p1.bottom_vertex()->y(), - p1.right_vertex()->x() ,p1.top_vertex()->y()); - - for(int i=0;i=test1.xmin() && p2[i].x()<=test1.xmax() && - p2[i].y()>=test1.ymin() && p2[i].y()<=test1.ymax())) - break; - - if(tmp) - { - a=p1; - b=p2; - }else - { - a=p2; - b=p1; - } - - } - - intersect=_inner_intersect_hexagon_predicate(a,b); - - if(intersect==false || b.size()==4) - return intersect; - else - return _inner_intersect_hexagon_predicate(b,a); - - } - -// This is meant for x_monotone and for non-x_monotone cases -template < typename Hex_iterator1, typename Hex_iterator2 > -bool do_intersect_hexagons_2(Hex_iterator1 a_begin, Hex_iterator1 a_end, Hex_iterator2 b_begin, Hex_iterator2 b_end) - { - - for(Hex_iterator1 it1=a_begin;it1!=a_end;it1++) - for(Hex_iterator2 it2=b_begin;it2!=b_end;it2++) - if( !(it2->top_vertex()->y() < it1->bottom_vertex()->y() || - it2->bottom_vertex()->y() > it1->top_vertex()->y() || - it2->right_vertex()->x() < it1->left_vertex()->x() || - it2->left_vertex()->x() > it1->right_vertex()->x() )) - { - bool tmp = _do_intersect_hexagon_2(*it1,*it2); - if (tmp) - return true; - - } - - return false; - - }// do_intersect_hexagons_2 - - - }//namespace internal - - -//Lazy like functors that there is no use to be included in the kernel - -template < class CK, class Hexagon> - class Hexagon_construction_with_interval_2 { - - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Line_arc_2 Line_arc_2; - typedef CGAL::Simple_cartesian > FK; - typedef CGAL::Circular_kernel_2< FK,CGAL::Algebraic_kernel_for_circles_2_2 > CK2; - typedef CGAL::Circular_kernel_converter Conv; - - public: - - template < class OutputIterator> - OutputIterator - operator()(const Circular_arc_2 &a, OutputIterator res) const - { - Conv cnv; - static const bool Protection = true; - try{return internal::construct_bounding_hexagons_2(cnv(a),res);} - catch (Uncertain_conversion_exception) - { - CGAL::Protect_FPU_rounding P(CGAL_FE_TONEAREST); - return internal::construct_bounding_hexagons_2(a,res); - } - - } - - Hexagon operator()(const Line_arc_2 &a) const - { - Conv cnv; - static const bool Protection = true; - try{return internal::construct_bounding_hexagon_for_line_arc_2(cnv(a));} - catch (Uncertain_conversion_exception) - { - CGAL::Protect_FPU_rounding P(CGAL_FE_TONEAREST); - return internal::construct_bounding_hexagon_for_line_arc_2(a); - } - - } - -}; - - -template < class CK, class Hexagon> - class Hexagon_construction_on_lazy_kernel_2 { - - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Line_arc_2 Line_arc_2; - - public: - - template < class OutputIterator> - OutputIterator - operator()(const Circular_arc_2 &a, OutputIterator res) const - { - static const bool Protection = true; - try{return internal::construct_bounding_hexagons_2(a.approx(),res);} - catch (Uncertain_conversion_exception) - { - CGAL::Protect_FPU_rounding P(CGAL_FE_TONEAREST); - return internal::construct_bounding_hexagons_2(a.exact(),res); - } - - } - - Hexagon operator()(const Line_arc_2 &a) const - { - static const bool Protection = true; - try{return internal::construct_bounding_hexagon_for_line_arc_2(a.approx());} - catch (Uncertain_conversion_exception) - { - CGAL::Protect_FPU_rounding P(CGAL_FE_TONEAREST); - return internal::construct_bounding_hexagon_for_line_arc_2(a.exact()); - } - - } -}; - - -}// namespace CGAL - -#endif // CGAL_HEXAGON_PRIMITIVES_H diff --git a/Circular_kernel_2/include/CGAL/Lazy_circular_kernel_2.h b/Circular_kernel_2/include/CGAL/Lazy_circular_kernel_2.h deleted file mode 100644 index f4129f036c0..00000000000 --- a/Circular_kernel_2/include/CGAL/Lazy_circular_kernel_2.h +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// 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) : Monique Teillaud, Sylvain Pion, Andreas Fabri, Constantinos Tsirogiannis - -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (ECG - Effective Computational Geometry for Curves and Surfaces) -// and a STREP (FET Open) Project under Contract No IST-006413 -// (ACS -- Algorithms for Complex Shapes) - - -#ifndef CGAL_LAZY_CIRCULAR_KERNEL_H -#define CGAL_LAZY_CIRCULAR_KERNEL_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -namespace CGAL { - -// Some specializations (move to another file ?) -template < typename K1, typename K2 > -struct Type_mapper < typename K1::Circular_arc_2, K1, K2 > -{ - typedef typename K2::Circular_arc_2 type; -}; - -template < typename K1, typename K2 > -struct Type_mapper < typename K1::Circular_arc_point_2, K1, K2 > -{ - typedef typename K2::Circular_arc_point_2 type; -}; - -template < typename K1, typename K2 > -struct Type_mapper < typename K1::Line_arc_2, K1, K2 > -{ - typedef typename K2::Line_arc_2 type; -}; - - -// EK = exact kernel that will be made lazy -// Kernel = lazy kernel -template < typename EK_, typename AK_, typename E2A_, typename Kernel > -class Lazy_circular_kernel_base -// : public EK::template Base::Type -#if 1 - : public Lazy_kernel_base< EK_, AK_, E2A_, - Lazy_kernel > -#endif -{ - // typedef typename EK::template Base::Type Kernel_base; - // Hardcoded for now. - // typedef Simple_cartesian AK; // An optimiser -public: - typedef AK_ AK; - typedef typename EK_::Algebraic_kernel Algebraic_kernel; - // typedef Simple_cartesian > AK; - typedef EK_ EK; - typedef E2A_ E2A; - - typedef Approx_converter C2F; - typedef Exact_converter C2E; - -#if 0 - typedef typename EK::Algebraic_kernel Al_EK; - typedef typename AK::Algebraic_kernel Al_AK; - typedef Algebraic_kernel_converter, - To_interval > Al_K_converter; - - typedef typename EK::Linear_kernel Ln_EK; - typedef typename AK::Linear_kernel Ln_AK; - typedef Cartesian_converter > Ln_converter; - - // typedef Circular_kernel_converter E2A; - - //typedef Lazy_kernel Linear_kernel; - typedef Lazy_kernel Linear_kernel0; - typedef typename Linear_kernel0::template Base::Type Linear_kernel; // should not be needed. - -#endif - - template < typename Kernel2 > - struct Base { typedef Lazy_circular_kernel_base Type; }; - - // What to do with the tag ? - // Probably this should not exist, should it ? - // struct filter_tag{}; - // typedef filter_tag Kernel_tag; - // typedef typename CK::Kernel_tag Kernel_tag; - // typedef typename CK::Rep_tag Rep_tag; - - - //Please remove this if you consider it to be sloppy - struct Lazy_tag{}; - typedef Lazy_tag Definition_tag; - typedef typename EK::Definition_tag Circular_tag; - //////////////////////////////////////////////////// - - // Types - typedef CGAL::Lazy_exact_nt FT; - typedef FT RT; - typedef typename Root_of_traits::RootOf_2 Root_of_2; - -// typedef Lazy Root_of_2; - - typedef FT Cartesian_coordinate_type; - typedef RT Homogeneous_coordinate_type; //Nothing to do with the circular_k - //just for the time being - - typedef CGAL::Object Object_2; - typedef CGAL::Object Object_3; - - typedef Lazy Circular_arc_2; - - typedef Lazy Circular_arc_point_2; - - typedef Lazy Line_arc_2; - - // typedef Root_for_circles_2_2 Root_for_circles_2_2; - typedef int Root_for_circles_2_2; // should AK be filtered ? - - // We don't touch the predicates. -#define CGAL_Circular_Kernel_pred(P, Pf) \ - typedef Filtered_predicate< typename EK::P, typename AK::P, C2E, C2F> P; \ - P Pf() const { return P(); } - - - // We change the constructions. - -#define CGAL_Circular_Kernel_cons(C, Cf) \ - typedef typename boost::mpl::if_, \ - Lazy_construct_intersections_2 , \ - typename boost::mpl::if_, \ - Lazy_make_x_monotone_2 , \ - typename boost::mpl::if_, \ - Lazy_make_x_monotone_2 , \ - typename boost::mpl::if_, \ - Lazy_functor_2_2 , \ - typename boost::mpl::if_, \ - Lazy_construction_bbox, \ - typename boost::mpl::if_,\ - Lazy_construction_nt,\ - typename boost::mpl::if_,\ - Lazy_construction_object,\ - Lazy_construction >::type >::type >::type >::type >::type >::type >::type C; \ - C Cf() const { return C(); } - - - -#include - -}; - -template -struct Lazy_circular_kernel_adaptor - : public Lazy_circular_kernel_base< EK, AK, E2A, Lazy_circular_kernel_adaptor > -{}; - -template -struct Lazy_circular_kernel_without_type_equality - : public Lazy_circular_kernel_base< EK, AK, E2A, Lazy_circular_kernel_without_type_equality > -{}; - -template , - // Algebraic_kernel_2_2 >, - class E2A = Circular_kernel_converter >, - Algebraic_kernel_converter< typename EK::Algebraic_kernel, typename AK::Algebraic_kernel, - To_interval, To_interval > > > -struct Lazy_circular_kernel_2 - : public Circular_kernel_type_equality_wrapper< - Lazy_circular_kernel_base< EK, AK, E2A, Lazy_circular_kernel_2 >, - Lazy_circular_kernel_2 > -{}; - -} //namespace CGAL - -#endif // CGAL_LAZY_CIRCULAR_KERNEL_H diff --git a/Circular_kernel_2/include/CGAL/Lazy_circular_kernel_constructions.h b/Circular_kernel_2/include/CGAL/Lazy_circular_kernel_constructions.h deleted file mode 100644 index c62e6d005b9..00000000000 --- a/Circular_kernel_2/include/CGAL/Lazy_circular_kernel_constructions.h +++ /dev/null @@ -1,417 +0,0 @@ -// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org); you may redistribute it under -// the terms of the Q Public License version 1.0. -// See the file LICENSE.QPL distributed with CGAL. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// 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) : Monique Teillaud, Sylvain Pion, Andreas Fabri, Constantinos Tsirogiannis - -// Partially supported by the IST Programme of the EU as a Shared-cost -// RTD (FET Open) Project under Contract No IST-2000-26473 -// (ECG - Effective Computational Geometry for Curves and Surfaces) -// and a STREP (FET Open) Project under Contract No IST-006413 -// (ACS -- Algorithms for Complex Shapes) - -#ifndef CGAL_LAZY_CIRCULAR_KERNEL_CONSTRUCTIONS_H -#define CGAL_LAZY_CIRCULAR_KERNEL_CONSTRUCTIONS_H - -#include -#include - -//TODO : More if-else's with object cast for all the possible -// types that could be returned by object-returning functions - -namespace CGAL { - -template -Object -make_lazy_CK(const Object& eto) -{ - typedef typename LK::AK AK; - typedef typename LK::EK EK; - typedef typename LK::E2A E2A; - - const std::pair *ptr; - - if(( ptr = - object_cast >(&eto))){ - return make_object(std::make_pair(typename LK::Circular_arc_point_2( - typename LK::Circular_arc_point_2::Rep( - new Lazy_rep_0(ptr->first))),ptr->second)); - } else if(const typename EK::Circular_arc_2* ptr = - object_cast(&eto)){ - return make_object(typename LK::Circular_arc_2(typename LK::Circular_arc_2::Rep( - new Lazy_rep_0(*ptr)))); - } else if(const typename EK::Line_arc_2* ptr = - object_cast(&eto)){ - return make_object(typename LK::Line_arc_2(typename LK::Line_arc_2::Rep( - new Lazy_rep_0(*ptr)))); - } else{ - std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's" << std::endl; - } - return Object(); -} - - -// This is the magic functor for functors that write their result as Objects into an output iterator - -template -struct Lazy_construct_intersections_2 { - - static const bool Protection = true; - - typedef typename LK::AK AK; - typedef typename LK::EK EK; - typedef typename EK::FT EFT; - typedef typename LK::E2A E2A; - typedef void result_type; - typedef Lazy Lazy_object; - typedef Lazy, std::vector, EFT, E2A> Lazy_vector; - AC ac; - EC ec; - -public: - - // In the example we intersect two Lazys - // and write into a back_inserter(list,Lazy]) >) - template - OutputIterator - operator()(const L1& l1, const L2& l2, OutputIterator it) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - try { - Protect_FPU_rounding P; - Lazy_vector lv(new Lazy_rep_with_vector_2(ac, ec, l1, l2)); - - for(unsigned int i = 0; i < lv.approx().size(); i++){ - - const std::pair *temp_p; - - if((temp_p=object_cast >(& (lv.approx()[i])))){ - *it = make_object(std::make_pair(typename LK::Circular_arc_point_2( - typename LK::Circular_arc_point_2::Rep( - new Lazy_rep_1, - Ith, E2A, - Lazy_vector>(Ith(i,false), - Ith(i,false), lv))),temp_p->second)); - ++it; - } else if(object_cast(& (lv.approx()[i]))){ - *it = make_object(typename LK::Circular_arc_2( typename LK::Circular_arc_2::Rep( - new Lazy_rep_1, - Ith,E2A, - Lazy_vector>(Ith(i), - Ith(i), lv)))); - ++it; - } else if(object_cast(& (lv.approx()[i]))){ - *it = make_object(typename LK::Line_arc_2( typename LK::Line_arc_2::Rep( - new Lazy_rep_1, - Ith,E2A, - Lazy_vector>(Ith(i), - Ith(i), lv)))); - ++it; - } else{ - std::cout << "UNEXPECTED CONSTRUCT_INTERSECTIONS_2 PRODUCT" << std::endl; - std::cout << lv.approx()[i].type().name() << std::endl; - CGAL_error(); - } - } - - } catch (Uncertain_conversion_exception) { - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P(CGAL_FE_TONEAREST); - // TODO: Instead of using a vector, write an iterator adapter - std::vector exact_objects; - ec(CGAL::exact(l1), CGAL::exact(l2), std::back_inserter(exact_objects)); - for (std::vector::iterator oit = exact_objects.begin(); - oit != exact_objects.end(); - oit++){ - *it = make_lazy_CK(*oit); - ++it; - } - } - return it; - } -}; - -template -struct Lazy_make_x_monotone_2 { - - static const bool Protection = true; - - typedef typename LK::AK AK; - typedef typename LK::EK EK; - typedef typename EK::FT EFT; - typedef typename LK::E2A E2A; - typedef void result_type; - typedef Lazy Lazy_object; - typedef Lazy, std::vector, EFT, E2A> Lazy_vector; - AC ac; - EC ec; - -public: - - // In the example we intersect two Lazys - // and write into a back_inserter(list,Lazy]) >) - template - OutputIterator - operator()(const L1& l1,OutputIterator it) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - try { - Protect_FPU_rounding P; - Lazy_vector lv(new Lazy_rep_with_vector_1(ac, ec, l1)); - // lv.approx() is a std::vector - // that is, when we get here we have constructed all approximate results - for(unsigned int i = 0; i < lv.approx().size(); i++){ - if(object_cast(& (lv.approx()[i]))){ - *it = make_object(typename LK::Circular_arc_2( - typename LK::Circular_arc_2::Rep( - new Lazy_rep_1, - Ith,E2A, - Lazy_vector>(Ith(i), - Ith(i), lv)))); - ++it; - } else if(object_cast(& (lv.approx()[i]))){ - *it = make_object(typename LK::Line_arc_2(typename LK::Line_arc_2::Rep( - new Lazy_rep_1, - Ith,E2A, - Lazy_vector>(Ith(i), - Ith(i), lv)))); - ++it; - } - else { - CGAL_error_msg( "UNEXPECTED MAKE_X_MONOTONE PRODUCT"); - } - } - - } catch (Uncertain_conversion_exception) { - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P(CGAL_FE_TONEAREST); - // TODO: Instead of using a vector, write an iterator adapter - std::vector exact_objects; - ec(CGAL::exact(l1), std::back_inserter(exact_objects)); - for (std::vector::iterator oit = exact_objects.begin(); - oit != exact_objects.end(); - oit++){ - *it = make_lazy_CK(*oit); - ++it; - } - } - return it; - } -}; - - -template -struct Lazy_advanced_make_x_monotone_2 { - - static const bool Protection = true; - - typedef typename LK::AK AK; - typedef typename LK::EK EK; - typedef typename EK::FT EFT; - typedef typename LK::E2A E2A; - typedef void result_type; - typedef Lazy Lazy_object; - typedef Lazy, std::vector, EFT, E2A> Lazy_vector; - AC ac; - EC ec; - -public: - - // In the example we intersect two Lazys - // and write into a back_inserter(list,Lazy]) >) - template - OutputIterator - operator()(const L1& l1,OutputIterator it) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - try { - Protect_FPU_rounding P; - Lazy_vector lv(new Lazy_rep_with_vector_1(ac, ec, l1)); - // lv.approx() is a std::vector - // that is, when we get here we have constructed all approximate results - for(unsigned int i = 0; i < lv.approx().size(); i++){ - if(object_cast(& (lv.approx()[i].first))){ - *it = std::make_pair(make_object(typename LK::Circular_arc_2(typename LK::Circular_arc_2::Rep( - new Lazy_rep_1, - Ith,E2A, - Lazy_vector>(Ith(i), - Ith(i), lv)))),lv.approx()[i].second); - ++it; - } else if(object_cast(& (lv.approx()[i].first))){ - *it = std::make_pair(make_object(typename LK::Line_arc_2(typename LK::Line_arc_2::Rep( - new Lazy_rep_1, - Ith,E2A, - Lazy_vector>(Ith(i), - Ith(i), lv)))),lv.approx()[i].second); - ++it; - } - else{ - CGAL_error_msg( "UNEXPECTED ADVANCED_MAKE_X_MONOTONE PRODUCT"); - } - } - - } catch (Uncertain_conversion_exception) { - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P(CGAL_FE_TONEAREST); - // TODO: Instead of using a vector, write an iterator adapter - std::vector exact_objects; - ec(CGAL::exact(l1), std::back_inserter(exact_objects)); - for (std::vector::iterator oit = exact_objects.begin(); - oit != exact_objects.end(); - ++oit){ - CGAL_error_msg( "Unfinished code !!!"); - //*it = std::make_pair(make_lazy_CK((*oit).first),(*oit).second); - ++it; - } - } - return it; - } -}; - -// The following functor returns an Object with a Lazy inside -// As the nested kernels return Objects of AK::Something and EK::Something -// we have to unwrap them from the Object, and wrap them in a Lazy -// -// TODO: write operators for more than two arguments. For the current kernel we only need two for -// Construct_intersections_2 and one for Make_x_monotone_2 - -template -struct Lazy_construction_object_CK { - - static const bool Protection = true; - typedef typename LK::AK AK; - typedef typename LK::EK EK; - typedef typename EK::FT EFT; - typedef typename LK::E2A E2A; - typedef typename AC::result_type AT; - typedef typename EC::result_type ET; - typedef Object result_type; - - typedef Lazy Lazy_object; - AC ac; - EC ec; - -public: - - -template - result_type - operator()(const L1& l1) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - try { - Protect_FPU_rounding P; - Lazy_object lo(new Lazy_rep_1(ac, ec, l1)); - - std::pair *temp_p; - - if((temp_p=object_cast >(& (lo.approx())))){ - typedef Lazy_rep_1, - Object_cast, E2A, Lazy_object> Lcr; - Lcr * lcr = new Lcr(Object_cast(), - Object_cast(), lo); - return make_object(std::make_pair(typename LK::Circular_arc_point_2( - typename LK::Circular_arc_point_2::Rep(lcr)),temp_p->second)); - } else if(object_cast(& (lo.approx()))){ - typedef Lazy_rep_1, - Object_cast, E2A, Lazy_object> Lcr; - Lcr * lcr = new Lcr(Object_cast(), - Object_cast(), lo); - return make_object(typename LK::Circular_arc_point_2(typename LK::Circular_arc_point_2::Rep(lcr))); - } else if(object_cast(& (lo.approx()))){ - typedef Lazy_rep_1, - Object_cast, E2A, Lazy_object> Lcr; - Lcr * lcr = new Lcr(Object_cast(), - Object_cast(), lo); - return make_object(typename LK::Circular_arc_2(typename LK::Circular_arc_2::Rep(lcr)));} - else if(object_cast(& (lo.approx()))){ - typedef Lazy_rep_1, - Object_cast, E2A, Lazy_object> Lcr; - Lcr * lcr = new Lcr(Object_cast(), - Object_cast(), lo); - return make_object(typename LK::Line_arc_2(typename LK::Line_arc_2::Rep(lcr)));} - else { - std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's" << std::endl; - } - } catch (Uncertain_conversion_exception) { - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P(CGAL_FE_TONEAREST); - ET eto = ec(CGAL::exact(l1)); - return make_lazy_CK(eto); - } - return Object(); - } - - - - template - result_type - operator()(const L1& l1, const L2& l2) const - { - CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); - try { - Protect_FPU_rounding P; - Lazy_object lo(new Lazy_rep_2(ac, ec, l1, l2)); - - std::pair *temp_p; - - - if((temp_p=object_cast >(& (lo.approx())))){ - typedef Lazy_rep_1, - Object_cast, E2A, Lazy_object> Lcr; - Lcr * lcr = new Lcr(Object_cast(), - Object_cast(), lo); - return make_object(std::make_pair(typename LK::Circular_arc_point_2( - typename LK::Circular_arc_point_2::Rep(lcr)),temp_p->second)); - } else if(object_cast(& (lo.approx()))){ - typedef Lazy_rep_1, - Object_cast, E2A, Lazy_object> Lcr; - Lcr * lcr = new Lcr(Object_cast(), - Object_cast(), lo); - return make_object(typename LK::Circular_arc_point_2(typename LK::Circular_arc_point_2::Rep(lcr))); - } else if(object_cast(& (lo.approx()))){ - typedef Lazy_rep_1, - Object_cast, E2A, Lazy_object> Lcr; - Lcr * lcr = new Lcr(Object_cast(), - Object_cast(), lo); - return make_object(typename LK::Circular_arc_2(typename LK::Circular_arc_2::Rep(lcr)));} - else if(object_cast(& (lo.approx()))){ - typedef Lazy_rep_1, - Object_cast, E2A, Lazy_object> Lcr; - Lcr * lcr = new Lcr(Object_cast(), - Object_cast(), lo); - return make_object(typename LK::Line_arc_2(typename LK::Line_arc_2::Rep(lcr)));} - else { - std::cerr << "object_cast inside Lazy_construction_rep::operator() failed. It needs more else if's" << std::endl; - } - } catch (Uncertain_conversion_exception) { - CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding P(CGAL_FE_TONEAREST); - ET eto = ec(CGAL::exact(l1), CGAL::exact(l2)); - return make_lazy_CK(eto); - } - return Object(); - } - -}; - -} //namespace CGAL - -#endif // CGAL_LAZY_CIRCULAR_KERNEL_CONSTRUCTIONS_H diff --git a/Circular_kernel_2/test/Circular_kernel_2/old_lazy/test_Lazy_Line_arc.cpp b/Circular_kernel_2/test/Circular_kernel_2/old_lazy/test_Lazy_Line_arc.cpp deleted file mode 100644 index 1b2be546c19..00000000000 --- a/Circular_kernel_2/test/Circular_kernel_2/old_lazy/test_Lazy_Line_arc.cpp +++ /dev/null @@ -1,1079 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -template -void _test_Line_arc(CK ck) -{ - typedef typename CK::FT FT; - typedef typename CK::Circle_2 Circle_2; - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Point_2 Point_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Intersect_2 Intersect_2; - typedef typename CK::Split_2 Split_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Do_overlap_2 Do_overlap_2; - CGAL::Random generatorOfgenerator; - int random_seed = generatorOfgenerator.get_int(0, 123456); - std::cout << "random_seed = " << random_seed << std::endl; - CGAL::Random theRandom(random_seed); - //int random_max = 127; - //int random_min = -127; - Point_2 center_circle1(0, 0); - int circle1_r = 5; - Circle_2 circle1(center_circle1, circle1_r * circle1_r); - Circle_2 circle2(center_circle1, circle1_r * circle1_r * 4); - Point_2 p2_line_horizontal(1, 0); - - Line_arc_2 line_arc_horizontal(Line_2(center_circle1, p2_line_horizontal), - circle1, - true, - circle2, - false); - assert(line_arc_horizontal.source().x() == -5); - assert(line_arc_horizontal.source().y() == 0); - assert(line_arc_horizontal.target().x() == 10); - assert(line_arc_horizontal.target().y() == 0); - Point_2 p2_line_vertical(0, 1); - Line_arc_2 line_arc_vertical(Line_2(center_circle1, p2_line_vertical), - circle1, - true, - Circle_2(center_circle1, circle1_r * circle1_r * 4), - false); - assert(line_arc_vertical.source().x() == 0); - assert(line_arc_vertical.source().y() == -5); - assert(line_arc_vertical.target().x() == 0); - assert(line_arc_vertical.target().y() == 10); - Point_2 p2_line_diagonal(3, 4); - Line_arc_2 line_arc_diagonal(Line_2(center_circle1, p2_line_diagonal), - circle1, - true, - Circle_2(center_circle1, circle1_r * circle1_r * 4), - false); - Circular_arc_2(circle1, line_arc_diagonal.source(), line_arc_diagonal.source()); - Circular_arc_2(circle2, line_arc_diagonal.target(), line_arc_diagonal.target()); - - Line_arc_2 line_arc_2(Line_2(center_circle1, p2_line_horizontal), - Line_2(Point_2(0, -1), Point_2(1,0)), - Line_2(Point_2(0, -1), Point_2(-1, 0))); - - //////////////Intersection Line_arc Line_arc////////////////// - - Intersect_2 theConstruct_intersect_2 = ck.intersect_2_object(); - - std::vector< CGAL::Object > - vector_for_intersection_1; - theConstruct_intersect_2(line_arc_horizontal, - line_arc_vertical, - std::back_inserter(vector_for_intersection_1)); - std::pair the_pair; - assert(assign(the_pair, vector_for_intersection_1[0])); - Circular_arc_point_2 first = the_pair.first; - assert(first.x() == 0); - assert(first.y() == 0); - - Line_arc_2 line_arc_3(Point_2(-1, -2), Point_2(2,1)); - std::vector< CGAL::Object > - vector_for_intersection_2; - theConstruct_intersect_2(line_arc_horizontal, - line_arc_3, - std::back_inserter(vector_for_intersection_2)); - assert(assign(the_pair, vector_for_intersection_2[0])); - first = the_pair.first; - assert(first.x() == 1); - assert(first.y() == 0); - - std::vector< CGAL::Object > - vector_for_intersection_3; - theConstruct_intersect_2(line_arc_vertical, - line_arc_3, - std::back_inserter(vector_for_intersection_3)); - assert(assign(the_pair, vector_for_intersection_3[0])); - first = the_pair.first; - assert(first.x() == 0); - assert(first.y() == -1); - - Line_arc_2 line_arc_4(Point_2(20, -2), Point_2(20,10)); - std::vector< CGAL::Object > - vector_for_intersection_4; - theConstruct_intersect_2(line_arc_horizontal, - line_arc_4, - std::back_inserter(vector_for_intersection_4)); - assert(vector_for_intersection_4.size() == 0); - - - - ////////////intersection in overlap/////////////// - std::vector< CGAL::Object > - vector_for_intersection_5; - theConstruct_intersect_2(line_arc_horizontal, - line_arc_horizontal, - std::back_inserter(vector_for_intersection_5)); - Line_arc_2 line_arc_tmp; - assert(vector_for_intersection_5.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_5[0])); - assert(line_arc_tmp == line_arc_horizontal); - - Line_arc_2 line_arc_horizontal2(Line_2(center_circle1, p2_line_horizontal), - circle1, - true, - circle1, - false); - std::vector< CGAL::Object > - vector_for_intersection_6; - theConstruct_intersect_2(line_arc_horizontal, - line_arc_horizontal2, - std::back_inserter(vector_for_intersection_6)); - assert(vector_for_intersection_6.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_6[0])); - assert(line_arc_tmp.source() == line_arc_horizontal.source()); - assert(line_arc_tmp.target() == line_arc_horizontal2.target()); - - - - std::vector< CGAL::Object > - vector_for_intersection_6_reverse; - theConstruct_intersect_2(line_arc_horizontal2, - line_arc_horizontal, - std::back_inserter(vector_for_intersection_6_reverse)); - assert(vector_for_intersection_6_reverse.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_6_reverse[0])); - assert(line_arc_tmp.source() == line_arc_horizontal.source()); - assert(line_arc_tmp.target() == line_arc_horizontal2.target()); - - - - Line_arc_2 line_arc_horizontal3(Line_2(center_circle1, p2_line_horizontal), - circle2, - true, - circle1, - false); - std::vector< CGAL::Object > - vector_for_intersection_7; - theConstruct_intersect_2(line_arc_horizontal, - line_arc_horizontal3, - std::back_inserter(vector_for_intersection_7)); - assert(vector_for_intersection_7.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_7[0])); - assert(line_arc_tmp.source() == line_arc_horizontal.source()); - assert(line_arc_tmp.target() == line_arc_horizontal3.target()); - - std::vector< CGAL::Object > - vector_for_intersection_8; - theConstruct_intersect_2(line_arc_horizontal3, - line_arc_horizontal, - std::back_inserter(vector_for_intersection_8)); - assert(vector_for_intersection_8.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_8[0])); - assert(line_arc_tmp.source() == line_arc_horizontal.source()); - assert(line_arc_tmp.target() == line_arc_horizontal3.target()); - - std::vector< CGAL::Object > - vector_for_intersection_8_bis_1; - theConstruct_intersect_2(line_arc_horizontal3, - line_arc_horizontal2, - std::back_inserter(vector_for_intersection_8_bis_1)); - assert(vector_for_intersection_8_bis_1.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_8_bis_1[0])); - assert(line_arc_tmp.source() == line_arc_horizontal2.source()); - assert(line_arc_tmp.target() == line_arc_horizontal3.target()); - - std::vector< CGAL::Object > - vector_for_intersection_8_bis_2; - theConstruct_intersect_2(line_arc_horizontal2, - line_arc_horizontal3, - std::back_inserter(vector_for_intersection_8_bis_2)); - assert(vector_for_intersection_8_bis_2.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_8_bis_2[0])); - assert(line_arc_tmp.source() == line_arc_horizontal2.source()); - assert(line_arc_tmp.target() == line_arc_horizontal3.target()); - - - Line_arc_2 line_arc_horizontal4(Line_2(center_circle1, p2_line_horizontal), - circle2, - true, - circle1, - true); - std::vector< CGAL::Object > - vector_for_intersection_9; - theConstruct_intersect_2(line_arc_horizontal4, - line_arc_horizontal, - std::back_inserter(vector_for_intersection_9)); - assert(vector_for_intersection_9.size() == 1); - assert(assign(the_pair, vector_for_intersection_9[0])); - assert(the_pair.second == 1); - assert(the_pair.first == line_arc_horizontal.source()); - - std::vector< CGAL::Object > - vector_for_intersection_10; - theConstruct_intersect_2(line_arc_horizontal, - line_arc_horizontal4, - std::back_inserter(vector_for_intersection_10)); - assert(vector_for_intersection_10.size() == 1); - assert(assign(the_pair, vector_for_intersection_10[0])); - assert(the_pair.second == 1); - assert(the_pair.first == line_arc_horizontal.source()); - - - std::vector< CGAL::Object > - vector_for_intersection_11; - theConstruct_intersect_2(Line_arc_2(Point_2(-1, -1),Point_2(2, 2)), - Line_arc_2(Point_2(0, 0), Point_2(1, 1)), - std::back_inserter(vector_for_intersection_11)); - assert(vector_for_intersection_11.size() == 1); - assert(assign(line_arc_tmp, vector_for_intersection_11[0])); - assert(line_arc_tmp == Line_arc_2(Point_2(0, 0), Point_2(1, 1))); - - - //////Split///////////// - - std::vector< CGAL::Object > - vector_for_intersection_split_1; - theConstruct_intersect_2(line_arc_horizontal, - line_arc_3, - std::back_inserter(vector_for_intersection_split_1)); - assert(assign(the_pair, vector_for_intersection_split_1[0])); - Circular_arc_point_2 point_of_split = the_pair.first; - Split_2 theSplit_2 = ck.split_2_object(); - Line_arc_2 first_part_line_arc_horizontal; - Line_arc_2 second_part_line_arc_horizontal; - theSplit_2(line_arc_horizontal, point_of_split, first_part_line_arc_horizontal, second_part_line_arc_horizontal); - assert(first_part_line_arc_horizontal.source() == line_arc_horizontal.source()); - assert(first_part_line_arc_horizontal.target() == point_of_split); - assert(second_part_line_arc_horizontal.source() == point_of_split); - assert(second_part_line_arc_horizontal.target() == line_arc_horizontal.target()); - - ////Overlap////// - - Do_overlap_2 theDo_overlap_2 = ck.do_overlap_2_object(); - assert(theDo_overlap_2(line_arc_horizontal, line_arc_horizontal)); - assert(theDo_overlap_2(line_arc_horizontal, line_arc_horizontal2)); - assert(!theDo_overlap_2(line_arc_horizontal, line_arc_vertical)); - -} - - -template -void _test_intersection_Line_arc_Circle(CK ck) -{ - typedef typename CK::FT FT; - typedef typename CK::Circle_2 Circle_2; - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Point_2 Point_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Intersect_2 Intersect_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Line_arc_2 Line_arc_2; - CGAL::Random generatorOfgenerator; - int random_seed = generatorOfgenerator.get_int(0, 123456); - std::cout << "random_seed = " << random_seed << std::endl; - CGAL::Random theRandom(random_seed); - - Intersect_2 theConstruct_intersect_2 = ck.intersect_2_object(); - Point_2 center_circle1(0, 0); - int circle1_r = 5; - Circle_2 circle1(center_circle1, circle1_r * circle1_r); - Circle_2 circle2(center_circle1, circle1_r * circle1_r * 4); - Point_2 p2_line_horizontal(1, 0); - Point_2 p2_high_circle2(0, circle1_r * 2); - Point_2 p2_low_circle2(0, circle1_r * -2); - Point_2 p2_left_circle2(circle1_r * -2, 0); - Point_2 p2_right_circle2(circle1_r * 2, 0); - Point_2 p2_high_right_circle2(circle1_r * 2, circle1_r * 2); - Point_2 p2_high_left_circle2(circle1_r * -2, circle1_r * 2); - Point_2 p2_low_right_circle2(circle1_r * 2, circle1_r * -2); - Point_2 p2_low_left_circle2(circle1_r * -2, circle1_r * -2); - Line_arc_2 line_arc_horizontal(Line_2(center_circle1, - p2_line_horizontal), - circle1, - true, - circle2, - false); - Line_arc_2 line_arc_horizontal2(Line_2(center_circle1, - p2_line_horizontal), - circle1, - true, - circle1, - false); - Line_arc_2 line_arc_horizontal3(Line_2(center_circle1, - p2_line_horizontal), - circle2, - true, - circle1, - false); - Point_2 p2_line_vertical(0, 1); - Line_arc_2 line_arc_vertical(Line_2(center_circle1, - p2_line_vertical), - circle1, - true, - circle2, - false); - Line_arc_2 line_arc_vertical2(Line_2(center_circle1, - p2_line_vertical), - circle1, - true, - circle1, - false); - Line_arc_2 line_arc_vertical3(Line_2(center_circle1, - p2_line_vertical), - circle2, - true, - circle1, - false); - Point_2 p2_line_diagonal(2, -2); - Line_arc_2 line_arc_diagonal(Line_2(center_circle1, - p2_line_diagonal), - circle1, - true, - circle2, - false); - Line_arc_2 line_arc_diagonal2(Line_2(center_circle1, - p2_line_diagonal), - circle1, - true, - circle1, - false); - Line_arc_2 line_arc_diagonal3(Line_2(center_circle1, - p2_line_diagonal), - circle2, - true, - circle1, - false); - - ////////test horizontal////// - std::vector< CGAL::Object > - vector_for_intersection_1; - theConstruct_intersect_2(line_arc_horizontal, - circle1, - std::back_inserter(vector_for_intersection_1)); - std::pair the_pair; - assert(vector_for_intersection_1.size() == 2); - assert(assign(the_pair, vector_for_intersection_1[0])); - Circular_arc_point_2 first = the_pair.first; - assert(first == line_arc_horizontal.source()); - assert(the_pair.second == 1); - assert(assign(the_pair, vector_for_intersection_1[1])); - first = the_pair.first; - assert(first == line_arc_horizontal2.target()); - assert(the_pair.second == 1); - - std::vector< CGAL::Object > - vector_for_intersection_2; - theConstruct_intersect_2(line_arc_horizontal, - circle2, - std::back_inserter(vector_for_intersection_2)); - assert(vector_for_intersection_2.size() == 1); - assert(assign(the_pair, vector_for_intersection_2[0])); - first = the_pair.first; - assert(first == line_arc_horizontal.target()); - assert(the_pair.second == 1); - - std::vector< CGAL::Object > - vector_for_intersection_3; - theConstruct_intersect_2(line_arc_horizontal2, - circle2, - std::back_inserter(vector_for_intersection_3)); - assert(vector_for_intersection_3.size() == 0); - - std::vector< CGAL::Object > - vector_for_intersection_4; - theConstruct_intersect_2(line_arc_horizontal3, - circle2, - std::back_inserter(vector_for_intersection_4)); - assert(vector_for_intersection_4.size() == 1); - assert(assign(the_pair, vector_for_intersection_4[0])); - first = the_pair.first; - assert(first == line_arc_horizontal3.source()); - assert(the_pair.second == 1); - - Line_arc_2 line_arc_aux(p2_high_circle2,p2_high_right_circle2); - std::vector< CGAL::Object > - vector_for_intersection_5; - theConstruct_intersect_2(Line_arc_2(p2_high_left_circle2,p2_high_right_circle2), - circle2, - std::back_inserter(vector_for_intersection_5)); - assert(vector_for_intersection_5.size() == 1); - theConstruct_intersect_2(line_arc_aux, - circle2, - std::back_inserter(vector_for_intersection_5)); - assert(vector_for_intersection_5.size() == 2); - assert(assign(the_pair, vector_for_intersection_5[0])); - first = the_pair.first; - assert(first == line_arc_aux.source()); - assert(the_pair.second == 2); - assert(assign(the_pair, vector_for_intersection_5[1])); - first = the_pair.first; - assert(first == line_arc_aux.source()); - assert(the_pair.second == 2); - - line_arc_aux = Line_arc_2(p2_low_circle2,p2_low_right_circle2); - std::vector< CGAL::Object > - vector_for_intersection_6; - theConstruct_intersect_2(Line_arc_2(p2_low_left_circle2,p2_low_right_circle2), - circle2, - std::back_inserter(vector_for_intersection_6)); - assert(vector_for_intersection_6.size() == 1); - theConstruct_intersect_2(line_arc_aux, - circle2, - std::back_inserter(vector_for_intersection_6)); - assert(vector_for_intersection_6.size() == 2); - assert(assign(the_pair, vector_for_intersection_6[0])); - first = the_pair.first; - assert(first == line_arc_aux.source()); - assert(the_pair.second == 2); - assert(assign(the_pair, vector_for_intersection_6[1])); - first = the_pair.first; - assert(first == line_arc_aux.source()); - assert(the_pair.second == 2); - - ////////test vertical////// - std::vector< CGAL::Object > - vector_for_intersection_7; - theConstruct_intersect_2(line_arc_vertical, - circle1, - std::back_inserter(vector_for_intersection_7)); - assert(vector_for_intersection_7.size() == 2); - assert(assign(the_pair, vector_for_intersection_7[0])); - first = the_pair.first; - assert(first == line_arc_vertical.source()); - assert(the_pair.second == 1); - assert(assign(the_pair, vector_for_intersection_7[1])); - first = the_pair.first; - assert(first == line_arc_vertical2.target()); - assert(the_pair.second == 1); - - std::vector< CGAL::Object > - vector_for_intersection_8; - theConstruct_intersect_2(line_arc_vertical, - circle2, - std::back_inserter(vector_for_intersection_8)); - std::cout << vector_for_intersection_8.size() << std::endl; - assert(vector_for_intersection_8.size() == 1); - assert(assign(the_pair, vector_for_intersection_8[0])); - first = the_pair.first; - assert(first == line_arc_vertical.target()); - assert(the_pair.second == 1); - - std::vector< CGAL::Object > - vector_for_intersection_9; - theConstruct_intersect_2(line_arc_vertical2, - circle2, - std::back_inserter(vector_for_intersection_9)); - assert(vector_for_intersection_9.size() == 0); - - std::vector< CGAL::Object > - vector_for_intersection_10; - theConstruct_intersect_2(line_arc_vertical3, - circle2, - std::back_inserter(vector_for_intersection_10)); - assert(vector_for_intersection_10.size() == 1); - assert(assign(the_pair, vector_for_intersection_10[0])); - first = the_pair.first; - assert(first == line_arc_vertical3.source()); - assert(the_pair.second == 1); - - line_arc_aux = Line_arc_2(p2_right_circle2,p2_high_right_circle2); - std::vector< CGAL::Object > - vector_for_intersection_11; - theConstruct_intersect_2(Line_arc_2(p2_low_right_circle2,p2_high_right_circle2), - circle2, - std::back_inserter(vector_for_intersection_11)); - assert(vector_for_intersection_11.size() == 1); - theConstruct_intersect_2(line_arc_aux, - circle2, - std::back_inserter(vector_for_intersection_11)); - assert(vector_for_intersection_11.size() == 2); - assert(assign(the_pair, vector_for_intersection_11[0])); - first = the_pair.first; - assert(first == line_arc_aux.source()); - assert(the_pair.second == 2); - assert(assign(the_pair, vector_for_intersection_11[1])); - first = the_pair.first; - assert(first == line_arc_aux.source()); - assert(the_pair.second == 2); - - line_arc_aux = Line_arc_2(p2_left_circle2,p2_high_left_circle2); - std::vector< CGAL::Object > - vector_for_intersection_12; - theConstruct_intersect_2(Line_arc_2(p2_low_left_circle2,p2_high_left_circle2), - circle2, - std::back_inserter(vector_for_intersection_12)); - assert(vector_for_intersection_12.size() == 1); - theConstruct_intersect_2(line_arc_aux, - circle2, - std::back_inserter(vector_for_intersection_12)); - assert(vector_for_intersection_12.size() == 2); - assert(assign(the_pair, vector_for_intersection_12[0])); - first = the_pair.first; - assert(first == line_arc_aux.source()); - assert(the_pair.second == 2); - assert(assign(the_pair, vector_for_intersection_12[1])); - first = the_pair.first; - assert(first == line_arc_aux.source()); - assert(the_pair.second == 2); - - //test diagonal - std::vector< CGAL::Object > - vector_for_intersection_13; - theConstruct_intersect_2(line_arc_diagonal, - circle1, - std::back_inserter(vector_for_intersection_13)); - assert(vector_for_intersection_13.size() == 2); - assert(assign(the_pair, vector_for_intersection_13[0])); - first = the_pair.first; - assert(first == line_arc_diagonal.source()); - assert(the_pair.second == 1); - assert(assign(the_pair, vector_for_intersection_13[1])); - first = the_pair.first; - assert(first == line_arc_diagonal2.target()); - assert(the_pair.second == 1); - - std::vector< CGAL::Object > - vector_for_intersection_14; - theConstruct_intersect_2(line_arc_diagonal, - circle2, - std::back_inserter(vector_for_intersection_14)); - assert(vector_for_intersection_14.size() == 1); - assert(assign(the_pair, vector_for_intersection_14[0])); - first = the_pair.first; - assert(first == line_arc_diagonal.target()); - assert(the_pair.second == 1); - - std::vector< CGAL::Object > - vector_for_intersection_15; - theConstruct_intersect_2(line_arc_diagonal2, - circle2, - std::back_inserter(vector_for_intersection_15)); - assert(vector_for_intersection_15.size() == 0); - - std::vector< CGAL::Object > - vector_for_intersection_16; - theConstruct_intersect_2(line_arc_diagonal3, - circle2, - std::back_inserter(vector_for_intersection_16)); - assert(vector_for_intersection_16.size() == 1); - assert(assign(the_pair, vector_for_intersection_16[0])); - first = the_pair.first; - assert(first == line_arc_diagonal3.source()); - assert(the_pair.second == 1); - - - //Diagonal tangent - - std::vector< CGAL::Object > - vector_for_intersection_17; - theConstruct_intersect_2(Line_arc_2(Point_2(-10, -5), Point_2(5, 15)), - circle1, - std::back_inserter(vector_for_intersection_17)); - assert(vector_for_intersection_17.size() == 1); - assert(assign(the_pair, vector_for_intersection_17[0])); - assert(the_pair.second == 2); - - - std::vector< CGAL::Object > - vector_for_intersection_18; - theConstruct_intersect_2(Line_arc_2(Point_2(10, -5), Point_2(-5, 15)), - circle1, - std::back_inserter(vector_for_intersection_18)); - assert(vector_for_intersection_18.size() == 1); - assert(assign(the_pair, vector_for_intersection_18[0])); - assert(the_pair.second == 2); - - - std::vector< CGAL::Object > - vector_for_intersection_19; - theConstruct_intersect_2(Line_arc_2(Point_2(10, 5), Point_2(-5, -15)), - circle1, - std::back_inserter(vector_for_intersection_19)); - assert(vector_for_intersection_19.size() == 1); - assert(assign(the_pair, vector_for_intersection_19[0])); - assert(the_pair.second == 2); - - std::vector< CGAL::Object > - vector_for_intersection_20; - theConstruct_intersect_2(Line_arc_2(Point_2(-10, 5), Point_2(5, -15)), - circle1, - std::back_inserter(vector_for_intersection_20)); - assert(vector_for_intersection_20.size() == 1); - assert(assign(the_pair, vector_for_intersection_20[0])); - assert(the_pair.second == 2); - -} - -template -void _test_intersection_Line_arc_Circular_arc(CK ck) -{ - typedef typename CK::FT FT; - typedef typename CK::Circle_2 Circle_2; - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Point_2 Point_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Intersect_2 Intersect_2; - typedef typename CK::Make_x_monotone_2 Make_x_monotone_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Line_arc_2 Line_arc_2; - CGAL::Random generatorOfgenerator; - int random_seed = generatorOfgenerator.get_int(0, 123456); - std::cout << "random_seed = " << random_seed << std::endl; - CGAL::Random theRandom(random_seed); - - Intersect_2 theConstruct_intersect_2 = ck.intersect_2_object(); - Point_2 center_circle1(0, 0); - int circle1_r = 5; - Circle_2 circle1(center_circle1, circle1_r * circle1_r); - Circle_2 circle2(center_circle1, circle1_r * circle1_r * 4); - Point_2 p2_line_horizontal(1, 0); - - Line_arc_2 line_arc_horizontal(Line_2(center_circle1, - p2_line_horizontal), - circle1, - true, - circle2, - false); - Line_arc_2 line_arc_horizontal2(Line_2(center_circle1, - p2_line_horizontal), - circle1, - true, - circle1, - false); - Line_arc_2 line_arc_horizontal3(Line_2(center_circle1, - p2_line_horizontal), - circle2, - true, - circle2, - false); - Point_2 p2_line_vertical(0, 1); - Line_arc_2 line_arc_vertical(Line_2(center_circle1, - p2_line_vertical), - circle1, - true, - Circle_2(center_circle1, - circle1_r * circle1_r * 4), - false); - Point_2 p2_line_diagonal(3, 4); - Line_arc_2 line_arc_diagonal(Line_2(center_circle1, - p2_line_diagonal), - circle1, - true, - Circle_2(center_circle1, - circle1_r * circle1_r * 4), - false); - Circular_arc_2 arc_1(circle2, - Line_2(center_circle1, - p2_line_horizontal), - true, - Line_2(center_circle1, - p2_line_vertical), - false); - Circular_arc_2 arc_2(circle1, - Line_2(center_circle1, - p2_line_horizontal), - true, - Line_2(center_circle1, - p2_line_vertical), - false); - std::vector< CGAL::Object > - vector_for_intersection_1; - theConstruct_intersect_2(line_arc_horizontal3, - arc_1, - std::back_inserter(vector_for_intersection_1)); - std::pair the_pair; - assert(vector_for_intersection_1.size() == 2); - assert(assign(the_pair, vector_for_intersection_1[0])); - Circular_arc_point_2 first = the_pair.first; - assert(first == line_arc_horizontal3.source()); - assert(the_pair.second == 1); - assert(assign(the_pair, vector_for_intersection_1[1])); - first = the_pair.first; - assert(first == line_arc_horizontal3.target()); - assert(the_pair.second == 1); - - std::vector< CGAL::Object > - vector_for_intersection_2; - theConstruct_intersect_2(line_arc_horizontal, - arc_1, - std::back_inserter(vector_for_intersection_2)); - assert(vector_for_intersection_2.size() == 1); - assert(assign(the_pair, vector_for_intersection_2[0])); - first = the_pair.first; - assert(first == line_arc_horizontal.target()); - assert(the_pair.second == 1); - - std::vector< CGAL::Object > - vector_for_intersection_3; - theConstruct_intersect_2(line_arc_vertical, - arc_1, - std::back_inserter(vector_for_intersection_3)); - assert(vector_for_intersection_3.size() == 1); - assert(assign(the_pair, vector_for_intersection_3[0])); - first = the_pair.first; - assert(first == arc_1.target()); - assert(the_pair.second == 1); - - std::vector< CGAL::Object > - vector_for_intersection_4; - theConstruct_intersect_2(Line_arc_2(Point_2(-10, -5), Point_2(5, 15)), - arc_2, - std::back_inserter(vector_for_intersection_4)); - assert(vector_for_intersection_4.size() == 0); - - std::vector< CGAL::Object > - vector_for_intersection_5; - theConstruct_intersect_2(Line_arc_2(Point_2(10, -5), Point_2(-5, 15)), - arc_2, - std::back_inserter(vector_for_intersection_5)); - assert(vector_for_intersection_5.size() == 1); - assert(assign(the_pair, vector_for_intersection_5[0])); - assert(the_pair.second == 2); - - //random - int random_max = 127; - int random_min = -127; - Point_2 center_circle_random1(0,0); - int circle_random1_r = theRandom.get_int(1, random_max); - Point_2 p_random1; - do{ - p_random1 = Point_2(theRandom.get_int(random_min, random_max) * circle_random1_r, - theRandom.get_int(random_min, random_max) * circle_random1_r); - }while(p_random1 == center_circle_random1); - Point_2 p_random2; - do{ - p_random2 = Point_2(theRandom.get_int(random_min, random_max) * circle_random1_r, - theRandom.get_int(random_min, random_max) * circle_random1_r); - }while(p_random2 == center_circle_random1); - Circle_2 circle_random1(center_circle_random1, circle_random1_r * circle_random1_r); - Circular_arc_2 arc_random_1(circle_random1, - Line_2(center_circle_random1, - p_random1), - true, - Line_2(center_circle_random1, - p_random2), - false); - - Circular_arc_point_2 first2; - std::vector< CGAL::Object > - vector_for_intersection_random1; - theConstruct_intersect_2(Line_arc_2(Point_2(-p_random1.x(),-p_random1.y()), - p_random1), - arc_random_1, - std::back_inserter(vector_for_intersection_random1)); - assert(vector_for_intersection_random1.size() > 0); - assert(assign(the_pair, vector_for_intersection_random1[0])); - first = the_pair.first; - assert(the_pair.second == 1); - assert(first == arc_random_1.source()); - - - - std::vector< CGAL::Object > - vector_for_intersection_random2; - theConstruct_intersect_2(Line_arc_2(Point_2(-p_random2.x(),-p_random2.y()),p_random2), - arc_random_1, - std::back_inserter(vector_for_intersection_random2)); - assert(vector_for_intersection_random2.size() > 0); - assert(assign(the_pair, vector_for_intersection_random2[0])); - first = the_pair.first; - assert(the_pair.second == 1); - if(vector_for_intersection_random2.size() == 2){ - assert(assign(the_pair, vector_for_intersection_random2[1])); - first2 = the_pair.first; - assert(the_pair.second == 1); - assert((first == arc_random_1.target()) || (first2 == arc_random_1.target())); - } - else{ - assert(first == arc_random_1.target()); - } - - - for (int loop = 0; loop < 200; loop++){ - Make_x_monotone_2 theMake_x_monotone = ck.make_x_monotone_2_object(); - Point_2 p_random3; - do{ - p_random3 = Point_2(theRandom.get_int(random_min, random_max), - theRandom.get_int(random_min, random_max)); - }while(p_random3 == center_circle_random1); - Point_2 p_random4; - do{ - p_random4 = Point_2(theRandom.get_int(random_min, random_max), - theRandom.get_int(random_min, random_max)); - }while(p_random4 == center_circle_random1 || - p_random4 == p_random3); - - std::vector< CGAL::Object > vector_for_intersection_random3; - theConstruct_intersect_2(Line_arc_2(p_random3,p_random4), - arc_random_1, - std::back_inserter(vector_for_intersection_random3)); - for( std::size_t i = 0; i < vector_for_intersection_random3.size(); i++){ - assert(assign(the_pair, vector_for_intersection_random3[i])); - first = the_pair.first; - std::vector objects_x_monotone; - theMake_x_monotone( arc_random_1, std::back_inserter(objects_x_monotone)); - bool is_on_arc = false; - for(std::size_t j = 0; j < objects_x_monotone.size(); j++){ - Circular_arc_2 aux; - assign(aux, objects_x_monotone[j]); - if(ck.has_on_2_object()(aux, first)){ - is_on_arc = true; - break; - } - } - assert(is_on_arc); - } - } -} - -template -void _test_compare_y_to_right(CK ck) -{ - typedef typename CK::FT FT; - typedef typename CK::Circle_2 Circle_2; - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Point_2 Point_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Intersect_2 Intersect_2; - typedef typename CK::Make_x_monotone_2 Make_x_monotone_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Line_arc_2 Line_arc_2; - CGAL::Random generatorOfgenerator; - int random_seed = generatorOfgenerator.get_int(0, 123456); - std::cout << "random_seed = " << random_seed << std::endl; - CGAL::Random theRandom(random_seed); - - Intersect_2 theConstruct_intersect_2 = ck.intersect_2_object(); - Point_2 center_circle1(0, 0); - int circle1_r = 5; - Circle_2 circle1(center_circle1, circle1_r * circle1_r); - Circle_2 circle2(center_circle1, circle1_r * circle1_r * 4); - Point_2 p2_line_horizontal(1, 0); - Point_2 p2_line_diagonal(1, 1); - Line_arc_2 line_arc_horizontal(Line_2(center_circle1, - p2_line_horizontal), - circle1, - true, - circle2, - false); - Line_arc_2 line_arc_diagonal(Line_2(center_circle1, - p2_line_diagonal), - circle1,true, - circle2,false); - std::vector< CGAL::Object > - vector_for_intersection_1; - theConstruct_intersect_2(line_arc_horizontal, - line_arc_diagonal, - std::back_inserter(vector_for_intersection_1)); - std::pair the_pair; - assert(assign(the_pair, vector_for_intersection_1[0])); - Circular_arc_point_2 first = the_pair.first; - - assert(ck.compare_y_to_right_2_object()(line_arc_horizontal, - line_arc_diagonal, - first) == CGAL::SMALLER); - - assert(ck.compare_y_to_right_2_object()(line_arc_diagonal, - line_arc_horizontal, - first) == CGAL::LARGER); - assert(ck.compare_y_to_right_2_object()(line_arc_diagonal, - line_arc_diagonal, - first) == CGAL::EQUAL); - - - Circular_arc_2 part_high(circle1, - line_arc_horizontal.supporting_line(), false, - line_arc_horizontal.supporting_line(), true); - - Circular_arc_2 part_low(circle1, - line_arc_horizontal.supporting_line(), true, - line_arc_horizontal.supporting_line(), false); - - assert(ck.compare_y_to_right_2_object()(line_arc_horizontal, - part_high, - part_high.target()) == CGAL::SMALLER); - assert(ck.compare_y_to_right_2_object()(line_arc_horizontal, - part_low, - part_low.source()) == CGAL::LARGER); - Point_2 p2_high(0, circle1_r); - Point_2 p2_high_right(circle1_r, circle1_r); - Line_arc_2 line_arc_horizontal_high(p2_high, - p2_high_right); - assert(ck.compare_y_to_right_2_object()(line_arc_horizontal_high, - part_high, - line_arc_horizontal_high.source()) == CGAL::LARGER); - Point_2 p2_low(0, -circle1_r); - Point_2 p2_low_right(circle1_r, -circle1_r); - Line_arc_2 line_arc_horizontal_low(p2_low, - p2_low_right - ); - assert(ck.compare_y_to_right_2_object()(line_arc_horizontal_low, - part_low, - line_arc_horizontal_low.source()) == CGAL::SMALLER); - - std::vector< CGAL::Object > - vector_for_intersection_2; - theConstruct_intersect_2(part_high, - line_arc_diagonal, - std::back_inserter(vector_for_intersection_2)); - assert(assign(the_pair, vector_for_intersection_2[0])); - first = the_pair.first; - assert(ck.compare_y_to_right_2_object()(line_arc_diagonal, - part_high, - first) == CGAL::LARGER); - std::vector< CGAL::Object > - vector_for_intersection_3; - theConstruct_intersect_2(part_low, - line_arc_diagonal, - std::back_inserter(vector_for_intersection_3)); - assert(assign(the_pair, vector_for_intersection_3[0])); - first = the_pair.first; - assert(ck.compare_y_to_right_2_object()(line_arc_diagonal, - part_low, - first) == CGAL::LARGER); - Point_2 p2_line_diagonal2(1, -1); - Line_arc_2 line_arc_diagonal2(Line_2(center_circle1, - p2_line_diagonal2), - circle1,true, - circle2,false); - std::vector< CGAL::Object > - vector_for_intersection_4; - theConstruct_intersect_2(part_high, - line_arc_diagonal2, - std::back_inserter(vector_for_intersection_4)); - assert(assign(the_pair, vector_for_intersection_4[0])); - first = the_pair.first; - assert(ck.compare_y_to_right_2_object()(line_arc_diagonal2, - part_high, - first) == CGAL::SMALLER); - std::vector< CGAL::Object > - vector_for_intersection_5; - theConstruct_intersect_2(part_low, - line_arc_diagonal2, - std::back_inserter(vector_for_intersection_5)); - assert(assign(the_pair, vector_for_intersection_5[0])); - first = the_pair.first; - assert(ck.compare_y_to_right_2_object()(line_arc_diagonal2, - part_low, - first) == CGAL::SMALLER); -} - -template -void _test_compare_y_at_x(CK ck) -{ - typedef typename CK::FT FT; - typedef typename CK::Circle_2 Circle_2; - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Point_2 Point_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Intersect_2 Intersect_2; - typedef typename CK::Make_x_monotone_2 Make_x_monotone_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Compare_y_at_x_2 Compare_y_at_x_2; - - Line_arc_2 line_arc_horizontal(Point_2(-1, 0), Point_2(1, 0)); - Line_arc_2 line_arc_vertical(Point_2(0, 0), Point_2(0, 1)); - Line_arc_2 line_arc_vertical2(Point_2(0, -1), Point_2(0, 1)); - Line_arc_2 line_arc_diagonal(Point_2(-1, -1), Point_2(1, 1)); - Line_arc_2 line_arc_diagonal2(Point_2(-1, 1), Point_2(1, -1)); - Line_arc_2 line_arc_vertical3(Point_2(0, -1), Point_2(0, 2)); - Compare_y_at_x_2 theCompare_y_at_x_2 = ck.compare_y_at_x_2_object(); - assert(theCompare_y_at_x_2(line_arc_vertical.target(), - line_arc_horizontal) == CGAL::LARGER); - assert(theCompare_y_at_x_2(line_arc_vertical2.source(), - line_arc_horizontal) == CGAL::SMALLER); - assert(theCompare_y_at_x_2(line_arc_vertical.source(), - line_arc_horizontal) == CGAL::EQUAL); - assert(theCompare_y_at_x_2(line_arc_vertical2.source(), - line_arc_vertical) == CGAL::SMALLER); - assert(theCompare_y_at_x_2(line_arc_vertical2.target(), - line_arc_vertical) == CGAL::EQUAL); - assert(theCompare_y_at_x_2(line_arc_vertical3.target(), - line_arc_vertical) == CGAL::LARGER); - assert(theCompare_y_at_x_2(line_arc_vertical2.target(), - line_arc_diagonal) == CGAL::LARGER); - assert(theCompare_y_at_x_2(line_arc_vertical2.source(), - line_arc_diagonal) == CGAL::SMALLER); - assert(theCompare_y_at_x_2(line_arc_vertical2.target(), - line_arc_diagonal2) == CGAL::LARGER); - assert(theCompare_y_at_x_2(line_arc_vertical2.source(), - line_arc_diagonal2) == CGAL::SMALLER); - assert(theCompare_y_at_x_2(line_arc_vertical.source(), - line_arc_diagonal) == CGAL::EQUAL); - assert(theCompare_y_at_x_2(line_arc_diagonal.source(), - line_arc_diagonal) == CGAL::EQUAL); - assert(theCompare_y_at_x_2(line_arc_diagonal.target(), - line_arc_diagonal) == CGAL::EQUAL); - -} - - - -template -void _test_has_on(CK ck) -{ - typedef typename CK::FT FT; - typedef typename CK::Circle_2 Circle_2; - typedef typename CK::Circular_arc_2 Circular_arc_2; - typedef typename CK::Point_2 Point_2; - typedef typename CK::Line_2 Line_2; - typedef typename CK::Intersect_2 Intersect_2; - typedef typename CK::Make_x_monotone_2 Make_x_monotone_2; - typedef typename CK::Circular_arc_point_2 Circular_arc_point_2; - typedef typename CK::Line_arc_2 Line_arc_2; - typedef typename CK::Compare_y_at_x_2 Compare_y_at_x_2; - - Line_arc_2 line_arc_horizontal(Point_2(-1, 0), Point_2(1, 0)); - Line_arc_2 line_arc_vertical(Point_2(0, 0), Point_2(0, 1)); - Line_arc_2 line_arc_vertical2(Point_2(0, -1), Point_2(0, 1)); - Line_arc_2 line_arc_diagonal(Point_2(-1, -1), Point_2(1, 1)); - Line_arc_2 line_arc_diagonal2(Point_2(-1, 1), Point_2(1, -1)); - Line_arc_2 line_arc_vertical3(Point_2(0, -1), Point_2(0, 2)); - assert(ck.has_on_2_object()(line_arc_horizontal, - line_arc_vertical.source())); - assert(!ck.has_on_2_object()(line_arc_horizontal, - line_arc_vertical.target())); - assert(!ck.has_on_2_object()(line_arc_vertical, - line_arc_vertical2.source())); - assert(ck.has_on_2_object()(line_arc_vertical, - line_arc_vertical2.target())); - assert(ck.has_on_2_object()(line_arc_diagonal, - line_arc_vertical.source())); - -} - - - - - -int main() -{ - typedef CGAL::Quotient NT1; - typedef CGAL::Cartesian Linear_k1; - typedef CGAL::Algebraic_kernel_for_circles_2_2 Algebraic_k1; - typedef CGAL::Circular_kernel_2 CK1; - - typedef CGAL::Interval_nt_advanced NT2; - typedef CGAL::Cartesian Linear_k2; - typedef CGAL::Algebraic_kernel_for_circles_2_2 Algebraic_k2; - typedef CGAL::Circular_kernel_2 CK2; - typedef CGAL::Lazy_circular_kernel_2 Circular_kernel; - Circular_kernel ck; - - - _test_Line_arc(ck); - _test_intersection_Line_arc_Circle(ck); - _test_intersection_Line_arc_Circular_arc(ck); - _test_compare_y_to_right(ck); - _test_compare_y_at_x(ck); - _test_has_on(ck); -} diff --git a/Circular_kernel_2/test/Circular_kernel_2/old_lazy/test_Lazy_circular_kernel.cpp b/Circular_kernel_2/test/Circular_kernel_2/old_lazy/test_Lazy_circular_kernel.cpp deleted file mode 100644 index 2a7038dcbec..00000000000 --- a/Circular_kernel_2/test/Circular_kernel_2/old_lazy/test_Lazy_circular_kernel.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -typedef CGAL::Quotient NT3; -typedef CGAL::Cartesian Linear_k3; -typedef CGAL::Algebraic_kernel_for_circles_2_2 Algebraic_k3; -typedef CGAL::Circular_kernel_2 CK1_2; - -typedef CGAL::Interval_nt_advanced NT4; -typedef CGAL::Cartesian Linear_k4; -typedef CGAL::Algebraic_kernel_for_circles_2_2 Algebraic_k4; -typedef CGAL::Circular_kernel_2 CK2_2; -typedef CGAL::Lazy_circular_kernel_2 CK2; - -CK2 ck2; - -#include -#include -#include - -int main() { - - _test_circle_predicat(ck2); - _test_circle_construct(ck2); - _test_circle_bbox(ck2); - _test_circular_arc_bbox(ck2); - _test_has_on(ck2); - - return 0; -} diff --git a/Circular_kernel_2/test/Circular_kernel_2/test_Circular_kernel_basic.cpp b/Circular_kernel_2/test/Circular_kernel_2/test_Circular_kernel_basic.cpp index b90ed333573..d11232d5be9 100644 --- a/Circular_kernel_2/test/Circular_kernel_2/test_Circular_kernel_basic.cpp +++ b/Circular_kernel_2/test/Circular_kernel_2/test_Circular_kernel_basic.cpp @@ -1,8 +1,9 @@ -// Copyright (c) 2001,2002 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2001,2002 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Circular_kernel_2/test/Circular_kernel_2/test_Exact_circular_kernel_basic.cpp b/Circular_kernel_2/test/Circular_kernel_2/test_Exact_circular_kernel_basic.cpp index 7e65c79fd0f..a61200bdf31 100644 --- a/Circular_kernel_2/test/Circular_kernel_2/test_Exact_circular_kernel_basic.cpp +++ b/Circular_kernel_2/test/Circular_kernel_2/test_Exact_circular_kernel_basic.cpp @@ -1,8 +1,9 @@ -// Copyright (c) 2001,2002 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2001,2002 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Circular_kernel_3/doc_tex/Circular_kernel_3/PkgDescription.tex b/Circular_kernel_3/doc_tex/Circular_kernel_3/PkgDescription.tex index 00e8dc04fda..e61fc9dd510 100644 --- a/Circular_kernel_3/doc_tex/Circular_kernel_3/PkgDescription.tex +++ b/Circular_kernel_3/doc_tex/Circular_kernel_3/PkgDescription.tex @@ -1,5 +1,5 @@ \begin{ccPkgDescription}{3D Spherical Geometry Kernel \label{Pkg:SphericalKernel3}} -\ccPkgHowToCiteCgal{cgal:cclt-sgk3-11} +\ccPkgHowToCiteCgal{cgal:cclt-sgk3-11b} \ccPkgSummary{ This package is an extension of the linear \cgal\ Kernel. It offers functionalities on spheres, circles, circular arcs and line segments, diff --git a/Circular_kernel_3/doc_tex/Circular_kernel_3_ref/intro.tex b/Circular_kernel_3/doc_tex/Circular_kernel_3_ref/intro.tex index 84ff7f3877e..bd54d642e29 100644 --- a/Circular_kernel_3/doc_tex/Circular_kernel_3_ref/intro.tex +++ b/Circular_kernel_3/doc_tex/Circular_kernel_3_ref/intro.tex @@ -159,7 +159,7 @@ \subsubsection*{Roots of Polynomials} -\ccRefIdfierPage{CGAL::Root_of_2}\\ +\ccRefIdfierPage{CGAL::Sqrt_extension}\\ \ccRefIdfierPage{CGAL::Root_for_spheres_2_3} \ccRefIdfierPage{CGAL::Root_of_traits_2} diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circle_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circle_3.h index ccbf8b2f265..8920b764d01 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circle_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circle_3.h @@ -71,7 +71,7 @@ namespace CGAL { return CGAL::THREADED; } - typename SK::Root_of_2 radius=CGAL::make_root_of_2(typename SK::FT(1),typename SK::FT(0),-sphere.squared_radius(),false); + typename SK::Root_of_2 radius=CGAL::make_sqrt(sphere.squared_radius()); Circular_arc_point_3 north_pole( Root_for_spheres_2_3(sphere.center().x(),sphere.center().y(),sphere.center().z()+radius) ); Circular_arc_point_3 south_pole( Root_for_spheres_2_3(sphere.center().x(),sphere.center().y(),sphere.center().z()-radius) ); @@ -163,7 +163,7 @@ namespace CGAL { typename SK::Vector_3 ortho=circle.center()-sphere.center(); CGAL_kernel_precondition(ortho.z()!=0); bool is_north_pole=ortho.z()>0; - typename SK::Root_of_2 radius = make_root_of_2(typename SK::FT(1),typename SK::FT(0),-sphere.squared_radius(),!is_north_pole); + typename SK::Root_of_2 radius = (is_north_pole?1:-1)* make_sqrt(sphere.squared_radius()); typename SK::Circular_arc_point_3 source_target( typename SK::Algebraic_kernel::Root_for_spheres_2_3( sphere.center().x(), diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h index b01b7719658..92e6b8a0d89 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h @@ -364,7 +364,7 @@ namespace CGAL { return true; if (type==POLAR){ bool circle_contains_north = arc.supporting_circle().center().z() > sphere.center().z(); - typename SK::Root_of_2 radius=make_root_of_2(typename SK::FT(0),typename SK::FT(1),sphere.squared_radius()); + typename SK::Root_of_2 radius=make_sqrt(sphere.squared_radius()); typename SK::Circular_arc_point_3 pole ( typename SK::Algebraic_kernel::Root_for_spheres_2_3( sphere.center().x(), sphere.center().y(), @@ -410,7 +410,7 @@ namespace CGAL { case THREADED: case POLAR:{ bool circle_contains_north = arc.supporting_circle().center().z() > sphere.center().z(); - typename SK::Root_of_2 radius=make_root_of_2(typename SK::FT(0),typename SK::FT(1),sphere.squared_radius()); + typename SK::Root_of_2 radius=make_sqrt(sphere.squared_radius()); typename SK::Circular_arc_point_3 pole ( typename SK::Algebraic_kernel::Root_for_spheres_2_3( sphere.center().x(), sphere.center().y(), diff --git a/Circular_kernel_3/include/CGAL/Spherical_kernel_type_equality_wrapper.h b/Circular_kernel_3/include/CGAL/Spherical_kernel_type_equality_wrapper.h index 0f5decb9c06..bf6de766ccf 100644 --- a/Circular_kernel_3/include/CGAL/Spherical_kernel_type_equality_wrapper.h +++ b/Circular_kernel_3/include/CGAL/Spherical_kernel_type_equality_wrapper.h @@ -43,7 +43,6 @@ struct Spherical_kernel_type_equality_wrapper typedef CGAL::Circular_arc_point_3 Circular_arc_point_3; typedef CGAL::Circular_arc_3 Circular_arc_3; typedef CGAL::Line_arc_3 Line_arc_3; - //~ typedef CGAL::Root_of_2 Root_of_2; }; } diff --git a/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_sphere_predicates.h b/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_sphere_predicates.h index ef7401bbbde..2f1e72edc96 100644 --- a/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_sphere_predicates.h +++ b/Circular_kernel_3/test/Circular_kernel_3/include/CGAL/_test_sphere_predicates.h @@ -325,7 +325,7 @@ void _test_has_on_predicate(SK sk) { std::make_pair(Polynomial_for_spheres_2_3(0,0,0,1), Polynomial_1_3(1,1,1,0)); Circle_3 c_2 = theConstruct_circle_3(pc2); - Root_of_2 r_1_1_c_2 = CGAL::make_root_of_2(FT(FT(1) / FT(2)),FT(0),FT(0)); + Root_of_2 r_1_1_c_2 = FT(FT(1) / FT(2)); Root_of_2 r_1_2_c_2 = CGAL::make_root_of_2(-FT(FT(1) / FT(4)),-FT(FT(1) / FT(4)),FT(5)); Root_of_2 r_1_3_c_2 = CGAL::make_root_of_2(-FT(FT(1) / FT(4)),FT(FT(1) / FT(4)),FT(5)); Root_for_spheres_2_3 r_1_c_2 = Root_for_spheres_2_3(r_1_1_c_2,r_1_2_c_2,r_1_3_c_2); diff --git a/Circular_kernel_3/test/Circular_kernel_3/test_Lazy_spherical_kernel_basics.cpp b/Circular_kernel_3/test/Circular_kernel_3/test_Lazy_spherical_kernel_basics.cpp index 2f84d032115..567adfafbb9 100644 --- a/Circular_kernel_3/test/Circular_kernel_3/test_Lazy_spherical_kernel_basics.cpp +++ b/Circular_kernel_3/test/Circular_kernel_3/test_Lazy_spherical_kernel_basics.cpp @@ -1,8 +1,9 @@ -// Copyright (c) 2001,2002 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2001,2002 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Circular_kernel_3/test/Circular_kernel_3/test_Spherical_kernel_basics.cpp b/Circular_kernel_3/test/Circular_kernel_3/test_Spherical_kernel_basics.cpp index 4dd3c5852bb..cf8ab557fa9 100644 --- a/Circular_kernel_3/test/Circular_kernel_3/test_Spherical_kernel_basics.cpp +++ b/Circular_kernel_3/test/Circular_kernel_3/test_Spherical_kernel_basics.cpp @@ -1,8 +1,9 @@ -// Copyright (c) 2001,2002 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2001,2002 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Circulator/doc_tex/Circulator/PkgDescription.tex b/Circulator/doc_tex/Circulator/PkgDescription.tex index 7dfa749be2a..d7d0b31177c 100644 --- a/Circulator/doc_tex/Circulator/PkgDescription.tex +++ b/Circulator/doc_tex/Circulator/PkgDescription.tex @@ -1,5 +1,5 @@ \begin{ccPkgDescription}{Handles and Circulators\label{Pkg:HandlesAndCirculators}} -\ccPkgHowToCiteCgal{cgal:dksy-hc-11} +\ccPkgHowToCiteCgal{cgal:dksy-hc-11b} \ccPkgSummary{This package descibes handles and circulators. They are related to iterators. Handles allow to dereference but neither to increment nor to decrement. diff --git a/Circulator/include/CGAL/Safe_circulator_from_iterator.h b/Circulator/include/CGAL/Safe_circulator_from_iterator.h index 7c402e8a1a1..037b9209a3e 100644 --- a/Circulator/include/CGAL/Safe_circulator_from_iterator.h +++ b/Circulator/include/CGAL/Safe_circulator_from_iterator.h @@ -1,8 +1,9 @@ -// Copyright (c) 2007 GeometryFactory (France) -// Copyright (c) 1997, 2007 GeometryFactory (France), Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), +// Copyright (c) 1997, 2007 +// GeometryFactory (France), +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), // and Tel-Aviv University (Israel). All rights reserved. // // This file is part of CGAL (www.cgal.org); you can redistribute it and/or diff --git a/Circulator/include/CGAL/circulator.h b/Circulator/include/CGAL/circulator.h index d6023c69e5a..f3c76160d00 100644 --- a/Circulator/include/CGAL/circulator.h +++ b/Circulator/include/CGAL/circulator.h @@ -1,8 +1,9 @@ -// Copyright (c) 1997 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 1997 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Circulator/include/CGAL/circulator_bases.h b/Circulator/include/CGAL/circulator_bases.h index 025c32e1299..a59d804cad4 100644 --- a/Circulator/include/CGAL/circulator_bases.h +++ b/Circulator/include/CGAL/circulator_bases.h @@ -1,8 +1,9 @@ -// Copyright (c) 1997 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 1997 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Circulator/include/CGAL/circulator_impl.h b/Circulator/include/CGAL/circulator_impl.h index 59e7f9667bc..9c4f93619ce 100644 --- a/Circulator/include/CGAL/circulator_impl.h +++ b/Circulator/include/CGAL/circulator_impl.h @@ -1,8 +1,9 @@ -// Copyright (c) 1997 Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany), -// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg -// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 1997 +// Utrecht University (The Netherlands), +// ETH Zurich (Switzerland), +// INRIA Sophia-Antipolis (France), +// Max-Planck-Institute Saarbruecken (Germany), +// and Tel-Aviv University (Israel). All rights reserved. // // 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 diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/Combinatorial_map.tex b/Combinatorial_map/doc_tex/Combinatorial_map/Combinatorial_map.tex new file mode 100644 index 00000000000..dd40e3c389b --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map/Combinatorial_map.tex @@ -0,0 +1,1695 @@ +% \def\ccTagRmTrailingConst{\ccFalse} + +\newcommand{\nulldart}{\ccc{null\_dart\_handle}} + +\def\betats{\ccTexHtml{$\beta$}{β}} +\def\betazero{\ccTexHtml{$\beta_0$}{β0}} +\def\betaun{\ccTexHtml{$\beta_1$}{β1}} +\def\betadeux{\ccTexHtml{$\beta_2$}{β2}} +\def\betatrois{\ccTexHtml{$\beta_3$}{β3}} +\def\betaquatre{\ccTexHtml{$\beta_4$}{β4}} +\def\betai{\ccTexHtml{$\beta_i$}{βi}} +\def\betad{\ccTexHtml{$\beta_d$}{βd}} +\def\betadprim{\ccTexHtml{$\beta_{d'}$}{βd'}} +\def\betaimun{\ccTexHtml{$\beta_{i-1}$}{βi-1}} +\def\betaipun{\ccTexHtml{$\beta_{i+1}$}{βi+1}} +\def\betaimdeux{\ccTexHtml{$\beta_{i-2}$}{βi-2}} +\def\betaipdeux{\ccTexHtml{$\beta_{i+2}$}{βi+2}} +\def\betaj{\ccTexHtml{$\beta_j$}{βj}} +\def\betajmun{\ccTexHtml{$\beta_{j-1}$}{βj-1}} +\def\betaiinv{\ccTexHtml{$\beta_i^{-1}$}{βi-1}} +\def\betajinv{\ccTexHtml{$\beta_j^{-1}$}{βj-1}} + +\def\comp{\ccTexHtml{$\circ$}{°}} +\def\pinv{\ccTexHtml{$p^{-1}$}{p-1}} + +\def\myneq{\ccTexHtml{$\neq$}{≠}} +\def\myleq{\ccTexHtml{$\leq$}{≤}} +\def\mylt{\ccTexHtml{$<$}{<}} +\def\mygt{\ccTexHtml{$>$}{>}} +\def\mygeq{\ccTexHtml{$\geq$}{≥}} +\def\mysubseteq{\ccTexHtml{$\subseteq$}{⊆}} +\def\myforall{\ccTexHtml{$\forall$}{∀}} +\def\myemptyset{\ccTexHtml{$\emptyset$}{∅}} +\def\myRightarrow{\ccTexHtml{$\Rightarrow$}{⇒}} +\def\myrightarrow{\ccTexHtml{$\rightarrow$}{→}} +\def\myin{\ccTexHtml{$\in$}{∈}} +\def\mynotin{\ccTexHtml{$\notin$}{∉}} +\def\mycup{\ccTexHtml{$\cup$}{∪}} +\def\myphi{\ccTexHtml{$\phi$}{φ}} +\def\mysetminus{\ccTexHtml{$\setminus$}{\ }} +\def\myldots{\ccTexHtml{$\ldots$}{…}} +\def\mytimes{\ccTexHtml{$\times$}{×}} + +%\def\myvarnothing{\ccTexHtml{$\varnothing$}{\varnothing}} +%\ccTexHtml{$\varnothing$}{\lcRawHtml{∅}}} + +\newcommand{\cell}[1]{\emph{#1}-cell} +\newcommand{\cells}[1]{\emph{#1}-cells} +\newcommand{\orbit}[1]{\ccTexHtml{$\langle{}$}{⟨}#1\ccTexHtml{$\rangle{}$}{⟩}} + +\section{Introduction} + +A \emph{d}-dimensional combinatorial map is a data structure +representing an orientable subdivided \emph{d}-dimensional object +obtained by taking \emph{d}D cells, and allowing to glue \emph{d}D +cells along \emph{(d-1)}D cells. It provides a description of all the +cells of the subdivision (for example vertices and edges), together +with incidence and adjacency relationships. This package is a +generalization of the halfedge data structure to higher +dimension.\footnote{A 2D combinatorial map is equivalent to a halfedge + data structure: there is a one-to-one mapping between elements of + both data structures, halfedges corresponding to darts.} + +We denote \cell{i} for an \emph{i}-dimensional cell (for example in 3D, +0-cells are \emph{vertices}, 1-cells are \emph{edges}, 2-cells are +\emph{facets}, and 3-cells are \emph{volumes}). A \emph{boundary + relation} is defined on these cells, giving for each \cell{i} \emph{c} +the set of \cells{(i-1)} contained in the boundary of \emph{c}. Two cells +\emph{c1} and \emph{c2} are \emph{incident} if there is a path of cells, +starting from the cell of biggest dimension to the other cell, such +that each cell of the path (except the first one) belongs to the +boundary of the previous cell in the path. Two \cells{i} \emph{c3} and \emph{c4} are \emph{adjacent} if there is an \cell{(i-1)} incident to both \emph{c3} +and \emph{c4}. You can see an example of a 2D object and a 3D object in +Figure~\ref{fig-exemple-3Dmanifold} showing some cells of the +subdivision and some adjacency and incidence relations. +\begin{figure}[ht] + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=.3\textwidth] + {Combinatorial_map/fig/pdf/object2d} + \qquad + \includegraphics[width=.4\textwidth] + {Combinatorial_map/fig/pdf/intuitif-example} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ + +
+ \end{ccHtmlOnly} + \caption{Example of subdivided objects that can be described by + combinatorial maps. \textbf{Left}: A 2D object composed of + three facets (2-cells), named \emph{f1}, \emph{f2} and \emph{f3}, nine + edges (1-cells) and seven vertices (0-cells). \emph{f1} and + \emph{f2} are adjacent along edge \emph{e1}, thus \emph{e1} is incident both + to \emph{f1} and \emph{f2}. Vertex \emph{v1} is incident to edge \emph{e1}, thus + \emph{v1} is incident to \emph{f1} and \emph{f2} by transitivity. + \textbf{Right}: A 3D object (only partially represented for vertices and edges) + composed of three volumes (3-cells), named \emph{vol1}, \emph{vol2} + and \emph{vol3}, twelve facets (2-cells) (there is one facet + \emph{f4} between \emph{vol1} and \emph{vol2}, and similarly between \emph{vol1} + and \emph{vol3} and \emph{vol2} and \emph{vol3}), sixteen edges (1-cells), + and eight vertices (0-cells). \emph{vol1} and \emph{vol2} are adjacent + along facet \emph{f4}, thus \emph{f4} is incident both to \emph{vol1} and + \emph{vol2}. Edge \emph{e4} is incident to the three facets between + \emph{vol1} and \emph{vol2}, \emph{vol1} and \emph{vol3}, and \emph{vol2} and + \emph{vol3}. \emph{e4} is also incident to the three volumes by + transitivity.} + \label{fig-exemple-3Dmanifold} +\end{figure} + +A combinatorial map is an edge-centered data structure describing the +cells and the incidence and adjacency relations, using only one basic +element called \emph{dart}, and a set of \emph{pointers} between these +darts. A dart can be thought as a part of an oriented edge (1-cell), +together with a part of incident cells of dimensions 0, 2, 3,\ldots, +\emph{d}. When a dart \emph{d0} describes a part of an \cell{i} \emph{c}, we say that +\emph{d0} \emph{belongs} to \emph{c}, and that \emph{c} \emph{contains} \emph{d0}. Let +us look at the example in Figure~\ref{fig-exemple-combi-maps} showing +the 2D and 3D combinatorial maps describing the two objects given in +Figure~\ref{fig-exemple-3Dmanifold}. +\begin{figure}[ht] + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=.3\textwidth] + {Combinatorial_map/fig/pdf/intuitif-example-map2d} + \qquad + \includegraphics[width=.4\textwidth] + {Combinatorial_map/fig/pdf/intuitif-example-map} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ + +
+ \end{ccHtmlOnly} + \caption{Combinatorial maps representing the objects given in + Figure~\ref{fig-exemple-3Dmanifold}. + \textbf{Left}: The 2D combinatorial map which contains 12 darts. + \textbf{Right}: The 3D combinatorial map which contains 54 darts + (18 for each volume). + } + \label{fig-exemple-combi-maps} +\end{figure} + +First let us start in 2D (Figure~\ref{fig-exemple-combi-maps} (Left)). +Facet \emph{f1} is described by four darts. These darts are linked +together with pointers. Starting from a dart and following a \betaun{} %\mbeta{1} +pointer, we get to a dart which belongs to the same facet but to the +next edge (1-cell, which explains the index~1 of~\betaun{}). +Starting from any dart and following \betaun{} pointers, we can reach +exactly all the darts describing the facet. Starting from a dart and +following a \betadeux{} pointer, we get to a dart which belongs to the +same edge but to the neighboring facet (2-cell, which explains the +index~2 of~\betadeux{}). Starting from any dart and following +\betadeux{} pointers, we can reach exactly all the darts describing the +edge (in 2D one or two darts). + +Things are slightly different for vertices. Indeed, each \betai{} +points to a dart belonging to a different \cell{i}, but also to a +different 0-cell (vertex). This is so because two linked darts have +opposite orientations. For this reason, starting from any dart +belonging to a vertex \emph{v}, we have to follow \betadeux{} then \betaun{} +to reach exactly the darts describing the vertex \emph{v}. In fact, by +composing two \betai{}s, we always obtain a dart belonging to the +same vertex (if we do not start by following a \betaun{} pointer). + +The main interest of combinatorial map definition based on darts and +\betai{} pointers is to be able to increase the dimension "only" by +adding new pointers. We can verify this fact by studying the 3D +example (Figure~\ref{fig-exemple-combi-maps} (Right)). In addition to +\betaun{} and \betadeux{} of the 2D case, there is a new pointer +\betatrois{}. + +If we take a closer look at the central edge \emph{e4} shown in +Figure~\ref{fig-intuitive-exemple} (Left), we can see that it is +described by six darts linked together. Starting from a dart and +following a \betatrois{} pointer, we get to a dart which belongs to the +same edge, to the same facet, but to the neighboring volume (a 3-cell, +which explains the index 3 in \betatrois{}). Similarly, starting from +a dart and following a \betadeux{} pointer, we get to a dart which +belongs to the same edge, to the same volume, but to the neighboring +facet (2-cell). Starting from any of these six darts and following +\betadeux{} and \betatrois{} pointers, we can reach exactly the six darts +describing edge \emph{e4}. +%%%%% +\def\LargFig{.3\textwidth} +\begin{figure} + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=\LargFig]{Combinatorial_map/fig/pdf/intuitif-example-zoom} + \includegraphics[width=\LargFig]{Combinatorial_map/fig/pdf/intuitif-example-zoom2} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ + + + + +
+ \end{ccHtmlOnly} + \caption{Two zooms on the 3D combinatorial map given in + Figure~\ref{fig-exemple-combi-maps} (Right). + \textbf{Left}:~Zoom around the central edge \emph{e4} which details + the six darts belonging to the edge. \textbf{Right}:~Zoom + around the facet between volumes \emph{vol2} and \emph{vol3} which + details the eight darts belonging to the facet.} + \label{fig-intuitive-exemple} +\end{figure} + +For facets, by following a \betaun{} pointer, we get to a dart which +belongs to the same facet, to the same volume, but to the next edge +(1-cell, which explains the index~1 of~\betaun{}). Starting from any +dart and following \betaun{} and \betatrois{} pointers, we can reach +exactly all the darts describing the facet (see +Figure~\ref{fig-intuitive-exemple} (Right)). +% +For volumes, starting from any dart and following \betaun{} and +\betadeux{} pointers, we can reach exactly all the darts describing the +volume. + +For vertices, we have to follow \betadeux{} then \betaun{}, and +\betatrois{} then \betaun{} to reach exactly the darts describing the +vertex \emph{v}. Indeed, as in 2D, we have to compose two \betai{}s to +obtain a dart belonging to the same vertex (if we do not start by following a \betaun{} pointer). + +In some cases, the general rule that by following a \betai{} we get a +dart which belongs to the neighboring \cell{i} is not true, as for example +for darts belonging to the boundary of the represented +object. For example, in Figure~\ref{fig-exemple-3Dmanifold} (Left), any dart +\emph{d0} that does not belong to edge \emph{e1}, \emph{e2} and \emph{e3} +belongs to a 2-cell, and there is no neighboring facet along the edge containing \emph{d0}. +Another example is in Figure~\ref{fig-exemple-3Dmanifold} (Right), for +any dart \emph{d0} that belongs to facet \emph{f5}. +\emph{d0} belongs to volume \emph{vol2}, but there is no neighboring volume +along this facet. The general rule is also not true for unbounded +cells. For example if we remove a dart in +Figure~\ref{fig-exemple-combi-maps} (Left), we obtain an unbounded +facet having a dart without next dart for \betaun{}, and if we remove +a facet in Figure~\ref{fig-exemple-combi-maps} (Right), we obtain an +unbounded volume having some darts without neighboring facet for +\betadeux{}. In such a case, there is a particular value called +$\varnothing$ used to describe that a dart \emph{d0} is not linked to +another dart in dimension~\emph{i}. + +Combinatorial maps are defined in any dimension. A 0D combinatorial +map is a set of isolated darts describing isolated vertices. A 1D +combinatorial map describes paths or cycles of darts corresponding to +paths or cycles of edges, and equivalent to double linked lists. The +most useful cases are 2D and 3D combinatorial maps. Since 2D +combinatorial maps are equivalent to halfedge data structure, notions +are illustrated in 3D in the following examples to help the reader +understand this specific case. But it is important to keep in mind +that one main interest of combinatorial maps is their generic +definition in any dimension, and that everything presented in this +manual is valid in any dimension. + +A \emph{d}D combinatorial map is useful when you want to describe \emph{d}D +objects and the adjacency relations between these objects, and you +want to be able to efficiency traverse these objects by using the +different relations. For example, we can use a 3D combinatorial map +to describe a 3D segmented image: each 3-cell corresponds to a region +in the image and each 2-cell corresponds to a contact area between two +regions. + +A combinatorial map does not contain any geometrical +information. However, this package allows to associate any information +to the cells of the combinatorial map. A specific information, which +is often used in practice, consists in adding linear geometry to a +combinatorial map by associating a point to each vertex of the +map\footnote{When an object has a point associated to each vertex, + each edge is thus a straight line segment, which explains the name + "linear geometry".}: this is the object of the +\ccc{Linear_cell_complex} package. This package can for example be +useful to describe 3D buildings as set of walls, rooms, doors and +windows (both combinatorial and geometrical descriptions) and all the +adjacency relations between these elements allowing for example to +move a camera in a given building from rooms to rooms by traversing +doors. + +\section{Data Structure Presentation}\label{sec_presentation} + +In this section, we describe \emph{d}D combinatorial maps in terms of data +structure and operations. Mathematical definitions are provided in +Section~\ref{sec_definition}, and a package description is given in +Section~\ref{sec-software-design}. + +\subsection{Combinatorial Map and Darts}\label{ssec-combi-map-and-darts} + +A \emph{d}D combinatorial map is a set of darts \emph{D}. A dart \emph{d0} is an +element that can be \emph{linked} with \emph{d}+1 darts by pointers called +\betai{}, with 0\myleq{}\emph{i}\myleq{}\emph{d}. Dart \emph{d0} is said \emph{i-free} +when \betai{}(\emph{d0})=$\varnothing$. Each \betai{}, for 2\myleq{}\emph{i}\myleq{}\emph{d}, +is its own inverse, i.e., if dart \emph{d0} is not \emph{i}-free, then +\betai{}(\betai{}(\emph{d0}))=\emph{d0}. This is different for \betazero{} and +\betaun{}: \betazero{} is the inverse of \betaun{}, i.e., if darts \emph{d1} +and \emph{d2} are such that \betaun{}(\emph{d1})=\emph{d2}, then +\betazero{}(\emph{d2})=\emph{d1}. Given dart \emph{d1}, if there is no dart \emph{d2} such +that \betaun{}(\emph{d2})=\emph{d1}, then \betazero{}(\emph{d1})=$\varnothing$. $\varnothing$ +is a constant, which does not belong to the set of darts \emph{D} of the +combinatorial map. However, by definition $\varnothing$ is linked with +itself for all \betai{}s: \myforall{}\emph{i}, 0\myleq{}\emph{i}\myleq{}\emph{d}, +\betai{}($\varnothing)$=$\varnothing$. + +A combinatorial map is \emph{without i-boundary} if there is no +\emph{i}-free dart, and it is \emph{without boundary} if it is without +\emph{i}-boundary for all dimensions 1\myleq{}\emph{i}\myleq{}\emph{d}. + + +We show in Figure~\ref{fig-exemple-carte3d} a 3D object and the +corresponding 3D combinatorial map. This map has 40 darts represented +by arrows, some darts being numbered. In this combinatorial map, we +have for example \betaun{}(1)=2, \betadeux{}(1)=10, and +\betatrois{}(1)=5. This combinatorial map is without 1-boundary and +2-boundary, but has some 3-boundary, because some darts are 3-free, +for example \betatrois{}(10)=$\varnothing$ and \betatrois{}(12)=$\varnothing$. +% +\def\LargFig{.4\textwidth} +\begin{figure} + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=\LargFig]{Combinatorial_map/fig/pdf/object3d}\qquad + \includegraphics[width=\LargFig]{Combinatorial_map/fig/pdf/exemple-carte2-3d} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ + + + +
+ \end{ccHtmlOnly} + \caption{Example of a 3D combinatorial map. \textbf{Left}:~A 3D object + made of two volumes adjacent along facet \emph{f2}. \textbf{Right}:~The + corresponding 3D combinatorial map. Darts are drawn with + arrows, sometimes numbered. Two darts linked by \betaun{} are + drawn consecutively (for example \betaun{}(10)=11), and two + darts linked by \betadeux{} are drawn parallel, in reverse + orientations, with a little gray segment joining them (for + example \betadeux{}(1)=10). \betatrois{} pointers are represented by + blue segments (for example \betatrois{}(1)=5).} + \label{fig-exemple-carte3d} +\end{figure} + +\subsection{Cells as Sets of Darts}\label{ssec-cells-in-map} + +A cell in a \emph{d}D combinatorial map is implicitly represented by a +subset of darts. +In this section, we will see how to retrieve all cells containing a +given dart, how to retrieve all darts belonging to a cell containing a +given dart, and how incidence and adjacency relations are defined in +terms of darts. + +The first important property of a combinatorial map is that +each dart belongs to an \cell{i}, \myforall{}\emph{i}, 0\myleq{}\emph{i}\myleq{}\emph{d}. +For example in 3D, a dart belongs to a vertex, an edge, a facet, and a +volume. This means that a 3D combinatorial map containing an isolated +dart contains exactly one vertex, one edge, one facet and one volume. + +The second important property is that cells of a combinatorial map +correspond to specific \emph{orbits}. Given a set +\emph{S}\mysubseteq{}\{\betaun{},\myldots{},\betad{}\} and a dart +\emph{d0}, the \emph{orbit} \orbit{\emph{S}}(\emph{d0}) is the set of darts that can be +reached from \emph{d0} by following any combination of any \betai{}'s in \emph{S} +and their inverses (to simplify notations, we can use for example +\orbit{\betaun{},\betaquatre{}}(\emph{d0}) to denote \orbit{\emph{S}}(\emph{d0}) with +\emph{S}=\{\betaun{},\betaquatre{}\}). + +Given a dart \emph{d0}, in general, \betai{}(\emph{d0}) (with 1\myleq{}\emph{i}\myleq{}d) +belongs to the same cells as \emph{d0}, only the \cell{i} and 0-cell are +different. There are two exceptions: (1)~if \emph{d0} is \emph{i}-free, then +\betai{}(\emph{d0})=$\varnothing$; (2)~if \betai{}(\emph{d0}) belongs to the same \cell{i} +as \emph{d0} (case of multi-incidence). For example if an edge is an isolated +loop, it is incident twice to the same vertex, then given a dart \emph{d0} +belonging to this edge, \betaun{}(\emph{d0}) goes to the next edge, which is in +fact the same edge. + +Since \betai{}(\emph{d0}) (with 1\myleq{}\emph{i}\myleq{}\emph{d}) allows to change the +current \cell{i}, all the darts that can be reached from \emph{d0} by +using any combination of \betaj{}'s, \myforall{}\emph{j}, 1\myleq{}\emph{j}\myleq{}\emph{d} and +\emph{j}\myneq{}\emph{i} and their inverse are contained in the same \cell{i} as +\emph{d0}. The \cell{i} containing \emph{d0} is defined in terms of orbit by +\orbit{\betaun{},\myldots{},\betaimun{},\betaipun{},\myldots{},\betad{}}(\emph{d0}). + +There is a special case for vertices. Given a dart \emph{d0}, the set of +darts contained in the same vertex as \emph{d0} are the darts that can be +reached from \emph{d0} by using any combination of \betai{}\comp{}\betaj{}, +\myforall{}\emph{i},\emph{j}, 1\myleq{}\emph{i}\mylt{}\emph{j}\myleq{}\emph{d}, and their inverse. The 0-cell +containing \emph{d0} is defined in terms of orbit by +\orbit{\{\betai{}\comp{}\betaj{}$|$\myforall{}\emph{i,j}: 1\myleq{}\emph{i}\mylt{}\emph{j}\myleq{}\emph{d}\}}(\emph{d0}). + +Orbit \orbit{\betaun{},\myldots{},\betad{}}(\emph{d0}) is the \emph{connected + component} containing dart \emph{d0}. A combinatorial map is +\emph{connected} if this set is equal to the set of all the darts +of the combinatorial map. + +%AF: Je ne trouve pas ques les \forall s'integrent bien dans une phrase +% et je preferais ceci: +% A last important property of cells, is that for all dimensions i +% the set of \cells{i} form a partition of the set of darts D, i.e. +% +% Je le dis ici a titre d'exemple, c'est a dire je recommende +% que tu fasse un passe pour obtenir plus de ``phrases sans $..$'' + +A last important property of cells is that for all dimensions \emph{i} the +set of \cells{i} forms a partition of the set of darts \emph{D}, i.e. for +any \emph{i}, the union of the sets of darts of all the \cells{i} is equal +to \emph{D}, and the sets of darts of two different \cells{i} are disjoint. + +Let us give some examples of cells in 3D, for the 3D combinatorial map +of Figure~\ref{fig-exemple-carte3d}: +\begin{itemize} +\item All the darts belonging to the same edge can be obtained by any + combination of \betadeux{} and \betatrois{}: for example edge \emph{e} of the + object corresponds in the combinatorial map to the set of darts + \{1,5,9,10\}. Given any dart belonging to this edge, we retrieve + all the other darts by, for example, a breadth-first traversal. In terms + of orbits, this 1-cell corresponds to \orbit{\betadeux{},\betatrois{}}(1). + +\item All the darts belonging to the same facet can be obtained by any + combination of \betaun{} and \betatrois{}: for example facet \emph{f2} + corresponds in the combinatorial map to the set of darts + \{1,2,3,4,5,6,7,8\}. Facet \emph{f1} corresponds to the set of darts + \{10,11,12,13\}. Note that these last darts are 3-free since + there is no other volume sharing this facet. In terms of orbits, + \emph{f2} corresponds to \orbit{\betaun{},\betatrois{}}(1) and \emph{f1} + corresponds to \orbit{\betaun{},\betatrois{}}(10). + +\item All the darts belonging to the same volume can be obtained by + any combination of \betaun{} and \betadeux{}: for example volume \emph{vol1} + corresponds in the combinatorial map to the set of the twenty-four + darts representing the cube. In terms of orbits, \emph{vol1} corresponds + to \orbit{\betaun{},\betadeux{}}(1). + +\item All the darts belonging to the same vertex can be obtained by + any combination of \betaun{}\comp{}\betadeux{}, + \betaun{}\comp{}\betatrois{} and \betadeux{}\comp{}\betatrois{} and their inverse + functions. In our example, vertex \emph{v} of the object corresponds + in the combinatorial map to the set of darts \{1,6,9,11,14,15\}. + Starting from dart 1, we obtain for example dart + 14=(\betaun{}\comp{}\betadeux{})\ccTexHtml{$^{-1}$}{-1}(1)=\betadeux{}\comp{}\betazero{}(1), dart + 11=\betaun{}\comp{}\betadeux{}(1), and dart 9=\betadeux{}\comp{}\betatrois{}(1). + Intuitively, the set of darts corresponding to a vertex contains all + the darts represented by arrows starting from this vertex. In terms + of orbits, \emph{v} corresponds to \orbit{\betaun{}\comp{}\betadeux{}, + \betaun{}\comp{}\betatrois{}, \betadeux{}\comp{}\betatrois{}}(1). +\end{itemize} + +Using this definition of cells as sets of darts, we can retrieve all the +incidence and adjacency relations between the cells of the subdivision +in a combinatorial map. Two cells are \emph{incident} if the +intersection of their two sets of darts is non empty (whatever the +dimension of the two cells). Two \cells{i} \emph{c1} and \emph{c2}, +1\myleq{}\emph{i}\myleq{}\emph{d}, are \emph{adjacent} if there is +\emph{d1}\myin{}\emph{c1} and \emph{d2}\myin{}\emph{c2} such that +\emph{d1}=\betai{}(\emph{d2}) (or \emph{d2}=\betai{}(\emph{d1}) +for \emph{i}=1). + +In the example of Figure~\ref{fig-exemple-carte3d}, vertex \emph{v} and +edge \emph{e} are incident since the intersection of the two corresponding +sets of darts is \{1,9\}\myneq{}\myemptyset{}. Vertex \emph{v} is incident to facet +\emph{f2} since the intersection of the two corresponding sets of darts is +\{1,6\}\myneq{}\myemptyset{}. Edge \emph{e} and facet \emph{f1} are incident +since the intersection of the two corresponding sets of darts is +\{10\}\myneq{}\myemptyset{}. Finally, facets \emph{f1} and \emph{f2} are adjacent +because 10\myin{}\emph{f1}, 1\myin{}\emph{f2} and 10=\betadeux{}(1). + +We can consider \cells{i} in a dimension \emph{d'} with \emph{i}\myleq{}\emph{d'}\myleq{} +\emph{d}. The idea is to consider the \cells{i} as if the combinatorial map +was in \emph{d'} dimension. For that, we only take into account the +\betaj{}s for \emph{j}\myleq{}\emph{d'}. The \cell{i} containing \emph{d0} in dimension +\emph{d'} is the orbit +\orbit{\betaun{},\myldots{},\betaimun{},\betaipun{},\myldots{},\betadprim{}}(\emph{d0}), and +the 0-cell is the orbit \orbit{\{\betai{}\comp{}\betaj{}$|$\myforall{}\emph{i,j}: +2\myleq{}\emph{i}\mylt{}\emph{j}\myleq{}\emph{d'}\}}(\emph{d0}). By default, \cells{i} are considered in +dimension \emph{d}, the dimension of the combinatorial map. + +In the example of Figure~\ref{fig-exemple-carte3d}, the 2-cell +containing dart 1 is facet \emph{f2} which is the set of darts +\{1,2,3,4,5,6,7,8\}. If we consider the same 2-cell in dimension~2, +we obtain the set of darts \{1,2,3,4\}. Intuitively we "forget" +\betatrois{} and we obtain the set of darts of the facet containing dart +1 restricted to the volume containing this dart. + +\subsection{How to Associate Information to Cells} +\label{ssec-associate-attributes} + +Combinatorial maps only describe the cells of the subdvision, and all +the incidence and adjacency relations between these cells. This is not +enough for many applications which need to associate +\emph{information} to cells. This can be geometric or non-geometric +information, such as 3D points associated to vertices, the edge length +associated to edges, or a color or normal to a facet. + +To answer this need, a combinatorial map allows to create +\emph{attributes} which are able to store any information, and to +associate attributes to cells of the combinatorial map. We denote +\emph{i}-attributes for the attributes associated with +\cells{i}. Attributes may exist for only some of the dimensions, and +if they exist for dimension \emph{i}, they do not necessarily exist for +each of the \cells{i}. More precisely, \emph{i}-attributes are associated +to \cells{i} by an injection: +\begin{itemize} +\item two different \cells{i} are associated to two different + \emph{i}-attributes; +\item an \cell{i} may have no associated \emph{i}-attribute. +\end{itemize} + +Since \cells{i} are not explicitely represented in combinatorial maps, +the association between \cells{i} and \emph{i}-attributes is transferred to +darts: if attribute \emph{a} is associated to \cell{i} \emph{c}, all the darts +belonging to \emph{c} are associated to \emph{a}. + +We can see two examples of combinatorial maps having some +attributes in Figure~\ref{fig-exemple-attribs}. In the first example +(Left), a 2D combinatorial map has 1-attributes containing a float, +for example corresponding to the length of the associated 1-cell, and +2-attributes containing a color in RGB format. In the second example +(Right), a 3D combinatorial map has 2-attributes containing a color +in RGB format. +% +\begin{figure} + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=.3\textwidth]{Combinatorial_map/fig/pdf/map2d-with-attrib}\qquad + \includegraphics[width=.45\textwidth]{Combinatorial_map/fig/pdf/exemple-carte-3d-sew2} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ \end{ccHtmlOnly} + \caption{Example of combinatorial maps with attributes. Attributes + are represented by black rectangles containing an information, and + association between darts and attributes are represented by small + lines. \textbf{Left}:~A 2D combinatorial map with 1-attributes + containing a double, for example corresponding to the length of + the 1-cell, and 2-attributes containing a color in RGB format. + Only three edges of the combinatorial map, among the nine, are + associated to a 1-attribute. All the 2-cells are associated to a + 2-attribute. \textbf{Right}:~A 3D combinatorial map with + 2-attributes containing a color in RGB format. Only three 2-cells + of the combinatorial map, among the ten, are associated to a + 2-attribute.} + \label{fig-exemple-attribs} +\end{figure} + +\subsection{Combinatorial Map Properties}\label{ssec-combimap-validity} + +There are some conditions that a combinatorial map must satisfy to be +valid. Some of them have already been given about the \betats{} pointers +(see Section~\ref{ssec-combi-map-and-darts}) and about the association +between darts and attributes (see +Section~\ref{ssec-associate-attributes}). + +There is an additional condition related to the type of represented +objects, which are \emph{quasi-manifold} orientable \emph{d}D objects. A +\emph{d}D quasi-manifold is an object obtained by taking some isolated +\cells{d}, and allowing to glue \cells{d} along \cells{(d-1)}. It is +orientable if it is possible to embed it in the Euclidean space and to +define a global "left" and "right" direction in each point of the +embedded object. In 2D, quasi-manifolds are manifolds, but this is no +longer true in higher dimension as we can see in the example presented +in Figure~\ref{fig-quasivariete}. In this example, the object to the +right is not a manifold since the neighborhood of the point \emph{p} in the +object is not homeomorphic\footnote{Intuitively, two objects are + homeomorphic if each object can be continuously deformed into the + second one. In such a case, the two objects have exactly the same + topological properties.} to a 3D ball. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FIGURE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{figure} + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=.33\textwidth]{Combinatorial_map/fig/pdf/quasivarietea} + \includegraphics[width=.33\textwidth]{Combinatorial_map/fig/pdf/quasivariete} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ + +
+ \end{ccHtmlOnly} + \caption{Example of a 3D quasi-manifold which is not a manifold. + The object to the right is made of the four pyramids (shown to the + left) glued together along facets, thus it is a quasi-manifold.} + \label{fig-quasivariete} +\end{figure} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Combinatorial maps can only represent quasi-manifolds due to the +definition of \betats{} pointers. As we have seen in +Section~\ref{ssec-cells-in-map}, \betai{}(\emph{d0}) (with 1\myleq{}\emph{i}\myleq{}\emph{d}) +belongs to the same cells as \emph{d0}, only the \cell{i} and 0-cell are +different. In other words, \betai{} links two \cells{i} that +share a common \cell{(i-1)}: it is not possible to link more than two +\cells{i} along a same \cell{(i-1)}. +For this reason, it is not possible to describe non quasi-manifold +objects as those shown in Figure~\ref{fig-nonquasi-manifold} by +combinatorial maps. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{figure}[ht] + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=.22\textwidth] + {Combinatorial_map/fig/pdf/object2d-nonmanifold} + \qquad + \includegraphics[width=.3\textwidth] + {Combinatorial_map/fig/pdf/object3d-nonmanifold} + \qquad + \includegraphics[width=.35\textwidth] + {Combinatorial_map/fig/pdf/object3d-nonmanifold2} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ + + +
+ \end{ccHtmlOnly} + \caption{Three examples of non quasi-manifold + objects. \textbf{Left}: A 2D object which is not a + quasi-manifold since the two 2-cells share a common vertex but + no common 1-cell. \textbf{Middle}: A 3D object which is not a + quasi-manifold since is it not only composed by 3D cells glued + together (there is an isolated 2-cell in dark + gray). \textbf{Right}: A 3D object which is not a quasi-manifold + since the two 3-cells share a common edge but no common 2-cell. + } + \label{fig-nonquasi-manifold} +\end{figure} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +Due to this additional condition, any objects can not be represented +by a combinatorial map but only orientable quasi-manifolds. We need to +study now the inverse relation. Does any set of darts linked together by +\betai{}'s, with 0\myleq{}\emph{i}\myleq{}\emph{d} correspond to a quasi-manifold? As +we can see in Figure~\ref{fig-pb-carte}, the answer is no. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{figure}[ht] + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=.4\textwidth] + {Combinatorial_map/fig/pdf/pb-carte3D} + \qquad + \includegraphics[width=.4\textwidth] + {Combinatorial_map/fig/pdf/pb2-carte3D} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ + +
+ \end{ccHtmlOnly} + \caption{Two examples of darts linked together by some \betazero{}, + \betaun{}, \betadeux{} and \betatrois{} which does not represent a 3D + quasi-manifold, and thus which are not 3D combinatorial map. + \textbf{Left}: In this example, all the darts are 3-free except + \betatrois{}(1)=5 and \betatrois{}(4)=6 (and vice-versa). + \textbf{Right}: In this example, darts linked by \betatrois{} + are not in the same order in both 3-cells. + } + \label{fig-pb-carte} +\end{figure} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +In the first example (Left), there are two 3-cells (one to the left +for the cube, a second to the right for the pyramid) which are +"partially adjacent" along one 2-cell. Indeed, only two darts +of the 2-cell are linked by \betatrois{}. We have \betatrois{}(1)=5 and +\betatrois{}(4)=6 (and reciprocally). This configuration is not possible +in a quasi-manifold: two \cells{d} are always glue along an "entire" +\cells{(d-1)}. + +But as we can see in the second example (Right), the condition that +all the darts of the cell are linked in not sufficient. Indeed, in +this example, all the darts of the 2-cell between the cube and the +pyramid are linked together by \betatrois{}. However, this configuration +does not correspond to an orientable 3D quasi-manifold. Indeed, the +operation of gluing two \cells{d} along one \cell{(d-1)} must +preserve the initial \cell{(d-1)}. + +To avoid these two kinds of configurations, conditions are added on +\betats{} pointers compositions (see Section~\ref{sec_definition}, +condition~(4) of the definition of combinatorial maps). Intuitively +these conditions say that if two darts are linked by \betai{}, then +all the required darts are linked by \betai{} two by two in such a +way that neighborhood relations are preserved. + + +We say that a combinatorial map is \emph{valid} if it satisfies all +the conditions on \betats{} pointers and on association between darts +and attributes. High level operations provided on combinatorial maps +ensure that these conditions are always satisfied. Sometimes, it can +be useful to use low level operations in a specific algorithm, for +example to modify locally a combinatorial map in a really fast way. In +such a case, additional operations may be needed to restore these +validity conditions. + + +\section{Software Design}\label{sec-software-design} + +The diagram in Figure~\ref{fig-diagram_class} shows the different +classes of the package. \ccc{Combinatorial_map} is the main class +(see Section~\ref{ssec-combinatorial-map}). It allows to manage darts +(see Section~\ref{ssec-darts}) and attributes (see +Section~\ref{ssec-attributes}). +Users can customize a combinatorial map thanks to an items class (see +Section~\ref{ssec-item}), which defines the dart type and the +attribute types. These types may be different for different +dimensions, and they may also be void. The darts and attributes are +accessed through \emph{handles}. A handle is a model of the +\ccc{Handle} concept, thus supporting the two dereference operators +\ccc{operator*} and \ccc{operator->}. + +\begin{figure} + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=.95\textwidth] + {Combinatorial_map/fig/pdf/Diagramme_class} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ + +
+ \end{ccHtmlOnly} + \caption{UML diagram of the main classes of the package. \emph{k} is the number of + non void attributes.} + \label{fig-diagram_class} +\end{figure} + +\subsection{Combinatorial Maps}\label{ssec-combinatorial-map} + +The class \ccc{Combinatorial_map} is a model of the +\ccc{CombinatorialMap} concept. It has three template parameters +standing for the dimension of the combinatorial map (an +\ccc{unsigned int}), an items class (a model of the +\ccc{CombinatorialMapItems} +concept), and an allocator which must be a model of the allocator +concept of the {\stl}. Default classes are provided for the items and +the allocator classes. + +The main role of the class \ccc{Combinatorial_map} is the storage and +the management of darts. It allows to create or remove an isolated +dart from the combinatorial map. The \ccc{Dart_handle} type defines a +handle to the type of used darts (given in the items class). +\ccc{Combinatorial_map} provides several \emph{ranges} which allow to +iterate over specific subsets of darts of the combinatorial map (see +Section~\ref{ssec-range}). It also defines several methods to link +and to unlink darts by \betai{}s (see +Section~\ref{ssec-link-darts}). We said that a dart \emph{d0} is \emph{i}-free +if \betai{}(\emph{d0})=$\varnothing$. The $\varnothing$ constant is +represented in the class \ccc{Combinatorial_map} through a +\ccc{static const Dart_handle} +called \nulldart{}. Finally, some high level +operations are defined as global functions taking a +\ccc{Combinatorial_map} as argument (see +Section~\ref{ssec-operations}) + +The second role of the class \ccc{Combinatorial_map} is the storage +and the management of attributes. It allows to create or remove an +attribute, and provides methods to associate attributes and cells. +A range is defined for each \emph{i}-attribute allowing to iterate +over all the \emph{i}-attributes of the combinatorial map. Finally, +\ccc{Combinatorial_map} defines several types allowing to manage the +attributes. We can use +\ccc{Combinatorial_map::Attribute_handle::type} for a handle to the +\emph{i}-attributes (and the const version +\ccc{Combinatorial_map::Attribute_const_handle::type}) and +\ccc{Combinatorial_map::Attribute_type::type} for the type of the +\emph{i}-attributes. + +\subsection{Combinatorial Map Items}\label{ssec-item} + +The \ccc{CombinatorialMapItems} concept defines dart and attribute +types of a combinatorial map. It contains one inner class named +\ccc{Dart_wrapper}, having one template parameter, \ccc{CMap}, a model +of \ccc{CombinatorialMap} concept. The \ccc{Dart_wrapper} class +provides two local types: \ccc{Dart} which must be a model of the +\ccc{Dart} concept, and \ccc{Attributes} which defines the attributes +and their types. + +The \ccc{Attributes} tuple must contain at most \emph{d}+1 types (one for +each possible cell dimension of the combinatorial map). Each type of +the tuple must be either a model of the \ccc{CellAttribute} concept or +\ccc{void}. The first type corresponds to 0-attributes, the second to +1-attributes and so on. If the \ccTexHtml{$i^{\mbox{th}}$}{ith} type in the tuple is +\ccc{void}, \emph{(i-1)}-attributes are disabled: we say that +\emph{(i-1)}-attributes are \emph{void}. Otherwise, \emph{(i-1)}-attributes are +enabled and have the given type: we say \emph{(i-1)}-attributes are +\emph{non void}. If the size of the tuple is \emph{k}, with \emph{k}\mylt{}\emph{dimension+1}, \myforall{}\emph{i}: \emph{k}\myleq{}\emph{i}\myleq{}dimension, +\emph{i}-attributes are void. + +The class \ccc{Combinatorial_map_min_items} is a model of the +\ccc{CombinatorialMapItems} concept which can be used for default behaviors. +It defines \ccc{CGAL::Dart} as type of dart, and +\ccc{Attributes} as empty tuple. + +\subsection{Darts}\label{ssec-darts} + +The class \ccc{Dart}, a model of the \ccc{Dart} concept, +defines a \emph{d}D dart. It has two template parameters standing for the +dimension of the combinatorial map, and a model of the +\ccc{CombinatorialMap} concept, which provides the two types +\ccc{Dart_handle} and \ccc{Dart_const_handle}. + +Each instance \ccc{d0} of \ccc{Dart} stores the \betai{} pointers in an +array of \emph{d}+1 \ccc{Dart_handle} (because we describe also the +\betazero{} pointer). It also stores the attributes associated to this +dart in a tuple of \ccc{CMap::Attribute_handle::type}, one for each +non void \emph{i}-attribute. + +Methods are defined allowing to retrieve each \betai{} and each +associated \emph{i}-attribute of \ccc{d0}, and allowing to test if \ccc{d0} +dart is \emph{i}-free. + +Note that the use of the \ccc{Dart} class is not hard wired in +the combinatorial map class. Users can provide their own model of the +\ccc{Dart} concept, and pass it to the combinatorial map with the help +of a custom item class. + +\subsection{Cell Attributes}\label{ssec-attributes} + +The class \ccc{Cell_attribute}, a +model of the \ccc{CellAttribute} concept, represents an attribute +associated with a cell of a combinatorial map. The +template parameter \ccc{CMap} must be a model of the +\ccc{CombinatorialMap} concept. The attribute stores a handle to one +dart of its associated cell when the template parameter \ccc{Tag} is +\ccc{Tag_true}. +\ccc{Info_} is the type of information stored in the attribute. It may +be \ccc{void}. \ccc{OnMerge} and \ccc{OnSplit} must be either +\ccc{Null_functor}, or models of the \ccc{Binary Function} concept +having two references to a model of \ccc{CellAttribute} as type of +both parameters and \ccc{void} as return type. There are two default +parameters for \ccc{OnMerge} and \ccc{OnSplit}, which are +\ccc{Null_functor}, a default parameter for \ccc{Tag} which is +\ccc{Tag_true}, and a default parameter for \ccc{Info_} which is +\ccc{void}. + +If \ccc{Info_} is different from \ccc{void}, the class +\ccc{Cell_attribute} contains two methods \ccc{info()} returning the +information contained in the attribute (const and non const version). +The information is returned by reference, thus the non const version +allows the modification of the information. + +Two attributes are merged when their corresponding cells are merged +into one cell during some operation. In this case, the functor +\ccc{OnMerge} is called, unless it is equal to \ccc{Null_functor}. +This functor allows the user to define its own custom behavior when +two attributes are merged (for example if the information is a color, +we can compute the average color of the two initial attributes, and +affect this value to the first attribute, see example in +Section~\ref{ssec-combi-map-with-color}). Similarly, the functor +\ccc{OnSplit} is called when one attribute is split in two, because +its corresponding cell is split in two during some operation, unless +it is equal to \ccc{Null_functor}. In any high level operation, +\ccc{OnMerge} is called before to start the operation (i.e. before +modifying the combinatorial map), and \ccc{OnSplit} is called when the +operation is finished (i.e. after all the modifications were made). + +What we said for the dart also holds for the cell attribute. The +combinatorial map can be used with any user defined model of the +\ccc{CellAttribute} concept. + +\subsection{Example of Combinatorial Map Definition}\label{ssec-example-def} + +Here comes an example of two combinatorial map definitions. The first +case \ccc{Example_cmap4} defines a 4D combinatorial map which uses all +the default values (\ccc{Dart} and +\ccc{Combinatorial_map_min_items}). The second example +\ccc{Example_custom_cmap3} uses its own model of the +\ccc{CombinatorialMapItems} concept. In this model, the type +of dart is \ccc{Dart<3,CMap>}, thus a dart is in 3D, and an +attribute containing an integer is associated to edges. + +\begin{ccExampleCode} +typedef CGAL::Combinatorial_map<4> Example_cmap4; + +struct Example_items_3 +{ + template + struct Dart_wrapper + { + typedef CGAL::Dart<3, CMap> Dart; + typedef CGAL::Cell_attribute Edge_attrib; + typedef CGAL::cpp0x::tuple Attributes; + }; +}; +typedef CGAL::Combinatorial_map<3, Example_items_3> Example_custom_cmap3; +\end{ccExampleCode} + + +\section{Iteration and Creation Operations} + +An important operation in combinatorial maps consists in iterating +over specific subsets of darts or over attributes. For that, several +\emph{ranges} are offered (see Section~\ref{ssec-range}). A range is +a model of the \ccc{Range} concept, thus supporting the two methods +\ccc{begin()} and \ccc{end()} allowing to iterate over all the +elements in the range. Several global functions allow to create +specific configurations of darts into a combinatorial map (see +Section~\ref{ssec-construction}). Darts can be marked during +operations, for example when performing a breadth-first search +traversal, thanks to Boolean marks (see +Sections~\ref{ssec-adv-marks}). In the following, we denote by +\ccc{dh0}, \ccc{dh1}, \ccc{dh2} the dart handles for the darts +\ccc{d0}, \ccc{d1}, \ccc{d2}, respectively. That is \ccc{d0 == *dh0}. + +\subsection{Iterating over Orbits, Cells, and Attributes}\label{ssec-range} + +The combinatorial map offers iterators to traverse the darts +of a specific orbit, to traverse all darts of one cell, or +one dart per cell, and to traverse all \emph{i}-attributes. + +Instead of the \ccc{begin()/end()} member function pair as we know it +from \stl\ containers, and from most \cgal\ data structures, the +combinatorial map defines range classes which are all models of the +\ccc{Range} concept. + +There are three different categories of dart range classes: +\begin{itemize} +\item \ccc{Dart_range}: range of all the darts of a combinatorial map; +\item \ccc{Dart_of_orbit_range}: range of all the darts of + the orbit \orbit{\ccc{Beta...}}(\emph{d0}) for a given \emph{d0}. \ccc{Beta...} is a + sequence of integers + \ccTexHtml{$i_1$}{i1},\myldots{},\ccTexHtml{$i_k$}{ik}, + each \ccTexHtml{$i_j$}{ij}\myin{}\{0,\ldots,\emph{d}\}. + These integers must satisfy: + \ccTexHtml{$i_1$}{i1}\mylt{}\ccTexHtml{$i_2$}{i2}\mylt{}\myldots{}\mylt{}\ccTexHtml{$i_k$}{ik}, + and (\ccTexHtml{$i_1$}{i1}\myneq{}0 or \ccTexHtml{$i_2$}{i2}\myneq{}1) + (for example \ccc{Dart_of_orbit_range<1,2>} for the orbit + \orbit{\betaun{},\betadeux{}}(\emph{d0})); +\item \ccc{Dart_of_cell_range}: range of all the darts of + the \cell{i} containing a given dart. The \cell{i} is considered in + dimension \ccc{dim} (with 0\myleq{}\emph{dim}\myleq{}\emph{d}, + \emph{dim}=\emph{d} by default), + with 0\myleq{}\emph{i}\myleq{}\emph{dim+1}. If \emph{i}=\emph{dim+1}, + \ccc{Dart_of_cell_range} is the range of all the darts of + the connected component containing a given dart. +\end{itemize} + +There are also two different classes of ranges containing one dart per +\cell{i}. Note that in these classes, the dart of each \cell{i} can +be any dart of the cell. Moreover, each \cell{i} (and \cell{j} in the +second case) is considered in dimension \ccc{dim} (with +0\myleq{}\emph{dim}\myleq{}\emph{d}, \emph{dim=d} by default). +\begin{itemize} +\item \ccc{One_dart_per_cell_range}: range containing one dart of + each \cell{i} of the combinatorial map, 0\myleq{}\emph{i}\myleq{}\emph{dim+1} (for + example \ccc{One_dart_per_cell_range<2>} for the range of one dart per + 2-cell of the combinatorial map); +\item \ccc{One_dart_per_incident_cell_range}: range + containing one dart of each \cell{i} incident to the \cell{j} + containing a given dart, with 0\myleq{}\emph{i}\myleq{}\emph{dim+1} and + 0\myleq{}\emph{j}\myleq{}\emph{dim+1} (for example + \ccc{One_dart_per_incident_cell_range<0,3>} for the range of + one dart per vertex of the volume incident to the starting dart). + If \emph{i}=\emph{j}, the range contains only the given dart. +\end{itemize} + +The iterators of the \ccc{Dart_range} are bidirectional iterators, +while the iterators of the other four ranges are forward iterators. +The value type of all these iterators is \ccc{Dart} thus all these +iterators can be directly used as \ccc{Dart_handle}. + +Additionally, there is a range over non void \emph{i}-attributes: +\ccc{Attribute_range::type}, having a bidirectional iterator with +value type \ccc{Attribute_type::type}. + +For each range, there is an associated const range, a model of the +\ccc{ConstRange} concept. You can find some examples of ranges in +Section~\ref{ssec-example-3DCM}. + +\subsection{Construction Operations}\label{ssec-construction} + +Several global functions allow to create specific configurations of +darts into a combinatorial map. Existing darts in the combinatorial +map are not modified. Note that the dimension of the combinatorial map +must be large enough: darts must contain all the \betats{} pointers used by the +operation. All these functions take an instance of +\ccc{CombinatorialMap} as first parameter (called \ccc{cm}) and return +a \ccc{Dart_handle} to a new dart created during the operation. + +\begin{itemize} +\item \ccc{make_edge(cm)}: creates an isolated edge (two darts + linked by \betadeux{}); dimension must be greater or equal than two; +\item \ccc{make_combinatorial_polygon(cm,lg)}: creates an + isolated combinatorial polygon of length \ccc{lg} (\ccc{lg} darts + linked by \betaun{}), for \ccc{lg>0}; dimension must be greater + or equal than one; +\item \ccc{make_combinatorial_tetrahedron(cm)}: creates an + isolated combinatorial tetrahedron (four combinatorial triangles + linked together by \betadeux{}); dimension must be greater or equal + than two; +\item \ccc{make_combinatorial_hexahedron(cm)}: creates an + isolated combinatorial hexahedron (six combinatorial quadrangles + linked together by \betadeux{}); dimension must be greater or equal + than two. +\end{itemize} + +\begin{ccAdvanced} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\subsection{Boolean Marks\label{ssec-adv-marks}} + +It is often necessary to mark darts, for example to retrieve in \emph{O(1)} +if a given dart was already processed during a specific algorithm, for example, +iteration over a given range. Users can also mark specific parts of a +combinatorial map (for example mark all the darts belonging to objects +having specific semantics). To answer these needs, a +\ccc{CombinatorialMap} has a certain number of Boolean marks (fixed by +the constant \ccc{NB_MARKS}). When one +wants to use a Boolean mark, the following methods are available (with +\ccc{cm} an instance of a combinatorial map): +\begin{itemize} +\item get a new free mark: \ccc{int m = cm.get_new_mark()} (return + -1 if no mark is available); + +\item set mark \ccc{m} for a given dart \ccc{d0}: \ccc{cm.mark(dh0,m)}; +\item unset mark \ccc{m} for a given dart \ccc{d0}: \ccc{cm.unmark(dh0,m)}; +\item test if a given dart \ccc{d0} is marked for \ccc{m}: \ccc{cm.is_marked(dh0,m)}; + +\item unmark all the darts of \ccc{cm} for \ccc{m}: \ccc{cm.unmark_all(m)}; + +\item negate mark \ccc{m} of all the darts of \ccc{cm}: \ccc{cm.negate_mark(m)}. + All the marked darts become unmarked and all the unmarked darts become marked; + +\item free mark \ccc{m}: + \ccc{cm.free_mark(m)}. This method unmarks all the darts of \ccc{cm} + for \ccc{m} before freeing it. +\end{itemize} + +It is important to free a mark when it is no longer needed, otherwise +you may at some point run out of marks. + +The following example illustrates how to use marks. Two combinatorial +tetrahedra are created and 3-sewn (see Section~\ref{ssec-link-darts} +for a detailed description of the sew operation). Then a mark is +reserved and used to mark all the darts belonging to the first +combinatorial tetrahedron. Finally, these tetrahedron are merged. The +marks allow us to know which darts come from the first and second +tetrahedron. + +\ccIncludeExampleCode{Combinatorial_map/map_3_marks.cpp} + +\end{ccAdvanced} + +\section{Modification Operations} + +Several operations allow to modify a given combinatorial map. +There are two main categories of modification operations: +\begin{itemize} +\item Sew, link, unsew and unlink which modify some existing \betats{} + pointers, without creating or removing darts (see + Section~\ref{ssec-link-darts}); +\item Removal and insertion of cells which modify both darts and + \betats{} pointers (see Section~\ref{ssec-operations}). +\end{itemize} +% + +\subsection{Sewing Orbits and Linking Darts \label{ssec-link-darts}} + +The \ccc{CombinatorialMap} defines two groups of methods to modify the +\betats{} pointers of existing darts. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\LargFig{.45\textwidth} +\begin{figure} + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=\LargFig]{Combinatorial_map/fig/pdf/exemple-carte-3d-sew}\qquad + \includegraphics[width=\LargFig]{Combinatorial_map/fig/pdf/exemple-carte-3d-sew2} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ \end{ccHtmlOnly} + \caption{Example of 3-sew operation. \textbf{Left}:~A 3D + combinatorial map containing two volumes that are not connected, + with 2-attributes. Each attribute contains a color in RGB format, + and there are four 2-cells associated with attributes. + Associations between darts and attributes are drawn with red + segments. \textbf{Right}:~The 3D combinatorial map obtained as + result of \ccc{sew<3>(1,5)} (or \ccc{sew<3>(2,8)}, or + \ccc{sew<3>(3,7)}, or \ccc{sew<3>(4,6)}). Darts (1,5), (2,8), + (3,7) and (4,6) are linked together by \betatrois{}. The two 2-cells + \emph{c1}=\{1,2,3,4\} and \emph{c2}=\{5,6,7,8\} are merged after the sew + into the 2-cell \{1,2,3,4,5,6,7,8\}. We are in the case where + the two attributes are non NULL, thus the first one is kept, and + all the darts of \emph{c2} are associated with the first attribute.} + \label{fig-exemple-sew} +\end{figure} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{itemize} +\item The \ccc{sew} and \ccc{unsew} methods iterate over two orbits in + order to link or unlink specific darts two by two. Intuitively, a + \ccc{sew} operation glues two \cells{i} by identifying two of + their \cells{(i-1)} (see example in Figure~\ref{fig-exemple-sew} + where \ccc{sew<3>} is used to glue two 3-cells along one 2-cell). + Reciprocally, a \ccc{unsew} operation un-glues two \cells{i} which + were glued along one of their \cells{(i-1)}. + These methods guarantee that given a valid combinatorial map and a + possible operation we obtain a valid combinatorial map as result of + the operation. + +\item +\begin{ccAdvanced} + The \ccc{link_beta} and \ccc{unlink_beta} methods only modify + the pointer of two darts: the obtained combinatorial maps may be not + valid. These operations can be useful to use low level operations + in a specific algorithm, for example to modify locally a + combinatorial map in a really fast way. In such a case, additional + operations may be needed to restore the validity conditions. +\end{ccAdvanced} +\end{itemize} + +Linking two darts \emph{d1} and \emph{d2} by \betai{}, with 2\myleq{}\emph{i}\myleq{}\emph{d} +and \emph{d1}\myneq{}\emph{d2}, consists in modifying two \betai{} pointers such that +\betai{}(\emph{d1})=\emph{d2} and \betai{}(\emph{d2})=\emph{d1}. For \emph{i}=1, the modification +is \betaun{}(\emph{d1})=\emph{d2} (and thus \betazero{}(\emph{d2})=\emph{d1} by definition of +\betazero{}); in this case we can have \emph{d1=d2} (a dart linked with +itself corresponds to an edge which is a loop). + +Reciprocally, unlinking a given dart \emph{d0} by \betai{}, with 2\myleq{} +\emph{i}\myleq{}\emph{d}, consists in modifying two \betai{} pointers +such that \betai{}(\betai{}(\emph{d0}))=$\varnothing$ and +\betai{}(\emph{d0})=$\varnothing$. For \emph{i=1}, the modification is +\betaun{}(\emph{d0})=$\varnothing$ (and thus +\betazero{}(\betaun{}(\emph{d0}))=$\varnothing$ by definition of \betazero{}). Note +that is it possible to unlink a given dart for \betai{} only if it is +not \emph{i}-free. + +The \ccc{sew(dh1,dh2)} method consists mainly to link two by two +several darts by \betai{}. This operation is possible only if there is +a bijection \emph{f} between all the darts of the orbit +\emph{D1}=\orbit{\betaun{},\myldots{},\betaimdeux{},\betaipdeux{},\myldots{},\betad{}}(\emph{d1}) and +\emph{D2}=\orbit{\betaun{},\myldots{},\betaimdeux{},\betaipdeux{},\myldots{},\betad{}}(\emph{d2}) +satisfying: \emph{f}(\emph{d1})=\emph{d2}, and for all \emph{e}\myin{}\emph{D1}, +for all \emph{j}\myin{}\{1,\myldots{},i-2,i+2,\myldots{},\emph{d}\}, +\emph{f}(\betaj{}(\emph{e}))=\betajinv{}(\emph{f}(\emph{e})). Intuitively, this condition +ensures the validity of the combinatorial map by verifying that +condition discussed in Section~\ref{ssec-combimap-validity} will be +satisfied after the operation. This condition can be tested by using the method +\ccc{is_sewable(dh1,dh2)}. For example, the function +\ccc{is_sewable} would return \ccc{false} if we tried to sew a +triangular facet with a quad facet. Note that given two darts \emph{d1} +and \emph{d2}, if there is such a bijection, it is uniquely defined. So giving +the two darts as arguments of the \ccc{sew} is enough to retrieve +all the pairs of darts to link. +If such a bijection exists, the \ccc{sew(dh1,dh2)} operation +consists only in linking by \betai{} each couple of darts \emph{d3} and +\emph{d4} such that \emph{d3}=\emph{f}(\emph{d4}). + +In addition, the sew operation updates the associations between darts +and non void attributes in order to guarantee that all the darts +belonging to a given cell are associated with the same attribute +(which is a condition of combinatorial map validity). For each couple +of \cells{j} \emph{c1} and \emph{c2} that are merged into one \cell{j} during +the sew, we have to update the two associated attributes \emph{attr1} and +\emph{attr2}. If both are NULL, there is nothing to do. If one is NULL +and the other not, we only associate the non NULL attribute to all the +darts of the resulting cell. When the two attributes are non NULL, we +first apply functor \ccc{On_merge} on the two attributes \emph{attr1} and +\emph{attr2} (see Section~\ref{ssec-attributes}). Then, we associate the +attribute \emph{attr1} to all darts of the resulting \cell{j}. Finally, +attribute \emph{attr2} is removed from the combinatorial map. + +Note that when the two attributes are non NULL, the first one is +kept. But user can customize this behavior in order to update the +information contained in the attributes according to its needs. For +that, we can define a specific functor, and use it as template +argument for \ccc{OnMerge} parameter of the \ccc{Cell_attribute} +definition. This functor can for example copy the information of the +second attribute in the information of the first one to make as if the +second attribute is kept. + +For example, in Figure~\ref{fig-exemple-sew}, we want to 3-sew the two +initial volumes. \ccc{sew<3>(1,5)} links by \betatrois{} the pairs of +darts (1,5), (2,8), (3,7) and (4,6), thus the combinatorial map +obtained is valid. 2-attributes are updated so that all the darts +belonging to the 2-cell containing dart 1 become associated to the +same 2-attribute after the operation. + +Similarly, \ccc{unsew(dh0)} operation unlinks \betai{} for all the darts +in the orbit +\orbit{\betaun{},\myldots{},\betaimdeux{},\betaipdeux{},\myldots{},\betad{}}(\emph{d0}), +and thus guarantees to obtain a valid combinatorial map. This +operation is possible for any non \emph{i}-free dart. + +As for the sew operations, attributes are updated to +guarantee that two darts belonging to two different \cells{j} are +associated to two different \emph{j}-attributes. If the unsew operation +splits a \cell{j} \emph{c} in two \cells{j} \emph{c1} and \emph{c2}, and if \emph{c} is +associated to a \emph{j}-attribute \emph{attr1}, then this attribute is duplicated +into \emph{attr2}, and all the darts belonging to \emph{c2} are associated +with this new attribute. Finally, we call the functor \ccc{On_split} +on the two attributes \emph{attr1} and \emph{attr2} (see +Section~\ref{ssec-attributes}). + +Let us consider the combinatorial map given in +Figure~\ref{fig-exemple-sew} (Right). If we call \ccc{unsew<3>(2)}, we +obtain the combinatorial map in Figure~\ref{fig-exemple-sew} (Left) +(except for the color of the attribute associated to the +2-cell \{5,6,7,8\} which would be \texttt{\#00ff00}). The \ccc{unsew<3>} +operation has duplicated the 2-attribute associated to the 2-cell +\{1,2,3,4,5,6,7,8\} since this 2-cell is split in two after the +unsew operation. + +\begin{ccAdvanced} + If one wants to modify a combinatorial map \emph{manually}, it is + possible to switch off the updating between + darts and attributes by passing \ccc{false} as last argument of + \ccc{sew(dh1,dh2,update_attributes=true)} and + \ccc{unsew(dh0,update_attributes=true)}. In these cases, the + combinatorial map obtained may be no longer valid due to incorrect + associations between darts and attributes. + + In Figure~\ref{fig-exemple-sew} (Left), if we call + \ccc{sew<3>(1,5,false)}, the resulting combinatorial map is similar + to the combinatorial map of Figure~\ref{fig-exemple-sew} (Right) + (we have linked by \betatrois{} the pairs of darts (1,5), (2,8), + (3,7) and (4,6)), but associations between darts and attributes + are not valid. Indeed, we have kept the four initial attributes + and all the associations between darts and attributes, thus two + darts belonging to the same 2-cell (for example darts 1 and 5) are + associated with two different attributes. + + We can also use the + \ccc{link_beta(dh1,dh2,update_attributes=true)} which links + \ccc{d1} and \ccc{d2} by \betai{} without modifying the other + links. + Association between darts and attributes are only modified for darts + \ccc{d1} and \ccc{d2}, and similarly as for \ccc{sew}, this + updating can be avoided by passing \ccc{false} as last argument of + \ccc{link_beta(dh1,dh2,update_attributes)}. Lastly, we can use + \ccc{unlink_beta(dh0)} to unlink \ccc{d0} for \betai{}. In this + last case, there is no modification of association between darts and + attributes. + + In Figure~\ref{fig-exemple-sew} (Left), if we call + \ccc{link_beta<3>(1,5)}, in the resulting combinatorial map we have + now \betatrois{}(1)=5 and \betatrois{}(5)=1. This combinatorial map is no + longer valid (for example dart 2 is 3-free and we should have + \betatrois{}(2)=8). + +\end{ccAdvanced} + +\subsection{Removal and Insertion Operations}\label{ssec-operations} + +The following high level operations are defined as global functions +taking an instance \ccc{cm} of \ccc{CombinatorialMap} as first +argument. All these methods ensure that given a valid combinatorial +map and a possible operation, the modified combinatorial map is also +valid. + +The first one is \ccc{remove_cell(cm,dh0)} which modifies the +combinatorial map to remove the \cell{i} containing dart \ccc{d0}, +with 0\myleq{}\emph{i}\myleq{}\emph{d}. This operation is possible +if \emph{i}=\emph{d} or if the given +\cell{i} is incident to at most two \cells{(i+1)} which can be tested +thanks to \ccc{is_removable(cm,dh0)}. If the removed \cell{i} +was incident to two different \cells{(i+1)}, these two cells are +merged into one \cell{(i+1)}. In this case, the \ccc{On_merge} functor +is called if two \emph{(i+1)}-attributes are associated to the two +\cells{(i+1)}. If the \cell{i} is associated with a non void +attribute, it is removed from the combinatorial map (see three +examples on Figures~\ref{fig-insert-vertex}, \ref{fig-insert-edge} and +\ref{fig-insert-face}). + +\begin{figure}[htb] + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=.75\textwidth]{Combinatorial_map/fig/pdf/insert-vertex} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ \end{ccHtmlOnly} + \caption{Example of \ccc{insert_cell_0_in_cell_1} and + \ccc{remove_cell<0>} operations. \textbf{Left}:~Initial + combinatorial map. \textbf{Right}:~After the insertion of a + 0-cell in the 1-cell containing dart \ccc{d1}. Now if we remove + the 0-cell containing dart \ccc{d2}, we obtain the initial + combinatorial map.} + \label{fig-insert-vertex} +\end{figure} + +The inverse operation of the removal is the insertion operation. +Several versions exist, sharing a common principle. They consist in +adding a new \cell{i} "inside" an existing \cell{j}, \emph{i}\mylt{}\emph{j}, by +splitting the \cell{j} into several \cells{j}. Contrary to +\ccc{remove_cell}, is it not possible to define a unique +\ccc{insert_cell_i_in_cell_j} function because parameters +are different depending on \ccc{i} and \ccc{j}. + +\ccc{insert_cell_0_in_cell_1(cm,dh0)} adds a 0-cell in +the 1-cell containing dart \ccc{d0}. The 1-cell is split in two. This +operation is possible if \ccc{d0}\myin{}\ccc{cm.darts()} (see +example on Figure~\ref{fig-insert-vertex}). + +\ccc{insert_cell_0_in_cell_2(cm,dh0)} adds a 0-cell in +the 2-cell containing dart \ccc{d0}. The 2-cell is split in +triangles, one for each initial edge of the facet. This operation +is possible if \ccc{d0}\myin{}\ccc{cm.darts()} (see example on +Figure~\ref{fig-triangulate}). + +\begin{figure}[htb] + \begin{ccTexOnly} + \centerline{\includegraphics[width=.85\textwidth] + {Combinatorial_map/fig/pdf/triangulation}} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ \end{ccHtmlOnly} + \caption{Example of \ccc{insert_cell_0_in_cell_2} operation.} + \label{fig-triangulate} +\end{figure} + +\ccc{insert_cell_1_in_cell_2(cm,dh1,dh2)} adds a 1-cell in +the 2-cell containing darts \ccc{d1} and \ccc{d2}, between the two +0-cells containing darts \ccc{d1} and \ccc{d2}. The 2-cell is split +in two. This operation is possible if \emph{d1}\myin{}\orbit{\betaun{}}(\emph{d2}) +which can be tested thanks to +\ccc{is_insertable_cell_1_in_cell_2(cm,dh1,dh2)}. In the example on +Figure~\ref{fig-insert-edge}, it is possible to insert an edge +between darts \emph{d2} and \emph{d3}, but it is +not possible to insert an edge between \emph{d1} and \emph{d3}. + +\begin{figure}[htb] + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=.72\textwidth]{Combinatorial_map/fig/pdf/insert-edge} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ \end{ccHtmlOnly} + \caption{Example of \ccc{insert_cell_1_in_cell_2} and + \ccc{remove_cell<1>} operations. \textbf{Left}:~Initial + combinatorial map. \textbf{Right}:~After the insertion of two + 1-cells: a first one between the two 0-cells containing darts + \ccc{d2} and \ccc{d3}, and a second one incident to the 0-cell + containing dart \ccc{d1}. Now if we remove the two + 1-cells containing darts \ccc{d4} and \ccc{d5}, we obtain the + initial combinatorial map.} + \label{fig-insert-edge} +\end{figure} + + +\ccc{insert_dangling_cell_1_in_cell_2(cm,dh0)} adds a 1-cell in +the 2-cell containing dart \ccc{d0}, the 1-cell being attached by only +one of its vertex to the 0-cell containing dart \ccc{d0}. +This operation is possible if \ccc{d0}\myin{}\ccc{cm.darts()}. + +\ccc{insert_cell_2_in_cell_3(cm,itbegin,itend)} adds a +2-cell in the 3-cell containing all the darts between +\ccc{itbegin} and \ccc{itend}, along the path of 1-cells +containing darts in [\ccc{itbegin},\ccc{itend}). The 3-cell is +split in two. This operation is possible if all the +darts in [\ccc{itbegin},\ccc{itend}) form a closed path inside a same 3-cell +which can be tested thanks to +\ccc{is_insertable_cell_2_in_cell_3(cm,itbegin,itend)} +(see example on Figure~\ref{fig-insert-face}). + +\begin{figure}[htb] + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=.75\textwidth]{Combinatorial_map/fig/pdf/insert-facet} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ \end{ccHtmlOnly} + \caption{Example of \ccc{insert_cell_2_in_cell_3} and + \ccc{remove_cell<2>} operations. \textbf{Left}:~Initial + combinatorial map. \textbf{Right}:~After the insertion of a + 2-cell along the path of 1-cells containing respectively + \ccc{d1,d2,d3,d4}. Now if we remove the 2-cell containing dart + \ccc{d5}, we obtain the initial combinatorial map.} + \label{fig-insert-face} +\end{figure} + +Some examples of use of these operations are given in +Section~\ref{ssec-exemple-operations}. + +\section{Examples} + +\subsection{A 3D Combinatorial Map}\label{ssec-example-3DCM} + +In this example, a 3-dimensional combinatorial map is constructed. Two +combinatorial tetrahedra are created, then the numbers of cells of the +combinatorial map are displayed, and the validity of the combinatorial +map is checked. Then, we illustrate the use of ranges to iterate over +specific darts. The first loop enumerates all the darts of the first +tetrahedron by using the range \ccc{Dart_of_orbit_range<1,2>}, and the +second loop enumerates all the darts of the facet containing dart +\ccc{dh2} by using the range +\ccc{Dart_of_orbit_range<1>}. + +\ccIncludeExampleCode{Combinatorial_map/map_3_simple_example.cpp} + +The output is: +\begin{verbatim} +#Darts=24, #0-cells=8, #1-cells=12, #2-cells=8, #3-cells=2, #ccs=2, valid=1 +Number of darts of the first tetrahedron: 12 +Number of darts of the facet containing dh2: 3 +\end{verbatim} + +which gives the number of darts of the combinatorial map, the numbers +of different cells, the number of connected components, and finally a +Boolean showing the validity of the combinatorial map (a tetrahedron +is made up of 12 darts because there are 3 darts per facet and there +are 4 facets). + +%\begin{ccAdvanced} +Note the creation in the for loops of the two instances of +\ccc{Dart_of_orbit_range::const_iterator}: \ccc{it} is the current iterator, +and \ccc{itend} an iterator to the end of the range. Having +\ccc{itend} avoids calling \ccc{cm.darts_of_orbit<1,2>(dh1).end()} +again and again as in the following example (which is a bad +solution): +\begin{ccExampleCode} + for (CMap_3::Dart_of_orbit_range<1,2>::const_iterator + it(cm.darts_of_orbit<1,2>(dh1).begin()); + it!=cm.darts_of_orbit<1,2>(dh1).end()); ++it) + {...} +\end{ccExampleCode} +%\end{ccAdvanced} + +\subsection{High Level Operations} +\label{ssec-exemple-operations} + +This example shows some uses of high level operations. First we +create a combinatorial hexahedron, the combinatorial map obtained is shown in +Figure~\ref{fig_exemple_ope} (Left). Then we insert two 1-cells along +two opposite 2-cells of the hexahedron. The combinatorial map +obtained is shown in Figure~\ref{fig_exemple_ope} (Middle). Finally, we +insert a 2-cell in the diagonal of the hexahedron in order to split +it into two parts. We obtain the combinatorial map shown in +Figure~\ref{fig_exemple_ope} (Right). We display the characteristics +of the combinatorial map and check its validity. + +The second part of this example removes the inserted elements. First +we remove the inserted 2-cell, then the two inserted 1-cells. We get +back the initial combinatorial hexahedron, which is verified by displaying once +again the characteristics of the combinatorial map. + +\ccIncludeExampleCode{Combinatorial_map/map_3_operations.cpp} + +The output is: +\begin{verbatim} +#Darts=36, #0-cells=8, #1-cells=14, #2-cells=9, #3-cells=2, #ccs=1, valid=1 +#Darts=24, #0-cells=8, #1-cells=12, #2-cells=6, #3-cells=1, #ccs=1, valid=1 +\end{verbatim} + +The first line gives the characteristics of the combinatorial map +after all the insertions (the combinatorial map drawn in +Figure~\ref{fig_exemple_ope} (Right)). There are two 3-cells (since +the combinatorial hexahedron was split in two by the 2-cell +insertion), nine 2-cells (since two 2-cells of the original hexahedron +were split in two by the two 1-cell insertions, and a new 2-cell was +created during the 2-cell insertion), fourteen 1-cells (since there +are two new 1-cells created by the 1-cell insertion) while the number +of 0-cells remains unchanged. + +The second line is the result after the removal operations. We +retrieve the original combinatorial hexahedron since we have removed +all the inserted elements. + +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FIGURE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\largFig{.25\textwidth}% +\begin{figure} + \begin{ccTexOnly} + \begin{center} + \includegraphics[width=\largFig]{Combinatorial_map/fig/pdf/ope1}\qquad + \includegraphics[width=\largFig]{Combinatorial_map/fig/pdf/ope2}\qquad + \includegraphics[width=\largFig]{Combinatorial_map/fig/pdf/ope3} + \end{center} + \end{ccTexOnly} + \begin{ccHtmlOnly} +
+ + + +
+ \end{ccHtmlOnly} + \caption{Example of high level operations. + \textbf{Left}:~Initial 3D combinatorial map after the + creation of the combinatorial hexahedron. + \textbf{Middle}:~Combinatorial map obtained after + the two 1-cell insertions. The two 2-cells were split in two. + \textbf{Right}:~Combinatorial map obtained after the 2-cell + insertion. The 3-cell was split in two.} + \label{fig_exemple_ope} +\end{figure} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FIGURE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\subsection{A 4D Combinatorial Map} + +In this example, a 4-dimensional combinatorial map is used. Two +tetrahedral cells are created and sewn by \betaquatre{}. Then the numbers +of cells of the combinatorial map are displayed, and its validity is +checked. + +By looking at these numbers of cells, we can see that the 4D +combinatorial map contains only one 3-cell. Indeed, the \ccc{sew<4>} +operation has identified by pairs all the darts of the two 3-cells +by definition of the sew operation (see Section~\ref{ssec-link-darts}) +which, in 4D, links by \betatrois{} all the darts in +\orbit{\betaun{},\betadeux{}}(\emph{d1}) and in +\orbit{\betaun{},\betadeux{}}(\emph{d2}). The +situation is similar (but in higher dimension) to the +configuration where we have two triangles in a 3D combinatorial map, +and you use \ccc{sew<3>} between these two triangles. The two triangles +are identified since all their darts are linked by \betatrois{}, thus we +obtain a 3D combinatorial map containing only one 3-cell. Note that +this 3-cell is unbounded since the darts of the two triangles are all +2-free. In the 4D case, the 4-cell is unbounded since all its darts +are 3-free. + +In this example, we also illustrate how to use the basic methods to +build "by hand" some specific configuration in a combinatorial +map. In fact, these functions are already present in the package: +function \ccc{make_triangle(cm)} is equivalent to +\ccc{CGAL::make_combinatorial_polygon(cm,3)} and +\ccc{make_tetrahedron(cm)} is equivalent to +\ccc{CGAL::make_combinatorial_tetrahedron(cm)}. If we want to create a 4D +simplex, we must create five 3D simplexes, and sew them correctly +two by two by \betatrois{} (and so on if you want to create higher +dimensional combinatorial map). + +\ccIncludeExampleCode{Combinatorial_map/map_4_simple_example.cpp} + +The output is: +\begin{verbatim} +#Darts=24, #0-cells=4, #1-cells=6, #2-cells=4, #3-cells=1, #4-cells=2, #ccs=1, valid=1 +\end{verbatim} + +\subsection{Combinatorial Map With Attributes} +\label{ssec-combi-map-with-color} + +In the following example, we illustrate how to specify the +2-attributes in a 3D combinatorial map. For that, we define our own +item class using \ccc{CGAL::Dart<3,CMap>} as type of dart, and +\ccc{CGAL::Cell_attribute} +as attributes which contain an \ccc{int} and which are associated to +2-cells of the combinatorial map. + +Functors \ccc{Sum_functor} and \ccc{Divide_by_two_functor} define a +custom behavior: when two attributes \ccc{ca1} and \ccc{ca2} are +merged into \ccc{ca1}, the value of \ccc{ca1} is the sum of the +two initial values. When an attribute \ccc{ca1} is split in the two +attributes \ccc{ca1} and \ccc{ca2}, the value of each attribute is +half of the first value. + +\ccIncludeExampleCode{Combinatorial_map/map_3_with_colored_facets.cpp} + +The output is: +\begin{verbatim} +20; 7; 7; 7; 7; 7; 13; 13; 13; 13; 13; +2; 7; 7; 7; 7; 7; 2; 13; 13; 13; 13; 13; 5; 10; +#Darts=64, #0-cells=13, #1-cells=24, #2-cells=14, #3-cells=2, #ccs=1, valid=1 +\end{verbatim} + +Before the \ccc{cm.sew<3>}, each 2-cell of the first cube is +associated with an attribute having 7 as value, and each 2-cell of the +second cube with an attribute having 13 as value. During the +\ccc{cm.sew<3>}, two 2-cells are merged, thus the functor +\ccc{Sum_functor} is called on the two associated 2-attributes, and +the value of the new 2-cell is the sum of the two previous one: 20. + +Then we call \ccc{CGAL::insert_cell_0_in_cell_2} on a dart which +belong to this 2-cell. This method splits the existing 2-cell in \emph{k} +2-cells, \emph{k} being the number of 1-cells of the initial 2-cell (4 in +this example). These splits are made consecutively, thus for the first +split, we create a new attribute as copy of the initial one and call +functor \ccc{Divide_by_two_functor} on these two attributes: the value +of each attribute is thus 20/2=10. For the second split, the value of +each attribute is thus 10/2=5, and for the last split the value of +each attribute is thus 5/2=2 (remember that information contained in +2-attributes in an \ccc{int}). At the end, we obtain five +2-attributes with 7 as value, five 2-attributes with 13 as value, and +four 2-attributes having respectively 2, 2, 5 and 10 as values. + +\section{Mathematical Definitions}\label{sec_definition} + +The initial definition of combinatorial map in any dimension is given +in \cite{cgal:l-tmbrc-91,l-ndgcm-94}. But it allows only to represent +objects without boundaries. This definition was extended +\cite{cgal:pabl-cco-07,cgal:d-ccccg-10} in order to allow to represent +objects with boundaries, based on the notions of partial permutations +and partial involutions. + +Intuitively, a \emph{partial permutation} on a finite set \emph{E} is a +mapping from \emph{E}\mycup{}\{$\varnothing$\} to \emph{E}\mycup{}\{$\varnothing$\} which is +injective on the subset of the domain that does not map to +$\varnothing$. More precisely, a mapping \emph{p}: \emph{E}\mycup{}\{$\varnothing$\} +\myrightarrow{} \emph{E}\mycup{}\{$\varnothing$\} is a \emph{partial permutation} +defined on \emph{E} if: +\begin{enumerate} +\item \emph{p}($\varnothing$)=$\varnothing$; +\item \myforall{}\emph{e1}\myin{}\emph{E}, \myforall{}\emph{e2}\myin{}\emph{E}, + \emph{p}(\emph{e1})=\emph{p}(\emph{e2})\myneq{}$\varnothing$ \myRightarrow{} \emph{e1}=\emph{e2}. +\end{enumerate} + +The inverse \pinv{} of this partial permutation is also a partial +permutation and is defined by: +\begin{enumerate} +\item \pinv{}($\varnothing$)=$\varnothing$; +\item \myforall{}\emph{e}\myin{}\emph{E}, if it exists \emph{a}\myin{}\emph{E} such that + \emph{p}(\emph{a})=\emph{e}, + then \pinv{}(\emph{e})=a, otherwise \pinv{}(\emph{e})=$\varnothing$. +\end{enumerate} + +Let \emph{E} be a set, and \emph{p} a partial permutation on \emph{E}. An element +\emph{e} is called a \emph{fixed point} for \emph{p} if \emph{p(e)=e}. \emph{p} is a +\emph{partial involution} if \myforall{}\emph{e}\myin{}\emph{E}: \emph{p}(\emph{e})\myneq{}$\varnothing$ +\myRightarrow{} \emph{p}(\emph{p}(\emph{e}))=\emph{e}. + +Now we can give the definition of a combinatorial map in any dimension. +Let \emph{d}\mygeq{}0. A \emph{d}-dimensional combinatorial map (or +\emph{d}-map) is a (d+1)-tuple \emph{M}=(\emph{D},\betaun{},\myldots{},\betad{}) +where: +\begin{enumerate} +\item \emph{D} is a finite set of darts; +\item \betaun{} is a partial permutation on \emph{D}; +\item \myforall{}\emph{i}, 2\myleq{}\emph{i}\myleq{}\emph{d}, \betai{} is a + partial involution on \emph{D} without fixed point; +\item\label{cond-composition} \myforall{}\emph{i}: 0\myleq{}\emph{i}\myleq{}\emph{d}-2, + \myforall{}\emph{j}: 3\myleq{}\emph{j}\myleq{}\emph{d}, \emph{i}+2\myleq{}\emph{j}, + \betai{}\comp{}\betaj{} is a partial involution. +\end{enumerate} + +A \emph{d}-dimensional combinatorial map represents a subdivision of an +orientable \emph{d}-dimensional quasi-manifold. A dart is an abstract element +which is only required to define partial permutations. The last line of +the definition fixes constraints which guarantee the topological +validity of the represented object, i.e., the fact that it is a +quasi-manifold. This definition allows us to verify the validity of a +given combinatorial map by checking if each item of the definition is +satisfied. + +Given a set of partial permutations +\emph{S}=\{\ccTexHtml{$f_1$}{f1},\myldots{},\ccTexHtml{$f_k$}{fk}\}, +we denote by \orbit{\emph{S}} the \emph{permutation group} generated by +\{\ccTexHtml{$f_1$}{f1},\myldots{},\ccTexHtml{$f_k$}{fk}\} +and whose group operation is the composition of partial permutations. +The orbit \orbit{\ccTexHtml{$f_1$}{f1},\myldots{},\ccTexHtml{$f_k$}{fk}}(\emph{a}) +is the set of darts which can be obtained from \emph{a} by elements of \orbit{\emph{S}}: +\orbit{\ccTexHtml{$f_1$}{f1},\myldots{},\ccTexHtml{$f_k$}{fk}}(\emph{a})=\{\myphi{}(\emph{a})$|$\myphi{}\myin{}\orbit{\emph{S}}\}\mysetminus{}\{$\varnothing$\}. + +Let \emph{d0}\myin{}\emph{D} be a dart. Given \emph{i}, 1\myleq{}\emph{i}\myleq{}\emph{d}, +the \cell{i} containing \emph{d0} is +\orbit{\betaun{},\myldots{},\betaimun{},\betaipun{},\myldots{},\betad{}}(\emph{d0}). +The \emph{0}-cell containing \emph{d0} is +\orbit{\{\betai{}\comp{}\betaj{}$|$\myforall{}\emph{i,j}: 1\myleq{}\emph{i}\mylt{}\emph{j}\myleq{}\emph{d}\}}(\emph{d0}). + +\section{Design and Implementation History} + +The code of this package is inspired by Moka, a 3D topological modeler +mainly developed by Fr\'ed\'eric Vidil and Guillaume Damiand +(\ccAnchor{http://moka-modeller.sourceforge.net/}{http://moka-modeller.sourceforge.net/}). +However, Moka was based on Generalized maps (and not Combinatorial +maps), and the design was not \cgal\ "compatible". Thus, Guillaume +Damiand started to develop a totally new package by mixing ideas taken +from Moka with the design of the Halfedge data structure package of +\cgal. Andreas Fabri and S\'ebastien Loriot contributed to the +design, the coding, and to the documentation of the package, and +Laurent Rineau helped for the design. Emma Michel contributed to the +manual. Monique Teillaud and Bernd Gaertner contributed to the manual +by giving useful remarks, really numerous and detailed for Monique. diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/PkgDescription.tex b/Combinatorial_map/doc_tex/Combinatorial_map/PkgDescription.tex new file mode 100644 index 00000000000..8d5c90eae06 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map/PkgDescription.tex @@ -0,0 +1,25 @@ + +\begin{ccPkgDescription}{Combinatorial Maps\label{Pkg:CombinatorialMaps}} + \ccPkgHowToCiteCgal{cgal:d-cm-11b} \ccPkgSummary{This package + implements Combinatorial Maps in \emph{d}-dimension. A combinatorial + map is a data structure allowing to represent an orientable + subdivided object by describing all the cells of the subdivision + (for example in 3D vertices, edges, faces, volumes) and all the + incidence and adjacency relationships between these cells. + Information can be associated to cells thanks to attributes. + + In 2D, a combinatorial map is equivalent to an halfedge data + structure. + + The package provides basic creations, modification operations, and + several iterators allowing to run through some specific part of + the object.} + +\ccPkgIntroducedInCGAL{3.9} +\ccPkgLicense{\ccLicenseLGPL} +\ccPkgIllustration{Combinatorial_map/logo-cmap-small-v2.png} + %{Combinatorial_map/logo-combinatorial-map-small.png} + {Combinatorial_map/logo-combinatorial-map.png} +% \ccPkgDemo{2D Combinatorial Map}{combinatorial_map_2.zip} +% \ccPkgDemo{3D Combinatorial Map}{combinatorial_map_3.zip} +\end{ccPkgDescription} diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/Diagramme_class.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/Diagramme_class.fig new file mode 100644 index 00000000000..cf5239d24f8 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/Diagramme_class.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/exemple-carte-3d-sew.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/exemple-carte-3d-sew.fig new file mode 100644 index 00000000000..489d1a73d12 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/exemple-carte-3d-sew.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/exemple-carte-3d-sew2.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/exemple-carte-3d-sew2.fig new file mode 100644 index 00000000000..7df8fefb20b Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/exemple-carte-3d-sew2.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/exemple-carte2-3d.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/exemple-carte2-3d.fig new file mode 100644 index 00000000000..f268197bfdf Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/exemple-carte2-3d.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/insert-edge.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/insert-edge.fig new file mode 100644 index 00000000000..ea341966454 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/insert-edge.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/insert-facet.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/insert-facet.fig new file mode 100644 index 00000000000..9198396359c Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/insert-facet.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/insert-vertex.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/insert-vertex.fig new file mode 100644 index 00000000000..2ee6d688ec9 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/insert-vertex.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-map.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-map.fig new file mode 100644 index 00000000000..efea8ac5e2a Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-map.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-map2d.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-map2d.fig new file mode 100644 index 00000000000..b75c4ec07cc Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-map2d.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-zoom.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-zoom.fig new file mode 100644 index 00000000000..eabd9c57d05 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-zoom.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-zoom2.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-zoom2.fig new file mode 100644 index 00000000000..721443c7ad1 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example-zoom2.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example.fig new file mode 100644 index 00000000000..fe47450111b Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/intuitif-example.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/logo-cmap-small-v2.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/logo-cmap-small-v2.fig new file mode 100644 index 00000000000..bef5180a593 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/logo-cmap-small-v2.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/logo-cmap-small.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/logo-cmap-small.fig new file mode 100644 index 00000000000..32132415642 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/logo-cmap-small.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/logo-cmap.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/logo-cmap.fig new file mode 100644 index 00000000000..b8b5ba51593 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/logo-cmap.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/map2d-with-attrib.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/map2d-with-attrib.fig new file mode 100644 index 00000000000..8e18d3cb166 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/map2d-with-attrib.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/object2d-nonmanifold.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/object2d-nonmanifold.fig new file mode 100644 index 00000000000..b522f6998d0 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/object2d-nonmanifold.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/object2d.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/object2d.fig new file mode 100644 index 00000000000..8cd26b69ab4 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/object2d.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/object3d-nonmanifold.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/object3d-nonmanifold.fig new file mode 100644 index 00000000000..e072309e817 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/object3d-nonmanifold.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/object3d-nonmanifold2.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/object3d-nonmanifold2.fig new file mode 100644 index 00000000000..1134cf33b39 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/object3d-nonmanifold2.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/object3d.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/object3d.fig new file mode 100644 index 00000000000..6c0844e8d3b Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/object3d.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/ope1.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/ope1.fig new file mode 100644 index 00000000000..fce565eb7c2 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/ope1.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/ope2.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/ope2.fig new file mode 100644 index 00000000000..44fedfa2ea0 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/ope2.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/ope3.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/ope3.fig new file mode 100644 index 00000000000..8d9b45feee5 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/ope3.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pb-carte3D.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pb-carte3D.fig new file mode 100644 index 00000000000..1fcf7c5d23d Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pb-carte3D.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pb2-carte3D.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pb2-carte3D.fig new file mode 100644 index 00000000000..097fe0d22d4 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pb2-carte3D.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/Diagramme_class.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/Diagramme_class.pdf new file mode 100644 index 00000000000..a130698346d Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/Diagramme_class.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/exemple-carte-3d-sew.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/exemple-carte-3d-sew.pdf new file mode 100644 index 00000000000..d8012d0a8af Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/exemple-carte-3d-sew.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/exemple-carte-3d-sew2.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/exemple-carte-3d-sew2.pdf new file mode 100644 index 00000000000..7acebda7df7 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/exemple-carte-3d-sew2.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/exemple-carte2-3d.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/exemple-carte2-3d.pdf new file mode 100644 index 00000000000..b5e265f093e Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/exemple-carte2-3d.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/insert-edge.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/insert-edge.pdf new file mode 100644 index 00000000000..47defeadb46 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/insert-edge.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/insert-facet.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/insert-facet.pdf new file mode 100644 index 00000000000..5d07754f3d6 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/insert-facet.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/insert-vertex.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/insert-vertex.pdf new file mode 100644 index 00000000000..df2c0ca0b02 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/insert-vertex.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-map.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-map.pdf new file mode 100644 index 00000000000..f84bf18dc47 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-map.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-map2d.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-map2d.pdf new file mode 100644 index 00000000000..4e170cd1439 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-map2d.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-zoom.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-zoom.pdf new file mode 100644 index 00000000000..c78c54a0c24 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-zoom.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-zoom2.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-zoom2.pdf new file mode 100644 index 00000000000..3a7bd7b50fe Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example-zoom2.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example.pdf new file mode 100644 index 00000000000..7f6b9ebb79c Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/intuitif-example.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/map2d-with-attrib.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/map2d-with-attrib.pdf new file mode 100644 index 00000000000..625a0ec218a Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/map2d-with-attrib.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object2d-nonmanifold.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object2d-nonmanifold.pdf new file mode 100644 index 00000000000..8186e512e3c Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object2d-nonmanifold.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object2d.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object2d.pdf new file mode 100644 index 00000000000..2acfbec4f04 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object2d.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object3d-nonmanifold.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object3d-nonmanifold.pdf new file mode 100644 index 00000000000..9fe93c770a4 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object3d-nonmanifold.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object3d-nonmanifold2.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object3d-nonmanifold2.pdf new file mode 100644 index 00000000000..8076a2b0af8 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object3d-nonmanifold2.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object3d.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object3d.pdf new file mode 100644 index 00000000000..2cf16c88ef3 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/object3d.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/ope1.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/ope1.pdf new file mode 100644 index 00000000000..4c7751ff022 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/ope1.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/ope2.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/ope2.pdf new file mode 100644 index 00000000000..5a5bd1b01b4 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/ope2.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/ope3.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/ope3.pdf new file mode 100644 index 00000000000..2fcdd88a0ab Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/ope3.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/pb-carte3D.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/pb-carte3D.pdf new file mode 100644 index 00000000000..4fa78f9d566 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/pb-carte3D.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/pb2-carte3D.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/pb2-carte3D.pdf new file mode 100644 index 00000000000..ecc77bede2c Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/pb2-carte3D.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/quasivariete.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/quasivariete.pdf new file mode 100644 index 00000000000..c9d8ebd72cf Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/quasivariete.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/quasivarietea.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/quasivarietea.pdf new file mode 100644 index 00000000000..d2244343511 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/quasivarietea.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/triangulation.pdf b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/triangulation.pdf new file mode 100644 index 00000000000..985784a9955 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/pdf/triangulation.pdf differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/Diagramme_class.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/Diagramme_class.png new file mode 100644 index 00000000000..ec4148058cc Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/Diagramme_class.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/exemple-carte-3d-sew.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/exemple-carte-3d-sew.png new file mode 100644 index 00000000000..cfb5d27f137 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/exemple-carte-3d-sew.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/exemple-carte-3d-sew2.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/exemple-carte-3d-sew2.png new file mode 100644 index 00000000000..36dfacc83ff Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/exemple-carte-3d-sew2.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/exemple-carte2-3d.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/exemple-carte2-3d.png new file mode 100644 index 00000000000..bac546d002d Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/exemple-carte2-3d.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/insert-edge.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/insert-edge.png new file mode 100644 index 00000000000..03103a4e701 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/insert-edge.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/insert-facet.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/insert-facet.png new file mode 100644 index 00000000000..2893391397f Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/insert-facet.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/insert-vertex.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/insert-vertex.png new file mode 100644 index 00000000000..da908b109d6 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/insert-vertex.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-map.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-map.png new file mode 100644 index 00000000000..e058db6ee68 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-map.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-map2d.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-map2d.png new file mode 100644 index 00000000000..6f8aafae143 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-map2d.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-zoom.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-zoom.png new file mode 100644 index 00000000000..e8ef6335732 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-zoom.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-zoom2.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-zoom2.png new file mode 100644 index 00000000000..e1908cf046c Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example-zoom2.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example.png new file mode 100644 index 00000000000..789b09650b3 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/intuitif-example.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/map2d-with-attrib.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/map2d-with-attrib.png new file mode 100644 index 00000000000..9c54966c17d Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/map2d-with-attrib.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object2d-nonmanifold.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object2d-nonmanifold.png new file mode 100644 index 00000000000..acf0bdd4f8f Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object2d-nonmanifold.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object2d.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object2d.png new file mode 100644 index 00000000000..42abd05f361 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object2d.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object3d-nonmanifold.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object3d-nonmanifold.png new file mode 100644 index 00000000000..826426d6c69 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object3d-nonmanifold.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object3d-nonmanifold2.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object3d-nonmanifold2.png new file mode 100644 index 00000000000..d0583dc5514 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object3d-nonmanifold2.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object3d.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object3d.png new file mode 100644 index 00000000000..c1874b899ed Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/object3d.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/ope1.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/ope1.png new file mode 100644 index 00000000000..cc59e48c1e3 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/ope1.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/ope2.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/ope2.png new file mode 100644 index 00000000000..5fe1bb47159 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/ope2.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/ope3.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/ope3.png new file mode 100644 index 00000000000..c51eb27f976 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/ope3.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/pb-carte3D.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/pb-carte3D.png new file mode 100644 index 00000000000..b11abcea7f2 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/pb-carte3D.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/pb2-carte3D.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/pb2-carte3D.png new file mode 100644 index 00000000000..476977760bd Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/pb2-carte3D.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/quasivariete.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/quasivariete.png new file mode 100644 index 00000000000..346eabae61c Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/quasivariete.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/quasivarietea.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/quasivarietea.png new file mode 100644 index 00000000000..5025f451257 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/quasivarietea.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/triangulation.png b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/triangulation.png new file mode 100644 index 00000000000..c18b6aefafd Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/png/triangulation.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/quasivariete.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/quasivariete.fig new file mode 100644 index 00000000000..2c2f16d9620 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/quasivariete.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/quasivarietea.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/quasivarietea.fig new file mode 100644 index 00000000000..cb51e7211d1 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/quasivarietea.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/fig/triangulation.fig b/Combinatorial_map/doc_tex/Combinatorial_map/fig/triangulation.fig new file mode 100644 index 00000000000..1952787df64 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/fig/triangulation.fig differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/logo-cmap-small-v2.png b/Combinatorial_map/doc_tex/Combinatorial_map/logo-cmap-small-v2.png new file mode 100644 index 00000000000..5e2199d690a Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/logo-cmap-small-v2.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/logo-combinatorial-map-small.png b/Combinatorial_map/doc_tex/Combinatorial_map/logo-combinatorial-map-small.png new file mode 100644 index 00000000000..7707fbfb166 Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/logo-combinatorial-map-small.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/logo-combinatorial-map.png b/Combinatorial_map/doc_tex/Combinatorial_map/logo-combinatorial-map.png new file mode 100644 index 00000000000..bdd7128f14c Binary files /dev/null and b/Combinatorial_map/doc_tex/Combinatorial_map/logo-combinatorial-map.png differ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map/main.tex b/Combinatorial_map/doc_tex/Combinatorial_map/main.tex new file mode 100644 index 00000000000..053cde7db39 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map/main.tex @@ -0,0 +1,11 @@ + +\ccUserChapter{Combinatorial Maps\label{ChapterCombinatorialMap}} +\ccChapterAuthor{Guillaume Damiand} + +\input{Combinatorial_map/PkgDescription.tex} +\minitoc + + +\input{Combinatorial_map/Combinatorial_map.tex} + + diff --git a/Combinatorial_map/doc_tex/Combinatorial_map_ref/CellAttribute.tex b/Combinatorial_map/doc_tex/Combinatorial_map_ref/CellAttribute.tex new file mode 100644 index 00000000000..75ebd9ff520 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map_ref/CellAttribute.tex @@ -0,0 +1,115 @@ +% +------------------------------------------------------------------------+ +% | Reference manual page: CellAttribute.tex +% +------------------------------------------------------------------------+ +% | 04.02.2010 Guillaume Damiand +% | Package: Combinatorial_map +% +------------------------------------------------------------------------+ +\ccRefPageBegin +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ +\begin{ccRefConcept}{CellAttribute} +%\ccRefLabel{CGAL::CellAttribute} + +\ccDefinition + +The concept \ccRefName\ represents a non void attribute associated +with a cell of a combinatorial map. It can keep a handle to one +dart of its associated cell, and can contain any information. + +% . The attribute keeps a handle to one dart +% of its associated cell when the template parameter \ccc{Tag} is +% \ccc{Tag_true} (bi-directional association between darts and +% attributes). If \ccc{Tag} is \ccc{Tag_false}, the attribute does not +% know a dart of its associated cell (uni-directional association from +% darts to attributes). + +% \ccParameters +% \ccc{Refs} must be a model of the \ccc{CombinatorialMap} concept defining +% \ccc{Dart_handle} and \ccc{Dart_const_handle} types.\\ +% \ccc{Tag} \ccc{Tag_true} to enable the storage of a +% \ccc{Dart_handle} of the associated cell, \ccc{Tag_false} otherwise.\\ +% \ccc{FunctorOnMerge} functor called when two attributes are merged. +% Must be a model of the \ccc{AttributeFunctor} concept.\\ +% \ccc{FunctorOnSplit} functor called when one attribute is split in two. +% Must be a model of the \ccc{AttributeFunctor} concept. + +\ccTypes +\ccNestedType{Dart_handle}{Dart handle type.} +\ccGlue +\ccNestedType{Dart_const_handle}{Dart const handle type.} + +\ccNestedType{Info}{Type of the information contained in the attribute. + If \ccc{void}, the cell attribute does not have any information.} + +\ccNestedType{Supports_cell_dart} + {Equals to \ccc{Tag_true} to enable the storage of a + \ccc{Dart_handle} of the associated cell, \ccc{Tag_false} otherwise.} + +\ccNestedType{On_merge}{Functor called before merging two attributes. Must be + a model of the \ccc{Binary Function} concept having two references + to a model of \ccc{CellAttribute} as type of both arguments and \ccc{void} as + return type.} +\ccGlue +\ccNestedType{On_split}{Functor called after an attribute was split in two. + Must be a model of the \ccc{Binary Function} concept having two references + to a model of \ccc{CellAttribute} as type of both arguments and \ccc{void} as + return type.} +%the \ccc{AttributeFunctor} concept + +% +-----------------------------------+ +\ccCreation +\ccCreationVariable{ca} + +\ccConstructor{CellAttribute();}{} + +\ccConstructor{Cell_attribute(const Info& info);} + {Constructor initializing the information of \ccc{ca} by the + copy contructor \ccc{Info(info)}. + Defined only if \ccc{Info} is different from \ccc{void}.} + +% +-----------------------------------+ +\ccHeading{Access Member Functions} + +\ccMethod{Dart_handle dart();} + {Returns one dart of the cell associated to attribute \ccc{ca}. + NULL if \ccc{Supports_cell_dart} is equal to \ccc{Tag_false}.} +\ccGlue +\ccMethod{Dart_const_handle dart() const;} + {Returns one dart of the cell associated to attribute \ccc{ca}, + when \ccc{ca} is const. + NULL if \ccc{Supports_cell_dart} is equal to \ccc{Tag_false}.} + +\ccMethod{void set_dart(Dart_handle ahandle);} + {Sets the dart of the cell associated to attribute \ccc{ca} to \ccc{ahandle}, + if \ccc{Supports_cell_dart} is equal to \ccc{Tag_true}. + Otherwise, this method does nothing. + \ccPrecond{\ccc{ahandle} belongs to the cell associated to \ccc{ca}.} +} + +\ccMethod{Info& info();} + {Returns the information of \ccc{ca}. + Defined only if \ccc{Info} is different from \ccc{void}.} + +\ccMethod{const Info& info() const;} + {Returns the information of \ccc{ca}, when \ccc{ca} is const. + Defined only if \ccc{Info} is different from \ccc{void}.} + +\ccHasModels +\ccRefIdfierPage{CGAL::Cell_attribute} +%\ccRefIdfierPage{CGAL::Cell_attribute_with_info}\\ + +% \ccRefIdfierPage{CGAL::Cell_with_point}\\ +% \ccRefIdfierPage{CGAL::Cell_with_point_and_attribute}\\ + + +\ccSeeAlso +%\ccRefConceptPage{CGAL::AttributeFunctor}\\ +\ccRefConceptPage{CombinatorialMap}\\ +\ccRefConceptPage{CombinatorialMapItems} + +\end{ccRefConcept} +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map_ref/Cell_attribute.tex b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Cell_attribute.tex new file mode 100644 index 00000000000..9ff565d5472 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Cell_attribute.tex @@ -0,0 +1,90 @@ +% +------------------------------------------------------------------------+ +% | Reference manual page: Cell_attribute.tex +% +------------------------------------------------------------------------+ +% | 04.02.2010 Guillaume Damiand +% | Package: Combinatorial_map +% +------------------------------------------------------------------------+ +\ccRefPageBegin +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ +\begin{ccRefClass}{Cell_attribute} +\ccRefLabel{CGAL::Cell_attribute} + +\ccInclude{CGAL/Cell_attribute.h} + +\ccDefinition + +The class \ccRefName\ represents an attribute containing (or not) an information. + +\ccIsModel +\ccRefConceptPage{CellAttribute} + +\ccParameters +\ccc{CMap} must be a model of the \ccc{CombinatorialMap}.\\ +\ccc{Info_} is the type of the information contained in the attribute.\\ +% If \ccc{void}, the cell attribute does not have any information.\\ +\ccc{Tag} is \ccc{Tag_true} to enable the storage of a + \ccc{Dart_handle} of the associated cell, \ccc{Tag_false} otherwise.\\ +\ccc{OnMerge} is the type of the functor called before two attributes are merged.\\ +% Must +% be either \ccc{Null_functor}, or a model of the +% \ccc{Binary Function} concept having +% \ccc{Cell_attribute} as type of +% both arguments and \ccc{void} as return type.\\ +\ccc{OnSplit} is the type of the functor called after one attribute is split in two. + % Must be either \ccc{Null_functor}, or a model of the + % \ccc{Binary Function} concept having + % \ccc{Cell_attribute} as type of both + % arguments and \ccc{void} as return type. + + By default, \ccc{OnMerge} and \ccc{OnSplit} are equal to + \ccc{Null_functor}; \ccc{Tag} is equal to + \ccc{Tag_true}; and \ccc{Info_} is equal to \ccc{void}. + +\ccTypes +\ccThree{typedef CMap::Dart_const_handle}{}{} +\ccTypedef{typedef Info_ Info;}{} +\ccGlue +\ccTypedef{typedef Tag Supports_cell_dart;}{} +\ccGlue +\ccTypedef{typedef OnMerge On_merge;}{} +\ccGlue +\ccTypedef{typedef OnSplit On_split;}{} + +\ccTypedef{typedef CMap::Dart_handle Dart_handle;}{} +\ccGlue +\ccTypedef{typedef CMap::Dart_const_handle Dart_const_handle;}{} + +% +-----------------------------------+ +% \ccCreation +% \ccCreationVariable{ca} + +% \ccConstructor{Cell_attribute();}{} + +% \ccConstructor{Cell_attribute(const Info& info);} +% {Constructor initializing the information of \ccc{ca} by the +% copy contructor \ccc{Info(info)}. +% Defined only if \ccc{Info} is different from \ccc{void}.} + +% % +-----------------------------------+ +% \ccHeading{Access Member Functions} + +% \ccMethod{Info& info();} +% {Returns the information of \ccc{cawi}. +% Defined only if \ccc{Info} is different from \ccc{void}.} + +% \ccMethod{const Info& info() const;} +% {Returns the information of \ccc{cawi}, when \ccc{cawi} is const. +% Defined only if \ccc{Info} is different from \ccc{void}.} + +\ccSeeAlso +%\ccRefIdfierPage{CGAL::Void_functor}\\ +%\ccRefIdfierPage{CGAL::Cell_attribute_with_info}\\ +\ccRefIdfierPage{CGAL::Combinatorial_map} + +\end{ccRefClass} +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map_ref/CombinatorialMap.tex b/Combinatorial_map/doc_tex/Combinatorial_map_ref/CombinatorialMap.tex new file mode 100644 index 00000000000..2ca7a2b4201 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map_ref/CombinatorialMap.tex @@ -0,0 +1,461 @@ +% +------------------------------------------------------------------------+ +% | Reference manual page: CombinatorialMap.tex +% +------------------------------------------------------------------------+ +% | 04.02.2010 Guillaume Damiand +% | Package: Combinatorial_map +% +------------------------------------------------------------------------+ +\ccRefPageBegin +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ +\begin{ccRefConcept}{CombinatorialMap} +%\ccRefLabel{CGAL::CombinatorialMap} + +\ccDefinition + +The concept \ccRefName\ defines a \emph{d}-dimensional combinatorial map. + +%\ccParameters +%\ccc{d} an integer for the dimension of the map.\\ +%\ccc{Items} must be a model of the \ccc{CombinatorialMapItems} concept. \\ +%\ccc{Alloc} must be a standard allocator for \stl\ container classes. + +%\ccIsModel + +\ccCreation +\ccCreationVariable{cm} +\ccConstructor{CombinatorialMap();}{Default constructor.} + +%%%%%%%%%%%%% TYPES +\ccTypes +\ccNestedType{Dart}{Dart type, a model of the \ccc{Dart} concept.} +\ccGlue +\ccNestedType{Dart_handle}{Dart handle type, equal to \ccc{Dart::Dart_handle}.} +\ccGlue +\ccNestedType{Dart_const_handle}{Dart const handle type, equal to \ccc{Dart::Dart_const_handle}.} +\ccGlue +\ccNestedType{size_type}{Size type (an unsigned integral type).} + + +% +-----------------------------------+ +\ccConstants +\ccVariable{static unsigned int dimension;}{The dimension \emph{d} of \ccc{cm}, equal to \ccc{Dart::dimension.}} +\ccGlue +\ccVariable{static size_type NB_MARKS;}{The number of available Boolean marks of \ccc{cm}.} +\ccGlue +\ccVariable{static Dart_handle null_dart_handle;}{The null dart handle constant: a dart \ccc{d0} + is \emph{i}-free if \ccc{d0.beta(i)==null_dart_handle}. + Note that \ccc{*null_dart_handle}\mynotin{}\ccc{cm.darts()}.} + +% \ccGlue +% \ccNestedType{Dart_container}{dart container type.} + +%\ccNestedType{Items}{the items class provided as template parameter.} +\ccHeading{Types for attributes} + +\ccNestedType{Attributes} +{The tuple of attributes, containing at most + \emph{dimension+1} types (one for each possible cell of the combinatorial + map). Each type of the tuple must be either a model of the + \ccc{CellAttribute} concept or \ccc{void}. + The first type corresponds to 0-attributes, + the second to 1-attributes and so on. + If the \ccTexHtml{$i^{\mbox{th}}$}{ith} type in the tuple is \ccc{void}, + \emph{(i-1)}-attributes are disabled. Otherwise, \emph{(i-1)}-attributes are enabled and + have the given type. If the size of the tuple is \emph{k}, + with \emph{k}\mylt{}\emph{dimension+1}, \myforall{}\emph{i}: \emph{k}\myleq{}\emph{i}\myleq{}\emph{dimension}, + \emph{i}-attributes are disabled.} + +\ccNestedType{template Attribute_type::type} + {Type of \emph{i}-attributes, a model of \ccc{CellAttribute} concept. + \ccc{Attribute_type::type::Dart_handle} is equal to \ccc{Dart_handle}, and + \ccc{Attribute_type::type::Dart_const_handle} is equal to \ccc{Dart_const_handle}. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension} and \emph{i}-attributes are non void.}} +\ccGlue +\ccNestedType{template Attribute_handle::type} + {Handle to \emph{i}-attributes, equal to \ccc{Dart::Attribute_handle::type}. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension} and \emph{i}-attributes are non void.}} +\ccGlue +\ccNestedType{template Attribute_const_handle::type} + {Const handle to \emph{i}-attributes, equal to \ccc{Dart::Attribute_const_handle::type}. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension} and \emph{i}-attributes are non void.}} + +\ccHeading{Range types} +\ccNestedType{Dart_range}{Range of all the darts of \ccc{cm}. + This type is a model of \ccc{Range} concept, its iterator type is bidirectional and its value type is \ccc{Dart}.} +\ccGlue +\ccNestedType{Dart_const_range}{Const range of all the darts of \ccc{cm}. + This type is a model of \ccc{ConstRange} concept, its iterator type is bidirectional and its value type is \ccc{Dart}.} + +\ccNestedType{template Attribute_range::type} +{Range of all the \emph{i}-attributes (which must be non void), with 0\myleq{}\emph{i}\myleq{}\emph{dimension}. + This type is a model of \ccc{Range} concept, its iterator type is bidirectional and its value type is \ccc{Attribute_type::type}.} +\ccGlue +\ccNestedType{template Attribute_const_range::type} +{Const range of all the \emph{i}-attributes (which must be non void), with 0\myleq{}\emph{i}\myleq{}\emph{dimension}. + This type is a model of \ccc{ConstRange} concept, its iterator type is bidirectional and its value type is \ccc{Attribute_type::type}.} + +% +\ccNestedType{template Dart_of_orbit_range} +{Range of all the darts of the \ccc{} orbit. + This type is a model of \ccc{Range} concept, its iterator type is forward and its value type is \ccc{Dart}.} +\ccGlue +\ccNestedType{template Dart_of_orbit_const_range} +{Const range of all the darts of the \ccc{} orbit. + This type is a model of \ccc{ConstRange} concept, its iterator type is forward and its value type is \ccc{Dart}.} + +\ccNestedType{template Dart_of_cell_range} +{Range of all the darts of an \emph{i}-cell in \emph{dim} dimension + (with 0\myleq{}\emph{i}\myleq{}\emph{dim+1} and 0\myleq{}\emph{dim}\myleq{}\emph{dimension}). If \emph{i==dim+1}, + range of all the darts of a connected component. + This type is a model of \ccc{Range} concept, its iterator type is forward and its value type is \ccc{Dart}.} +\ccGlue +\ccNestedType{template Dart_of_cell_const_range} +{Const range of all the darts of the \emph{i}-cell in \emph{dim} dimension + (with 0\myleq{}\emph{i}\myleq{}\emph{dim+1} and 0\myleq{}\emph{dim}\myleq{}\emph{dimension}). If \emph{i==dim+1}, + range of all the darts of a connected component. + This type is a model of \ccc{ConstRange} concept, its iterator type is forward and its value type is \ccc{Dart}.} + +\ccNestedType{template + One_dart_per_incident_cell_range} +{Range of one dart of each \emph{i}-cell incident to one \emph{j}-cell. + Cells are considered in \emph{dim} dimension + (with 0\myleq{}\emph{i}\myleq{}\emph{dim+1}, 0\myleq{}\emph{j}\myleq{}\emph{dim+1} and + 0\myleq{}\emph{dim}\myleq{}\emph{dimension}). If \emph{i}==\emph{dim+1}, + consider each connected component instead of each \emph{i}-cell. If \emph{j}==\emph{dim+1}, + consider one connected component instead of one \emph{j}-cell. + This type is a model of \ccc{Range} concept, its iterator type is forward and its value type is \ccc{Dart}.} +\ccGlue +\ccNestedType{template + One_dart_per_incident_cell_const_range} +{Const range of one dart of each \emph{i}-cell incident to one \emph{j}-cell. + Cells are considered in \emph{dim} dimension + (with 0\myleq{}\emph{i}\myleq{}\emph{dim+1}, 0\myleq{}\emph{j}\myleq{}\emph{dim+1} and + 0\myleq{}\emph{dim}\myleq{}\emph{dimension}). If \emph{i==dim+1}, + consider each connected component instead of each \emph{i}-cell. If \emph{j==dim+1}, + consider one connected component instead of one \emph{j}-cell. + This type is a model of \ccc{ConstRange} concept, its iterator type is forward and its value type is \ccc{Dart}.} + +\ccNestedType{template One_dart_per_cell_range} +{Range of one dart of each \emph{i}-cell of \ccc{cm}. + Cells are considered in \emph{dim} dimension + (with 0\myleq{}\emph{i}\myleq{}\emph{dim+1} and 0\myleq{}\emph{dim}\myleq{}\emph{dimension}). + If \emph{i==dim+1}, consider each connected component instead of each \emph{i}-cell. + This type is a model of \ccc{Range} concept, its iterator type is forward and its value type is \ccc{Dart}.} +\ccGlue +\ccNestedType{template One_dart_per_cell_const_range} +{Const range of one dart of each \emph{i}-cell of \ccc{cm}. + Cells are considered in \emph{dim} dimension + (with 0\myleq{}\emph{i}\myleq{}\emph{dim+1} and 0\myleq{}\emph{dim}\myleq{}\emph{dimension}). + If \emph{i==dim+1}, consider each connected component instead of each \emph{i}-cell. + This type is a model of \ccc{ConstRange} concept, its iterator type is forward and its value type is \ccc{Dart}.} + +% +-----------------------------------+ +\ccHeading{Access Member Functions} + +\ccMethod{bool is_empty() const;} {Returns true iff \ccc{cm} is empty, + i.e. it contains no dart.} + +\ccMethod{bool is_valid() const;} + {Returns true iff \ccc{cm} is valid.} +A combinatorial map \ccc{cm} is valid (see Sections~\ref{ssec-combi-map-and-darts} and \ref{ssec-combimap-validity}) +if for all dart handle \emph{dh} such that +\ccc{*dh}\myin{}\ccc{cm.darts()}:\\ +\begin{itemize} +\item \ccc{dh->is_free(0)}, or \ccc{dh->beta(0)->beta(1)==dh}; +\item \ccc{dh->is_free(1)}, or \ccc{dh->beta(1)->beta(0)==dh}; +\item \myforall{}\emph{i}, 2\myleq{}\emph{i}\myleq{}\emph{dimension}: + \ccc{dh->is_free(i)}, or \ccc{dh->beta(i)->beta(i)==dh}; +\item \myforall{}\emph{i},\emph{j}, 0\myleq{}\emph{i}\mylt{}\emph{i}+2\myleq{}\emph{j}\myleq{}\emph{dimension} + such that \emph{j}\mygeq{}3: \ccc{dh->beta(i)->beta(j)==null_dart_handle} or + \ccc{dh->beta(i)->beta(j)->beta(i)->beta(j)==dh}; +\item \myforall{}\emph{i}, 0\myleq{}\emph{i}\myleq{}\emph{dimension} such that \emph{i}-attributes are non void: + \myforall{}\emph{dh2} such that \ccc{*dh2} belong to the same \emph{i}-cell than \ccc{*dh}: + \ccc{dh2->attribute()==dh->attribute()}. + \end{itemize} + +\ccMethod{bool is_without_boundary(unsigned int i) const;} + {Returns true iff \ccc{cm} is wihout \emph{i}-boundary + (i.e. there is no \ccc{i}-free dart). + \ccPrecond{1\myleq{}\emph{i}\myleq{}\emph{dimension}.}} + +\ccMethod{bool is_without_boundary() const;} + {Returns true iff \ccc{cm} is without boundary in all dimensions.} + +\ccMethod{size_type number_of_darts() const;} + {Returns the number of darts in \ccc{cm}.} + +\ccMethod{Dart_handle dart_handle(Dart& adart);} + {Returns the dart handle of \ccc{adart}.} +\ccGlue +\ccMethod{Dart_const_handle dart_handle(const Dart& adart) const;} + {Returns the dart const handle of \ccc{adart}.} + +\ccMethod{template size_type number_of_attributes() const;} + {Returns the number of \emph{i}-attributes in \ccc{cm}. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}, and \emph{i}-attributes are non void.}} + +\ccMethod{template bool is_sewable(Dart_const_handle dh1, Dart_const_handle dh2) const;} + {Returns true iff \ccc{dh1} can be \emph{i}-sewn with \ccc{dh2} by + keeping \ccc{cm} valid, i.e. if there is + a bijection \emph{f} between all the darts of the orbit + \emph{D1}=\orbit{\betaun{},\myldots{},\betaimdeux{},\betaipdeux{},\myldots{},\betad{}}(\emph{dh1}) and + \emph{D2}=\orbit{\betaun{},\myldots{},\betaimdeux{},\betaipdeux{},\myldots{},\betad{}}(\emph{dh2}) + satisfying: \emph{f}(\emph{dh1})=\emph{dh2}, and for all \emph{e}\myin{}\emph{D1}, for all \emph{j}\myin{}\{1,\myldots{},\emph{i}-2,\emph{i}+2,\myldots{},\emph{d}\}, + \emph{f}(\betaj{}(\emph{e}))=\betajinv{}(\emph{f}(\emph{e})). + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}, \ccc{*dh1}\myin{}\ccc{cm.darts()}, + and \ccc{*dh2}\myin{}\ccc{cm.darts()}.}} + +\ccMethod{std::ostream& display_characteristics(std::ostream & os) const;} +{Displays on \ccc{os} the characteristics of \ccc{cm}: its number of darts, + its number of \emph{i}-cells, for each \emph{i}, 0\myleq{}\emph{i}\myleq{}CMap::\emph{dimension}, + and its number of connected components.} +Example of output for a 3D combinatorial map containing two disjoint +combinatorial tetrahedra:\\ +\texttt{\#Darts=24, \#0-cells=8, \#1-cells=12, \#2-cells=8, \#3-cells=2, \#ccs=2} + + +% +-----------------------------------+ +\ccHeading{Range Access Member Functions} + +\ccMethod{Dart_range& darts();} + {Returns a range of all the darts in \ccc{cm}.} +\ccGlue +\ccMethod{Dart_const_range& darts() const;} + {Returns a const range of all the darts in \ccc{cm}.} + +\ccMethod{template Attribute_range::type & attributes();} + {Returns a range of all the \emph{i}-attributes in \ccc{cm}. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}, and \emph{i}-attributes are non void.}} +\ccGlue +\ccMethod{template Attribute_const_range::type & attributes() const;} + {Returns a const range of all the \emph{i}-attributes in \ccc{cm}. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}, and \emph{i}-attributes are non void.}} + +% \ccMethod{std::vector count_cells(const std::vector& acells) const;} +% {count the number of $i$-cells of the combinatorial map, for each $i$ in the +% \ccc{std::vector} \ccc{acells}, with $0 \leq i \leq dimension+1$ +% (for $i=dimension+1$, count the number of connected component). +% Return a \ccc{std::vector} of size $dimension+2$ containing, for each +% $i$ in \ccc{acells}, the number of $i$-cell.} + +\ccMethod{template Dart_of_orbit_range darts_of_orbit(Dart_handle dh);} + {Returns a range of all the darts of the orbit \ccc{(dh)}. + \ccPrecond{\ccc{*dh}\myin{}\ccc{cm.darts()} and \ccc{Beta...} is a + sequence of integers \ccTexHtml{$i_1$}{i1},\myldots{},\ccTexHtml{$i_k$}{ik}, such that + 0\myleq{}\ccTexHtml{$i_1$}{i1}\mylt{}\ccTexHtml{$i_2$}{i2}\mylt{}\myldots{}\mylt{}\ccTexHtml{$i_k$}{ik}\myleq{}\emph{dimension}, and (\ccTexHtml{$i_1$}{i1}\myneq{}0 or \ccTexHtml{$i_2$}{i2}\myneq{}1).}} +\ccGlue +\ccMethod{template Dart_of_orbit_const_range darts_of_orbit(Dart_const_handle dh) const;} + {Returns a const range of all the darts of the orbit \ccc{(dh)}. + \ccPrecond{Same as for the non const version.}} + +\ccMethod{template Dart_of_cell_range darts_of_cell(Dart_handle dh);} + {Returns a range of all the darts of the \emph{i}-cell containing \ccc{dh}. + \emph{i}-cells are considered in \emph{dim} dimension. If \emph{i==dim+1}, + range of all the darts of the connected component containing \ccc{dh}. + \ccPrecond{\ccc{*dh}\myin{}\ccc{cm.darts()}, + 0\myleq{}\emph{i}\myleq{}\emph{dim+1} and 0\myleq{}\emph{dim}\myleq{}\emph{dimension}.}} +\ccGlue +\ccMethod{template Dart_of_cell_const_range darts_of_cell(Dart_const_handle dh) const;} + {Returns a const range of all the darts of the \emph{i}-cell containing \ccc{dh}. + \emph{i}-cells are considered in \emph{dim} dimension. If \emph{i==dim+1}, + const range of all the darts of the connected component containing \ccc{dh}. + \ccPrecond{Same as for the non const version.}} + +\ccMethod{template One_dart_per_incident_cell_range one_dart_per_incident_cell(Dart_handle dh);} + {Returns a range of one dart of each \emph{i}-cell incident to the \emph{j}-cell + containing \ccc{dh}. Cells are considered in \emph{dim} dimension. If \emph{i==dim+1}, + consider each connected component instead of each \emph{i}-cell. If \emph{j==dim+1}, + consider the connected component containing \ccc{dh} instead of the \emph{j}-cell. + \ccPrecond{\ccc{*dh}\myin{}\ccc{cm.darts()}, 0\myleq{}\emph{i}\myleq{}\emph{dim+1}, + 0\myleq{}\emph{j}\myleq{}\emph{dim+1} and 0\myleq{}\emph{dim}\myleq{}\emph{dimension}.}} +\ccGlue +\ccMethod{template One_dart_per_incident_cell_const_range one_dart_per_incident_cell(Dart_const_handle dh) const;} + {Returns a const range of one dart of each \emph{i}-cell incident to the \emph{j}-cell + containing \ccc{dh}. Cells are considered in \emph{dim} dimension. If \emph{i==dim+1}, + consider each connected component instead of each \emph{i}-cell. If \emph{j==dim+1}, + consider the connected component containing \ccc{dh} instead of the \emph{j}-cell. + \ccPrecond{Same as for the non const version.}} + +\ccMethod{template One_dart_per_cell_range one_dart_per_cell();} + {Returns a range of one dart of each \emph{i}-cell in \ccc{cm}. + Cells are considered in \emph{dim} dimension. If \emph{i==dim+1}, + range of one dart of each connected component in \ccc{cm}. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dim+1} and 0\myleq{}\emph{dim}\myleq{}\emph{dimension}.}} +\ccGlue +\ccMethod{template One_dart_per_cell_const_range one_dart_per_cell() const;} + {Returns a const range of one dart of each \emph{i}-cell in \ccc{cm}. + Cells are considered in \emph{dim} dimension. If \emph{i==dim+1}, + const range of one dart of each connected component in \ccc{cm}. + \ccPrecond{Same as for the non const version.}} + +% +-----------------------------------+ +\ccHeading{Modifiers} +\ccMethod{Dart_handle create_dart();} + {Creates a new dart in \ccc{cm}, and returns the corresponding handle. + A new dart is initialized to be \emph{i}-free, + \myforall{}\emph{i}: 0\myleq{}\emph{i}\myleq{}\emph{dimension}, and to have no associated + attribute for each non void attribute. + } +\ccMethod{void erase_dart(Dart_handle dh);} + {Removes \ccc{*dh} from \ccc{cm}.} + +\ccMethod{template Attribute_handle::type create_attribute();} +{Creates a new \emph{i}-attribute in \ccc{cm}, and returns the corresponding handle. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}, and \emph{i}-attributes are non void.}} + +\ccMethod{template Attribute_handle::type + create_attribute(const A&a);} +{Creates a new \emph{i}-attribute in \ccc{cm} initialized + by the constructor \ccc{A(a)}, and returns the corresponding handle. \ccc{A} must be + a type compatible with the information contained in the \emph{i}-attributes + (compatible means that there is a constructor for the information type + taking an \emph{A} as parameter). + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}, and \emph{i}-attributes are non void.}} + +\ccMethod{template void erase_attribute(Attribute_handle::type ah);} +{Removes the \emph{i}-attribute \ccc{*ah} from \ccc{cm}. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}, \emph{i}-attributes are non void, + and \ccc{*ah}\myin{}\ccc{cm.attributes()}.}} + +\ccMethod{template void set_attribute(Dart_handle dh, Attribute_handle::type ah);} + {Associates the \emph{i}-attribute of all the darts of the \emph{i}-cell + containing \ccc{dh} to \ccc{ah}. + \ccPrecond{\ccc{*dh}\myin{}\ccc{cm.darts()}, 0\myleq{}\emph{i}\myleq{}\emph{dimension}, + \emph{i}-attributes are non void, and \ccc{*ah}\myin{}\ccc{cm.attributes()}.}} + +\ccMethod{void clear();} + {Deletes all the darts and all the attributes of \ccc{cm}.} +% +-----------------------------------+ +\ccOperations + +\ccMethod{template void sew(Dart_handle dh1, + Dart_handle dh2, bool update_attributes=true);} {Links by \betai{} + two by two all the darts of the orbit + \emph{D1}=\orbit{\betaun{},\myldots{},\betaimdeux{},\betaipdeux{},\myldots{},\betad{}}(\ccc{dh1}) and + \emph{D2}=\orbit{\betazero{},\betadeux{},\myldots{},\betaimdeux{},\betaipdeux{},\myldots{},\betad{}} (\ccc{dh2}) + such that \emph{d2}=\emph{f}(\emph{d1}), \emph{f} being the bijection between \emph{D1} and \emph{D2} + satisfying: \emph{f}(\emph{dh1})=\emph{dh2}, and for all \emph{e}\myin{}\emph{D1}, for all + \emph{j}\myin{}\{1,\myldots{},\emph{i}-2,\emph{i}+2,\myldots{},\emph{d}\}, + \emph{f}(\betaj{}(\emph{e}))=\betajinv{}(\emph{f}(\emph{e})). + + If \ccc{update_attributes} is \ccc{true}, when necessary, non void + attributes are updated to ensure the validity of \ccc{cm}: for each + \emph{j}-cells \emph{c1} and \emph{c2} which are merged into one \emph{j}-cell during + the sew, the two associated attributes \emph{attr1} and \emph{attr2} are + considered. If one attribute is + NULL and the other not, the non NULL attribute is associated to all + the darts of the resulting cell. When the two attributes are non + NULL, functor \ccc{Attribute_type::type::On_merge} is called on + the two attributes \emph{attr1} and \emph{attr2}. Then, the attribute + \emph{attr1} is associated to all darts of the resulting + \emph{j}-cell. Finally, attribute \emph{attr2} is removed from \ccc{cm}. + \ccPrecond{\ccc{cm.is_sewable(dh1,dh2)}.} + \begin{ccAdvanced} + If \ccc{update_attributes} is \ccc{false}, non void attributes are + not updated; thus \ccc{cm} can be no more valid after this + modification. + \end{ccAdvanced} +} + +\ccMethod{template void unsew(Dart_handle dh, bool + update_attributes=true);} {Unlinks by \betai{} all the darts in the + orbit + \orbit{\betaun{},\myldots{},\betaimdeux{},\betaipdeux{},\myldots{},\betad{}}(\ccc{dh}). If + \ccc{update_attributes} is \ccc{true}, when necessary, non void + attributes are updated to ensure the validity of \ccc{cm}: for each + \emph{j}-cell \emph{c} split in two \emph{j}-cells \emph{c1} and \emph{c2} by the + operation, if \emph{c} is associated to a \emph{j}-attribute \emph{attr1}, then + this attribute is duplicated into \emph{attr2}, and all the darts + belonging to \emph{c2} are associated with this new attribute. Finally, + the functor \ccc{Attribute_type::type::On_split} is called on the + two attributes \emph{attr1} and \emph{attr2}. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}, \ccc{*dh}\myin{}\ccc{cm.darts()} and + \ccc{dh} is not \emph{i}-free.} +\begin{ccAdvanced} + If \ccc{update_attributes} is \ccc{false}, non void attributes are + not updated thus \ccc{cm} can be no more valid after this + modification. +\end{ccAdvanced}} + +\begin{ccAdvanced} + +\ccMethod{template void link_beta(Dart_handle dh1, Dart_handle dh2, bool update_attributes=true);} +{Links \ccc{dh1} and \ccc{dh2} by \betai{}. + \ccc{cm} can be no more valid after this modification. If + \ccc{update_attributes} is true, non void attributes of \ccc{dh1} and + \ccc{dh2} are updated: if one dart has an attribute and the second + dart not, the non null attribute is associated to the dart having a null attribute. + If both darts have an attribute, + the attribute of \ccc{dh1} is associated to \ccc{dh2}. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}, \ccc{*dh1}\myin{}\ccc{cm.darts()}, + \ccc{*dh2}\myin{}\ccc{cm.darts()} and (\emph{i}\mylt{}2 or \ccc{dh1}\myneq{}\ccc{dh2}).}} + + +\ccMethod{template void unlink_beta(Dart_handle dh);} + {Unlinks \ccc{dh} and \betai{}(\ccc{dh}) by \betai{}. + \ccc{cm} can be no more valid after this modification. + Attributes of \ccc{dh} and \betai{}(\ccc{dh}) + are not modified. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}, \ccc{*dh}\myin{}\ccc{cm.darts()}, + and \ccc{dh} is not \emph{i}-free.}} + +\end{ccAdvanced} + +% +-----------------------------------+ +\begin{ccAdvanced} +\ccHeading{Boolean marks} + +\ccMethod{int get_new_mark() const;}{Reserves a new mark. Returns its + index. Returns -1 if there is no more available free mark.} + +\ccMethod{bool is_reserved(int amark) const;} + {Returns true iff \ccc{amark} is a reserved mark of \ccc{cm}. + \ccPrecond{0\myleq{}\emph{amark}\mylt{}\ccc{NB_MARKS}.}} + +\ccMethod{bool is_marked(Dart_const_handle dh, int amark) const;} + {Returns true iff \ccc{dh} is marked for \ccc{amark}. + \ccPrecond{\ccc{is_reserved(amark)} and \ccc{*dh}\myin{}\ccc{cm.darts()}.}} + +\ccMethod{void mark(Dart_const_handle dh, int amark) const;} + {Marks \ccc{dh} for \ccc{amark}. + \ccPrecond{\ccc{is_reserved(amark)} and \ccc{*dh}\myin{}\ccc{cm.darts()}.}} + +\ccMethod{void unmark(Dart_const_handle dh, int amark) const;} + {Unmarks \ccc{dh} for the mark \ccc{amark}. + \ccPrecond{\ccc{is_reserved(amark)} and \ccc{*dh}\myin{}\ccc{cm.darts()}.}} + +\ccMethod{void negate_mark(int amark) const;} + {Inverse the mark \ccc{amark} for all the darts of \ccc{cm}. + All the marked darts become unmarked and all the unmarked darts + become marked. + \ccPrecond{\ccc{is_reserved(amark)}.}} + +\ccMethod{void unmark_all(int amark) const;} + {Unmarks all the darts of \ccc{cm} for \ccc{amark}. + \ccPrecond{\ccc{is_reserved(amark)}.}} + +\ccMethod{size_type number_of_marked_darts(int amark) const;} + {Returns the number of marked darts for \ccc{amark}. + \ccPrecond{\ccc{is_reserved(amark)}.}} + +\ccMethod{size_type number_of_unmarked_darts(int amark) const;} + {Return the number of unmarked darts for \ccc{amark}. + \ccPrecond{\ccc{is_reserved(amark)}.}} + +\ccMethod{void free_mark(int amark) const;} + {Frees \ccc{amark}. + \ccPrecond{\ccc{is_reserved(amark)}.}} +\end{ccAdvanced} + +\ccHasModels +\ccRefIdfierPage{CGAL::Combinatorial_map} + +% \ccSeeAlso +% \ccRefIdfierPage{CGAL::CombinatorialMapWithPoints} + +\end{ccRefConcept} +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map_ref/CombinatorialMapItems.tex b/Combinatorial_map/doc_tex/Combinatorial_map_ref/CombinatorialMapItems.tex new file mode 100644 index 00000000000..87190cd5e1f --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map_ref/CombinatorialMapItems.tex @@ -0,0 +1,120 @@ +% +------------------------------------------------------------------------+ +% | Reference manual page: CombinatorialMapItems.tex +% +------------------------------------------------------------------------+ +% | 04.02.2010 Guillaume Damiand +% | Package: Combinatorial_map +% +------------------------------------------------------------------------+ +\ccRefPageBegin +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ + +\begin{ccRefConcept}{CombinatorialMapItems} +%\ccRefLabel{CGAL::CombinatorialMapItems} + +\ccDefinition + +The concept \ccRefName\ allows to customize a \emph{d}D combinatorial map +by choosing the type of darts, and by enabling and disabling some +attributes. For that, it defines an inner class template named +\ccc{Dart_wrapper}, with one template parameter, \ccc{CMap}, a model +of the \ccc{CombinatorialMap} concept. This inner class must define +two types: \ccc{Dart} and \ccc{Attributes}. + +% A \ccRefName\ contains one static const unsigned +% int \ccc{NB_MARKS} for the number of Boolean marks. It contains also +% one member class template named \ccc{Dart_wrapper}, with one template +% parameter, \ccc{Refs}. \ccc{Refs} must be a model of +% \ccc{CombinatorialMap} concept. The \ccc{Dart_wrapper} member class +% template provides a local type named \ccc{Dart} which must be a model +% of \ccc{Dart} concept, and a local type named \ccc{Attributes_enabled} +% which must be a tuple of types, each one being a model of +% \ccc{CellAttribute} concept, or equal to \ccc{Disabled}. + +% The tuple \ccc{Attributes_enabled} must contain at most $d+1$ types +% (one for each possible cell of the $d$-map). The first type +% corresponds to 0-cell attributes, the second to 1-cell attributes and +% so on. If a type is \ccc{CGAL::Disabled}, the corresponding cell +% attribute is disabled. If the size of the tuple is $k < d+1$, each +% $i$-cell attributes, $\forall i: k \leq d+1$, is disabled (see +% examples below). + +% \ccConstants +% \ccVariable{static unsigned int NB_MARKS;}{The number of Boolean marks.} + +\begin{ccClass}{CombinatorialMapItems::Dart_wrapper} +\ccCreationVariable{dw} + +\ccHeading{% + Types in \ccc{CombinatorialMapItems::Dart_wrapper}} + +\ccNestedType{Dart} + {The type of dart, a model of the \ccc{Dart} concept.} + +\ccNestedType{Attributes} +{The tuple of attributes, containing at most + \emph{dimension+1} types (one for each possible cell of the combinatorial + map). Each type of the tuple must be either a model of the + \ccc{CellAttribute} concept or \ccc{void}. + The first type corresponds to 0-attributes, + the second to 1-attributes and so on. + If the \ccTexHtml{$i^{\mbox{th}}$}{ith} type in the tuple is \ccc{void}, + (\emph{i}-1)-attributes are disabled. Otherwise, (\emph{i}-1)-attributes are enabled and + have the given type. If the size of the tuple is \emph{k}, + with \emph{k}<\emph{dimension+1}, + \myforall{}\emph{i}: \emph{k}\myleq{}\emph{i}\myleq{}\emph{dimension}, + \emph{i}-attributes are disabled.} +\end{ccClass} + +\ccExample +The following examples show two possible models of the +\ccc{CombinatorialMapItems} concept: the first one for a 4D +combinatorial map without enabled attributes, the second one for a 3D +combinatorial map with edge attributes enabled, and associated with a +\ccc{Cell_attribute} containing an \ccc{int}. + +\begin{ccExampleCode} +struct Exemple_Item_4 +{ + template < class CMap > + struct Dart_wrapper + { + typedef CGAL::Dart<4, CMap> Dart; + typedef CGAL::cpp0x::tuple<> Attributes; + }; +}; +\end{ccExampleCode} + +\begin{ccExampleCode} +struct Exemple_Item_3 +{ + template < class CMap > + struct Dart_wrapper + { + typedef CGAL::Dart<3, CMap> Dart; + typedef Cell_attribute Edge_attrib; + typedef CGAL::cpp0x::tuple Attributes; + }; +}; +\end{ccExampleCode} + +\ccHasModels +\ccRefIdfierPage{CGAL::Combinatorial_map_min_items} + +\ccSeeAlso +% \ccRefConceptPage{HalfedgeDS}\\ +% \ccRefConceptPage{HalfedgeDSVertex}\\ +% \ccRefConceptPage{HalfedgeDSHalfedge}\\ +% \ccRefConceptPage{HalfedgeDSFace}\\ +% \ccRefConceptPage{PolyhedronItems_3}\\ +% \ccRefIdfierPage{CGAL::HalfedgeDS_vertex_base}\\ +% \ccRefIdfierPage{CGAL::HalfedgeDS_halfedge_base}\\ +\ccRefConceptPage{CombinatorialMap}\\ +\ccRefConceptPage{Dart} + +\end{ccRefConcept} +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ + diff --git a/Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map.tex b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map.tex new file mode 100644 index 00000000000..6799f5313c7 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map.tex @@ -0,0 +1,83 @@ +% +------------------------------------------------------------------------+ +% | Reference manual page: Combinatorial_map.tex +% +------------------------------------------------------------------------+ +% | 04.02.2010 Guillaume Damiand +% | Package: Combinatorial_map +% +------------------------------------------------------------------------+ +\ccRefPageBegin +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ + +\begin{ccRefClass}{Combinatorial_map} +\ccRefLabel{CGAL::Combinatorial_map} + +\ccInclude{CGAL/Combinatorial_map.h} + +\ccDefinition + +The class \ccRefName\ represents a \emph{d}D combinatorial map. + +Darts and non void attributes are stored in memory using +\ccc{CGAL::Compact_container}, using \ccc{Alloc} as allocator. + +\ccIsModel +\ccRefConceptPage{CombinatorialMap} + +\ccParameters +\ccc{d} an integer for the dimension of the map.\\ +\ccc{Items} must be a model of the \ccc{CombinatorialMapItems} concept. \\ +\ccc{Alloc} has to match the standard allocator requirements. The \ccc{rebind} mechanism from +\ccc{Alloc} will be used to create appropriate allocators internally with value type \ccc{Dart}. + +There are two default template arguments: +\ccc{Combinatorial_map_min_items} for \ccc{Items} and +\ccc{CGAL_ALLOCATOR(int)} from the \ccc{} header file for \ccc{Alloc}. + +\ccTypes +\ccThree{typedef Combinatorial_map}{}{} +\ccTypedef{typedef Combinatorial_map Self;}{} +\ccGlue +\ccTypedef{typedef Items::Dart_wrapper::Dart Dart;}{} + +\ccHeading{Complexity} + +The complexity of \ccc{sew} and \ccc{unsew} is in \emph{O}($|$\emph{S}$|$\mytimes{}$|$\emph{c}$|$), \emph{S} +being the set of darts of the orbit +\orbit{\betaun{},\myldots{},\betaimdeux{},\betaipdeux{},\myldots{},\betad{}} for the +considered dart, and \emph{c} the biggest \emph{j}-cell merged or +split during the sew such that \emph{j}-attributes are non void. +The complexity of \ccc{is_sewable} is in \emph{O}($|$\emph{S}$|$). + +% The complexity of \ccc{topo_sew}, and \ccc{topo_unsew} are in +% $O(|S|\times c)$, $S$ being the set of darts of the orbit +% $\orb{\mb{1},\ldots,\mb{i-2},\mb{i+2},\ldots,\mb{d}}$ for the +% considered dart. + +The complexity of \ccc{set_attribute} is in \emph{O}($|$\emph{c}$|$), \emph{c} being the +\emph{i}-cell containing the considered dart. + +The complexity of \ccc{is_without_boundary(unsigned int i)} is in \emph{O}($|$\emph{D}$|$), +\emph{D} being the set of darts of the combinatorial map, and the complexity of +\ccc{is_without_boundary()} is in \emph{O}($|$\emph{D}$|$\mytimes{}\emph{d}). + +The complexity of \ccc{unmark_all} and \ccc{free_mark} is in \emph{O}(1) if +all the darts of the combinatorial map have the same mark, and in +\emph{O}($|$\emph{D}$|$) otherwise. + +The complexity of \ccc{is_valid} is in +\emph{O}($|$\emph{D}$|$\mytimes{}\emph{d}\ccTexHtml{$^2$}{2}). + +The complexity of \ccc{clear} is in \emph{O}($|$\emph{D}$|$\mytimes{}\emph{d}). + +Other methods have all a constant time complexity. + +\ccSeeAlso +\ccRefConceptPage{CombinatorialMapItems}\\ +\ccRefConceptPage{Dart}\\ + +\end{ccRefClass} +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map_constructors.tex b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map_constructors.tex new file mode 100644 index 00000000000..b68f05d98f8 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map_constructors.tex @@ -0,0 +1,107 @@ +% +------------------------------------------------------------------------+ +% | Reference manual page: Combinatorial_map_constructors.tex +% +------------------------------------------------------------------------+ +% | 04.02.2010 Guillaume Damiand +% | Package: Combinatorial_map +% +------------------------------------------------------------------------+ +\ccRefPageBegin +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ + +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{make_edge} +\ccInclude{CGAL/Combinatorial_map_constructors.h}\\ + +\ccFunction{template < class CMap > + typename CMap::Dart_handle make_edge(CMap& cm);} +{Creates an isolated edge (two darts linked by \betadeux{}) and adds it in \ccc{cm}. + Returns a handle on one dart of this edge. + \ccPrecond{\ccc{CMap::dimension}\mygeq{}2.} +% \ccCommentHeading{Template parameter}\\ +% \ccc{CMap} must be a model of the \ccc{CombinatorialCMap} concept. +% \ccCommentHeading{Parameters} \\ +% \ccc{cm}: the combinatorial map used. +% \ccCommentHeading{Returns} \\ +% a handle to one dart part of the edge created. +} + +\ccSeeAlso +\ccRefIdfierPage{CGAL::make_combinatorial_polygon}\\ +\ccRefIdfierPage{CGAL::make_combinatorial_tetrahedron}\\ +\ccRefIdfierPage{CGAL::make_combinatorial_hexahedron}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{make_combinatorial_polygon} +\ccInclude{CGAL/Combinatorial_map_constructors.h}\\ + +\ccFunction{template < class CMap > typename CMap::Dart_handle + make_combinatorial_polygon(CMap& cm, unsigned int lg);} +{Creates a combinatorial polygon of length \ccc{lg} (\ccc{lg} darts + linked by \betaun{}), and adds it in \ccc{cm}. + Returns a handle on one dart of this combinatorial polygon. + \ccPrecond{\ccc{CMap::dimension}\mygeq{}1 and \ccc{lg}\mygt{}0.} + % \ccCommentHeading{Template parameter}\\ + % \ccc{CMap} must be a model of the \ccc{CombinatorialCMap} concept. + % \ccCommentHeading{Parameters} \\ + % \ccc{cm}: the combinatorial map used. + % \ccCommentHeading{Returns} \\ + % a handle to a dart which is part of the triangle created. +} +\ccSeeAlso +\ccRefIdfierPage{CGAL::make_edge}\\ +\ccRefIdfierPage{CGAL::make_combinatorial_tetrahedron}\\ +\ccRefIdfierPage{CGAL::make_combinatorial_hexahedron}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{make_combinatorial_tetrahedron} +\ccInclude{CGAL/Combinatorial_map_constructors.h}\\ + +\ccFunction{template < class CMap > + typename CMap::Dart_handle make_combinatorial_tetrahedron(CMap& cm);} +{Creates a combinatorial tetrahedron (four combinatorial triangles linked + together by \betadeux{}), and adds it in \ccc{cm}. + Returns a handle on one dart of this combinatorial tetrahedron. +% \ccCommentHeading{Template parameter}\\ +% \ccc{CMap} must be a model of the \ccc{CombinatorialCMap} concept. +% \ccCommentHeading{Parameters} \\ +% \ccc{cm}: the combinatorial map used. +% \ccCommentHeading{Returns} \\ +% a handle to a dart which is part of the tetrahedron created. + \ccPrecond{\ccc{CMap::dimension}\mygeq{}2.} +} + +\ccSeeAlso +\ccRefIdfierPage{CGAL::make_edge}\\ +\ccRefIdfierPage{CGAL::make_combinatorial_polygon}\\ +\ccRefIdfierPage{CGAL::make_combinatorial_hexahedron}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{make_combinatorial_hexahedron} +\ccInclude{CGAL/Combinatorial_map_constructors.h}\\ + +\ccFunction{template < class CMap > + typename CMap::Dart_handle make_combinatorial_hexahedron(CMap& cm);} +{Creates an combinatorial hexahedron (six combinatorial quadrangles linked + together by \betadeux{}), and adds it in \ccc{cm}. + Returns a handle on one dart of this combinatorial hexahedron. +% \ccCommentHeading{Template parameter}\\ +% \ccc{CMap} must be a model of the \ccc{CombinatorialCMap} concept. +% \ccCommentHeading{Parameters} \\ +% \ccc{cm}: the combinatorial map used. +% \ccCommentHeading{Returns} \\ +% a handle to a dart which is part of the hexahedron created. + \ccPrecond{\ccc{CMap::dimension}\mygeq{}2.} +} + +\ccSeeAlso +\ccRefIdfierPage{CGAL::make_edge}\\ +\ccRefIdfierPage{CGAL::make_combinatorial_polygon}\\ +\ccRefIdfierPage{CGAL::make_combinatorial_tetrahedron}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- + +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map_min_items.tex b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map_min_items.tex new file mode 100644 index 00000000000..7b4ce46e1b7 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map_min_items.tex @@ -0,0 +1,63 @@ +% +------------------------------------------------------------------------+ +% | Reference manual page: Combinatorial_map_min_items.tex +% +------------------------------------------------------------------------+ +% | 04.02.2010 Guillaume Damiand +% | Package: Combinatorial_map +% +------------------------------------------------------------------------+ +\ccRefPageBegin +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ + +\begin{ccRefClass}{Combinatorial_map_min_items} +\ccRefLabel{CGAL::Combinatorial_map_min_items} + +\ccInclude{CGAL/Combinatorial_map_min_items.h} + +\ccDefinition + +The class \ccRefName\ is a model of the \ccc{CombinatorialMapItems} +concept. It defines the type of darts which is a +\ccc{CGAL::Dart}. The \ccRefName\ has a +template argument for the dimension of the combinatorial map. +In this class, no attribute is enabled. + +\ccIsModel +\ccRefConceptPage{CombinatorialMapItems} + +\ccExample + +The following example shows the implementation of the +\ccc{CGAL::Combinatorial_map_min_items} class. + +\begin{ccExampleCode} +template +struct Combinatorial_map_min_items +{ + template + struct Dart_wrapper + { + typedef CGAL::Dart Dart; + typedef CGAL::cpp0x::tuple<> Attributes; + }; +}; +\end{ccExampleCode} + +\ccSeeAlso +\ccRefIdfierPage{CGAL::Combinatorial_map}\\ +\ccRefIdfierPage{CGAL::Dart} + +% \ccRefIdfierPage{CGAL::HalfedgeDS_items_2}\\ +% \ccRefIdfierPage{CGAL::Polyhedron_items_3}\\ +% \ccRefConceptPage{HalfedgeDS}\\ +% \ccRefConceptPage{PolyhedronItems_3}\\ +% \ccRefIdfierPage{CGAL::HalfedgeDS_vertex_min_base}\\ +% \ccRefIdfierPage{CGAL::HalfedgeDS_halfedge_min_base}\\ +% \ccRefIdfierPage{CGAL::HalfedgeDS_face_min_base} + +\end{ccRefClass} + +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map_operations.tex b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map_operations.tex new file mode 100644 index 00000000000..0a11a1b2053 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Combinatorial_map_operations.tex @@ -0,0 +1,357 @@ +% +------------------------------------------------------------------------+ +% | Reference manual page: Combinatorial_map_operations.tex +% +------------------------------------------------------------------------+ +% | 04.02.2010 Guillaume Damiand +% | Package: Combinatorial_map +% +------------------------------------------------------------------------+ +\ccRefPageBegin +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ + +%-------------------------------------------------------------------------------- +% \ccFunction{template < class CMap > +% void remove_vertex_2(CMap& cm, typename CMap::Dart_handle dh);} +% { +% Remove a 2D vertex, and merge eventually both incident edges.\\ +% \ccCommentHeading{Parameters} \\ +% \ccc{cm}: the combinatorial map used;\\ +% \ccc{dh}: a dart belonging to the vertex to remove. +% } +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{is_removable} +\ccInclude{CGAL/Combinatorial_map_operations.h}\\ +\ccFunction{template + bool is_removable(const CMap& cm, typename CMap::Dart_const_handle dh);} + {Returns true iff the \emph{i}-cell containing \ccc{dh} can be removed, + i.e. if \ccc{i}==\ccc{CMap::dimension} or if + \ccc{i}==\ccc{CMap::dimension}-1 or + if \ccc{i}\mylt{}\ccc{CMap::dimension}-1 and the \emph{i}-cell containing \ccc{dh} + is incident to at most two (\emph{i+1})-cells. + \ccPrecond{0\myleq{}\ccc{i}\myleq{}\ccc{CMap::dimension} and \ccc{*dh}\myin{}\ccc{cm.darts()}.} +} + +\ccSeeAlso +\ccRefIdfierPage{CGAL::remove_cell}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{remove_cell} +\ccInclude{CGAL/Combinatorial_map_operations.h}\\ + +\ccFunction{template + unsigned int remove_cell(CMap& cm, typename CMap::Dart_handle dh);} +{Removes the \emph{i}-cell containing \ccc{dh}. + Returns the number of darts removed from \ccc{cm}. + \ccPrecond{\ccc{is_removable(cm,dh)}.}\\ + See examples in Figures~\ref{fig-insert-vertex}, \ref{fig-insert-edge} and \ref{fig-insert-face}. \\ +% +% \begin{ccAdvanced} + If \ccc{i}\mylt{}\ccc{CMap::dimension}, and \emph{i+1}-attributes are + non void, and if there are two distinct (\emph{i+1})-cells around dart + \ccc{dh}, \ccc{Attribute_type::type::On_merge}(\emph{a1},\emph{a2}) is + called, with \emph{a1} the (\emph{i+1})-attribute associated to \ccc{dh}, + and \emph{a2} the (\emph{i+1})-attribute associated to \betaipun{}(\emph{dh}).\\ + % + If a \emph{j}-cell is disconnected in two \emph{j}-cells during the + operation, and if \emph{j}-attributes are non void, + \ccc{Attribute_type::type::On_split}(\emph{a},\emph{a'}) is called + with \emph{a} the original \emph{j}-attribute and \emph{a'} the new + \emph{j}-attribute created due to the disconnection. +% \end{ccAdvanced} +} + % \ccCommentHeading{Template parameter}\\ + % \ccc{Map} must be a model of the \ccc{CombinatorialMap} + % concept. + % \ccCommentHeading{Parameters} \\ + % \ccc{cm}: the combinatorial map used;\\ + % \ccc{dh}: a dart belonging to the edge to remove. + % \ccPrecond{\ccc{cm.can_remove(dh)}} + % \ccCommentHeading{Returns} \\ + % the number of deleted darts. } + +% \def\LargFig{.8\textwidth} +% %\begin{figure} +% \begin{ccTexOnly} +% \begin{center} +% \includegraphics[width=\LargFig]{Combinatorial_map_ref/fig/pdf/insert-vertex} +% \end{center} +% \end{ccTexOnly} +% \begin{ccHtmlOnly} +%
+% +% +%
+% \end{ccHtmlOnly} +% \centerline{Example of \ccc{insert_cell_0_in_cell_1} and \ccc{remove_cell<0>} functions.} +% % \label{fig-exemple-remove_vertex} +% %\end{figure} + +% \def\LargFig{.8\textwidth} +% %\begin{figure} +% \begin{ccTexOnly} +% \begin{center} +% \includegraphics[width=\LargFig]{Combinatorial_map_ref/fig/pdf/insert-edge} +% \end{center} +% \end{ccTexOnly} +% \begin{ccHtmlOnly} +%
+% +% +%
+% \end{ccHtmlOnly} +% \centerline{Example of \ccc{:insert_cell_1_in_cell_2} and +% \ccc{remove_cell<1>} functions.} +% % \label{fig-exemple-remove_edge} +% %\end{figure} + +% \def\LargFig{.8\textwidth} +% %\begin{figure} +% \begin{ccTexOnly} +% \begin{center} +% \includegraphics[width=\LargFig]{Combinatorial_map_ref/fig/pdf/insert-facet} +% \end{center} +% \end{ccTexOnly} +% \begin{ccHtmlOnly} +%
+% +% +%
+% \end{ccHtmlOnly} +% \centerline{Example of \ccc{insert_cell_2_in_cell_3} and +% \ccc{remove_cell<2>} functions.} +% % \label{fig-exemple-remove_facet} +% %\end{figure} + +\ccSeeAlso +\ccRefIdfierPage{CGAL::is_removable}\\ +\ccRefIdfierPage{CGAL::insert_cell_0_in_cell_1}\\ +\ccRefIdfierPage{CGAL::insert_cell_0_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_dangling_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_2_in_cell_3}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{is_insertable_cell_1_in_cell_2} +\ccInclude{CGAL/Combinatorial_map_operations.h}\\ + +\ccFunction{template < class CMap > + bool is_insertable_cell_1_in_cell_2(const CMap & cm, + typename CMap::Dart_const_handle dh1, + typename CMap::Dart_const_handle dh2);} +{Returns true iff it is possible to insert a 1-cell in \ccc{cm} + between \ccc{dh1} and \ccc{dh2}, + i.e. if \ccc{dh1}\myneq{}\ccc{dh2} and \ccc{dh1}\myin{}\orbit{\betaun{}}(\ccc{dh2}). + \ccPrecond{\ccc{CMap::dimension}\mygeq{}2, + \ccc{*dh1}\myin{}\ccc{cm.darts()}, and \ccc{*dh2}\myin{}\ccc{cm.darts()}.} +} +% \ccCommentHeading{Template parameter}\\ +% \ccc{Map} must be a model of the \ccc{CombinatorialMap} concept. +% \ccCommentHeading{Parameters} \\ +% \ccc{cm}: the combinatorial map used;\\ +% \ccc{dh1, dh2}: the two given darts. +% \ccCommentHeading{Returns} \\ +% true iff it is possible to insert an edge between dh1 and dh2. + +\ccSeeAlso +\ccRefIdfierPage{CGAL::insert_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::is_insertable_cell_2_in_cell_3}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{is_insertable_cell_2_in_cell_3} +\ccInclude{CGAL/Combinatorial_map_operations.h}\\ + +\ccFunction{template + bool is_insertable_cell_2_in_cell_3(const CMap & cm, + InputIterator afirst, InputIterator alast);} +{Returns true iff it is possible to insert a 2-cell in \ccc{cm} along the path + of darts given by the range \ccc{[afirst,alast)}. The 2-cell can be inserted + iff each couple of consecutive darts of the path \emph{a1} and \emph{a2} belong to the + same vertex and the same volume, and if the path is closed. + \ccPrecond{\ccc{CMap::dimension}\mygeq{}3.} + % \ccCommentHeading{Template parameter}\\ + % \ccc{Map} must be a model of the \ccc{CombinatorialMap} concept. + % \ccCommentHeading{Parameters} \\ + % \ccc{cm}: the combinatorial map used;\\ + % \ccc{afirst}: an iterator on the beginining of the path of darts. + % \ccc{alast}: an iterator to the end of the path of darts. + % \ccCommentHeading{Returns} \\ + % true iff it is possible to insert a facet along apath. } +} + +\ccSeeAlso +\ccRefIdfierPage{CGAL::insert_cell_2_in_cell_3}\\ +\ccRefIdfierPage{CGAL::is_insertable_cell_1_in_cell_2}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{insert_cell_0_in_cell_1} +\ccInclude{CGAL/Combinatorial_map_operations.h}\\ + +\ccFunction{template < class CMap > + typename CMap::Dart_handle insert_cell_0_in_cell_1(CMap& cm, + typename CMap::Dart_handle dh);} +{Inserts a 0-cell in the 1-cell containing \ccc{dh}. + Returns a handle on one dart belonging to the new 0-cell. + \ccPrecond{\ccc{CMap::dimension}\mygeq{}1 and \ccc{*dh}\myin{}\ccc{cm.darts()}.}\\ + See example in Figure~\ref{fig-insert-vertex}.\\ +% \begin{ccAdvanced} + If 1-attributes are non void, + \ccc{Attribute_type<1>::type::On_split}(\emph{a},\emph{a'}) is called, with \emph{a} the original 1-attribute associated + with \emph{dh} and \emph{a'} the new 1-attribute created during the operation. +% \end{ccAdvanced} +} +% \ccCommentHeading{Template parameter}\\ +% \ccc{CMap} must be a model of the \ccc{CombinatorialMap} concept. +% \ccCommentHeading{Parameters} \\ +% \ccc{cm}: the combinatorial map used;\\ +% \ccc{dh}: a dart belonging to the edge. +% \ccPrecond{\ccc{can_insert_vertex(cm,dh)}} +% \ccCommentHeading{Returns} \\ +% a dart of the new vertex. +% } + +\ccSeeAlso +\ccRefIdfierPage{CGAL::insert_cell_0_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_dangling_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_2_in_cell_3}\\ +\ccRefIdfierPage{CGAL::remove_cell}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{insert_cell_0_in_cell_2} +\ccInclude{CGAL/Combinatorial_map_operations.h}\\ + +\ccFunction{template + typename CMap::Dart_handle insert_cell_0_in_cell_2(CMap & cm, + typename CMap::Dart_handle dh);} +{Inserts a 0-cell in the 2-cell containing \ccc{dh}. + The 2-cell is split in triangles, one for each initial edge of the facet. + Returns a handle on one dart belonging to the new 0-cell. + \ccPrecond{\ccc{CMap::dimension}\mygeq{}2 and \ccc{*dh}\myin{}\ccc{cm.darts()}.}\\ + See example in Figure~\ref{fig-triangulate}.\\ +% \begin{ccAdvanced} + If 2-attributes are non void, + \ccc{Attribute_type<2>::type::On_split}(\emph{a},\emph{a'}) is called, with \emph{a} the original 2-attribute associated + with \ccc{dh} and \emph{a'} each new 2-attribute created during the operation. +% \end{ccAdvanced} +% \ccCommentHeading{Template parameter}\\ +% \ccc{CMap} must be a model of the \ccc{CombinatorialMap} concept. +% Operation defined here is purely combinatorial, there is no geometry modification. +% \ccCommentHeading{Parameters} \\ +% \ccc{cm}: the combinatorial map used;\\ +% \ccc{dh}: a dart belonging to the facet to triangulate. +% \ccCommentHeading{Returns} \\ +% a dart created during the triangulation, and incident to the new vertex. +} + +\ccSeeAlso +\ccRefIdfierPage{CGAL::insert_cell_0_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_dangling_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_2_in_cell_3}\\ +\ccRefIdfierPage{CGAL::remove_cell}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{insert_cell_1_in_cell_2} +\ccInclude{CGAL/Combinatorial_map_operations.h}\\ + +\ccFunction{template < class CMap > + typename CMap::Dart_handle insert_cell_1_in_cell_2(CMap& cm, + typename CMap::Dart_handle dh1,typename CMap::Dart_handle dh2);} +{Inserts a 1-cell in the 2-cell containing \ccc{dh1} and \ccc{dh2}. + Returns a handle on one dart belonging to the new 1-cell. + \ccPrecond{\ccc{is_insertable_cell_1_in_cell_2(cm,dh1,dh2)}.}\\ + See example in Figure~\ref{fig-insert-edge}.\\ +% \begin{ccAdvanced} + If 2-attributes are non void, + \ccc{Attribute_type<2>::type::On_split}(\emph{a},\emph{a'}) is called, with \emph{a} the original 2-attribute associated + with \ccc{dh} and \emph{a'} the new 2-attribute created during the operation. +% \end{ccAdvanced} +} +% \ccCommentHeading{Template parameter}\\ +% \ccc{CMap} must be a model of the \ccc{CombinatorialMap} concept. +% \ccCommentHeading{Parameters} \\ +% \ccc{cm}: the combinatorial map used;\\ +% \ccc{dh1}: a first dart belonging to the facet. +% \ccc{dh2}: a second dart belonging to the facet. +% \ccPrecond{\ccc{can_insert_edge(cm,dh1,dh2)}} +% \ccCommentHeading{Returns} \\ +% a dart of the new edge.} + +\ccSeeAlso +\ccRefIdfierPage{CGAL::is_insertable_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_0_in_cell_1}\\ +\ccRefIdfierPage{CGAL::insert_cell_0_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_dangling_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_2_in_cell_3}\\ +\ccRefIdfierPage{CGAL::remove_cell}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{insert_dangling_cell_1_in_cell_2} +\ccInclude{CGAL/Combinatorial_map_operations.h}\\ + +\ccFunction{template < class CMap > + typename CMap::Dart_handle insert_dangling_cell_1_in_cell_2(CMap& cm, + typename CMap::Dart_handle dh);} +{Inserts a 1-cell in a the 2-cell containing \ccc{dh}, the 1-cell +being attached only by one of its extremity to the 0-cell containing \ccc{dh}. + Returns a handle on one dart belonging to the new 1-cell. + \ccPrecond{\ccc{CMap::dimension}\mygeq{}2 and \ccc{*dh}\myin{}\ccc{cm.darts()}.}\\ + See example in Figure~\ref{fig-insert-edge}. +} +% \ccCommentHeading{Template parameter}\\ +% \ccc{CMap} must be a model of the \ccc{CombinatorialMap} concept. +% \ccCommentHeading{Parameters} \\ +% \ccc{cm}: the combinatorial map used;\\ +% \ccc{dh}: a dart belonging to the facet. +% \ccCommentHeading{Returns} \\ +% a dart of the new edge and incident to the new vertex.} + +\ccSeeAlso +\ccRefIdfierPage{CGAL::insert_cell_0_in_cell_1}\\ +\ccRefIdfierPage{CGAL::insert_cell_0_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_2_in_cell_3}\\ +\ccRefIdfierPage{CGAL::remove_cell}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- +\begin{ccRefFunction}{insert_cell_2_in_cell_3} +\ccInclude{CGAL/Combinatorial_map_operations.h}\\ + +\ccFunction{template + typename CMap::Dart_handle insert_cell_2_in_cell_3(CMap & cm, + InputIterator afirst, InputIterator alast);} +{Inserts a 2-cell along the path of 1-cells containing darts given + by the range \ccc{[afirst,alast)}. + Returns a handle on one dart belonging to the new 2-cell. + \ccPrecond{\ccc{is_insertable_cell_2_in_cell_3(cm,afirst,alast)}.}\\ + See example in Figure~\ref{fig-insert-face}.\\ +% \begin{ccAdvanced} + If 3-attributes are non void, + \ccc{Attribute_type<3>::type::On_split}(\emph{a},\emph{a'}) is called, with \emph{a} the original 3-attribute associated + with \ccc{dh} and \emph{a'} the new 3-attribute created during the operation. +% \end{ccAdvanced} +} +% \ccCommentHeading{Template parameter}\\ +% \ccc{CMap} must be a model of the \ccc{CombinatorialMap} concept. +% \ccCommentHeading{Parameters} \\ +% \ccc{cm}: the combinatorial map used;\\ +% \ccc{afirst}: an iterator on the beginining of the path of darts. +% \ccc{alast}: an iterator to the end of the path of darts. +% \ccPrecond{\ccc{can_insert_facet(cm,afirst,alast)}} +% \ccCommentHeading{Returns} \\ +% a dart of the new facet.} + +\ccSeeAlso +\ccRefIdfierPage{CGAL::is_insertable_cell_2_in_cell_3}\\ +\ccRefIdfierPage{CGAL::insert_cell_0_in_cell_1}\\ +\ccRefIdfierPage{CGAL::insert_cell_0_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_dangling_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::remove_cell}\\ +\end{ccRefFunction} +%-------------------------------------------------------------------------------- + +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map_ref/Dart.tex b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Dart.tex new file mode 100644 index 00000000000..dd53a680049 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Dart.tex @@ -0,0 +1,114 @@ +% +------------------------------------------------------------------------+ +% | Reference manual page: Dart.tex +% +------------------------------------------------------------------------+ +% | 04.02.2010 Guillaume Damiand +% | Package: Combinatorial_map +% +------------------------------------------------------------------------+ +\ccRefPageBegin +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ +\begin{ccRefConcept}{Dart} +%\ccRefLabel{CGAL::Dart} + +\ccDefinition + +The concept \ccRefName\ defines a \emph{d}-dimensional dart. A dart mainly +stores handles to the darts linked with itself by \betai{}, \myforall{}\emph{i}, +0\myleq{}\emph{i}\myleq{}\emph{d}. Moreover, it stores also handles to each +non void attribute associated with itself. + +% \ccParameters +% \ccc{d} is the dimension of the combinatorial map.\\ +% \ccc{CMap} must be a model of the \ccc{CombinatorialMap} concept. + +\ccCreation +\ccCreationVariable{d0} +A dart \ccc{d0} is never constructed directly, but always created +within a combinatorial map \ccc{cm} by using the method +\ccc{cm.create_dart();} A new dart is initialized to be \emph{i}-free, +\myforall{}\emph{i}: 0\myleq{}\emph{i}\myleq{}\emph{dimension}, and having all +its attribute handles initialized to NULL, for each non void attribute. + +\ccConstants +\ccVariable{static unsigned int dimension;}{The dimension of \ccc{d0}.} + +\ccTypes +\ccTwo{Dart:: Dart_const_handle_}{}{} +% +\ccNestedType{Dart_handle}{Dart handle type.} +\ccGlue +\ccNestedType{Dart_const_handle}{Dart const handle type.} + +\ccNestedType{template Attribute_handle::type} + {Handle to \emph{i}-attributes, with 0\myleq{}\emph{i}\myleq{}\emph{dimension}.} +\ccGlue +\ccNestedType{template Attribute_const_handle::type} + {Const handle to \emph{i}-attributes, with 0\myleq{}\emph{i}\myleq{}\emph{dimension}.} + +\ccHeading{Access Member Functions} +\ccThree{Dart_const_handle}{beta(unsigned int i) const}{} +% +\ccMethod{Dart_handle beta(unsigned int i);} + {Returns \betai{}(\ccc{d0}). + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}.}} +\ccGlue +\ccMethod{Dart_const_handle beta(unsigned int i) const;} + {Returns \betai{}(\ccc{d0}) when \ccc{d0} is const. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}.}} + +\ccMethod{Dart_handle beta_inv(unsigned int i);} + {Returns \betaiinv{}(\ccc{d0}). + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}.}} +\ccGlue +\ccMethod{Dart_const_handle beta_inv(unsigned int i) const;} + {Returns \betaiinv{}(\ccc{d0}) when \ccc{d0} is const. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}.}} + +\ccMethod{bool is_free(unsigned int i) const;} + {Returns true iff \ccc{d0} is \emph{i}-free. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}.}} + +\ccMethod{int highest_nonfree_dimension() const;} + {Returns the highest dimension \emph{i} such that \ccc{d0} is not \emph{i}-free. + -1 if \ccc{d0} is free for any dimension.} + +\ccMethod{Dart_handle opposite();} + {Returns a handle to a dart belonging to the same edge + than \ccc{d0}, and not to the same vertex. + NULL if such a dart does not exist.} +\ccGlue +\ccMethod{Dart_const_handle opposite() const;} + {Returns a handle to a dart belonging to the same edge + than \ccc{d0}, and not to the same vertex, when \ccc{d0} is const. + NULL if such a dart does not exist.} + +\ccMethod{Dart_handle other_extremity();} + {Returns a handle to a dart belonging to the other vertex of + the edge containing \ccc{d0} (but contrary to \ccc{opposite()} not + necessarily to the same edge). NULL if such a dart does not exist.} +\ccGlue +\ccMethod{Dart_const_handle other_extremity() const;} + {Returns a \ccc{Dart_const_handle} to a dart belonging to the other vertex of + the edge containing \ccc{d0}, when \ccc{d0} is const (but contrary to + \ccc{opposite()} not necessarily to the same edge). + NULL if such a dart does not exist.} + +\ccMethod{template Attribute_handle::type attribute();} + {Returns the \emph{i}-attribute associated to \ccc{d0}. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}, and \emph{i}-attributes are non void.}} +\ccGlue +\ccMethod{template + Attribute_const_handle::type attribute() const;} + {Returns the \emph{i}-attribute associated to \ccc{d0}, + when \ccc{d0} is const. + \ccPrecond{0\myleq{}\emph{i}\myleq{}\emph{dimension}, and \emph{i}-attributes are non void.}} + +\ccHasModels +\ccRefIdfierPage{CGAL::Dart} + +\end{ccRefConcept} +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map_ref/Dart_base.tex b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Dart_base.tex new file mode 100644 index 00000000000..9b63eabc8a2 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map_ref/Dart_base.tex @@ -0,0 +1,63 @@ +% +------------------------------------------------------------------------+ +% | Reference manual page: Dart.tex +% +------------------------------------------------------------------------+ +% | 04.02.2010 Guillaume Damiand +% | Package: Combinatorial_map +% +------------------------------------------------------------------------+ +\ccRefPageBegin +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ +\begin{ccRefClass}{Dart} + +\ccInclude{CGAL/Dart.h} + +\ccDefinition + +The class \ccRefName\ represents a \emph{d}D dart. + +\betai{} pointers are coded in a array of \emph{d+1} \ccc{Dart_handle} +(because we describe also the \betazero{} link). Attributes are +associated to each dart by \ccc{Attribute_handle}, one for each +non void \emph{i}-attribute. + +\ccIsModel +\ccRefConceptPage{Dart} + +\ccParameters +\ccc{d} an integer for the dimension of the dart.\\ +\ccc{CMap} must be a model of the \ccc{CombinatorialMap} concept. + +% A dart \ccc{a} is never constructed directly, but always created withing a +% combinatorial map \ccc{cm} by using the method \ccc{cm.create_dart();} + +\ccTypes +\ccThree{typedef CMap::Attribute_const_handle::type}{}{} +\ccTypedef{typedef CMap::Dart_handle Dart_handle;}{} +\ccGlue +\ccTypedef{typedef CMap::Dart_const_handle Dart_const_handle;}{} + +\ccTypedef{typedef CMap::Attribute_handle::type Attribute_handle::type;}{} +\ccGlue +\ccTypedef{typedef CMap::Attribute_const_handle::type Attribute_const_handle::type;}{} + +\ccHeading{Complexity} + +Each \betai{} link is initialized to \ccc{CMap::null_dart_handle}, and each +attribute handle of non void \emph{i}-attribute is initialized to \ccc{NULL} +at the creation of the dart, thus the complexity of the creation is in +\emph{O}(\emph{d+1}). + +The complexity of \ccc{opposite} and \ccc{other_extremity} methods is in +\emph{O}(\emph{d+1}). + +Other methods have all a constant time complexity. + +\ccSeeAlso +\ccRefConceptPage{CombinatorialMap} + +\end{ccRefClass} +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ diff --git a/Combinatorial_map/doc_tex/Combinatorial_map_ref/intro.tex b/Combinatorial_map/doc_tex/Combinatorial_map_ref/intro.tex new file mode 100644 index 00000000000..6c2b2d84485 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map_ref/intro.tex @@ -0,0 +1,84 @@ +\ccRefChapter{Combinatorial map} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\section{Classified Reference Pages} + +\subsection{Concepts} + +\ccRefConceptPage{CombinatorialMap}\\ +\ccRefConceptPage{Dart}\\ +%\ccRefConceptPage{CGAL::CombinatorialMapWithPoints} +\ccRefConceptPage{CellAttribute}\\ +%\ccRefConceptPage{CGAL::CellAttributeWithPoint} +%\ccRefConceptPage{CGAL::AttributeFunctor} +\ccRefConceptPage{CombinatorialMapItems} +%\ccRefConceptPage{CGAL::CombinatorialMapWithPointsItems} +%\ccRefConceptPage{CGAL::CombinatorialMapWithPointsTraits} + +\subsection{Classes} +\ccRefIdfierPage{CGAL::Combinatorial_map}\\ +\ccRefIdfierPage{CGAL::Dart}\\ +%\ccRefIdfierPage{CGAL::Combinatorial_map_with_points} +\ccRefIdfierPage{CGAL::Cell_attribute}\\ +%\ccRefIdfierPage{CGAL::Cell_attribute_with_info} +%\ccRefIdfierPage{CGAL::Cell_attribute_with_point} +%\ccRefIdfierPage{CGAL::Cell_attribute_with_point_and_info} +\ccRefIdfierPage{CGAL::Combinatorial_map_min_items} +%\ccRefIdfierPage{CGAL::Combinatorial_map_with_points_min_items} +%\ccRefIdfierPage{CGAL::Combinatorial_map_with_points_cartesian_traits} +%\ccRefIdfierPage{CGAL::Combinatorial_map_with_points_epik_traits} +%\ccRefIdfierPage{CGAL::Void_functor} +%\ccRefIdfierPage{CGAL::Disabled} + +\subsection{Global Functions} +\subsubsection{Constructions for Combinatorial Maps} +\ccRefIdfierPage{CGAL::make_edge}\\ +\ccRefIdfierPage{CGAL::make_combinatorial_polygon}\\ +\ccRefIdfierPage{CGAL::make_combinatorial_tetrahedron}\\ +\ccRefIdfierPage{CGAL::make_combinatorial_hexahedron} + +% \subsubsection{Constructions for Combinatorial maps with Points} +% \ccRefIdfierPage{CGAL::make_segment}\\ +% \ccRefIdfierPage{CGAL::make_triangle}\\ +% \ccRefIdfierPage{CGAL::make_quadrilateral}\\ +% \ccRefIdfierPage{CGAL::make_rectangle}\\ +% \ccRefIdfierPage{CGAL::make_square}\\ +% \ccRefIdfierPage{CGAL::make_tetrahedron}\\ +% \ccRefIdfierPage{CGAL::make_hexahedron}\\ +% \ccRefIdfierPage{CGAL::make_cuboid}\\ +% \ccRefIdfierPage{CGAL::make_cube}\\ +% \ccRefIdfierPage{CGAL::import_from_plane_graph}\\ +% \ccRefIdfierPage{CGAL::import_from_triangulation_3}\\ +% \ccRefIdfierPage{CGAL::import_from_polyhedron} + + +\subsubsection{Operations for Combinatorial Maps} +\ccRefIdfierPage{CGAL::is_removable}\\ +\ccRefIdfierPage{CGAL::remove_cell}\\ +\ccRefIdfierPage{CGAL::is_insertable_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::is_insertable_cell_2_in_cell_3}\\ +\ccRefIdfierPage{CGAL::insert_cell_0_in_cell_1}\\ +\ccRefIdfierPage{CGAL::insert_cell_0_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_dangling_cell_1_in_cell_2}\\ +\ccRefIdfierPage{CGAL::insert_cell_2_in_cell_3} +%\ccRefIdfierPage{CGAL::display_characteristics} + +% \ccRefIdfierPage{CGAL::create_facet_vertex}\\ +% \ccRefIdfierPage{CGAL::can_insert_vertex}\\ +% \ccRefIdfierPage{CGAL::can_insert_edge}\\ +% \ccRefIdfierPage{CGAL::can_insert_facet}\\ +% \ccRefIdfierPage{CGAL::insert_vertex}\\ +% \ccRefIdfierPage{CGAL::insert_edge}\\ +% \ccRefIdfierPage{CGAL::insert_dangling_edge}\\ +% \ccRefIdfierPage{CGAL::insert_facet}\\ + +% \subsubsection{Operations for Combinatorial maps with Points} +% \ccRefIdfierPage{CGAL::barycenter}\\ +% \ccRefIdfierPage{CGAL::compute_facet_normal}\\ +% \ccRefIdfierPage{CGAL::compute_vertex_normal}\\ +% \ccRefIdfierPage{CGAL::create_facet_center_vertex}\\ +% \ccRefIdfierPage{CGAL::insert_vertex}\\ +% \ccRefIdfierPage{CGAL::insert_dangling_edge} + + diff --git a/Combinatorial_map/doc_tex/Combinatorial_map_ref/main.tex b/Combinatorial_map/doc_tex/Combinatorial_map_ref/main.tex new file mode 100644 index 00000000000..1b4935684d8 --- /dev/null +++ b/Combinatorial_map/doc_tex/Combinatorial_map_ref/main.tex @@ -0,0 +1,51 @@ +% +------------------------------------------------------------------------+ +% | CBP Reference Manual: main.tex +% +------------------------------------------------------------------------+ +% | Automatically generated driver file for the reference manual chapter +% | of this package. Do not edit manually, you may loose your changes. +% +------------------------------------------------------------------------+ +\def\ccTagRmTrailingConst{\ccFalse} + +\input{Combinatorial_map_ref/intro.tex} + +% First: concepts +\input{Combinatorial_map_ref/CombinatorialMap.tex} +%\input{Combinatorial_map_ref/CombinatorialMapWithPoints.tex} + +\input{Combinatorial_map_ref/Dart.tex} + +\input{Combinatorial_map_ref/CellAttribute.tex} +%\input{Combinatorial_map_ref/CellAttributeWithPoint.tex} +%\input{Combinatorial_map_ref/AttributeFunctor.tex} + +\input{Combinatorial_map_ref/CombinatorialMapItems.tex} +%\input{Combinatorial_map_ref/CombinatorialMapWithPointsItems.tex} +%\input{Combinatorial_map_ref/CombinatorialMapWithPointsTraits.tex} + +% Second: classes +\input{Combinatorial_map_ref/Combinatorial_map.tex} +%\input{Combinatorial_map_ref/Combinatorial_map_with_points.tex} + +\input{Combinatorial_map_ref/Dart_base.tex} + +\input{Combinatorial_map_ref/Cell_attribute.tex} +%\input{Combinatorial_map_ref/Cell_attribute_with_info.tex} +%\input{Combinatorial_map_ref/Cell_attribute_with_point.tex} +%\input{Combinatorial_map_ref/Cell_attribute_with_point_and_info.tex} + +\input{Combinatorial_map_ref/Combinatorial_map_min_items.tex} +%\input{Combinatorial_map_ref/Combinatorial_map_with_points_min_items.tex} +%\input{Combinatorial_map_ref/Combinatorial_map_with_points_cartesian_traits.tex} +%\input{Combinatorial_map_ref/Combinatorial_map_with_points_epik_traits.tex} + +%\input{Combinatorial_map_ref/Disabled.tex} +%\input{Combinatorial_map_ref/Void_functor.tex} + +% Third: global functions. +\input{Combinatorial_map_ref/Combinatorial_map_constructors.tex} +%\input{Combinatorial_map_ref/Combinatorial_map_with_points_constructors.tex} + +\input{Combinatorial_map_ref/Combinatorial_map_operations.tex} +%\input{Combinatorial_map_ref/Combinatorial_map_with_points_operations.tex} + +%% EOF diff --git a/Combinatorial_map/dont_submit b/Combinatorial_map/dont_submit new file mode 100644 index 00000000000..e69de29bb2d diff --git a/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp b/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp new file mode 100644 index 00000000000..c298230c352 --- /dev/null +++ b/Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp @@ -0,0 +1,53 @@ +#include +#include +#include +#include +#include + +typedef CGAL::Combinatorial_map<3> CMap_3; +typedef CMap_3::Dart_handle Dart_handle; + +int main() +{ + CMap_3 cm; + + // 1) Reserve a mark. + int mark = cm.get_new_mark(); + if ( mark==-1 ) + { + std::cerr<<"No more free mark, exit."<(dh1, dh2); + + // 4) Mark the darts belonging to the first tetrahedron. + for (CMap_3::Dart_of_cell_range<3>::iterator + it(cm.darts_of_cell<3>(dh1).begin()), + itend(cm.darts_of_cell<3>(dh1).end()); it!=itend; ++it) + cm.mark(it, mark); + + // 4) Remove the common 2-cell between the two cubes: + // the two tetrahedra are merged. + CGAL::remove_cell(cm, dh1); + + // 5) Thanks to the mark, we know which darts come from the first tetrahedron. + unsigned int res=0; + for (CMap_3::Dart_range::iterator it(cm.darts().begin()), + itend(cm.darts().end()); it!=itend; ++it) + { + if ( cm.is_marked(it, mark) ) + ++res; + } + + std::cout<<"Number of darts from the first tetrahedron: "< +#include +#include +#include +#include + +typedef CGAL::Combinatorial_map<3> CMap_3; +typedef CMap_3::Dart_handle Dart_handle; + +int main() +{ + CMap_3 cm; + + // Create one combinatorial hexahedron. + Dart_handle dh1 = CGAL::make_combinatorial_hexahedron(cm); + + // Add two edges along two opposite facets. + CGAL_assertion( CGAL::is_insertable_cell_1_in_cell_2 + (cm,dh1->beta(1),dh1->beta(0)) ); + + CGAL::insert_cell_1_in_cell_2(cm,dh1->beta(1),dh1->beta(0)); + CGAL_assertion( cm.is_valid() ); + + Dart_handle dh2=dh1->beta(2)->beta(1)->beta(1)->beta(2); + + CGAL_assertion( CGAL::is_insertable_cell_1_in_cell_2 + (cm,dh2,dh2->beta(1)->beta(1)) ); + + CGAL::insert_cell_1_in_cell_2(cm,dh2,dh2->beta(1)->beta(1)); + CGAL_assertion( cm.is_valid() ); + + // Insert a facet along these two new edges plus two initial edges + // of the hexahedron. + std::vector path; + path.push_back(dh1->beta(1)); + path.push_back(dh1->beta(0)->beta(2)->beta(1)); + path.push_back(dh2->beta(0)); + path.push_back(dh2->beta(2)->beta(1)); + + CGAL_assertion( (CGAL::is_insertable_cell_2_in_cell_3 + (cm,path.begin(),path.end())) ); + + Dart_handle dh3=CGAL::insert_cell_2_in_cell_3(cm,path.begin(),path.end()); + CGAL_assertion( cm.is_valid() ); + + // Display the combinatorial map characteristics. + cm.display_characteristics(std::cout) << ", valid=" << + cm.is_valid() << std::endl; + + // We use the removal operations to get back to the initial hexahedron. + CGAL_assertion( (CGAL::is_removable(cm,dh3)) ); + CGAL::remove_cell(cm,dh3); + CGAL_assertion( cm.is_valid() ); + + CGAL_assertion( (CGAL::is_removable(cm,dh1->beta(1))) ); + CGAL::remove_cell(cm,dh1->beta(1)); + CGAL_assertion( cm.is_valid() ); + + CGAL_assertion( (CGAL::is_removable(cm,dh2->beta(0))) ); + CGAL::remove_cell(cm,dh2->beta(0)); + CGAL_assertion( cm.is_valid() ); + + // Display the combinatorial map characteristics. + cm.display_characteristics(std::cout) << ", valid=" + << cm.is_valid() << std::endl; + + return EXIT_SUCCESS; +} + diff --git a/Combinatorial_map/examples/Combinatorial_map/map_3_simple_example.cpp b/Combinatorial_map/examples/Combinatorial_map/map_3_simple_example.cpp new file mode 100644 index 00000000000..91d4d17b44b --- /dev/null +++ b/Combinatorial_map/examples/Combinatorial_map/map_3_simple_example.cpp @@ -0,0 +1,45 @@ +#include +#include +#include +#include + +typedef CGAL::Combinatorial_map<3> CMap_3; +typedef CMap_3::Dart_const_handle Dart_const_handle; + + int main() + { + CMap_3 cm; + + // Create two tetrahedra. + Dart_const_handle dh1 = CGAL::make_combinatorial_tetrahedron(cm); + Dart_const_handle dh2 = CGAL::make_combinatorial_tetrahedron(cm); + + // Display the combinatorial map characteristics. + cm.display_characteristics(std::cout); + std::cout<<", valid="< in 3D is equivalent to + // CMap_3::Dart_of_cell_range<3>. + for (CMap_3::Dart_of_orbit_range<1,2>::const_iterator + it(cm.darts_of_orbit<1,2>(dh1).begin()), + itend(cm.darts_of_orbit<1,2>(dh1).end()); it!=itend; ++it) + ++res; + + std::cout<<"Number of darts of the first tetrahedron: " + <::const_iterator + it(cm.darts_of_orbit<1>(dh2).begin()), + itend(cm.darts_of_orbit<1>(dh2).end()); it!=itend; ++it) + ++res; + + std::cout<<"Number of darts of the facet containing dh2: " + < +#include +#include +#include +#include +#include +#include + +struct Sum_functor +{ + template + void operator()(Cell_attribute& ca1,Cell_attribute& ca2) + { ca1.info()=ca1.info()+ca2.info(); } +}; +struct Divide_by_two_functor +{ + template + void operator()(Cell_attribute& ca1,Cell_attribute& ca2) + { + ca1.info()=(ca1.info()/2); + ca2.info()=(ca1.info()); + } +}; + +struct Myitem +{ + template + struct Dart_wrapper + { + typedef CGAL::Dart<3, CMap> Dart; + typedef CGAL::Cell_attribute + Facet_attribute; + typedef CGAL::cpp0x::tuple Attributes; + }; +}; + +typedef CGAL::Combinatorial_map<3,Myitem> CMap_3; +typedef CMap_3::Dart_handle Dart_handle; + +int main() +{ + CMap_3 cm; + + // Create 2 hexahedra. + Dart_handle dh1 = make_combinatorial_hexahedron(cm); + Dart_handle dh2 = make_combinatorial_hexahedron(cm); + + // 1) Create all 2-attributes and associated them to darts. + for (CMap_3::Dart_range::iterator + it=cm.darts().begin(), itend=cm.darts().end(); + it!=itend; ++it) + { + if ( it->attribute<2>()==NULL ) + cm.set_attribute<2>(it, cm.create_attribute<2>()); + } + + // 2) Set the color of all facets of the first hexahedron to 7. + for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator + it=cm.one_dart_per_incident_cell<2,3>(dh1).begin(), + itend=cm.one_dart_per_incident_cell<2,3>(dh1).end(); it!=itend; ++it) + { it->attribute<2>()->info()=7; } + + // 3) Set the color of all facets of the second hexahedron to 13. + for (CMap_3::One_dart_per_incident_cell_range<2, 3>::iterator it= + cm.one_dart_per_incident_cell<2,3>(dh2).begin(), + itend=cm.one_dart_per_incident_cell<2,3>(dh2).end(); it!=itend; ++it) + { it->attribute<2>()->info()=13; } + + // 4) 3-Sew the two hexahedra along one facet. + cm.sew<3>(dh1, dh2); + + // 5) Display all the values of 2-attributes. + for (CMap_3::Attribute_range<2>::type::iterator + it=cm.attributes<2>().begin(), itend=cm.attributes<2>().end(); + it!=itend; ++it) + { + std::cout<info()<<"; "; + } + std::cout<::type::iterator + it=cm.attributes<2>().begin(), itend=cm.attributes<2>().end(); + it!=itend; ++it) + { + std::cout<info()<<"; "; + } + std::cout<, + class Alloc_=CGAL_ALLOCATOR(int) > + class Combinatorial_map_base + { + template + friend struct internal::sew_functor; + + template + friend struct internal::unsew_functor; + + template + friend struct Remove_cell_functor; + + template + friend typename Map::Dart_handle + insert_cell_0_in_cell_1(Map& amap, typename Map::Dart_handle adart); + + template + friend typename CMap::Dart_handle + insert_cell_1_in_cell_2(CMap& amap, typename CMap::Dart_handle adart1); + + template + friend + typename CMap::Dart_handle + insert_cell_1_in_cell_2(CMap& amap, + typename CMap::Dart_handle adart1, + typename CMap::Dart_handle adart2); + + template + friend + typename Map::Dart_handle + insert_cell_2_in_cell_3(Map& amap, InputIterator afirst, + InputIterator alast); + + template < class Map > + friend + typename Map::Dart_handle + insert_cell_0_in_cell_2(Map& amap, typename Map::Dart_handle adart); + + template + friend struct internal::Degroup_one_attribute_of_dart_functor; + + template + friend struct internal::Degroup_one_attribute_functor; + + template + friend struct internal::Test_is_valid_attribute_functor; + + template + friend struct internal::Group_attribute_functor_of_dart_run; + + template + friend struct internal::Group_attribute_functor_run; + + template + friend struct internal::Group_one_attribute_functor; + + template + friend struct internal::Degroup_attribute_functor_run; + + template + friend struct internal::Update_dart_of_attribute_functor; + + template + friend struct internal::Decrease_attribute_functor; + + public: + /// Types definition + typedef Combinatorial_map_base Self; + + typedef Items_ Items; + typedef Alloc_ Alloc; + + typedef typename Items::template Dart_wrapper Dart_wrapper; + typedef typename Dart_wrapper::Dart Dart; + + typedef typename Alloc::template rebind::other Dart_allocator; + typedef Compact_container Dart_container; + + typedef typename Dart_container::iterator Dart_handle; + typedef typename Dart_container::const_iterator Dart_const_handle; + typedef typename Dart_container::size_type size_type; + + /// The dimension of the combinatorial map. + static const unsigned int dimension = d_; + + /// Number of marks + static const size_type NB_MARKS = 32; + + typedef internal::Combinatorial_map_helper Helper; + + /// Typedef for Dart_range, a range through all the darts of the map. + typedef Dart_container Dart_range; + typedef const Dart_container Dart_const_range; + + typedef typename Dart_wrapper::Attributes Attributes; + + /// Typedef for attributes + template + struct Attribute_type: public Helper::template Attribute_type + {}; + template + struct Attribute_handle: public Helper::template Attribute_handle + {}; + template + struct Attribute_const_handle: + public Helper::template Attribute_const_handle + {}; + template + struct Attribute_range: public Helper::template Attribute_range + {}; + template + struct Attribute_const_range: + public Helper::template Attribute_const_range + {}; + + public: + /** Default Combinatorial_map constructor. + * The map is empty. + */ + Combinatorial_map_base() + { + CGAL_static_assertion_msg( Dart::dimension==dimension, + "Dimension of dart different from dimension of map"); + + CGAL_static_assertion_msg( Helper::nb_attribs<=dimension+1, + "Too many attributes in the tuple Attributes_enabled"); + + this->mnb_used_marks = 0; + this->mmask_marks.reset(); + this->mused_marks.reset(); + + for (size_type i = 0; i < NB_MARKS; ++i) + { + this->mfree_marks_stack[i] = (int)i; + this->mindex_marks[i] = i; + this->mnb_marked_darts[i] = 0; + } + + // We must do this ony once, but problem because null_dart_handle + // is static ! + if ( mnull_dart_container.empty() ) + { + null_dart_handle = + mnull_dart_container.emplace( std::bitset() ); + + for (unsigned int i=0; i<=dimension; ++i) + { + null_dart_handle->unlink_beta(i); + } + } + + CGAL_assertion(number_of_darts()==0); + } + + /** Clear the combinatorial map. Remove all darts and all attributes. + * Note that reserved marks are not free. + */ + void clear() + { + mdarts.clear(); + for (unsigned int i = 0; i < NB_MARKS; ++i) + this->mnb_marked_darts[i] = 0; + + internal::Clear_all::run(mattribute_containers); + } + + /** Test if the map is empty. + * @return true iff the map is empty. + */ + bool is_empty() const + { return mdarts.empty(); } + + /** Create a new dart and add it to the map. + * The marks of the darts are initialised with mmask_marks, i.e. the dart + * is unmarked for all the marks. + * @return a Dart_handle on the new dart. + */ + Dart_handle create_dart() + { return mdarts.emplace(mmask_marks); } + + /** Erase a dart from the list of darts. + * @param adart the dart to erase. + */ + void erase_dart(Dart_handle adart) + { + // 1) We update the number of marked darts. + for (unsigned int i = 0; i < mnb_used_marks; ++i) + { + if (is_marked(adart, mused_marks_stack[i])) + --mnb_marked_darts[mused_marks_stack[i]]; + } + + // 2) We update the attribute_ref_counting. + Helper::template Foreach_enabled_attributes + >::run(this,adart); + + // 3) We erase the dart. + mdarts.erase(adart); + } + + /// @return a Dart_range (range through all the darts of the map). + Dart_range& darts() { return mdarts;} + Dart_const_range& darts() const { return mdarts; } + + /** Get the first dart of this map. + * @return the first dart. + */ + Dart_handle first_dart() + { + if (darts().begin() == darts().end()) return null_dart_handle; + return mdarts.begin(); + } + Dart_const_handle first_dart() const + { + if (darts().begin() == darts().end()) return null_dart_handle; + return mdarts.begin(); + } + + /// @return the Dart_handle corresponding to the given dart. + Dart_handle dart_handle(Dart& adart) + { return mdarts.iterator_to(adart); } + Dart_const_handle dart_handle(const Dart& adart) const + { return mdarts.iterator_to(adart); } + + /** Count the number of used marks. + * @return the number of used marks. + */ + size_type number_of_used_marks() const + { return mnb_used_marks; } + + /** Test if a given mark is reserved. + * @return true iff the mark is reserved (ie in used). + */ + bool is_reserved(int amark) const + { + CGAL_assertion(amark>=0 && (size_type)amarkget_mark(amark)!=mmask_marks[(size_type)amark]; + } + + /** Set the mark of a given dart to a state (on or off). + * @param adart the dart. + * @param amark the given mark. + * @param astate the state of the mark (on or off). + */ + void set_mark_to(Dart_const_handle adart, int amark, + bool astate) const + { + CGAL_assertion( adart != null_dart_handle ); + CGAL_assertion( is_reserved(amark) ); + + if (is_marked(adart, amark) != astate) + { + if (astate) ++mnb_marked_darts[(size_type)amark]; + else --mnb_marked_darts[(size_type)amark]; + + adart->set_mark(amark, astate ^ mmask_marks[(size_type)amark]); + } + } + + /** Mark the given dart. + * @param adart the dart. + * @param amark the given mark. + */ + void mark(Dart_const_handle adart, int amark) const + { + CGAL_assertion( adart != null_dart_handle ); + CGAL_assertion( is_reserved(amark) ); + + if (is_marked(adart, amark)) return; + + ++mnb_marked_darts[(size_type)amark]; + adart->set_mark(amark, !mmask_marks[(size_type)amark]); + } + + /** Unmark the given dart. + * @param adart the dart. + * @param amark the given mark. + */ + void unmark(Dart_const_handle adart, int amark) const + { + CGAL_assertion( adart != null_dart_handle ); + CGAL_assertion( is_reserved(amark) ); + + if (!is_marked(adart, amark)) return; + + --mnb_marked_darts[(size_type)amark]; + adart->set_mark(amark, mmask_marks[(size_type)amark]); + } + + /** Unmark all the darts of the map for a given mark. + * If all the darts are marked or unmarked, this operation takes O(1) + * operations, otherwise it traverses all the darts of the map. + * @param amark the given mark. + */ + void unmark_all(int amark) const + { + CGAL_assertion( is_reserved(amark) ); + + if (is_whole_map_unmarked(amark)) return; + + if (is_whole_map_marked(amark)) + { + negate_mark(amark); + } + else + { + for (typename Dart_range::const_iterator it(darts().begin()), + itend(darts().end()); it!=itend; ++it) + unmark(it, amark); + } + CGAL_assertion(is_whole_map_unmarked(amark)); + } + + /** Free a given mark, previously calling unmark_all_darts. + * @param amark the given mark. + */ + void free_mark(int amark) const + { + CGAL_assertion( is_reserved(amark) ); + + unmark_all(amark); + mused_marks.set((size_type)amark, false); + + // 1) We remove amark from the array mused_marks_stack by + // replacing it with the last mark in this array. + mused_marks_stack[mindex_marks[(size_type)amark]] = + mused_marks_stack[--mnb_used_marks]; + mindex_marks[mused_marks_stack[mnb_used_marks]] = + mindex_marks[(size_type)amark]; + + // 2) We add amark in the array mfree_marks_stack and update its index. + mfree_marks_stack[ mnb_used_marks ] = amark; + mindex_marks[(size_type)amark] = mnb_used_marks; + } + + /** Test if this map is without boundary for a given dimension. + * @param i the dimension. + * @return true iff all the darts are not i-free. + * @pre 1<=i<=n + */ + bool is_without_boundary(unsigned int i) const + { + CGAL_assertion(1<=i && i<=dimension); + for (typename Dart_const_range::const_iterator it(darts().begin()), + itend(darts().end()); it!=itend; ++it) + if (it->is_free(i)) return false; + return true; + } + + /** Test if this map is without boundary for all the dimensions. + * @return true iff all the darts are non free. + */ + bool is_without_boundary() const + { + for (typename Dart_const_range::const_iterator it(darts().begin()), + itend(darts().end()); it!=itend; ++it) + for (unsigned int i = 1; i<=dimension; ++i) + if (it->is_free(i)) return false; + return true; + } + + /** Close the combinatorial map for a given dimension. + * @param i the dimension to close + * @return the number of new darts. + * @pre 2<=i<=n (TODO case i==1) + */ + unsigned int close(unsigned int i) + { + CGAL_assertion(2<=i && i<=dimension); + unsigned int res = 0; + Dart_handle d, d2; + + for (typename Dart_range::iterator it(darts().begin()); + it!=darts().end(); ++it) + { + if ( it->is_free(i) ) + { + d = create_dart(); + ++res; + link_beta(it, d, i); + + // Special cases for 0 and 1 + if ( !it->is_free(1) && !it->beta(1)->is_free(i) ) + link_beta<1>(it->beta(1)->beta(i),d); + if ( !it->is_free(0) && !it->beta(0)->is_free(i) ) + link_beta<0>(it->beta(0)->beta(i),d); + // General case for 2...dimension + for (unsigned int j=2; j<=dimension; ++j) + { + if ( j+1!=i && j!=i && j!=i+1 && + !it->is_free(j) && !it->beta(j)->is_free(i) ) + { + link_beta(it->beta(j)->beta(i), d, j); + } + } + + d2 = it; + while (d2 != null_dart_handle && !d2->is_free(i-1)) + { d2 = d2->beta(i-1)->beta(i); } + if (d2 != null_dart_handle) + { + if (i==2) link_beta<1>(d2, d); + else link_beta(d2, d, i-1); + } + } + } + return res; + } + + /** Test if the map is valid. + * @return true iff the map is valid. + */ + bool is_valid() const + { + bool valid = true; + unsigned int i = 0, j = 0; + std::vector marks(dimension+1); + for (i=0; i<=dimension; ++i) + marks[i] = -1; + + Helper::template + Foreach_enabled_attributes >:: + run(this,&marks); + + for (typename Dart_range::const_iterator it(darts().begin()), + itend(darts().end()); it!=itend; ++it) + { + if ( !valid ) + { // We continue the traversal to mark all the darts. + for (i=0; i<=dimension; ++i) + if (marks[i]!=-1) mark(it,marks[i]); + } + else + { + // beta0 must be the inverse of beta1 + if ((!it->is_free(0) && it->beta(0)->beta(1)!=it) || + (!it->is_free(1) && it->beta(1)->beta(0)!=it )) + { + std::cerr << "Map not valid: beta(0) " + "is not the inverse of beta(1) for " + <<&(*it) << std::endl; + valid = false; + } + + // Each beta(i>=2) must be an involution + for (i = 2; i <= dimension; ++i) + if (!it->is_free(i) && it->beta(i)->beta(i)!=it) + { + std::cerr << "Map not valid: beta(" << i + << ") is not an involution for " + <<&(*it) << std::endl; + valid = false; + } + + // beta1 o betai and beta0 o betai (i>=3) must be involutions + if (!it->is_free(0)) + { + for (i = 3; i <= dimension; ++i) + if ((it->is_free(i) != it->beta(0)->is_free(i)) || + (!it->is_free(i) && + it->beta(0)->beta(i)!=it->beta(i)->beta(1))) + { + std::cerr << "Map not valid: beta(0) o beta(" << i + << ") is not an involution for " + <<&(*it) << std::endl; + valid = false; + } + } + if (!it->is_free(1)) + { + for (i = 3; i <= dimension; ++i) + if ((it->is_free(i) != it->beta(1)->is_free(i)) || + (!it->is_free(i) && + it->beta(1)->beta(i)!=it->beta(i)->beta(0))) + { + std::cerr << "Map not valid: beta(1) o beta(" << i + << ") is not an involution for " + <<&(*it)<< std::endl; + valid = false; + } + } + + // beta(i>=2) o beta(j>=i+2) must be an involution + for (i = 2; i <= dimension; ++i) + { + if (!it->is_free(i)) + { + for (j = i + 2; j <= dimension; ++j) + if ((it->is_free(j)!=it->beta(i)->is_free(j)) || + (!it->is_free(j) && + it->beta(i)->beta(j)!=it->beta(j)->beta(i))) + { + std::cerr << "Map not valid: beta(" << i + << ") o beta(" << j + << ") is not an involution for " + << &(*it)<< std::endl; + valid = false; + } + } + } + Helper::template Foreach_enabled_attributes + >:: + run(this,it,&marks,&valid); + } + } + for (i=0; i<=dimension; ++i) + if ( marks[i]!=-1 ) + { + CGAL_assertion( is_whole_map_marked(marks[i]) ); + free_mark(marks[i]); + } + + return valid; + } + + /// @return the number of darts. + size_type number_of_darts() const + { return mdarts.size(); } + + /// @return an estimation of the bytes used by the combinatorial map. + size_type bytes() const + { + return mdarts.capacity() * sizeof(Dart) + + internal::Count_bytes_all_attributes_functor::run(*this); + } + + /** Write the content of the map: each dart and each beta links. + * @param os the ostream. + * @return the ostream. + */ + std::ostream& display_darts(std::ostream & os) const + { + unsigned int nb = 0; + for (typename Dart_range::const_iterator it=darts().begin(); + it!=darts().end(); ++it) + { + os << " dart " << &(*it) << "; beta[i]="; + for (unsigned int i=0; i<=dimension; ++i) + { + os << &(*it->beta(i)) << ",\t"; + if (it->is_free(i))os << "\t"; + } + os << std::endl; + ++nb; + } + os << "Number of darts: " << nb <<"(sizeofdarts=" + < + std::ostream& display_orbits(std::ostream & aos) const + { + CGAL_assertion( Ite::is_basic_iterator() ); + unsigned int nb = 0; + int amark = get_new_mark(); + for (typename Dart_range::const_iterator it1(darts().begin()), + itend(darts().end()); it1!=itend; ++it1) + { + if ( !is_marked(it1, amark) ) + { + ++nb; + for ( Ite it2(*this, it1, amark); it2.cont(); ++it2 ) + { + aos << &(**it2) << " - " << std::flush; + mark(*it2, amark); + } + aos << std::endl; + } + } + CGAL_assertion( is_whole_map_marked(amark) ); + free_mark(amark); + aos << "Number of orbits: " << nb << std::endl; + return aos; + } + + /** Write the content of each i-cell of the map. + * @param aos the ostream. + * @return the ostream. + */ + template < unsigned int i > + std::ostream& display_cells(std::ostream & aos) const + { + return display_orbits > + (aos); + } + + /** Write the number of darts and cells of the map into a given ostream. + * @param os the ostream. + * @return the ostream. + */ + std::ostream& display_characteristics(std::ostream & os) const + { + std::vector cells(dimension+2); + for (unsigned int i=0; i<=dimension+1; ++i) + { cells[i]=i; } + + std::vector res = count_cells(cells); + + os << "#Darts=" << number_of_darts(); + for (unsigned int i=0; i<=dimension; ++i) + os<<", #"< but i-attributes are disabled"); + return CGAL::cpp0x::get::value> + (mattribute_containers).emplace(); + } + + /// Create a new attribute by copy. + /// @return a handle on the new attribute. + template + typename Attribute_handle::type create_attribute(const A&a) + { + CGAL_static_assertion_msg( Helper::template Dimension_index::value>=0, + "create_attribute but i-attributes are disabled"); + return CGAL::cpp0x::get::value> + (mattribute_containers).emplace(a); + } + + /// Erase an attribute. + /// @param h a handle to the attribute to erase. + template + void erase_attribute(typename Attribute_handle::type h) + { + CGAL_static_assertion_msg( Helper::template Dimension_index::value>=0, + "erase_attribute but i-attributes are disabled"); + CGAL::cpp0x::get::value> + (mattribute_containers).erase(h); + } + + /// @return the number of attributes. + template + size_type number_of_attributes() const + { + CGAL_static_assertion_msg( Helper::template Dimension_index::value>=0, + "number_of_attributes but i-attributes are disabled"); + return CGAL::cpp0x::get::value> + (mattribute_containers).size(); + } + + /// @return a Attributes_range (range through all the + /// attributes of the map). + template + typename Attribute_range::type & attributes() + { + CGAL_static_assertion_msg( Helper::template Dimension_index::value>=0, + "attributes but i-attributes are disabled"); + return CGAL::cpp0x::get::value> + (mattribute_containers); + } + + template + typename Attribute_const_range::type & attributes() const + { + CGAL_static_assertion_msg( Helper::template Dimension_index::value>=0, + "attributes but i-attributes are disabled"); + return CGAL::cpp0x::get::value> + (mattribute_containers); + } + + /** Double link a dart with beta i to a second dart, when i>=2. + * \em adart1 is i-linked to \em adart2 and \em adart2 is i-linked + * with \em adart1. Attributes are not updated, thus we can obtain + * a non-valid map with darts belonging to a same orbit and having + * different attributes. + * @param adart1 a first dart. + * @param adart2 a second dart. + * @param i the dimension of the beta + */ + void basic_link_beta(Dart_handle adart1, Dart_handle adart2, unsigned int i) + { + CGAL_assertion( i>=2 && i<=dimension ); + CGAL_assertion(adart1 != NULL && adart2 != NULL && adart1!=adart2); + CGAL_assertion(adart1 != null_dart_handle && adart2 != null_dart_handle); + adart1->basic_link_beta(adart2, i); + adart2->basic_link_beta(adart1, i); + } + + /** Double link a dart with betai to a second dart. + * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked + * with \em adart1. Attributes are not updated, thus we can obtain + * a non-valid map with darts belonging to a same orbit and having + * different attributes. + * @param adart1 a first dart. + * @param adart2 a second dart. + */ + template + void basic_link_beta(Dart_handle adart1, Dart_handle adart2) + { internal::basic_link_beta_functor::run(*this,adart1,adart2); } + + /** Double unlink a dart with beta0. + * beta0(\em adart) is 1-unlinked and \em adart is 0-unlinked. + * The attributes are not updated, thus we can obtain a non-valid map + * with darts belonging to different orbits and having the same + * attributes. + * @param adart a dart. + */ + template + void unlink_beta(Dart_handle adart) + { internal::unlink_beta_functor::run(*this,adart); } + + /** Double unlink a dart with beta i, for i>=2. + * betai(\em adart) is i-unlinked and \em adart is i-unlinked. + * The attributes are not updated, thus we can obtain a non-valid map + * with darts belonging to different orbits and having the same + * attributes. + * @param adart a dart. + * @param i the dimension of the beta + */ + void unlink_beta(Dart_handle adart, unsigned int i) + { + CGAL_assertion(adart!=NULL && adart!=null_dart_handle && + !adart->is_free(i)); + CGAL_assertion(2<=i && i<=dimension); + adart->beta(i)->unlink_beta(i); + adart->unlink_beta(i); + } + + /** Double link two darts, and update the NULL attributes. + * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked + * with \em adart1. The NULL attributes of \em adart1 are updated to + * non NULL attributes associated to \em adart2, and vice-versa. + * We can obtain a non-valid map with darts belonging to a same cell + * and having different attributes. + * @param adart1 a first dart. + * @param adart2 a second dart. + */ + template + void link_beta(Dart_handle adart1, Dart_handle adart2) + { internal::link_beta_functor::run(*this,adart1,adart2); } + + /** Double link two darts, and update the NULL attributes. + * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked + * with \em adart1. The NULL attributes of \em adart1 are updated to + * non NULL attributes associated to \em adart2, and vice-versa. + * We can obtain a non-valid map with darts belonging to a same cell + * and having different attributes. + * @param adart1 a first dart. + * @param adart2 a second dart. + * @param i the dimension of the beta. + * @pre 2<=i<=dimension + */ + void link_beta(Dart_handle adart1, Dart_handle adart2, unsigned int i) + { + CGAL_assertion(adart1 != NULL && adart2 != NULL && adart1!=adart2 ); + CGAL_assertion(adart1 != null_dart_handle && adart2 != null_dart_handle); + CGAL_assertion( 2<=i && i<=dimension ); + adart1->basic_link_beta(adart2, i); + adart2->basic_link_beta(adart1, i); + Helper::template Foreach_enabled_attributes + >:: + run(this,adart1,adart2,i); + } + + /** Double link a dart with betai to a second dart. + * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked + * with \em adart1. The NULL attributes of \em adart1 are updated to + * non NULL attributes associated to \em adart2, and vice-versa, only . + * if update_attributes==true. + * @param adart1 a first dart. + * @param adart2 a second dart. + * @param update_attributes a boolean to update the enabled attributes + */ + template + void link_beta(Dart_handle adart1, Dart_handle adart2, + bool update_attributes) + { + if ( update_attributes ) link_beta(adart1, adart2); + else basic_link_beta(adart1, adart2); + } + + /** Test if it is possible to sew by betai the two given darts + * @param adart1 the first dart. + * @param adart2 the second dart. + * @return true iff \em adart1 can be i-sewn with \em adart2. + */ + template + bool is_sewable(Dart_const_handle adart1, Dart_const_handle adart2) const + { return internal::is_sewable_functor::run(*this,adart1,adart2); } + + /** Topological sew by betai the two given darts plus all the required darts + * to satisfy the combinatorial map validity: but do not update attributes + * thus the map can be non valid. + * @param adart1 the first dart. + * @param adart2 the second dart. + * @pre is_sewable(adart1, adart2). + */ + template + void topo_sew(Dart_handle adart1, Dart_handle adart2) + { return internal::topo_sew_functor::run(*this,adart1,adart2); } + + /** Sew by betai the two given darts plus all the required darts + * to satisfy the combinatorial map validity, and updates enabled + * attributes when necessary so that the final map is valid. + * @param adart1 the first dart. + * @param adart2 the second dart. + * @pre is_sewable(adart1, adart2). + * @post is_valid() + */ + template + void sew(Dart_handle adart1, Dart_handle adart2) + { return internal::sew_functor::run(*this,adart1,adart2); } + + /** Sew by betai the two given darts plus all the required darts + * to satisfy the combinatorial map validity. Enabled attributes + * are updated only if update_attributes==true. + * @param adart1 the first dart. + * @param adart2 the second dart. + * @param update_attributes a boolean to update the enabled attributes + * @pre is_sewable(adart1, adart2). + */ + template + void sew(Dart_handle adart1, Dart_handle adart2, bool update_attributes) + { + if ( update_attributes ) sew(adart1, adart2); + else topo_sew(adart1, adart2); + } + + /** Topological unsew by betai the given dart plus all the required darts + * to satisfy the combinatorial map validity: but do not update attributes + * thus the map can be non valid + * @param adart first dart. + * @pre !adart->is_free(i). + */ + template + void topo_unsew(Dart_handle adart) + { return internal::topo_unsew_functor::run(*this,adart); } + + /** Unsew by betai the given dart plus all the required darts + * to satisfy the combinatorial map validity, and update enabled + * attributes when necessary so that the final map is valid. + * @param adart first dart. + * @pre !adart->is_free(i). + * @post is_valid() + */ + template + void unsew(Dart_handle adart) + { return internal::unsew_functor::run(*this,adart); } + + /** Unsew by betai the given dart plus all the required darts + * to satisfy the combinatorial map validity. Enabled attributes + * are updated only if update_attributes==true. + * @param adart first dart. + * @param update_attributes a boolean to update the enabled attributes + * @pre !adart->is_free(i). + */ + template + void unsew(Dart_handle adart, bool update_attributes) + { + if ( update_attributes ) unsew(adart); + else topo_unsew(adart); + } + + /** Count the marked cells (at least one marked dart). + * @param amark the mark to consider. + * @param avector containing the dimensions of the cells to count. + * @return a vector containing the number of cells. + */ + std::vector + count_marked_cells(int amark, const std::vector& acells) const + { + std::vector res(dimension+2); + std::vector marks(dimension+2); + + // Initialization of the result + for (unsigned int i=0; i,dimension+1>:: + run(this, it, &marks, &res); + } + } + + // Unmarking darts + std::vector tounmark; + for (unsigned int i=0; i 0 ) + { + for (typename Dart_range::const_iterator it(darts().begin()), + itend(darts().end()); it!=itend; ++it) + { + for (unsigned int i=0; i + count_cells(const std::vector& acells) const + { + std::vector res(dimension+1); + int m = get_new_mark(); + negate_mark(m); // We mark all the cells. + + res = count_marked_cells(m,acells); + + negate_mark(m); // We unmark the cells + free_mark(m); + + return res; + } + + protected: + /** Set simultaneously all the marks of a given dart. + * @param adart the dart. + * @param amarks the marks to set. + */ + void set_marks(Dart_handle adart, + const std::bitset & amarks) const + { + CGAL_assertion(adart != NULL && adart!=null_dart_handle); + adart->set_marks(amarks ^ mmask_marks); + } + + /** Get simultaneously all the marks of a given dart. + * @param adart the dart. + * @return allt the marks of adart. + */ + std::bitset get_marks(Dart_handle adart) const + { + CGAL_assertion(adart != NULL && adart!=null_dart_handle); + return adart->get_marks() ^ mmask_marks; + } + + /** Get the mask associated to a given mark. + * @param amark the mark. + * @return the mask associated to mark amark. + */ + bool get_mask_mark(int amark) const + { + CGAL_assertion(amark>=0 && (size_type)amark + void decrease_attribute_ref_counting(Dart_handle adart) + { + CGAL_static_assertion_msg( Helper::template Dimension_index::value>=0, + "decrease_attribute_ref_counting but " + "i-attributes are disabled"); + if ( adart->template attribute()!=NULL ) + { + adart->template attribute()->dec_nb_refs(); + if ( adart->template attribute()->get_nb_refs()==0 ) + erase_attribute(adart->template attribute()); + } + } + + /** Update the dart of the given i-cell attribute onto a non marked dart. + * @param ah the attribute to update. + * @param amark the mark. + */ + template + void update_dart_of_attribute(Dart_handle ah, int amark) + { + CGAL_static_assertion_msg( Helper::template Dimension_index::value>=0, + "update_dart_of_attribute but " + "i-attributes are disabled"); + CGAL_assertion(ah!=NULL && ah!=null_dart_handle); + + if ( ah->template attribute()==NULL || + ah->template attribute()->dart()==NULL || + !is_marked(ah->template attribute()->dart(),amark) ) + return; + + for (CMap_dart_iterator_of_cell it(*this, ah); it.cont(); ++it) + { + if (!is_marked(it,amark)) + { + ah->template attribute()->set_dart(it); + return; + } + } + ah->template attribute()->set_dart(NULL); + } + + /** Update the dart of all the cell-attributes incident to ah onto a non + * marked dart. This method is used before to remove a cell (which is + * marked), to put all the darts of the enabled cells onto surviving dart. + * @param ah the dart to update. + * @param amark the mark. + */ + void update_dart_of_all_attributes(Dart_handle ah, int amark) + { + Helper::template Foreach_enabled_attributes + >::run(this,ah,amark); + } + + /** Group the i cell-attributes of two darts. + * If the two i cell-attribute of \em adart1 and \em adart2 are different, + * we set the i cell-attribute of each dart belonging to the i-cell orbit + * of \em adart2 onto the i-cell of \em adart1. + * We use the functor On_merge and possibly remove the second + * cell-attribute if there is no more darts linked to it. + * @param adart1 the first dart. + * @param adart2 the second dart. + */ + template + void group_enabled_attribute( Dart_handle adart1, Dart_handle adart2) + { + CGAL_static_assertion_msg( Helper::template Dimension_index::value>=0, + "group_enabled_attribute but " + "i-attributes are disabled"); + CGAL_assertion(adart1 != NULL && adart2 != NULL); + CGAL_assertion(adart1 != null_dart_handle && adart2 != null_dart_handle); + CGAL_assertion(i<=dimension); + + typename Attribute_handle::type a1=adart1->template attribute(); + typename Attribute_handle::type a2=adart2->template attribute(); + + // If the two attributes are equal, nothing to do. + if ( a1 == a2 ) return; + + Dart_handle toSet = NULL; + + // If the attribute associated to adart1 is NULL, set it with + // the attribute associated to adart2 (necessarily != NULL) + if (a1 == NULL) + { toSet = adart1; a1 = a2; } + else + { + toSet = adart2; + if (a2 != NULL) + { + internal::Apply_cell_functor::run(*a1,*a2); + } + } + set_attribute(toSet, a1); + } + + /** Group all the attributes of adart1 and adart2. If both dart have a + * i-attribute, the attribute associated to adart1 is kept. + * @param adart1 the first dart. + * @param adart1 the second dart. + */ + template + void group_attribute(Dart_handle adart1, Dart_handle adart2) + { + internal::Group_one_attribute_functor::type>::run(this,adart1,adart2); + } + + /** Group the i cell-attributes of two darts. + * If the two i cell-attribute of \em adart1 and \em adart2 are different, + * we set the i cell-attribute of adart2 onto the attribute of adart1. + * @param adart1 the first dart. + * @param adart2 the second dart. + */ + template + void group_enabled_attribute_of_dart( Dart_handle dh1, Dart_handle dh2) + { + CGAL_static_assertion_msg( Helper::template Dimension_index::value>=0, + "group_enabled_attribute_of_dart but " + "i-attributes are disabled"); + CGAL_assertion( dh1!=NULL && dh2!=NULL ); + CGAL_assertion( dh1!=null_dart_handle && dh2!=null_dart_handle ); + CGAL_assertion(i<=dimension); + + typename Attribute_handle::type a1=dh1->template attribute(); + typename Attribute_handle::type a2=dh2->template attribute(); + + // If the two attributes are equal, nothing to do. + if ( a1 == a2 ) return; + + if ( a1==NULL ) + set_attribute_of_dart(dh1, a2); + else + set_attribute_of_dart(dh2, a1); + } + + /** Group all the cells attributes of adart1 and adart2, except the + * adim-cell attribute. + * @param adart1 the first dart. + * @param adart1 the second dart. + * @param adim the dimension to not group (-1 to group all dimensions). + */ + void group_all_attributes_except(Dart_handle adart1, Dart_handle adart2, + int adim) + { + CGAL_assertion( adim==-1 || (1<=adim && (unsigned int)adim<=dimension) ); + Helper::template Foreach_enabled_attributes + >:: + run(this,adart1,adart2,adim); + } + + /** Degroup the i-cell attribute of the two given darts, if required. + * If the two darts are incident to the same attribute and do not belong to + * the same i-cell, we create a new attibute and link each dart + * belonging to the i-cell of adart2 onto this new attribute. + * The new attribute is initialized by copying the old one then by using + * the functor On_split from the original attribute. + * @param adart1 the first dart. + * @param adart2 the second dart. + * @return true iff the attribute is split. + */ + template + bool degroup_enabled_attribute(Dart_handle adart1, Dart_handle adart2) + { + CGAL_static_assertion_msg( Helper::template Dimension_index::value>=0, + "degroup_enabled_attribute but " + "i-attributes are disabled"); + CGAL_assertion(adart1 != NULL && adart2 != NULL); + CGAL_assertion(adart1 != null_dart_handle && adart2 != null_dart_handle); + + typename Attribute_handle::type a1=adart1->template attribute(); + typename Attribute_handle::type a2=NULL; + + // If the two attributes are not equal, nothing to do. + if ( a1 != adart2->template attribute() || a1 == NULL) return false; + + // If the two darts belong to the same cell, nothing to do. + if ( belong_to_same_cell(*this, adart1, adart2) ) + return false; + + // Here we create a new attribute + a2 = create_attribute(*a1); + + // We call the on_split functor + internal::Apply_cell_functor::run(*a1,*a2); + + // We set the dart of the cell a1 onto adart1. + a1->set_dart(adart1); + + // And we set all the dart of the cell of adart2 to v1. + set_attribute(adart2, a2); + + return true; + } + + template + bool degroup_attribute(Dart_handle adart1, Dart_handle adart2) + { + return internal::Degroup_one_attribute_functor::type>::run(this,adart1,adart2); + } + + /** Degroup all the cells attributes of adart1 and adart2, except the + * adim-cell attribute. + * @param adart1 the first dart. + * @param adart1 the second dart. + * @param adim the dimension to not degroup (-1 to degroup all). + */ + void degroup_all_attributes_except(Dart_handle adart1, Dart_handle adart2, + int adim) + { + CGAL_assertion( adim==-1 || (1<=adim && (unsigned int)adim<=dimension) ); + Helper::template Foreach_enabled_attributes + >:: + run(this,adart1,adart2,adim); + } + + /** Degroup all the cells attributes of adart1 and adart2. + * @param adart1 the first dart. + * @param adart1 the second dart. + */ + void degroup_all_attributes(Dart_handle adart1, Dart_handle adart2) + { degroup_all_attributes_except(adart1, adart2, -1); } + + /** Degroup the i-cell attribute of the two given darts, if required. + * We create a new attibute and link dart2 onto this new attribute. + * The new attribute is initialized by copying the old one then by using + * the functor On_split from the original attribute. + * @param adart1 the first dart. + * @param adart2 the second dart. + * @return true iff the attribute is split. + */ + template + bool degroup_enabled_attribute_of_dart( Dart_handle dh1, Dart_handle dh2) + { + CGAL_static_assertion_msg( Helper::template Dimension_index::value>=0, + "group_enabled_attribute_of_dart but " + "i-attributes are disabled"); + CGAL_assertion( dh1!=NULL && dh2!=NULL ); + CGAL_assertion( dh1!=null_dart_handle && dh2!=null_dart_handle ); + CGAL_assertion(i<=dimension); + + typename Attribute_handle::type a1=dh1->template attribute(); + typename Attribute_handle::type a2=dh2->template attribute(); + + // If the two attributes are equal, nothing to do. + if ( a1==NULL || a1 != a2 ) return false; + + a2 = create_attribute(*a1); + + // We call the on_split functor + // internal::Apply_cell_functor::run(*a1,*a2); + + // We set the attribute of dh2 to a2. + for (typename Range::iterator it=Range(*this,dh2).begin(), + itend=Range(*this,dh2).end(); it!=itend; ++it) + { + set_attribute_of_dart(it, a2); + } + return true; + } + + template + bool degroup_attribute_of_dart(Dart_handle adart1, Dart_handle adart2) + { + return internal::Degroup_one_attribute_of_dart_functor::type, Range>::run(this,adart1,adart2); + } + + /** Test the validity of a i-cell-attribute. + * ie all the darts belonging to a i-cell are linked to the same attribute. + * @param adart a dart. + * @param amark a mark used to mark darts of the i-cell. + * @return true iff all the darts of the i-cell link to the same attribute. + */ + template + bool is_valid_attribute(Dart_const_handle adart, + unsigned int amark) const + { + CGAL_static_assertion_msg( Helper::template Dimension_index::value>=0, + "is_valid_attribute but i-attributes" + " are disabled"); + if ( is_marked(adart, amark) ) return true; + bool valid = true; + + typename Attribute_const_handle::type + a=adart->template attribute(); + + unsigned int nb = 0; + for (CMap_dart_const_iterator_basic_of_cell + it(*this,adart,amark); it.cont(); ++it) + { + if ( it->template attribute() != a ) + valid = false; + + mark(it, amark); + ++nb; + } + + if ( a!=NULL && a->get_nb_refs()!=nb ) + valid = false; + + return valid; + } + + /** Erase marked darts from the map. + * Marked darts are unlinked before to be removed, thus surviving darts + * are correctly linked, but the map is not necessarily valid depending + * on the configuration of removed darts. User must check carefully marked + * darts before calling this method. + * @param amark the mark of darts to erase. + * @return the number of removed darts. + */ + unsigned int erase_marked_darts(int amark) + { + unsigned int res = 0, i = 0; + Dart_handle d; + for (typename Dart_range::iterator it(darts().begin()), + itend(darts().end()); it!=itend; ) + { + d = it++; + if (is_marked(d, amark)) + { + for (i = 0; i <= dimension; ++i) + { if (!d->is_free(i)) unlink_beta(d, i); } + erase_dart(d); ++res; + } + } + return res; + } + + public: + /** Set the i th attribute of the given dart. + * @param adart a dart. + * @param ah the attribute to set. + */ + template + void set_attribute_of_dart(Dart_handle adart, + typename Attribute_handle::type ah) + { + CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + "set_attribute_of_dart but " + "i-attributes are disabled"); + CGAL_assertion( adart!=NULL && adart!=null_dart_handle && ah!=NULL ); + if ( adart->template attribute()==ah ) return; + + decrease_attribute_ref_counting(adart); + + adart->set_attribute(ah); + ah->set_dart(adart); + } + + /** Set the i th attribute of all the darts of a given i-cell. + * @param adart a dart of the i-cell. + * @param ah the vertex to set. + */ + template + void set_attribute(Dart_handle adart, + typename Attribute_handle::type ah) + { + CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + "set_attribute but i-attributes are disabled"); + CGAL_assertion( adart!=NULL && adart!=null_dart_handle && ah!=NULL ); + for (CMap_dart_iterator_of_cell it(*this, adart); + it.cont(); ++it) + { + if ( it->template attribute()!=ah ) + { + decrease_attribute_ref_counting(it); + it->set_attribute(ah); + } + } + ah->set_dart(adart); + } + +#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + //**************************************************************************** + // Dart_of_orbit_range + template + struct Dart_of_orbit_range { + typedef CMap_dart_iterator_of_orbit iterator; + typedef CMap_dart_const_iterator_of_orbit const_iterator; + Dart_of_orbit_range(Self &amap, Dart_handle adart) : + mmap(amap), mdart(adart), msize(0) + {} + iterator begin() { return iterator(mmap,mdart); } + iterator end() { return iterator(mmap,NULL); } + const_iterator begin() const { return const_iterator(mmap,mdart); } + const_iterator end() const { return const_iterator(mmap,NULL); } + size_type size() + { + if (msize==0) + for ( iterator it=begin(),itend=end(); it!=itend; ++it) + ++msize; + return msize; + } + bool empty() const + { return mdart==NULL; } + private: + Self & mmap; + Dart_handle mdart; + size_type msize; + }; + //**************************************************************************** + // Dart_of_orbit_const_range + template + struct Dart_of_orbit_const_range { + typedef CMap_dart_const_iterator_of_orbit const_iterator; + Dart_of_orbit_const_range(const Self &amap, Dart_const_handle adart) : + mmap(amap), mdart(adart), msize(0) + {} + const_iterator begin() const { return const_iterator(mmap,mdart); } + const_iterator end() const { return const_iterator(mmap,NULL); } + size_type size() + { + if (msize==0) + for ( const_iterator it=begin(),itend=end(); it!=itend; ++it) + ++msize; + return msize; + } + bool empty() const + { return mdart==NULL; } + private: + const Self & mmap; + Dart_const_handle mdart; + size_type msize; + }; +#else + //**************************************************************************** + // Dart_of_orbit_range + template + struct Dart_of_orbit_range { + typedef CMap_dart_iterator_of_orbit + iterator; + typedef CMap_dart_const_iterator_of_orbit + const_iterator; + Dart_of_orbit_range(Self &amap, Dart_handle adart) : + mmap(amap), mdart(adart), msize(0) + {} + iterator begin() { return iterator(mmap,mdart); } + iterator end() { return iterator(mmap,NULL); } + const_iterator begin() const { return const_iterator(mmap,mdart); } + const_iterator end() const { return const_iterator(mmap,NULL); } + size_type size() + { + if (msize==0) + for ( iterator it=begin(),itend=end(); it!=itend; ++it) + ++msize; + return msize; + } + bool empty() const + { return mdart==NULL; } + private: + Self & mmap; + Dart_handle mdart; + size_type msize; + }; + //**************************************************************************** + // Dart_of_orbit_const_range + template + struct Dart_of_orbit_const_range { + typedef CMap_dart_const_iterator_of_orbit + const_iterator; + Dart_of_orbit_const_range(const Self &amap, Dart_const_handle adart) : + mmap(amap), mdart(adart), msize(0) + {} + const_iterator begin() const { return const_iterator(mmap,mdart); } + const_iterator end() const { return const_iterator(mmap,NULL); } + size_type size() + { + if (msize==0) + for ( const_iterator it=begin(),itend=end(); it!=itend; ++it) + ++msize; + return msize; + } + bool empty() const + { return mdart==NULL; } + private: + const Self & mmap; + Dart_const_handle mdart; + size_type msize; + }; +#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + //**************************************************************************** + // Dart_of_cell_range + template + struct Dart_of_cell_range { + typedef CMap_dart_iterator_of_cell iterator; + typedef CMap_dart_const_iterator_of_cell const_iterator; + Dart_of_cell_range(Self &amap, Dart_handle adart) : + mmap(amap), mdart(adart), msize(0) + {} + iterator begin() { return iterator(mmap,mdart); } + iterator end() { return iterator(mmap,NULL); } + const_iterator begin() const { return const_iterator(mmap,mdart); } + const_iterator end() const { return const_iterator(mmap,NULL); } + size_type size() + { + if (msize==0) + for ( iterator it=begin(); it!=end(); ++it) + ++msize; + return msize; + } + bool empty() const + { return mdart==NULL; } + private: + Self & mmap; + Dart_handle mdart; + size_type msize; + }; + //**************************************************************************** + // Dart_of_cell_const_range + template + struct Dart_of_cell_const_range { + typedef CMap_dart_const_iterator_of_cell const_iterator; + Dart_of_cell_const_range(const Self &amap, Dart_const_handle adart) : + mmap(amap), mdart(adart), msize(0) + {} + const_iterator begin() const { return const_iterator(mmap,mdart); } + const_iterator end() const { return const_iterator(mmap,NULL); } + size_type size() + { + if (msize==0) + for ( const_iterator it=begin(); it!=end(); ++it) + ++msize; + return msize; + } + bool empty() const + { return mdart==NULL; } + private: + const Self & mmap; + Dart_const_handle mdart; + size_type msize; + }; + //**************************************************************************** + +#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + /// @return a range on all the darts of the given orbit + template + Dart_of_orbit_range darts_of_orbit(Dart_handle adart) + { return Dart_of_orbit_range(*this,adart); } + + template + Dart_of_orbit_const_range + darts_of_orbit(Dart_const_handle adart) const + { return Dart_of_orbit_const_range(*this,adart); } +#else + /// @return a range on all the darts of the given orbit + Dart_of_orbit_range<> darts_of_orbit(Dart_handle adart) + { return Dart_of_orbit_range<>(*this,adart); } + Dart_of_orbit_const_range<> darts_of_orbit(Dart_const_handle adart) const + { return Dart_of_orbit_const_range<>(*this,adart); } + + template + Dart_of_orbit_range darts_of_orbit(Dart_handle adart) + { return Dart_of_orbit_range(*this,adart); } + template + Dart_of_orbit_const_range darts_of_orbit(Dart_const_handle + adart) const + { return Dart_of_orbit_const_range(*this,adart); } + + template + Dart_of_orbit_range darts_of_orbit(Dart_handle adart) + { return Dart_of_orbit_range(*this,adart); } + template + Dart_of_orbit_const_range darts_of_orbit(Dart_const_handle + adart) const + { return Dart_of_orbit_const_range(*this,adart); } + + template + Dart_of_orbit_range darts_of_orbit(Dart_handle adart) + { return Dart_of_orbit_range(*this,adart); } + template + Dart_of_orbit_range darts_of_orbit(Dart_const_handle adart) const + { return Dart_of_orbit_range(*this,adart); } + + template + Dart_of_orbit_range darts_of_orbit(Dart_handle adart) + { return Dart_of_orbit_range(*this,adart); } + template + Dart_of_orbit_const_range + darts_of_orbit(Dart_const_handle adart) const + { return Dart_of_orbit_const_range(*this,adart); } + + template + Dart_of_orbit_range darts_of_orbit(Dart_handle adart) + { return Dart_of_orbit_range(*this,adart); } + template + Dart_of_orbit_const_range + darts_of_orbit(Dart_const_handle adart) const + { return Dart_of_orbit_const_range(*this,adart); } + + template + Dart_of_orbit_range darts_of_orbit(Dart_handle adart) + { return Dart_of_orbit_range(*this,adart); } + template + Dart_of_orbit_const_range + darts_of_orbit(Dart_const_handle adart) const + { return Dart_of_orbit_const_range(*this,adart); } + + template + Dart_of_orbit_range darts_of_orbit(Dart_handle adart) + { return Dart_of_orbit_range(*this,adart); } + template + Dart_of_orbit_const_range + darts_of_orbit(Dart_const_handle adart) const + { return Dart_of_orbit_const_range(*this,adart); } + + template + Dart_of_orbit_range darts_of_orbit + (Dart_handle adart) + { return Dart_of_orbit_range(*this,adart); } + template + Dart_of_orbit_const_range + darts_of_orbit(Dart_const_handle adart) const + { return Dart_of_orbit_const_range(*this,adart); } + + template + Dart_of_orbit_range + darts_of_orbit(Dart_handle adart) + { return Dart_of_orbit_range(*this,adart); } + template + Dart_of_orbit_const_range + darts_of_orbit(Dart_const_handle adart) const + { return Dart_of_orbit_const_range + (*this,adart); } +#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + + /// @return a range on all the darts of the given i-cell + template + Dart_of_cell_range darts_of_cell(Dart_handle adart) + { return Dart_of_cell_range(*this,adart); } + + template + Dart_of_cell_const_range darts_of_cell(Dart_const_handle adart) const + { return Dart_of_cell_const_range(*this,adart); } + + template + Dart_of_cell_range darts_of_cell(Dart_handle adart) + { return darts_of_cell(adart); } + + template + Dart_of_cell_const_range + darts_of_cell(Dart_const_handle adart) const + { return darts_of_cell(adart); } + + //************************************************************************** + // One_dart_per_incident_cell_range + template + struct One_dart_per_incident_cell_range { + typedef CMap_one_dart_per_incident_cell_iterator iterator; + typedef CMap_one_dart_per_incident_cell_const_iterator + const_iterator; + One_dart_per_incident_cell_range(Self &amap, Dart_handle adart) : + mmap(amap), mdart(adart),msize(0) + {} + iterator begin() { return iterator(mmap,mdart); } + iterator end() { return iterator(mmap,NULL); } + const_iterator begin() const { return const_iterator(mmap,mdart); } + const_iterator end() const { return const_iterator(mmap,NULL); } + size_type size() + { + if (msize==0) + for ( iterator it=begin(); it!=end(); ++it) + ++msize; + return msize; + } + bool empty() const + { return mdart==NULL; } + private: + Self & mmap; + Dart_handle mdart; + size_type msize; + }; + //************************************************************************** + // One_dart_per_incident_cell_const_range + template + struct One_dart_per_incident_cell_const_range { + typedef CMap_one_dart_per_incident_cell_const_iterator + const_iterator; + One_dart_per_incident_cell_const_range(const Self &amap, + Dart_const_handle adart) : + mmap(amap), mdart(adart), msize(0) + {} + const_iterator begin() const { return const_iterator(mmap,mdart); } + const_iterator end() const { return const_iterator(mmap,NULL); } + size_type size() + { + if (msize==0) + for ( const_iterator it=begin(); it!=end(); ++it) + ++msize; + return msize; + } + bool empty() const + { return mdart==NULL; } + private: + const Self & mmap; + Dart_const_handle mdart; + size_type msize; + }; + //************************************************************************** + // One_dart_per_cell_range + template + struct One_dart_per_cell_range { + typedef CMap_one_dart_per_cell_iterator iterator; + typedef CMap_one_dart_per_cell_const_iterator const_iterator; + One_dart_per_cell_range(Self &amap) : mmap(amap), msize(0) + {} + iterator begin() { return iterator(mmap); } + iterator end() { return iterator(mmap,NULL); } + const_iterator begin() const { return const_iterator(mmap); } + const_iterator end() const { return const_iterator(mmap,NULL); } + size_type size() + { + if (msize==0) + for ( iterator it=begin(); it!=end(); ++it) + ++msize; + return msize; + } + bool empty() const + { return mmap.is_empty(); } + private: + Self & mmap; + size_type msize; + }; + //************************************************************************** + // One_dart_per_cell_const_range + template + struct One_dart_per_cell_const_range { + typedef CMap_one_dart_per_cell_const_iterator const_iterator; + One_dart_per_cell_const_range(const Self &amap) : mmap(amap), msize(0) + {} + const_iterator begin() const { return const_iterator(mmap); } + const_iterator end() const { return const_iterator(mmap,NULL); } + size_type size() + { + if (msize==0) + for ( const_iterator it=begin(); it!=end(); ++it) + ++msize; + return msize; + } + bool empty() const + { return mmap.is_empty(); } + private: + const Self & mmap; + size_type msize; + }; + //************************************************************************** + // Dart_of_involution_range + template + struct Dart_of_involution_range { + typedef CMap_dart_iterator_of_involution iterator; + typedef CMap_dart_const_iterator_of_involution const_iterator; + Dart_of_involution_range(Self &amap, Dart_handle adart) : + mmap(amap), mdart(adart), msize(0) + {} + iterator begin() { return iterator(mmap,mdart); } + iterator end() { return iterator(mmap,NULL); } + const_iterator begin() const { return const_iterator(mmap,mdart); } + const_iterator end() const { return const_iterator(mmap,NULL); } + size_type size() + { + if (msize==0) + for (iterator it=begin(); it!=end(); ++it) + ++msize; + return msize; + } + bool empty() const + { return mmap.is_empty(); } + private: + Self & mmap; + Dart_handle mdart; + size_type msize; + }; + //************************************************************************** + // Dart_of_involution_const_range + template + struct Dart_of_involution_const_range { + typedef CMap_dart_const_iterator_of_involution const_iterator; + Dart_of_involution_const_range(const Self &amap, Dart_const_handle adart) : + mmap(amap), mdart(adart), msize(0) + {} + const_iterator begin() const { return const_iterator(mmap,mdart); } + const_iterator end() const { return const_iterator(mmap,NULL); } + size_type size() + { + if (msize==0) + for (const_iterator it=begin(); it!=end(); ++it) + ++msize; + return msize; + } + bool empty() const + { return mmap.is_empty(); } + private: + const Self & mmap; + Dart_const_handle mdart; + size_type msize; + }; + //************************************************************************** + + /// @return a range on the i-cells incindent to the given j-cell. + template + One_dart_per_incident_cell_range + one_dart_per_incident_cell(Dart_handle adart) + { return One_dart_per_incident_cell_range(*this,adart); } + + template + One_dart_per_incident_cell_const_range + one_dart_per_incident_cell(Dart_const_handle adart) const + { return One_dart_per_incident_cell_const_range(*this,adart); } + + template + One_dart_per_incident_cell_range + one_dart_per_incident_cell(Dart_handle adart) + { return one_dart_per_incident_cell(adart); } + + template + One_dart_per_incident_cell_const_range + one_dart_per_incident_cell(Dart_const_handle adart) const + { return one_dart_per_incident_cell(adart); } + + /// @return a range on all the i-cells + template + One_dart_per_cell_range one_dart_per_cell() + { return One_dart_per_cell_range(*this); } + + template + One_dart_per_cell_const_range one_dart_per_cell() const + { return One_dart_per_cell_const_range(*this); } + + template + One_dart_per_cell_range one_dart_per_cell() + { return one_dart_per_cell(); } + + template + One_dart_per_cell_const_range one_dart_per_cell() const + { return one_dart_per_cell(); } + + public: + /// Void dart. A dart d is i-free if beta_i(d)=null_dart_handle. + static Dart_handle null_dart_handle; + + private: + /// Dart container. + Dart_container mdarts; + + /// Container for the null_dart_handle, static data member. + static Dart_container mnull_dart_container; + + /// Array of reserved marks: mused_marks[i] true <=> mark number i is + /// in used, otherwise the mark is free. + mutable std::bitset mused_marks; + + /// Mask marks to know the value of unmark dart, for each index i. + mutable std::bitset mmask_marks; + + /// Number of used marks. + mutable size_type mnb_used_marks; + + /// Index of each mark, in mfree_marks_stack or in mfree_marks_stack. + mutable size_type mindex_marks[NB_MARKS]; + + /// "Stack" of free marks. + mutable int mfree_marks_stack[NB_MARKS]; + + /// "Stack" of used marks. + mutable int mused_marks_stack[NB_MARKS]; + + /// Number of marked darts for each used marks. + mutable size_type mnb_marked_darts[NB_MARKS]; + + /// Tuple of attributes containers + typename Helper::Attribute_containers mattribute_containers; + }; + + /// Allocation of static data members + /// mnull_dart_container + template < unsigned int d_, class Refs, class Items_, class Alloc_ > + typename Combinatorial_map_base::Dart_container + Combinatorial_map_base::mnull_dart_container; + + /// null_dart_handle + template < unsigned int d_, class Refs, class Items_, class Alloc_ > + typename Combinatorial_map_base::Dart_handle + Combinatorial_map_base::null_dart_handle; + // = mnull_dart_container.emplace( std::bitset() ); + // Does not work on windows => segfault + // Thus we initialize null_dart_handle in the Combinatorial_map constructor + // Not thread safe ! + + template < unsigned int d_, + class Items_=Combinatorial_map_min_items, + class Alloc_=CGAL_ALLOCATOR(int) > + class Combinatorial_map : + public Combinatorial_map_base, + Items_, Alloc_ > + { + public: + typedef Combinatorial_map Self; + typedef Combinatorial_map_base Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Dart_const_handle Dart_const_handle; + typedef typename Base::Alloc Alloc; + }; + + +} // namespace CGAL + +#endif // CGAL_COMBINATORIAL_MAP_H // +// EOF // diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h b/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h new file mode 100644 index 00000000000..e6c06b7d696 --- /dev/null +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h @@ -0,0 +1,340 @@ +// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France). +// All rights reserved. +// +// 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. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Guillaume Damiand +// +#ifndef CGAL_COMBINATORIAL_MAP_BASIC_OPERATIONS_H +#define CGAL_COMBINATORIAL_MAP_BASIC_OPERATIONS_H 1 + +namespace CGAL { + +/** @file Combinatorial_map_basic_operations.h + * Basic operations on a combinatorial map. + */ + +/** Test if the two given darts belong to the same given orbit. + * @param amap a combinatorial map. + * @param adart1 the first dart. + * @param adart2 the second dart. + * @return true iff the two darts belong to the same orbit. + */ +template < class Map, class Iterator > +bool belong_to_same_orbit(const Map & amap, + typename Map::Dart_const_handle adart1, + typename Map::Dart_const_handle adart2) +{ + CGAL_assertion( (!Iterator::is_basic_iterator()) ); + bool found = false; + + for (Iterator it(amap, adart1); !found && it.cont(); ++it) + { + if (it == adart2) found = true; + } + + return found; +} + +/** Test if all the darts of a given orbit are marked. + * @param amap a combinatorial map. + * @param adart a dart of the orbit. + * @param amark the mark. + * @return true iff all the darts are marked. + */ +template < class Map, class Iterator > +bool is_whole_orbit_marked(const Map & amap, + typename Map::Dart_const_handle adart, + int amark) +{ + CGAL_assertion( !Iterator::is_basic_iterator() ); + bool res = true; + + for ( Iterator it(amap, adart); res && it.cont(); ++it ) + { + if (!amap.is_marked(it, amark)) res = false; + } + + return res; +} + +/** Test if all the darts of a given orbit are unmarked. + * @param amap a combinatorial map. + * @param adart a dart of the orbit. + * @param amark the mark. + * @return true iff all the darts are unmarked. + */ +template < class Map, class Iterator > +bool is_whole_orbit_unmarked(const Map & amap, + typename Map::Dart_const_handle adart, + int amark) +{ + amap.negate_mark(amark); + bool res = is_whole_orbit_marked(amap, adart, amark); + amap.negate_mark(amark); + return res; +} + +/** Mark a given orbit with a given mark. + * @param amap a combinatorial map. + * @param adart a dart of the orbit. + * @param amark the mark. + * @return the number of darts of the marked orbit. + * @pre The whole orbit must be unmarked. + */ +template < class Map, class Iterator > +typename Map::size_type mark_orbit(const Map & amap, + typename Map::Dart_const_handle adart, + unsigned int amark) +{ + CGAL_assertion( Iterator::is_basic_iterator() ); + CGAL_assertion( (is_whole_orbit_unmarked > + (amap, adart, amark)) ); + typename Map::size_type res = 0; + + for (Iterator it(amap, adart, amark); it.cont(); ++it) + { + amap.mark(it, amark); + ++res; + } + + return res; +} + +/** Unmark a given orbit with a given mark. + * @param amap a combinatorial map. + * @param adart a dart of the orbit. + * @param amark the mark. + * @return the number of darts of the unmarked orbit. + * @pre The whole orbit must be marked. + */ +template < class Map, class Iterator > +typename Map::size_type unmark_orbit(const Map & amap, + typename Map::Dart_const_handle adart, + int amark) +{ + amap.negate_mark(amark); + typename Map::size_type res = mark_orbit(amap, adart, amark); + amap.negate_mark(amark); + return res; +} + +/** Test if the two given darts belong to the same cell. + * @param amap a combinatorial map. + * @param adart1 the first dart. + * @param adart2 the second dart. + * @return true iff the two darts belong to the same cell. + */ + template < class Map, unsigned int i, unsigned int d> + bool belong_to_same_cell(const Map & amap, + typename Map::Dart_const_handle adart1, + typename Map::Dart_const_handle adart2) +{ + return belong_to_same_orbit > + (amap, adart1, adart2); +} + + template < class Map, unsigned int i> + bool belong_to_same_cell(const Map & amap, + typename Map::Dart_const_handle adart1, + typename Map::Dart_const_handle adart2) +{ + return belong_to_same_cell(amap,adart1,adart2); +} + + +/** Test if all the darts of a given cell are marked. + * @param amap a combinatorial map. + * @param adart a dart of the cell. + * @param amark the mark. + * @return true iff all the darts are marked. + */ +template < class Map, unsigned int i, unsigned int d> +bool is_whole_cell_marked(const Map & amap, + typename Map::Dart_const_handle adart, + unsigned int amark) +{ + return is_whole_orbit_marked > + (amap, adart, amark); +} + +template < class Map, unsigned int i> + bool is_whole_cell_marked(const Map & amap, + typename Map::Dart_const_handle adart, + unsigned int amark) +{ + return is_whole_cell_marked(amap,adart,amark); +} + +/** Test if all the darts of a given cell are unmarked. + * @param amap a combinatorial map. + * @param adart a dart of the cell. + * @param amark the mark. + * @return true iff all the darts are marked. + */ +template < class Map, unsigned int i, unsigned int d > +bool is_whole_cell_unmarked(const Map & amap, + typename Map::Dart_const_handle adart, + unsigned int amark) +{ + return is_whole_orbit_unmarked > + (amap, adart, amark); +} + +template < class Map, unsigned int i> +bool is_whole_cell_unmarked(const Map & amap, + typename Map::Dart_const_handle adart, + unsigned int amark) +{ + return is_whole_cell_unmarked(amap,adart,amark); +} + +/** Mark a given cell with a given mark. + * @param amap a combinatorial map. + * @param adart a dart of the cell. + * @param amark the mark. + * @return the number of darts of the marked cell. + * @pre The whole cell must be unmarked. + */ +template < class Map, unsigned int i, unsigned int d > +typename Map::size_type mark_cell(const Map & amap, + typename Map::Dart_const_handle adart, + int amark) +{ return mark_orbit > + (amap, adart, amark); } + +template < class Map, unsigned int i> +typename Map::size_type mark_cell(const Map & amap, + typename Map::Dart_const_handle adart, + int amark) +{ return mark_cell(amap, adart, amark);} + +/** Unmark a given orbit with a given mark. + * @param amap a combinatorial map. + * @param adart a dart of the cell. + * @param amark the mark. + * @return the number of darts of the unmarked cell. + * @pre The whole cell must be marked. + */ +template < class Map, unsigned int i, unsigned int d > +typename Map::size_type unmark_cell(const Map & amap, + typename Map::Dart_handle adart, + int amark) +{ return unmark_orbit > + (amap, adart, amark);} + +template < class Map, unsigned int i > +typename Map::size_type unmark_cell(const Map & amap, + typename Map::Dart_handle adart, + int amark) +{ return unmark_cell(amap, adart, amark);} + +/** Compute the degree of a given i-cell c. + * The degree is the number of distinct i+1 cells incident to c. + * @param amap a combinatorial map. + * @param adart a dart of the cell. + * @return the degree of the cell. + */ +template < class Map, unsigned int i > +typename Map::size_type degree( const Map & amap, + typename Map::Dart_handle adart ) +{ + CGAL_assertion(adart != NULL); + + typename Map::size_type nbIncident = 0; + int mark = amap.get_new_mark(); + int treated = amap.get_new_mark(); + + CMap_dart_const_iterator_basic_of_cell it(amap, adart, mark); + for ( ;it.cont(); ++it ) + { + if (!amap.is_marked(*it, treated)) + { + ++nbIncident; + mark_cell(amap, *it, treated); + } + amap.mark(*it,mark); + } + + amap.negate_mark(mark); + for (it.rewind(); it.cont(); ++it) + { + if (amap.is_marked(*it, treated)) + unmark_cell(amap, *it, treated); + amap.mark(*it,mark); + } + + amap.negate_mark(mark); + CGAL_assertion( amap.is_whole_map_unmarked(mark) ); + CGAL_assertion( amap.is_whole_map_unmarked(treated) ); + + amap.free_mark(mark); + amap.free_mark(treated); + + CGAL_assertion(nbIncident != 0); + return nbIncident; +} + +/** Compute the co-degree of a given i-cell c. + * The co-degree is the number of distinct i-1 cells incident to c. + * @param amap a combinatorial map. + * @param adart a dart of the cell. + * @return the co-degree of the cell. + */ +template < class Map, unsigned int i > +typename Map::size_type codegree(const Map & amap, + typename Map::Dart_handle adart) +{ + CGAL_assertion(adart != NULL); + + typename Map::size_type nbIncident = 0; + int mark = amap.get_new_mark(); + int treated = amap.get_new_mark(); + + CMap_dart_const_iterator_basic_of_cell it(amap, adart, mark); + for ( ; it.cont(); ++it) + { + if (!amap.is_marked(*it, treated)) + { + ++nbIncident; + mark_cell(amap, *it, treated); + } + amap.mark(*it,mark); + } + + amap.negate_mark(mark); + for (it.rewind(); it.cont(); ++it) + { + if (amap.is_marked(*it, treated)) + unmark_cell(amap, *it, treated); + amap.mark(*it,mark); + } + + amap.negate_mark(mark); + CGAL_assertion( amap.is_whole_map_unmarked(mark) ); + CGAL_assertion( amap.is_whole_map_unmarked(treated) ); + + amap.free_mark(mark); + amap.free_mark(treated); + + CGAL_assertion(nbIncident != 0); + return nbIncident; +} + +} // namespace CGAL + +#endif // CGAL_COMBINATORIAL_MAP_BASIC_OPERATIONS_H // +// EOF // diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_constructors.h b/Combinatorial_map/include/CGAL/Combinatorial_map_constructors.h new file mode 100644 index 00000000000..c21ff9229fe --- /dev/null +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_constructors.h @@ -0,0 +1,167 @@ +// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France). +// All rights reserved. +// +// 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. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Guillaume Damiand +// +#ifndef CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H +#define CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H 1 + +namespace CGAL { + +/** @file Combinatorial_map_constructors.h + * Basic creation operations for a combinatorial map. + * Create edge, triangle, quadrilateral, tetrahedron, hexahedron. + */ + +/** Create an edge. + * @param amap the used combinatorial map. + * @return a dart of the new edge. + */ +template < class Map > +typename Map::Dart_handle make_edge(Map& amap) +{ + typename Map::Dart_handle d1 = amap.create_dart(); + typename Map::Dart_handle d2 = amap.create_dart(); + amap.template basic_link_beta<2>(d1, d2); + return d1; +} + +/** Create a combinatorial polygon of length alg + * (a cycle of alg darts beta1 links together). + * @param amap the used combinatorial map. + * @return a new dart. + */ +template < class Map > +typename Map::Dart_handle make_combinatorial_polygon(Map& amap, + unsigned int alg) +{ + CGAL_assertion(alg>0); + + typename Map::Dart_handle start = amap.create_dart(); + typename Map::Dart_handle prev = start; + for ( unsigned int nb=1; nb(prev, cur); + prev=cur; + } + + amap.template basic_link_beta<1>(prev, start); + return start; +} + +/** Create a combinatorial tetrahedron from 4 triangles. + * @param amap the used combinatorial map. + * @param d1 a dart onto a first triangle. + * @param d2 a dart onto a second triangle. + * @param d3 a dart onto a third triangle. + * @param d4 a dart onto a fourth triangle. + * @return a new dart. + */ +template < class Map > +typename Map::Dart_handle +make_combinatorial_tetrahedron(Map& amap, + typename Map::Dart_handle d1, + typename Map::Dart_handle d2, + typename Map::Dart_handle d3, + typename Map::Dart_handle d4) +{ + amap.basic_link_beta(d1, d2, 2); + amap.basic_link_beta(d3, d2->beta(0), 2); + amap.basic_link_beta(d1->beta(1), d3->beta(0), 2); + amap.basic_link_beta(d4, d2->beta(1), 2); + amap.basic_link_beta(d4->beta(0), d3->beta(1), 2); + amap.basic_link_beta(d4->beta(1), d1->beta(0), 2); + + return d1; +} + +/** Create a new combinatorial tetrahedron. + * @param amap the used combinatorial map. + * @return a new dart. + */ +template < class Map > +typename Map::Dart_handle make_combinatorial_tetrahedron(Map& amap) +{ + typename Map::Dart_handle d1 = make_combinatorial_polygon(amap,3); + typename Map::Dart_handle d2 = make_combinatorial_polygon(amap,3); + typename Map::Dart_handle d3 = make_combinatorial_polygon(amap,3); + typename Map::Dart_handle d4 = make_combinatorial_polygon(amap,3); + + return make_combinatorial_tetrahedron(amap, d1, d2, d3, d4); +} + +/** Create a combinatorial hexahedron from 6 quadrilaterals. + * @param amap the used combinatorial map. + * @param d1 a dart onto a first quadrilateral. + * @param d2 a dart onto a second quadrilateral. + * @param d3 a dart onto a third quadrilateral. + * @param d4 a dart onto a fourth quadrilateral. + * @param d5 a dart onto a fifth quadrilateral. + * @param d6 a dart onto a sixth quadrilateral. + * @return a dart of the new cuboidal_cell. + */ +template < class Map > +typename Map::Dart_handle +make_combinatorial_hexahedron(Map& amap, + typename Map::Dart_handle d1, + typename Map::Dart_handle d2, + typename Map::Dart_handle d3, + typename Map::Dart_handle d4, + typename Map::Dart_handle d5, + typename Map::Dart_handle d6) +{ + amap.basic_link_beta(d1, d4->beta(1)->beta(1), 2); + amap.basic_link_beta(d1->beta(1), d6->beta(0) , 2); + amap.basic_link_beta(d1->beta(1)->beta(1), d2 , 2); + amap.basic_link_beta(d1->beta(0), d5 , 2); + + amap.basic_link_beta(d3, d2->beta(1)->beta(1), 2); + amap.basic_link_beta(d3->beta(1), d6->beta(1) , 2); + amap.basic_link_beta(d3->beta(1)->beta(1), d4 , 2); + amap.basic_link_beta(d3->beta(0), d5->beta(1)->beta(1), 2); + + amap.basic_link_beta(d6, d4->beta(1) , 2); + amap.basic_link_beta(d6->beta(1)->beta(1), d2->beta(1) , 2); + + amap.basic_link_beta(d5->beta(0), d4->beta(0) , 2); + amap.basic_link_beta(d5->beta(1), d2->beta(0) , 2); + + return d1; +} + +/** Create a new combinatorial hexahedron. + * @param amap the used combinatorial map. + * @return a new dart. + */ +template < class Map > +typename Map::Dart_handle make_combinatorial_hexahedron(Map& amap) +{ + typename Map::Dart_handle d1 = make_combinatorial_polygon(amap,4); + typename Map::Dart_handle d2 = make_combinatorial_polygon(amap,4); + typename Map::Dart_handle d3 = make_combinatorial_polygon(amap,4); + typename Map::Dart_handle d4 = make_combinatorial_polygon(amap,4); + typename Map::Dart_handle d5 = make_combinatorial_polygon(amap,4); + typename Map::Dart_handle d6 = make_combinatorial_polygon(amap,4); + + return make_combinatorial_hexahedron(amap, d1, d2, d3, d4, d5, d6); +} + +} // namespace CGAL + +#endif // CGAL_COMBINATORIAL_MAP_CONSTRUCTORS_H // +// EOF // diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_min_items.h b/Combinatorial_map/include/CGAL/Combinatorial_map_min_items.h new file mode 100644 index 00000000000..11a305a8f56 --- /dev/null +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_min_items.h @@ -0,0 +1,50 @@ +// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France). +// All rights reserved. +// +// 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. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Guillaume Damiand +// +#ifndef CGAL_COMBINATORIAL_MAP_MIN_ITEMS_H +#define CGAL_COMBINATORIAL_MAP_MIN_ITEMS_H 1 + +#include + +namespace CGAL { + +/** @file Combinatorial_map_min_items.h + * Definition of min item class for dD combinatorial map. + */ + +/** Minimal items for dD combinatorial map. + * Combinatorial_map_min_items defines what is the minimal item + * class for a d-map It provides definitions for darts without attribute. + */ +template +struct Combinatorial_map_min_items +{ + /// Dart_wrapper defines the type of darts used, and enabled attributes. + template < class Refs > + struct Dart_wrapper + { + typedef CGAL::Dart< d, Refs > Dart; + typedef CGAL::cpp0x::tuple<> Attributes; + }; +}; + +} // namespace CGAL + +#endif // CGAL_COMBINATORIAL_MAP_MIN_ITEMS_H // +// EOF // diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h b/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h new file mode 100644 index 00000000000..75185a1ae7f --- /dev/null +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_operations.h @@ -0,0 +1,927 @@ +// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France). +// All rights reserved. +// +// 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. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Guillaume Damiand +// +#ifndef CGAL_COMBINATORIAL_MAP_OPERATIONS_H +#define CGAL_COMBINATORIAL_MAP_OPERATIONS_H 1 + +#include +#include +#include + +namespace CGAL { + + /** @file Combinatorial_map_operations.h + * Some operations to modify a combinatorial map. + */ + + /** Insert a vertex in the given 2-cell which is splitted in triangles, + * once for each inital edge of the facet. + * @param amap the used combinatorial map. + * @param adart a dart of the facet to triangulate. + * @return A dart incident to the new vertex. + */ + template < class Map > + typename Map::Dart_handle + insert_cell_0_in_cell_2(Map& amap, typename Map::Dart_handle adart) + { + CGAL_assertion(adart != NULL && adart!=Map::null_dart_handle); + + typename Map::Dart_handle first = adart, prev = NULL, cur = NULL; + typename Map::Dart_handle n1 = NULL, n2 = NULL; + + typename Map::Dart_handle nn1 = NULL, nn2 = NULL; + + // If the facet is open, we search the dart 0-free + while (!first->is_free(0) && first->beta(0) != adart) + first = first->beta(0); + + // Stack of couple of dart and dimension for which + // we must call on_split functor + std::stack > + tosplit; + + // Now we run through the facet + for (CGAL::CMap_dart_iterator_basic_of_orbit it(amap,first); + it.cont();) + { + cur = it; + ++it; + + if ( cur!=first ) + { + if ( amap.template degroup_attribute_of_dart<2, + typename Map::template Dart_of_involution_range<1> > + (first, cur) ) + tosplit.push(internal::Couple_dart_and_dim + + (first,cur,2)); + } + + if (!cur->is_free(0)) + { + n1 = amap.create_dart(); + amap.template link_beta<0>(cur, n1); + } + else n1 = NULL; + + if (!cur->is_free(1)) + { + n2 = amap.create_dart(); + amap.template link_beta<1>(cur, n2); + } + else n2 = NULL; + + if (n1 != NULL && n2 != NULL) + amap.template link_beta<0>(n1, n2); + + if (n1 != NULL && prev != NULL) + amap.link_beta(prev, n1, 2); + + for (unsigned int dim=3; dim<=Map::dimension; ++dim) + { + if ( !adart->is_free(dim) ) + { + if (n1!=NULL) + { + nn1=amap.create_dart(); + amap.template link_beta<1>(cur->beta(dim), nn1); + amap.link_beta(n1, nn1, dim); + } + else nn1=NULL; + + if (n2!=NULL) + { + nn2=amap.create_dart(); + amap.template link_beta<0>(cur->beta(dim), nn2); + amap.link_beta(n2, nn2, dim); + } + else nn2=NULL; + + if (nn1 != NULL && nn2 != NULL) + amap.template basic_link_beta<1>(nn1, nn2); + + if (nn1 != NULL && prev != NULL) + amap.link_beta(nn1, prev->beta(dim), 2); + } + } + + prev = n2; + } + + if (n2 != NULL) + { + amap.link_beta(first->beta(0), n2, 2); + for (unsigned int dim=3; dim<=Map::dimension; ++dim) + { + if ( !adart->is_free(dim) ) + { + amap.link_beta(first->beta(0)->beta(dim), nn2, 2); + } + } + } + + while ( !tosplit.empty() ) + { + internal::Couple_dart_and_dim c=tosplit.top(); + tosplit.pop(); + internal::Call_split_functor::run(c.d1, c.d2); + } + + return n1; + } + + /** Test if a i-cell can be removed. + * An i-cell can be removed if i==Map::dimension, + * or if there are at most two (i+1)-cell incident to it. + * @param adart a dart of the i-cell. + * @return true iff the i-cell can be removed. + */ + template < class Map, unsigned int i > + bool is_removable(const Map& amap, typename Map::Dart_const_handle adart) + { + CGAL_assertion(adart != NULL); + CGAL_assertion(0<=i && i<=Map::dimension); + + if ( i==Map::dimension ) return true; + if ( i==Map::dimension-1 ) return true; + + // TODO ? Optimisation for dim-2, and to not test all the darts of the cell ? + bool res = true; + for (CMap_dart_const_iterator_of_cell it(amap, adart); + res && it.cont(); ++it) + { + if (it->beta(i+2)->beta(i+1) != it->beta_inv(i+1)->beta(i+2) ) + res = false; + } + return res; + } + + /** Remove a i-cell, 0 + struct Remove_cell_functor + { + static size_t run(Map& amap, typename Map::Dart_handle adart) + { + CGAL_assertion ( 1<=i && i(amap, adart)) ); + + size_t res = 0; + + // 1) We group the two (i+1)-cells if they exist. + if (!adart->is_free(i+1)) + amap.template group_attribute(adart, adart->beta(i+1)); + + typename Map::Dart_handle d1, d2, other; + int mark = amap.get_new_mark(); + std::vector to_erase; + + // 2) We mark all the darts of the i-cell. + { + for ( CMap_dart_iterator_basic_of_cell it(amap,adart,mark); + it.cont(); ++it ) + { + to_erase.push_back(it); + amap.mark(it,mark); + ++res; + } + } + + // Stack of couple of dart for which we must call degroup_all_attributes + typedef std::pair + Dart_pair; + std::stack todegroup; + + // 3) We modify the darts of the cells incident to the removed i-cell + // when they are marked to remove. + typename std::vector::iterator it = + to_erase.begin(); + for (; it != to_erase.end(); ++it) + { amap.update_dart_of_all_attributes(*it, mark); } + + // 4) For each dart of the cell, we modify i-link of neighbors. + for ( it=to_erase.begin(); it != to_erase.end(); ++it) + { + d1 = (*it)->beta_inv(i); + while ( d1!=Map::null_dart_handle && amap.is_marked(d1, mark) ) + { + d1 = d1->beta(i+1)->beta_inv(i); + if (d1 == (*it)->beta_inv(i)) d1 = Map::null_dart_handle; + } + + d2 = (*it)->beta(i+1)->beta(i); + while ( d2!=Map::null_dart_handle && amap.is_marked(d2, mark) ) + { + d2 = d2->beta(i+1)->beta(i); + if ( d2==(*it)->beta(i+1)->beta(i) ) d2=Map::null_dart_handle; + } + + // TODO ? We can optimize by using map.basic_link_beta but we need to mark + // the second dart to not process another time... + if (d1 != Map::null_dart_handle) + { + if (d2 != Map::null_dart_handle) + { + d1->basic_link_beta(d2, i); + // Here special case for edge, TODO special method ? + if ( i==1 ) d2->basic_link_beta(d1, 0); + } + else + { + if ( !d1->is_free(i) ) + { + todegroup.push(Dart_pair(d1, d1->beta(i))); + d1->unlink_beta(i); + } + } + } + else if (d2 != Map::null_dart_handle) + { + if ( !d2->is_free(CGAL_BETAINV(i)) ) + { + todegroup.push(Dart_pair(d2, d2->beta_inv(i))); + d2->unlink_beta(CGAL_BETAINV(i)); + } + } + + if ((*it)->is_free(i+1) && !(*it)->is_free(i)) + { + d1 = (*it)->beta(i); + if ( !d1->is_free(CGAL_BETAINV(i)) ) + { + todegroup.push(Dart_pair(d1, d1->beta_inv(i))); + d1->unlink_beta(CGAL_BETAINV(i)); + } + } + } + + // 5) We degroup all the pair + while ( !todegroup.empty() ) + { + Dart_pair p=todegroup.top(); + todegroup.pop(); + amap.degroup_all_attributes(p.first,p.second); + } + + // 6) We remove all the darts of the cell. + for ( it=to_erase.begin(); it!=to_erase.end(); ++it ) + { amap.erase_dart(*it); } + + CGAL_assertion( amap.is_whole_map_unmarked(mark) ); + amap.free_mark(mark); + + // CGAL_postcondition(amap.is_valid()); + + return res; + } + }; + + /** Remove a d-cell, in a d-map (special case). + * @param amap the used combinatorial map. + * @param adart a dart of the volume to remove. + * @return the number of deleted darts. + */ + template + struct Remove_cell_functor + { + static size_t run(Map& amap, typename Map::Dart_handle adart) + { + CGAL_assertion( adart!=NULL ); + + std::vector to_erase; + int mark = amap.get_new_mark(); + size_t res = 0; + typename Map::Dart_handle other = NULL; + + // Stack of couple of dart for which we must call degroup_all_attributes + typedef std::pair + Dart_pair; + std::stack todegroup; + + // 1) We mark all the darts of the d-cell. + { + for (CMap_dart_iterator_basic_of_cell + it(amap,adart,mark); it.cont(); ++it) + { + to_erase.push_back(it); + amap.mark(it,mark); + ++res; + } + } + + // 2) We update the cells incident to the remove volume. + typename std::vector::iterator + it = to_erase.begin(); + for (; it != to_erase.end(); ++it) + { amap.update_dart_of_all_attributes(*it, mark); } + + // 3) We unlink all the darts of the volume for beta-d. + for ( it = to_erase.begin(); it != to_erase.end(); ++it ) + { + if ( !(*it)->is_free(Map::dimension) ) + { + todegroup.push(Dart_pair(*it, (*it)->beta(Map::dimension))); + amap.unlink_beta(*it,Map::dimension); + } + } + + // 4) We degroup all the pairs + while ( !todegroup.empty() ) + { + Dart_pair p=todegroup.top(); + todegroup.pop(); + amap.degroup_all_attributes(p.first,p.second); + } + + // 5) last, we remove all the darts of the d-cell. + for ( it = to_erase.begin(); it != to_erase.end(); ++it ) + { amap.erase_dart(*it); } + + CGAL_assertion( amap.is_whole_map_unmarked(mark) ); + amap.free_mark(mark); + + //CGAL_postcondition(amap.is_valid()); + + return res; + } + }; + + /** Remove a vertex, and merge eventually both incident edges. + * @param amap the used combinatorial map. + * @param adart a dart of the vertex to remove. + * @return the number of deleted darts. + */ + template + struct Remove_cell_functor + { + static size_t run(Map& amap, typename Map::Dart_handle adart) + { + CGAL_assertion( (is_removable(amap,adart)) ); + + size_t res = 0; + + // Stack of couple of dart for which we must call degroup_all_attributes + typedef std::pair + Dart_pair; + std::stack todegroup; + + // 1) We group the two edges if they exist. + if (!adart->is_free(0)) + amap.template group_attribute<1>(adart, adart->beta(0)); + + typename Map::Dart_handle d1, d2; + int mark = amap.get_new_mark(); + std::vector to_erase; + + // 2) We mark all the darts of the vertex. + { + for ( CMap_dart_iterator_basic_of_cell it(amap,adart,mark); + it.cont(); ++it ) + { + to_erase.push_back(it); + amap.mark(it,mark); + ++res; + } + } + + // 3) We modify the darts of the cells incident to the vertex + // when they are marked to remove. + typename std::vector::iterator + it = to_erase.begin(); + for (; it != to_erase.end(); ++it) + { amap.update_dart_of_all_attributes(*it, mark); } + + // 4) For each dart of the cell, we modify link of neighbors. + for ( it=to_erase.begin(); it!=to_erase.end(); ++it ) + { + if ( !(*it)->is_free(0) && (*it)->beta(0)!=(*it) ) + { + amap.template basic_link_beta<1>((*it)->beta(0), (*it)->beta(1)); + + for ( unsigned int j=2; j<=Map::dimension; ++j ) + { + if ( !(*it)->is_free(j) ) + ((*it)->beta(0))->basic_link_beta((*it)->beta(j),j); + } + } + else + { + for ( unsigned int j=1; j<=Map::dimension; ++j ) + { + if (!(*it)->is_free(j)) + { + d1 = (*it)->beta(j); + if ( !d1->is_free(CGAL_BETAINV(j)) ) + { + todegroup.push(Dart_pair(d1, d1->beta_inv(j))); + d1->unlink_beta(CGAL_BETAINV(j)); + } + } + } + } + } + + // 5) We degroup all the pairs + while ( !todegroup.empty() ) + { + Dart_pair p=todegroup.top(); + todegroup.pop(); + amap.degroup_all_attributes(p.first,p.second); + } + + // 6) We remove all the darts of the cell. + for (it = to_erase.begin(); it != to_erase.end(); ++it) + { amap.erase_dart(*it); } + + CGAL_assertion( amap.is_whole_map_unmarked(mark) ); + amap.free_mark(mark); + + // CGAL_postcondition( amap.is_valid() ); + + return res; + } + }; + + /** Remove a i-cell, 0<=i<=dimension. + * @param amap the used combinatorial map. + * @param adart a dart of the i-cell to remove. + * @return the number of deleted darts. + */ + template < class Map, unsigned int i > + size_t remove_cell(Map& amap, typename Map::Dart_handle adart) + { return Remove_cell_functor::run(amap,adart); } + + /** Test if an edge can be inserted onto a 2-cell between two given darts. + * @param amap the used combinatorial map. + * @param adart1 a first dart. + * @param adart2 a second dart. + * @return true iff an edge can be inserted between adart1 and adart2. + */ + template < class Map > + bool is_insertable_cell_1_in_cell_2(const Map& amap, + typename Map::Dart_const_handle adart1, + typename Map::Dart_const_handle adart2) + { + CGAL_assertion(adart1 != NULL && adart2 != NULL); + if ( adart1==adart2 ) return false; + for ( CMap_dart_const_iterator_of_orbit it(amap,adart1); + it.cont(); ++it ) + { + if ( it==adart2 ) return true; + } + return false; + } + + /** Test if a 2-cell can be inserted onto a given 3-cell along + * a path of edges. + * @param amap the used combinatorial map. + * @param afirst iterator on the begining of the path. + * @param alast iterator on the end of the path. + * @return true iff a 2-cell can be inserted along the path. + */ + template + bool is_insertable_cell_2_in_cell_3(const Map& amap, + InputIterator afirst, + InputIterator alast) + { + CGAL_assertion( Map::dimension>= 3 ); + + // The path must have at least one dart. + if (afirst==alast) return false; + typename Map::Dart_const_handle prec = NULL; + typename Map::Dart_const_handle od = NULL; + + for (InputIterator it(afirst); it!=alast; ++it) + { + // The path must contain only non empty darts. + if (*it == NULL || *it==Map::null_dart_handle) return false; + + // Two consecutive darts of the path must belong to two edges + // incident to the same vertex of the same volume. + if (prec != NULL) + { + od = prec->other_extremity(); + if ( od==Map::null_dart_handle ) return false; + + // of and *it must belong to the same vertex of the same volume + if ( !belong_to_same_cell(amap, od, *it) ) + return false; + } + prec = *it; + } + + // The path must be closed. + od = prec->other_extremity(); + if ( od==Map::null_dart_handle ) return false; + + if (!belong_to_same_cell(amap, od, *afirst)) + return false; + + return true; + } + + /** Insert a vertex in a given edge. + * @param amap the used combinatorial map. + * @param adart a dart of the edge (!=NULL && !=null_dart_handle). + * @return a dart of the new vertex. + */ + template + typename Map::Dart_handle + insert_cell_0_in_cell_1(Map& amap, typename Map::Dart_handle adart) + { + CGAL_assertion(adart != NULL && adart!=Map::null_dart_handle); + + typename Map::Dart_handle d1, d2; + int mark = amap.get_new_mark(); + + std::vector vect; + { + for (typename Map::template Dart_of_cell_range<1>::iterator it= + amap.template darts_of_cell<1>(adart).begin(); + it != amap.template darts_of_cell<1>(adart).end(); ++it) + vect.push_back(it); + } + + // 3) For each dart of the cell, we modify link of neighbors. + typename std::vector::iterator it = vect.begin(); + for (; it != vect.end(); ++it) + { + d1 = amap.create_dart(); + + if (!(*it)->is_free(1)) + { amap.template basic_link_beta<1>(d1, (*it)->beta(1)); } + + amap.template link_beta<1>(*it, d1); + + for ( unsigned int dim = 2; dim<=Map::dimension; ++dim ) + { + if (!(*it)->is_free(dim) && amap.is_marked((*it)->beta(dim), mark)) + { + amap.basic_link_beta((*it)->beta(dim), d1, dim); + amap.basic_link_beta(*it, (*it)->beta(dim)->beta(1), dim); + } + } + + amap.mark(*it, mark); + } + + for (it = vect.begin(); it != vect.end(); ++it) + { amap.unmark(*it, mark); } + + amap.free_mark(mark); + + amap.template degroup_attribute<1>(adart, adart->beta(1)); + + // CGAL_postcondition(amap.is_valid()); + + return adart->beta(1); + } + + /** Insert a dangling edge in a 2-cell between given by a dart. + * @param amap the used combinatorial map. + * @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle). + * @return a dart of the new edge, not incident to the vertex of adart1. + */ + template + typename Map::Dart_handle + insert_dangling_cell_1_in_cell_2(Map& amap, typename Map::Dart_handle adart1) + { + CGAL_assertion(adart1!=NULL && adart1!=Map::null_dart_handle); + + int mark1 = amap.get_new_mark(); + std::vector to_unmark; + { + for ( CMap_dart_iterator_basic_of_cell it(amap,adart1,mark1); + it.cont(); ++it ) + { + to_unmark.push_back(it); + amap.mark(it,mark1); + } + } + + typename Map::Dart_handle d1 = NULL; + typename Map::Dart_handle d2 = NULL; + unsigned int s1 = 0; + + int treated = amap.get_new_mark(); + + CGAL::CMap_dart_iterator_of_involution it1(amap,adart1); + + for ( ; it1.cont(); ++it1) + { + d1 = amap.create_dart(); + d2 = amap.create_dart(); + + if ( amap.is_marked(it1, mark1) ) s1 = 0; + else s1 = 1; + + if ( !it1->is_free(s1) ) + { + if ( s1==0 ) amap.template link_beta<1>(it1->beta(0), d2); + else amap.template link_beta<0>(it1->beta(1), d2); + } + + if (s1==0) + { + amap.template link_beta<0>(it1, d1); + amap.template basic_link_beta<0>(d1,d2); + } + else + { + amap.template link_beta<1>(it1, d1); + amap.template basic_link_beta<1>(d1,d2); + } + + amap.link_beta(d1, d2, 2); + + for ( unsigned int dim=3; dim<=Map::dimension; ++dim) + { + if ( !it1->is_free(dim) && + amap.is_marked(it1->beta(dim), treated) ) + { + amap.basic_link_beta(it1->beta(dim)->beta_inv(s1), d1, dim); + amap.basic_link_beta(it1->beta(dim)->beta_inv(s1)->beta(2), + d2, dim); + } + } + + amap.mark(it1,treated); + } + + // amap.template degroup_attribute<1>(adart1, adart1->beta(0)); + // amap.template degroup_attribute<2>(d1, d2); + + for ( it1.rewind(); it1.cont(); ++it1 ) + { + amap.unmark(it1,treated); + } + CGAL_assertion( amap.is_whole_map_unmarked(treated) ); + amap.free_mark(treated); + + typename std::vector::iterator it = + to_unmark.begin(); + for (; it != to_unmark.end(); ++it) + { amap.unmark(*it, mark1); } + CGAL_assertion( amap.is_whole_map_unmarked(mark1) ); + amap.free_mark(mark1); + + // CGAL_postcondition(amap.is_valid()); + return adart1->beta(0); + } + + /** Insert an edge in a 2-cell between two given darts. + * @param amap the used combinatorial map. + * @param adart1 a first dart of the facet (!=NULL && !=null_dart_handle). + * @param adart2 a second dart of the facet. If NULL insert a dangling edge. + * @return a dart of the new edge, and not incident to the + * same vertex than adart1. + */ + template + typename CMap::Dart_handle + insert_cell_1_in_cell_2(CMap& amap, + typename CMap::Dart_handle adart1, + typename CMap::Dart_handle adart2) + { + if ( adart2==NULL ) return insert_dangling_cell_1_in_cell_2(amap,adart1); + + CGAL_assertion(is_insertable_cell_1_in_cell_2(amap, adart1, adart2)); + + int m1 = amap.get_new_mark(); + CMap_dart_iterator_basic_of_involution + it1 = CMap_dart_iterator_basic_of_involution(amap, adart1, m1); + int m2 = amap.get_new_mark(); + CMap_dart_iterator_basic_of_involution + it2 = CMap_dart_iterator_basic_of_involution(amap, adart2, m2); + + int mark1 = amap.get_new_mark(); + std::vector to_unmark; + { + for ( CMap_dart_iterator_basic_of_cell it(amap,adart1,mark1); + it.cont(); ++it ) + { + to_unmark.push_back(it); + amap.mark(it,mark1); + } + } + + typename CMap::Dart_handle d1 = NULL; + typename CMap::Dart_handle d2 = NULL; + unsigned int s1 = 0; + + int treated = amap.get_new_mark(); + + for ( ; it1.cont(); ++it1, ++it2) + { + CGAL_assertion (it2.cont() ); + d1 = amap.create_dart(); + d2 = amap.create_dart(); + + if ( amap.is_marked(it1, mark1) ) s1 = 0; + else s1 = 1; + + if ( !it1->is_free(s1) ) + { + if ( s1==0 ) amap.template basic_link_beta<1>(it1->beta(0), d2); + else amap.template link_beta<0>(it1->beta(1), d2); + } + + if ( !it2->is_free(s1) ) + { + if ( s1==0 ) amap.template basic_link_beta<1>(it2->beta(0), d1); + else amap.template link_beta<0>(it2->beta(1), d1); + } + + if ( s1==0 ) + { + amap.template link_beta<0>(it1, d1); + amap.template link_beta<0>(it2, d2); + } + else + { + amap.template basic_link_beta<1>(it1, d1); + amap.template basic_link_beta<1>(it2, d2); + } + amap.link_beta(d2, d1, 2); + + for ( unsigned int dim=3; dim<=CMap::dimension; ++dim) + { + if ( !it1->is_free(dim) && + amap.is_marked(it1->beta(dim), treated) ) + { + amap.basic_link_beta(it1->beta(dim)->beta_inv(s1), d1, dim); + amap.basic_link_beta(it1->beta(dim)->beta_inv(s1)->beta(2), + d2, dim); + } + } + + amap.mark(it1,treated); + } + + // amap.template degroup_attribute<1>(adart1, adart1->beta(0)); + amap.template degroup_attribute<2>(d1, d2); + + amap.negate_mark(m1); + amap.negate_mark(m2); + it1.rewind(); it2.rewind(); + for ( ; it1.cont(); ++it1, ++it2) + { + amap.mark(it1,m1); + amap.unmark(it1,treated); + amap.mark(it2,m2); + } + amap.negate_mark(m1); + amap.negate_mark(m2); + CGAL_assertion( amap.is_whole_map_unmarked(m1) ); + CGAL_assertion( amap.is_whole_map_unmarked(m2) ); + CGAL_assertion( amap.is_whole_map_unmarked(treated) ); + amap.free_mark(m1); + amap.free_mark(m2); + amap.free_mark(treated); + + typename std::vector::iterator it = + to_unmark.begin(); + for (; it != to_unmark.end(); ++it) + { amap.unmark(*it, mark1); } + CGAL_assertion( amap.is_whole_map_unmarked(mark1) ); + amap.free_mark(mark1); + + // CGAL_postcondition(amap.is_valid()); + return adart1->beta(0); + } + + /** Insert a 2-cell in a given 3-cell along a path of darts. + * @param amap the used combinatorial map. + * @param afirst iterator on the begining of the path. + * @param alast iterator on the end of the path. + * @return a dart of the new 2-cell. + */ + template + typename Map::Dart_handle + insert_cell_2_in_cell_3(Map& amap, InputIterator afirst, InputIterator alast) + { + CGAL_assertion(is_insertable_cell_2_in_cell_3(amap,afirst,alast)); + + typename Map::Dart_handle prec = NULL, d = NULL, dd = NULL, first = NULL; + bool withBeta3 = false; + + { + for (InputIterator it(afirst); it!=alast; ++it) + { + if (!(*it)->is_free(2)) withBeta3 = true; + } + } + + { + for (InputIterator it(afirst); it!=alast; ++it) + { + d = amap.create_dart(); + if (withBeta3) + { + dd = amap.create_dart(); + amap.basic_link_beta(d, dd, 3); + } + + if (prec != NULL) + { + amap.template link_beta<0>(prec, d); + if (withBeta3) amap.template link_beta<1>(prec->beta(3), dd); + } + else first = d; + + if (!(*it)->is_free(2)) + amap.link_beta((*it)->beta(2), dd, 2); + + amap.link_beta(*it, d, 2); + + prec = d; + } + } + + amap.template link_beta<0>(prec, first); + if (withBeta3) + { + amap.template link_beta<1>(prec->beta(3), first->beta(3)); + } + + // Make copies of the new facet for dimension >=4 + for ( unsigned int dim=4; dim<=Map::dimension; ++dim ) + { + if ( !first->is_free(dim) ) + { + typename Map::Dart_handle first2 = NULL; + prec = NULL; + for ( CMap_dart_iterator_of_orbit it(amap, first); + it.cont(); ++it ) + { + d = amap.create_dart(); + amap.link_beta(it->beta(2),d,dim); + if ( withBeta3 ) + { + dd = amap.create_dart(); + amap.link_beta(it->beta(2)->beta(3),dd,dim); + amap.basic_link_beta(d, dd, 3); + } + if ( prec!=NULL ) + { + amap.template link_beta<0>(prec,d); + if ( withBeta3 ) + { + amap.template link_beta<1>(prec->beta(3),dd); + } + } + else first2 = prec; + + for ( unsigned dim2=2; dim2<=Map::dimension; ++dim2 ) + { + if ( dim2+1!=dim && dim2!=dim && dim2!=dim+1 ) + { + if ( !it->is_free(dim2) && + it->beta(dim2)->is_free(dim) ) + amap.basic_link_beta(it->beta(dim2)->beta(dim), d, dim2); + if ( withBeta3 && !it->beta(3)->is_free(dim2) && + it->beta(3)->beta(dim2)->is_free(dim) ) + amap.basic_link_beta(it->beta(3)->beta(dim2)->beta(dim), + dd, dim2); + } + } + prec = d; + } + amap.template link_beta<0>( prec, first2 ); + if ( withBeta3 ) + { + amap.template link_beta<1>( prec->beta(3), first2->beta(3) ); + } + } + } + + // Degroup the attributes + if ( withBeta3 ) + amap.template degroup_attribute<3>( first, first->beta(3) ); + + // CGAL_postcondition(amap.is_valid()); + return first; + } +} // namespace CGAL + +#endif // CGAL_COMBINATORIAL_MAP_OPERATIONS_H // +// EOF // diff --git a/Combinatorial_map/include/CGAL/Dart.h b/Combinatorial_map/include/CGAL/Dart.h new file mode 100644 index 00000000000..3db4780d4fd --- /dev/null +++ b/Combinatorial_map/include/CGAL/Dart.h @@ -0,0 +1,302 @@ +// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France). +// All rights reserved. +// +// 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. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Guillaume Damiand +// +#ifndef CGAL_DART_H +#define CGAL_DART_H 1 + +#include +#include +#include + +namespace CGAL { + +/** @file Dart.h + * Definition of nD dart. + */ + + template < unsigned int d_, class Refs, + class Items_, class Alloc_ > + class Combinatorial_map_base; + + template + struct Remove_cell_functor; + + namespace internal { + template + struct basic_link_beta_functor; + + template + struct link_beta_functor; + } + +#define CGAL_BETAINV(i) (i>1?i:(i==1?0:1)) + +/** Definition of nD dart. + * The Dart class describes an nD dart (basic element of a + * combinatorial map). A dart is composed with handle towards its neighbors, + * a bitset containing Boolean marks, and handle towards enabled attributes. + * n is the dimension of the space (2 for 2D, 3 for 3D...) + * Refs the ref class + */ +template +struct Dart +{ + template < unsigned int d_, class Refs_, + class Items_, class Alloc_ > + friend class Combinatorial_map_base; + + template + friend class Compact_container; + + template + friend struct Remove_cell_functor; + + template + friend struct internal::basic_link_beta_functor; + + template + friend struct internal::link_beta_functor; + +public: + typedef Dart Self; + typedef typename Refs::Dart_handle Dart_handle; + typedef typename Refs::size_type size_type; + typedef typename Refs::Dart_const_handle Dart_const_handle; + typedef typename Refs::Helper Helper; + /// Typedef for attributes + template + struct Attribute_handle: public Refs::template Attribute_handle + {}; + template + struct Attribute_const_handle: public Refs::template Attribute_const_handle + {}; + + /// The number of used marks. + static const size_type NB_MARKS = Refs::NB_MARKS; + + /// The dimension of the combinatorial map. + static const unsigned int dimension = d; + + /** Return if this dart is free for adimension. + * @param i the dimension. + * @return true iff the dart is linked with NULL for \em adimension. + */ + bool is_free(unsigned int i) const + { + CGAL_assertion(i <= dimension); + return mbeta[i] == Refs::null_dart_handle; + } + + /** Return the highest dimension for which the dart is not free. + * @return the dimension d such that the dart is not d-free but k-free for + * all k>d. -1 if the dart is free for all d in {0..n} + */ + int highest_nonfree_dimension() const + { + for (int i=(int)dimension; i>=0; --i) + { if ( !is_free(i) ) return i; } + return -1; + } + + /** Return the beta of this dart for a given dimension. + * @param i the dimension. + * @return beta(\em i). + */ + Dart_handle beta(unsigned int i) + { + CGAL_assertion(i <= dimension); + return mbeta[i]; + } + Dart_const_handle beta(unsigned int i) const + { + CGAL_assertion(i <= dimension); + return mbeta[i]; + } + + /** Return the beta inverse of this dart for a given dimension. + * @param i the dimension. + * @return beta^{-1}(\em i). + */ + Dart_handle beta_inv(unsigned int i) + { return beta(CGAL_BETAINV(i)); } + Dart_const_handle beta_inv(unsigned int i) const + { return beta(CGAL_BETAINV(i)); } + + /** Return a dart belonging to the same edge and to the second vertex + * of the current edge (NULL if such a dart does not exist). + * @return An handle to the opposite dart. + */ + Dart_handle opposite() + { + for (unsigned int i = 2; i <= dimension; ++i) + if (!is_free(i)) return beta(i); + return NULL; + } + Dart_const_handle opposite() const + { + for (unsigned int i = 2; i <= dimension; ++i) + if (!is_free(i)) return beta(i); + return NULL; + } + + /** Return a dart incident to the other extremity of the current edge, + * but contrary to opposite, non necessary to the same edge + * (NULL if such a dart does not exist). + * @return An handle to the opposite dart. + */ + Dart_handle other_extremity() + { + for (unsigned int i = 1; i <= dimension; ++i) + if (!is_free(i)) return beta(i); + return NULL; + } + Dart_const_handle other_extremity() const + { + for (unsigned int i = 1; i <= dimension; ++i) + if (!is_free(i)) return beta(i); + return NULL; + } + + /// @return a handle on the i-attribute + template + typename Attribute_handle::type attribute() + { + CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + "attribute called but i-attributes are disabled."); + return CGAL::cpp0x::get::value> + (mattribute_handles); + } + template + typename Attribute_const_handle::type attribute() const + { + CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + "attribute called but i-attributes are disabled."); + return CGAL::cpp0x::get::value> + (mattribute_handles); + } + +protected: + /** Default constructor: initialise marks and beta of this dart. + * @param amarks the marks. + */ + Dart(const std::bitset& amarks) : mmarks(amarks) + { + for (unsigned int i = 0; i <= dimension; ++i) + mbeta[i] = Refs::null_dart_handle; + + Helper::template Foreach_enabled_attributes:: + run(this); + } + + /** Return the mark value of a given mark number. + * @param amark the mark number. + * @return the value for this number. + */ + bool get_mark(int amark) const + { + CGAL_assertion(amark>=0 && (size_type)amark=0 && (size_type)amark get_marks() const + { return mmarks; } + + /** Set simultaneously all the marks of this dart to a given value. + * @param amarks the value of the marks. + */ + void set_marks(const std::bitset& amarks) const + { mmarks = amarks; } + + /** Link this dart with a given dart for a given dimension. + * @param adart the dart to link with. + * @param i the dimension. + */ + void basic_link_beta(Dart_handle adart, unsigned int i) + { + CGAL_assertion(i <= dimension); + CGAL_assertion(this!=&*Refs::null_dart_handle); + mbeta[i] = adart; + } + + /** Unlink this dart for a given dimension. + * @param i the dimension. + */ + void unlink_beta(unsigned int i) + { + CGAL_assertion(i <= dimension); + mbeta[i] = Refs::null_dart_handle; + } + + /// @return a handle on the i th attribute + template + void set_attribute( typename Attribute_handle::type & ahandle ) + { + CGAL_static_assertion_msg(Helper::template Dimension_index::value>=0, + "set_attribute called but i-attributes are disabled."); + CGAL::cpp0x::get::value> + (mattribute_handles) = ahandle; + if (ahandle!=NULL) ahandle->inc_nb_refs(); + } + +protected: + /// Functor used to initialize all attributes to NULL. + struct Init_attribute_functor + { + template + static void run(Self* adart) + { + // TODO BUG EN 1 SEULE LIGNE ? + typename Attribute_handle::type h = NULL; + adart->template set_attribute (h); } + }; + +public: + void * for_compact_container() const + { return mbeta[0].for_compact_container(); } + void * & for_compact_container() + { return mbeta[0].for_compact_container(); } + +protected: + /// Beta for each dimension +1 (from 0 to dimension). + Dart_handle mbeta[dimension+1]; + + /// Attributes enabled + typename Helper::Attribute_handles mattribute_handles; + + /// Values of Boolean marks. + mutable std::bitset mmarks; +}; + +} // namespace CGAL + +#endif // CGAL_DART_H // +// EOF // diff --git a/Combinatorial_map/include/CGAL/Dart_const_iterators.h b/Combinatorial_map/include/CGAL/Dart_const_iterators.h new file mode 100644 index 00000000000..37e5d4f66a7 --- /dev/null +++ b/Combinatorial_map/include/CGAL/Dart_const_iterators.h @@ -0,0 +1,273 @@ +// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France). +// All rights reserved. +// +// 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. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Guillaume Damiand +// +#ifndef CGAL_DART_CONST_ITERATORS_HH +#define CGAL_DART_CONST_ITERATORS_HH 1 + +#include + +namespace CGAL { + + /** @file Dart_const_iterators.h + * Definition of dart const iterators. There are 8 iterators: + * - CMap_dart_const_iterator_basic_of_orbit + * - CMap_dart_const_iterator_basic_of_cell + * - CMap_dart_const_iterator_of_orbit + * - CMap_dart_const_iterator_of_cell + * - CMap_dart_const_iterator_basic_of_involution + * - CMap_dart_const_iterator_of_involution + * - CMap_dart_const_iterator_basic_of_involution_inv + * - CMap_dart_const_iterator_of_involution_inv + */ + //**************************************************************************** + #ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + template + class CMap_dart_const_iterator_basic_of_orbit: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_const_iterator_basic_of_orbit Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Map_::Dart_const_handle Dart_const_handle; + + /// Main constructor. + CMap_dart_const_iterator_basic_of_orbit(const Map_& amap, + Dart_const_handle adart): + Base(amap,adart) + {} + /// Main constructor. + CMap_dart_const_iterator_basic_of_orbit(const Map_& amap, + Dart_const_handle adart, + int amark): + Base(amap,adart,amark) + {} + }; + //**************************************************************************** + template + class CMap_dart_const_iterator_of_orbit: + public CMap_dart_iterator_of_orbit_generic + { + public: + typedef CMap_dart_const_iterator_of_orbit Self; + typedef CMap_dart_iterator_of_orbit_generic Base; + + typedef typename Map_::Dart_const_handle Dart_const_handle; + + /// Main constructor. + CMap_dart_const_iterator_of_orbit(const Map_& amap, + Dart_const_handle adart): + Base(amap,adart) + {} + /// Constructor from non const version. + CMap_dart_const_iterator_of_orbit + (const CMap_dart_iterator_of_orbit& it): + Base(*const_cast(it.get_combinatorial_map()), + it.get_first_dart()) + {} + }; + #else + //**************************************************************************** + template + class CMap_dart_const_iterator_basic_of_orbit: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_const_iterator_basic_of_orbit Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Map_::Dart_const_handle Dart_const_handle; + + /// Main constructor. + CMap_dart_const_iterator_basic_of_orbit(const Map_& amap, + Dart_const_handle adart): + Base(amap,adart) + {} + /// Main constructor. + CMap_dart_const_iterator_basic_of_orbit(const Map_& amap, + Dart_const_handle adart, + int amark): + Base(amap,adart,amark) + {} + }; + //**************************************************************************** + template + class CMap_dart_const_iterator_of_orbit: + public CMap_dart_iterator_of_orbit_generic + { + public: + typedef CMap_dart_const_iterator_of_orbit Self; + typedef CMap_dart_iterator_of_orbit_generic Base; + + typedef typename Map_::Dart_const_handle Dart_const_handle; + + /// Main constructor. + CMap_dart_const_iterator_of_orbit(const Map_& amap, + Dart_const_handle adart): + Base(amap,adart) + {} + /// Constructor from non const version. + CMap_dart_const_iterator_of_orbit + (const CMap_dart_iterator_of_orbit& it): + Base(*const_cast(it.get_combinatorial_map()), + it.get_first_dart()) + {} + }; + #endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + //**************************************************************************** + template + class CMap_dart_const_iterator_basic_of_cell: + public CMap_dart_iterator_basic_of_cell + { + public: + typedef CMap_dart_iterator_basic_of_cell Base; + typedef typename Map_::Dart_const_handle Dart_const_handle; + + /* Main constructor. */ + CMap_dart_const_iterator_basic_of_cell(const Map_& amap, + Dart_const_handle adart, int amark): + Base(amap,adart,amark) + {} + /// Constructor from non const version. + CMap_dart_const_iterator_basic_of_cell + (const CMap_dart_iterator_basic_of_cell& it): + Base(*const_cast(it.get_combinatorial_map()), + it.get_first_dart()) + {} + }; + //**************************************************************************** + template + class CMap_dart_const_iterator_of_cell: + public CMap_dart_iterator_of_cell + { + public: + typedef CMap_dart_iterator_of_cell Base; + typedef typename Map_::Dart_const_handle Dart_const_handle; + + /* Main constructor. */ + CMap_dart_const_iterator_of_cell(const Map_& amap, + Dart_const_handle adart): + Base(amap,adart) + {} + /// Constructor from non const version. + CMap_dart_const_iterator_of_cell + (const CMap_dart_iterator_of_cell& it): + Base(*const_cast(it.get_combinatorial_map()), + it.get_first_dart()) + {} + }; + //**************************************************************************** + template + class CMap_dart_const_iterator_basic_of_involution: + public CMap_dart_iterator_basic_of_involution + { + public: + typedef CMap_dart_iterator_basic_of_involution Base; + typedef typename Map_::Dart_const_handle Dart_const_handle; + + /* Main constructor. */ + CMap_dart_const_iterator_basic_of_involution(const Map_& amap, + Dart_const_handle adart, + int amark): + Base(amap,adart,amark) + {} + /// Constructor from non const version. + CMap_dart_const_iterator_basic_of_involution + (const CMap_dart_iterator_basic_of_involution& it): + Base(*const_cast(it.get_combinatorial_map()), + it.get_first_dart(), it.mmark_number) + {} + }; + //**************************************************************************** + template + class CMap_dart_const_iterator_of_involution: + public CMap_dart_iterator_of_involution + { + public: + typedef CMap_dart_iterator_of_involution Base; + typedef typename Map_::Dart_const_handle Dart_const_handle; + + /* Main constructor. */ + CMap_dart_const_iterator_of_involution(const Map_& amap, + Dart_const_handle adart): + Base(amap,adart) + {} + /// Constructor from non const version. + CMap_dart_const_iterator_of_involution + (const CMap_dart_iterator_of_involution& it): + Base(*const_cast(it.get_combinatorial_map()), + it.get_first_dart()) + {} + }; + //**************************************************************************** + template + class CMap_dart_const_iterator_basic_of_involution_inv: + public CMap_dart_iterator_basic_of_involution_inv + { + public: + typedef CMap_dart_iterator_basic_of_involution_inv Base; + typedef typename Map_::Dart_const_handle Dart_const_handle; + + /* Main constructor. */ + CMap_dart_const_iterator_basic_of_involution_inv(const Map_& amap, + Dart_const_handle adart, + int amark): + Base(amap,adart,amark) + {} + /// Constructor from non const version. + CMap_dart_const_iterator_basic_of_involution_inv + (const CMap_dart_iterator_basic_of_involution_inv& it): + Base(*const_cast(it.get_combinatorial_map()), + it.get_first_dart(), it.mmark_number) + {} + }; + //**************************************************************************** + template + class CMap_dart_const_iterator_of_involution_inv: + public CMap_dart_iterator_of_involution_inv + { + public: + typedef CMap_dart_iterator_of_involution_inv Base; + typedef typename Map_::Dart_const_handle Dart_const_handle; + + /* Main constructor. */ + CMap_dart_const_iterator_of_involution_inv(const Map_& amap, + Dart_const_handle adart): + Base(amap,adart) + {} + /// Constructor from non const version. + CMap_dart_const_iterator_of_involution_inv + (const CMap_dart_iterator_of_involution_inv& it): + Base(*const_cast(it.get_combinatorial_map()), + it.get_first_dart()) + {} + }; + //**************************************************************************** +} // namespace CGAL +//****************************************************************************** +#endif // CGAL_DART_CONST_ITERATORS_HH +//****************************************************************************** diff --git a/Combinatorial_map/include/CGAL/Dart_iterators.h b/Combinatorial_map/include/CGAL/Dart_iterators.h new file mode 100644 index 00000000000..e0200fb45c6 --- /dev/null +++ b/Combinatorial_map/include/CGAL/Dart_iterators.h @@ -0,0 +1,2920 @@ +// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France). +// All rights reserved. +// +// 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. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Guillaume Damiand +// +#ifndef CGAL_DART_ITERATORS_HH +#define CGAL_DART_ITERATORS_HH 1 + +#include + +namespace CGAL { + + /** @file Dart_iterators.h + * Definition of dart iterators. There are 9 iterators: + * - CMap_dart_iterator_basic_of_orbit + * - CMap_dart_iterator_basic_of_cell + * - CMap_dart_iterator_basic_of_all + * - CMap_dart_iterator_of_orbit + * - CMap_dart_iterator_of_cell + * - CMap_dart_iterator_basic_of_involution + * - CMap_dart_iterator_of_involution + * - CMap_dart_iterator_basic_of_involution_inv + * - CMap_dart_iterator_of_involution_inv + * but many specializations to optimize specific cases. + * + */ + //**************************************************************************** + /// OperationState: type to keep the last operation used by the previous ++. + typedef char OperationState; + + /// Enum of all the possible operations used by the ++ operator. + enum + { + OP_NONE = -1, ///< Beginning of the iterator (there is not yet operator++). + OP_BETAI, ///< Previous op was the first beta. + OP_BETAI_INV, ///< Previous op was the inverse of the first beta. + OP_BETAJ, ///< Previous op was the second beta. + OP_BETAK, ///< Previous op was the third beta. + OP_BETA0I, ///< Previous op was beta0 o the first beta. + OP_BETAI1, ///< Previous op was the first beta o beta1. + OP_BETAIJ, ///< Previous op was the composition of two beta. + OP_BETAJI, ///< Previous op was the composition of two beta. + OP_BETA21, ///< Previous op was beta21. + OP_JUMP, ///< Previous op was a jump . + OP_POP, ///< Previous op pop a dart from a stack or a queue. + OP_END ///< Previous op go out of the iterator. + }; + //**************************************************************************** + //**************************************************************************** + /** Generic class of iterator onto darts. + * Class CMap_dart_iterator is a pure virtual generic iterator. This + * class defines what is an iterator. All the iterator classes inherit + * from this class. + */ + template < typename Map_,bool Const=false > + class CMap_dart_iterator: + public internal::CC_iterator + { + public: + typedef CMap_dart_iterator Self; + typedef internal::CC_iterator Base; + + typedef Base Dart_handle; + typedef typename boost::mpl::if_c< Const, const Map_, + Map_>::type Map; + + typedef std::input_iterator_tag iterator_category; + typedef typename Base::value_type value_type; + typedef typename Base::difference_type difference_type; + typedef typename Base::pointer pointer; + typedef typename Base::reference reference; + + public: + /// Main constructor. + CMap_dart_iterator(Map& amap, Dart_handle adart): + Base(adart), + mmap(&amap), + mfirst_dart(adart), + mprev_op(OP_NONE) + {} + + /// == operator. + bool operator==(const Self& aiterator) const + { + return ( ((*this==NULL) && (aiterator==NULL)) || + (mfirst_dart == aiterator.mfirst_dart && + ((const Base&)*this==(const Base&)aiterator)) ); + } + + /// != operator. + bool operator!=(const Self& aiterator) const + { return !operator==(aiterator); } + + /// Accessor to the initial dart of the iterator. + Dart_handle get_first_dart() const { return mfirst_dart; } + + /// Accessor to the combinatorial map. + Map* get_combinatorial_map() const { return mmap; } + + /// Rewind of the iterator to its beginning. + void rewind() + { set_current_dart(mfirst_dart); mprev_op = OP_NONE; } + + /// Test if the iterator is at its end. + bool cont() const { return *this != NULL; } + + /// Get the previous operation used for the last ++. + OperationState prev_operation() const { return mprev_op; } + + /// Return true iff this iterator is basic + static bool is_basic_iterator() + { return true; } + + protected: + /// Set the current dart to a given dart + void set_current_dart(Dart_handle adart) + { Base::operator=(adart); } + + private: + /// operator -- in private to invalidate the base operator. + Self& operator--() + { return *this; } + /// operator -- in private to invalidate the base operator. + void operator--(int) + {} + + protected: + /// test if adart->beta(ai) exists and is not marked for amark + bool is_unmarked(Dart_handle adart, unsigned int ai, unsigned amark) const + { return !adart->is_free(ai) && + !mmap->is_marked(adart->beta(ai), amark); } + + /// test if adart->beta(ai)->beta(aj) exists + bool exist_betaij(Dart_handle adart, unsigned int ai, unsigned int aj) const + { return !adart->is_free(ai) && !adart->beta(ai)->is_free(aj); } + + /// test if adart->beta(ai)->beta(aj) exists and is not marked for amark + bool is_unmarked2(Dart_handle adart, unsigned int ai, unsigned int aj, + unsigned amark) const + { return exist_betaij(adart,ai,aj) && + !mmap->is_marked(adart->beta(ai)->beta(aj), amark); } + + protected: + /// The map containing the darts to iterate on. + Map* mmap; + + /// The initial dart of the iterator. + Dart_handle mfirst_dart; + + /// The last operation used for the ++ operator. + OperationState mprev_op; + }; + //**************************************************************************** + //**********************BASIC ITERATORS*************************************** + //**************************************************************************** + /* Class CMap_dart_iterator_basic_of_orbit: to iterate + * on the darts of the orbit + */ + #ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + template + class CMap_dart_iterator_basic_of_orbit_generic; + #else + template + class CMap_dart_iterator_basic_of_orbit_generic; + + template + struct Get_CMap_dart_iterator_basic_of_orbit; + + template + struct Get_CMap_dart_iterator_basic_of_orbit + { + typedef CMap_dart_iterator_basic_of_orbit_generic type; + }; + + template + struct Get_CMap_dart_iterator_basic_of_orbit + { + typedef CMap_dart_iterator_basic_of_orbit_generic type; + }; + + template + struct Get_CMap_dart_iterator_basic_of_orbit + { + typedef CMap_dart_iterator_basic_of_orbit_generic type; + }; + + template + struct Get_CMap_dart_iterator_basic_of_orbit + { + typedef CMap_dart_iterator_basic_of_orbit_generic type; + }; + + template + struct Get_CMap_dart_iterator_basic_of_orbit + { + typedef CMap_dart_iterator_basic_of_orbit_generic type; + }; + + template + struct Get_CMap_dart_iterator_basic_of_orbit + { + typedef CMap_dart_iterator_basic_of_orbit_generic type; + }; + + template + struct Get_CMap_dart_iterator_basic_of_orbit + { + typedef CMap_dart_iterator_basic_of_orbit_generic type; + }; + + template + struct Get_CMap_dart_iterator_basic_of_orbit + { + typedef CMap_dart_iterator_basic_of_orbit_generic type; + }; + + template + struct Get_CMap_dart_iterator_basic_of_orbit + { + typedef CMap_dart_iterator_basic_of_orbit_generic type; + }; + + template + struct Get_CMap_dart_iterator_basic_of_orbit + { + typedef CMap_dart_iterator_basic_of_orbit_generic type; + }; + + template + class CMap_dart_iterator_basic_of_orbit_generic: + public Get_CMap_dart_iterator_basic_of_orbit::type + { + public: + typedef typename Get_CMap_dart_iterator_basic_of_orbit::type Self; + typedef typename Get_CMap_dart_iterator_basic_of_orbit::type Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, + int amark): + Base(amap, adart, amark) + { + CGAL_assertion( B1>=0 && B1<=Map::dimension ); + + if (adart!=NULL) + { + if (!adart->is_free(B1) && + !this->mmap->is_marked(adart->beta(B1), this->mmark_number)) + this->mto_treat.push(adart->beta(B1)); + } + } + + /// Rewind of the iterator to its beginning. + void rewind() + { + CGAL_assertion(this->mmark_number != -1); + Base::rewind(); + if (!(*this)->is_free(B1) && + !this->mmap->is_marked((*this)->beta(B1), this->mmark_number)) + this->mto_treat.push((*this)->beta(B1)); + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(this->cont()); + + Base::operator++(); + + if (this->cont()) + { + if (!(*this)->is_free(B1) && + !this->mmap->is_marked((*this)->beta(B1), + this->mmark_number)) + this->mto_treat.push((*this)->beta(B1)); + } + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + }; + #endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + //**************************************************************************** + // Case when Beta... is empty: iterator of self + template + class CMap_dart_iterator_basic_of_orbit_generic: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_orbit_generic Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart): + Base(amap, adart) + {} + + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, + int /*amark*/): + Base(amap, adart) + {} + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(this->cont()); + this->set_current_dart(NULL); + this->mprev_op = OP_END; + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + }; + //**************************************************************************** + /* Class CMap_dart_iterator_basic_of_orbit: iterate onto orbit . + * Begin by turning around the facet with beta0, then turn if + * necessary in the second direction by using beta1. + */ + template + class CMap_dart_iterator_basic_of_orbit_generic: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_orbit_generic Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart): + Base(amap, adart), + mfirst_dir(true) + {} + + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, + int /*amark*/): + Base(amap, adart), + mfirst_dir(true) + {} + + /// Assignment operator. + Self& operator= (const Self & aiterator) + { + if (this != &aiterator) + { + Base::operator=(aiterator); + mfirst_dir = aiterator.mfirst_dir; + } + return *this; + } + + /// Rewind of the iterator to its beginning. + void rewind() + { + Base::rewind(); + mfirst_dir = true; + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(this->cont()); + + if (mfirst_dir && (*this)->is_free(0)) + { + this->set_current_dart(this->mfirst_dart); + mfirst_dir = false; + this->mprev_op = OP_JUMP; + } + else + { + this->mprev_op = OP_BETAI; + } + + if (mfirst_dir) + { + CGAL_assertion(!(*this)->is_free(0)); + this->set_current_dart((*this)->beta(0)); + + if ((*this)==this->mfirst_dart) + { + this->set_current_dart(NULL); + this->mprev_op = OP_END; + } + } + else + { + if ((*this)->is_free(1)) + { + this->set_current_dart(NULL); + this->mprev_op = OP_END; + } + else + { + this->set_current_dart((*this)->beta(1)); + this->mprev_op = OP_BETAI_INV; + } + } + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + protected: + /// Boolean: true iff we turn in the first direction (i.e. using beta0). + bool mfirst_dir; + }; + //**************************************************************************** + /* Class CMap_dart_iterator_basic_of_orbit: iterate onto orbit . + * Begin by turning around the facet with beta1, then turn if + * necessary in the second direction by using beta0. + */ + template + class CMap_dart_iterator_basic_of_orbit_generic: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_orbit_generic Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart): + Base(amap, adart), + mfirst_dir(true) + {} + + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, + int /*amark*/): + Base(amap, adart), + mfirst_dir(true) + {} + + /// Rewind of the iterator to its beginning. + void rewind() + { + Base::rewind(); + mfirst_dir = true; + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(this->cont()); + + if (mfirst_dir && (*this)->is_free(1)) + { + this->set_current_dart(this->mfirst_dart); + mfirst_dir = false; + this->mprev_op = OP_JUMP; + } + else + { + this->mprev_op = OP_BETAI; + } + + if (mfirst_dir) + { + CGAL_assertion(!(*this)->is_free(1)); + this->set_current_dart((*this)->beta(1)); + + if ((*this)==this->mfirst_dart) + { + this->set_current_dart(NULL); + this->mprev_op = OP_END; + } + } + else + { + if ((*this)->is_free(0)) + { + this->set_current_dart(NULL); + this->mprev_op = OP_END; + } + else + { + this->set_current_dart((*this)->beta(0)); + this->mprev_op = OP_BETAI_INV; + } + } + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + protected: + /// Boolean: true iff we turn in the first direction (i.e. using beta0). + bool mfirst_dir; + }; + //**************************************************************************** + /* Class CMap_dart_iterator_basic_of_orbit: to iterate + * on the darts of the orbit (2<=Bi<=dimension) + * (not for beta0 and beta1 which are special cases). + */ + template + class CMap_dart_iterator_basic_of_orbit_generic: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_orbit_generic Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart): + Base(amap, adart) + { CGAL_assertion( Bi>=2 && Bi<=Map::dimension ); } + + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, + int /*amark*/): + Base(amap, adart) + { CGAL_assertion( Bi>=2 && Bi<=Map::dimension ); } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(this->cont()); + if ((*this)!=this->mfirst_dart || (*this)->is_free(Bi)) + { + this->set_current_dart(NULL); + this->mprev_op = OP_END; + } + else + { + this->set_current_dart((*this)->beta(Bi)); + this->mprev_op = OP_BETAI; + } + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + }; + //**************************************************************************** + /* Class CMap_extend_iterator which extend a given iterator by + * adding Bi and by using a stack and a mark. + */ + template + class CMap_extend_iterator: public Ite + { + public: + typedef CMap_extend_iterator Self; + typedef Ite Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_extend_iterator(Map& amap, Dart_handle adart, int amark): + Base(amap, adart), + mmark_number(amark), + minitial_dart(adart) + { + if ( adart!=NULL ) + { + this->mmap->mark(adart, mmark_number); + if (!(*this)->is_free(Bi)) + mto_treat.push((*this)->beta(Bi)); + } + } + + /// Rewind of the iterator to its beginning. + void rewind() + { + CGAL_assertion(mmark_number != -1); + Base::operator= ( Base(*this->mmap,minitial_dart) ); + mto_treat = std::queue(); + this->mmap->mark((*this), mmark_number); + if (!(*this)->is_free(Bi)) + mto_treat.push((*this)->beta(Bi)); + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(mmark_number != -1); + CGAL_assertion(this->cont()); + + Base::operator++(); + + if ( !this->cont() ) + { + if ( !mto_treat.empty() ) + { + Dart_handle res=NULL; + do + { + res = mto_treat.front(); + mto_treat.pop(); + } + while (!mto_treat.empty() && + this->mmap->is_marked(res, mmark_number)); + + if (!this->mmap->is_marked(res, mmark_number)) + { + Base::operator= ( Base(*this->mmap,res) ); + this->mprev_op = OP_POP; + } + } + } + + if ( this->cont() ) + { + CGAL_assertion( !this->mmap->is_marked((*this), + mmark_number) ); + this->mmap->mark((*this), mmark_number); + + if (!(*this)->is_free(Bi) && + !this->mmap->is_marked((*this)->beta(Bi), + mmark_number)) + mto_treat.push((*this)->beta(Bi)); + } + + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + protected: + /// Queue of darts to process. + std::queue mto_treat; + + /// Index of the used mark. + int mmark_number; + + /// Initial dart + Dart_handle minitial_dart; + }; + //**************************************************************************** + /* Class CMap_dart_iterator_basic_of_orbit: to iterate + * on the darts of the orbit : Bi + class CMap_dart_iterator_basic_of_orbit_generic: + public CMap_extend_iterator, Bj> + { + public: + typedef CMap_dart_iterator_basic_of_orbit_generic Self; + typedef CMap_extend_iterator, Bj> Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, + int amark): + Base(amap, adart, amark) + { CGAL_assertion( Bi: to iterate onto the + * darts of the orbit (i.e. orbit facet in 3D). + * Specialized here since we do not need queue nor mark. + */ + template + class CMap_dart_iterator_basic_of_orbit_generic: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_orbit_generic Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart): + Base(amap, adart), + mit(amap, adart), + mexist_beta3(false), + mprev_beta3(false), + mfirst_border(true) + { if (adart!=NULL) mexist_beta3=!adart->is_free(3); } + + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, + int /*amark*/): + Base(amap, adart), + mit(amap, adart), + mexist_beta3(false), + mprev_beta3(false), + mfirst_border(true) + { if (adart!=NULL) mexist_beta3=!adart->is_free(3); } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(this->cont()); + if (mexist_beta3 && !mprev_beta3) + { + mprev_beta3 = true; + mfirst_border = ! mfirst_border; + this->set_current_dart((*this)->beta(3)); + this->mprev_op = OP_BETAJ; + } + else + { + mprev_beta3 = false; + ++mit; + this->mprev_op = mit.prev_operation(); + if ( !mit.cont() ) + this->set_current_dart(NULL); + else + { + if ( !mfirst_border ) + this->set_current_dart(mit->beta(3)); + else + this->set_current_dart(*mit); + } + } + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + /// Rewind of the iterator to its beginning. + void rewind() + { + Base::rewind(); + mit.rewind(); + mprev_beta3 = false; + mfirst_border = true; + } + + private: + /// Iterator on beta0 + CMap_dart_iterator_basic_of_orbit_generic mit; + + /// Boolean: true iff there are two half facets. + bool mexist_beta3; + + /// Boolean: true iff the last ++ used beta3. + bool mprev_beta3; + + /// Boolean: true iff the current dart is on the first border. + bool mfirst_border; + }; + //**************************************************************************** + /* Class CMap_dart_iterator_basic_of_orbit: to iterate onto the + * darts of the orbit (i.e. orbit facet in 3D). + * Specialized here since we do not need queue nor mark. + */ + template + class CMap_dart_iterator_basic_of_orbit_generic: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_orbit_generic Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart): + Base(amap, adart), + mit(amap, adart), + mexist_beta3(false), + mprev_beta3(false), + mfirst_border(true) + { if (adart!=NULL) mexist_beta3=!adart->is_free(3); } + + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, + int /*amark*/): + Base(amap, adart), + mit(amap, adart), + mexist_beta3(false), + mprev_beta3(false), + mfirst_border(true) + { if (adart!=NULL) mexist_beta3=!adart->is_free(3); } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(this->cont()); + if (mexist_beta3 && !mprev_beta3) + { + mprev_beta3 = true; + mfirst_border = ! mfirst_border; + this->set_current_dart((*this)->beta(3)); + this->mprev_op = OP_BETAJ; + } + else + { + mprev_beta3 = false; + ++mit; + this->mprev_op = mit.prev_operation(); + if ( !mit.cont() ) + this->set_current_dart(NULL); + else + { + if ( !mfirst_border ) + this->set_current_dart(mit->beta(3)); + else + this->set_current_dart(mit); + } + } + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + /// Rewind of the iterator to its beginning. + void rewind() + { + Base::rewind(); + mit.rewind(); + mprev_beta3 = false; + mfirst_border = true; + } + + private: + /// Iterator on beta1 + CMap_dart_iterator_basic_of_orbit_generic mit; + + /// Boolean: true iff there are two half facets. + bool mexist_beta3; + + /// Boolean: true iff the last ++ used beta3. + bool mprev_beta3; + + /// Boolean: true iff the current dart is on the first border. + bool mfirst_border; + }; + //**************************************************************************** + /* Class CMap_dart_iterator_basic_of_orbit: to iterate onto the + * darts of the orbit (i.e. orbit edge in 3D). + */ + template + class CMap_dart_iterator_basic_of_orbit_generic: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_orbit_generic Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart): + Base(amap, adart), + mfirst_dir(true), + mnext_try_beta2(true) + {} + + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, + int /*amark*/): + Base(amap, adart), + mfirst_dir(true), + mnext_try_beta2(true) + {} + + /// Rewind of the iterator to its beginning. + void rewind() + { + Base::rewind(); + mfirst_dir = true; + mnext_try_beta2 = true; + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(this->cont()); + + if (mfirst_dir) + { + if (mnext_try_beta2) + { + if ((*this)->is_free(2)) + { + mfirst_dir = false; + if (this->mfirst_dart->is_free(3)) + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + else + { + this->set_current_dart(this->mfirst_dart->beta(3)); + this->mprev_op = OP_JUMP; + } + } + else + { + this->set_current_dart((*this)->beta(2)); + mnext_try_beta2 = false; + this->mprev_op = OP_BETAI; + } + } + else + { + if ((*this)->is_free(3)) + { + mfirst_dir = false; + if (this->mfirst_dart->is_free(3)) + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + else + { + this->set_current_dart(this->mfirst_dart->beta(3)); + mnext_try_beta2 = true; + this->mprev_op = OP_JUMP; + } + } + else + { + this->set_current_dart((*this)->beta(3)); + if ((*this)==this->mfirst_dart) + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + else + { + mnext_try_beta2 = true; + this->mprev_op = OP_BETAJ; + } + } + } + } + else + { + if (mnext_try_beta2) + { + if ((*this)->is_free(2)) + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + else + { + this->set_current_dart((*this)->beta(2)); + mnext_try_beta2 = false; + this->mprev_op = OP_BETAI; + } + } + else + { + if ((*this)->is_free(3)) + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + else + { + this->set_current_dart((*this)->beta(3)); + mnext_try_beta2 = true; + this->mprev_op = OP_BETAJ; + } + } + } + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + private: + /// Boolean: true iff we turn in the first direction (i.e. using beta2). + bool mfirst_dir; + + /// Boolean: true iff the next ++ must use beta2. + bool mnext_try_beta2; + }; + //**************************************************************************** + /* Class CMap_dart_iterator_basic_of_orbit: to iterate onto + * the darts of the orbit , Bi, , which are specific cases. + */ + template + class CMap_dart_iterator_basic_of_orbit_generic: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_orbit_generic Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, + int amark): + Base(amap, adart, amark) + { + CGAL_assertion( Biis_free(Bk) && + !this->mmap->is_marked(adart->beta(Bk), this->mmark_number)) + this->mto_treat.push(adart->beta(Bk)); + } + } + + /// Rewind of the iterator to its beginning. + void rewind() + { + CGAL_assertion(this->mmark_number != -1); + Base::rewind(); + if (!(*this)->is_free(Bk) && + !this->mmap->is_marked((*this)->beta(Bk), + this->mmark_number)) + this->mto_treat.push((*this)->beta(Bk)); + } + + /// Prefix ++ operator. + Self& operator++() + { + Base::operator++(); + + if ( this->cont() ) + { + if (!(*this)->is_free(Bk) && + !this->mmap->is_marked((*this)->beta(Bk), + this->mmark_number)) + this->mto_treat.push((*this)->beta(Bk)); + } + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + }; + //**************************************************************************** + template + class CMap_dart_iterator_basic_of_orbit_generic: + public CMap_extend_iterator, Bk> + { + public: + typedef CMap_dart_iterator_basic_of_orbit_generic Self; + typedef CMap_extend_iterator, Bk> Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, Dart_handle adart, + int amark): + Base(amap, adart, amark) + { CGAL_assertion( Bi<3 && 3 + class CMap_dart_iterator_basic_of_orbit: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_orbit Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Map::Dart_handle Dart_handle; + + /// Main constructor. + CMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart): + Base(amap,adart) + {} + /// Main constructor. + CMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart,int amark): + Base(amap,adart,amark) + {} + }; + #else + //**************************************************************************** + template + class CMap_dart_iterator_basic_of_orbit: + public Get_CMap_dart_iterator_basic_of_orbit::type + { + public: + typedef CMap_dart_iterator_basic_of_orbit + Self; + typedef typename Get_CMap_dart_iterator_basic_of_orbit::type + Base; + + typedef typename Map::Dart_handle Dart_handle; + + /// Main constructor. + CMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart): + Base(amap,adart) + {} + /// Main constructor. + CMap_dart_iterator_basic_of_orbit(Map& amap,Dart_handle adart,int amark): + Base(amap,adart,amark) + {} + }; + #endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + //**************************************************************************** + // i-Cell iterator in combinatorial map of dimension d, i>1 + // i<=Map::dimension+1 (for i==Map::dimension+1, iterate on the connected + // component) + template + class CMap_dart_iterator_basic_of_cell: public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_cell Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart), + mmark_number(amark) + { + CGAL_assertion( i>=2 && i<=Map::dimension+1 ); + if (adart!=NULL) + this->mmap->mark(adart, mmark_number); + } + + /// Rewind of the iterator to its beginning. + void rewind() + { + CGAL_assertion(mmark_number != -1); + Base::rewind(); + mto_treat = std::queue(); + this->mmap->mark(*this, mmark_number); + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(mmark_number != -1); + CGAL_assertion(this->cont()); + Dart_handle nd = NULL; + + for ( unsigned int k=0; k<=d; ++k ) + { + if ( k!=i && this->is_unmarked((*this), k, mmark_number) ) + { + if (nd == NULL) + { + nd = (*this)->beta(k); + CGAL_assertion(nd!=Map::null_dart_handle); + this->mmap->mark(nd, mmark_number); + this->mprev_op = OP_BETAI; + } + else + { + mto_treat.push((*this)->beta(k)); + this->mmap->mark((*this)->beta(k), mmark_number); + } + } + } + + if (nd == NULL) + { + if (!mto_treat.empty()) + { + nd = mto_treat.front(); + mto_treat.pop(); + this->mprev_op = OP_POP; + } + else + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + } + + this->set_current_dart(nd); + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + protected: + /// Queue of darts to process. + std::queue mto_treat; + + /// Index of the used mark. + int mmark_number; + }; + //**************************************************************************** + // 0-Cell iterator in combinatorial map of dimension d + template + class CMap_dart_iterator_basic_of_cell: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_cell Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart), + mmark_number(amark) + { + if (adart!=NULL) this->mmap->mark(adart, mmark_number); + } + + /// Rewind of the iterator to its beginning. + void rewind() + { + CGAL_assertion(mmark_number != -1); + Base::rewind(); + mto_treat = std::queue(); + this->mmap->mark((*this), mmark_number); + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(mmark_number != -1); + CGAL_assertion(this->cont()); + + Dart_handle nd = NULL; + + for ( unsigned int k=2; k<=d; ++k ) + { + if ( this->is_unmarked2((*this), 0, k, mmark_number) ) + { + if (nd == NULL) + { + nd = (*this)->beta(0)->beta(k); + CGAL_assertion(nd!=Map::null_dart_handle); + this->mmap->mark(nd, mmark_number); + this->mprev_op = OP_BETA0I; + } + else + { + mto_treat.push((*this)->beta(0)->beta(k)); + this->mmap->mark((*this)->beta(0)->beta(k), mmark_number); + } + + } + if ( this->is_unmarked2((*this), k, 1, mmark_number) ) + { + if (nd == NULL) + { + nd = (*this)->beta(k)->beta(1); + CGAL_assertion(nd!=Map::null_dart_handle); + this->mmap->mark(nd, mmark_number); + this->mprev_op = OP_BETAI1; + } + else + { + mto_treat.push((*this)->beta(k)->beta(1)); + this->mmap->mark((*this)->beta(k)->beta(1), mmark_number); + } + } + for ( unsigned int l=k+1; l<=d; ++l ) + { + if ( this->is_unmarked2((*this), k, l, mmark_number) ) + { + if (nd == NULL) + { + nd = (*this)->beta(k)->beta(l); + CGAL_assertion(nd!=Map::null_dart_handle); + this->mmap->mark(nd, mmark_number); + this->mprev_op = OP_BETAIJ; + } + else + { + mto_treat.push((*this)->beta(k)->beta(l)); + this->mmap->mark((*this)->beta(k)->beta(l), mmark_number); + } + } + if ( this->is_unmarked2((*this), l, k, mmark_number) ) + { + if (nd == NULL) + { + nd = (*this)->beta(l)->beta(k); + CGAL_assertion(nd!=Map::null_dart_handle); + this->mmap->mark(nd, mmark_number); + this->mprev_op = OP_BETAJI; + } + else + { + mto_treat.push((*this)->beta(l)->beta(k)); + this->mmap->mark((*this)->beta(l)->beta(k), mmark_number); + } + } + } + } + + if (nd == NULL) + { + if (!mto_treat.empty()) + { + nd = mto_treat.front(); + CGAL_assertion(nd!=Map::null_dart_handle); + mto_treat.pop(); + this->mprev_op = OP_POP; + } + else + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + } + + this->set_current_dart(nd); + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + protected: + /// Queue of darts to process. + std::queue mto_treat; + + /// Index of the used mark. + int mmark_number; + }; + //**************************************************************************** + // 1-Cell iterator in combinatorial map of dimension d + template + class CMap_dart_iterator_basic_of_cell: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_cell Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart), + mmark_number(amark) + { if (adart!=NULL) this->mmap->mark(adart, mmark_number); } + + /// Rewind of the iterator to its beginning. + void rewind() + { + CGAL_assertion(mmark_number != -1); + Base::rewind(); + mto_treat = std::queue(); + this->mmap->mark((*this), mmark_number); + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(mmark_number != -1); + CGAL_assertion(this->cont()); + + Dart_handle nd = NULL; + + for ( unsigned int k=2; k<=d; ++k ) + { + if ( this->is_unmarked((*this), k, mmark_number) ) + { + if (nd == NULL) + { + nd = (*this)->beta(k); + CGAL_assertion(nd!=Map::null_dart_handle); + this->mmap->mark(nd, mmark_number); + this->mprev_op = OP_BETAI; + } + else + { + mto_treat.push((*this)->beta(k)); + this->mmap->mark((*this)->beta(k), mmark_number); + } + } + } + + if (nd == NULL) + { + if (!mto_treat.empty()) + { + nd = mto_treat.front(); + mto_treat.pop(); + this->mprev_op = OP_POP; + } + else + { + this->mprev_op = OP_END; + } + } + + this->set_current_dart(nd); + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + protected: + /// Queue of darts to process. + std::queue mto_treat; + + /// Index of the used mark. + int mmark_number; + }; + //**************************************************************************** + // Specialization for edge in 2D + template + class CMap_dart_iterator_basic_of_cell: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_cell Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart, + int /*amark*/): + Base(amap, adart) + {} + }; + //**************************************************************************** + // Specialization for facet in 2D + template + class CMap_dart_iterator_basic_of_cell: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_cell Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart, + int /*amark*/): + Base(amap, adart) + {} + }; + //**************************************************************************** + // Specialization for cc in 2D + template + class CMap_dart_iterator_basic_of_cell: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_cell Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart, amark) + {} + }; + //**************************************************************************** + // Specialization for edge in 3D + template + class CMap_dart_iterator_basic_of_cell: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_cell Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart, + int /*amark*/): Base(amap, adart) + {} + }; + //**************************************************************************** + // Specialization for facet in 3D + template + class CMap_dart_iterator_basic_of_cell: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_cell Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart, + int /*amark*/): Base(amap, adart) + {} + }; + //**************************************************************************** + // Specialization for volume in 3D + template + class CMap_dart_iterator_basic_of_cell: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_cell Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart, amark) + {} + }; + //**************************************************************************** + // Specialization for cc in 3D + template + class CMap_dart_iterator_basic_of_cell: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_cell Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart, amark) + {} + }; + //**************************************************************************** + /* Class CMap_dart_iterator_basic_of_cell: to iterate onto the + * darts of the orbit vertex in 2D. + */ + template + class CMap_dart_iterator_basic_of_cell: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_cell Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart): + Base(amap, adart), + mfirst_dir(true) + {} + + /// Main constructor. + CMap_dart_iterator_basic_of_cell(Map& amap, + Dart_handle adart, + int /*amark*/): + Base(amap, adart), + mfirst_dir(true) + {} + + /// Rewind of the iterator to its beginning. + void rewind() + { + Base::rewind(); + mfirst_dir = true; + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(this->cont()); + + if (mfirst_dir) + { + this->set_current_dart((*this)->beta(0)->beta(2)); + if ((*this)==Map::null_dart_handle) + { + mfirst_dir = false; + this->set_current_dart(this->mfirst_dart->beta(2)->beta(1)); + if ((*this)==Map::null_dart_handle) + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + else + { + this->mprev_op = OP_BETAI1; + } + } + else + { + if ((*this)==this->mfirst_dart) + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + else + this->mprev_op = OP_BETA0I; + } + } + else + { + this->set_current_dart((*this)->beta(2)->beta(1)); + if ((*this) == Map::null_dart_handle) + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + else + this->mprev_op = OP_BETA21; + } + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + protected: + /// Boolean: true iff we turn in the first direction (i.e. using beta02). + bool mfirst_dir; + }; + //**************************************************************************** + /* Class CMap_dart_iterator_basic_of_all: to iterate onto all the + * darts of the map. + */ + template + class CMap_dart_iterator_basic_of_all: public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_all Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_all(Map& amap): + Base(amap, amap.darts().begin()) + {} + + /// Main constructor. + CMap_dart_iterator_basic_of_all(Map& amap, int /*amark*/): + Base(amap, amap.darts().begin()) + {} + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(this->cont()); + + Base::operator++(); + if ( (*this) != this->mmap->darts().end()) + { this->mprev_op = OP_POP; } + else + { + this->set_current_dart(NULL); + this->mprev_op = OP_END; + } + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + }; + //************************************************************************** + /* Generic nD version. Here we are sure that all the bases classes use mark + * and queue. + */ + #ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + template + class CMap_dart_iterator_basic_of_orbit_generic: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_orbit_generic Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_orbit_generic(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart, amark) + { + CGAL_assertion( Bi>=0 && Bi<=Map::dimension ); + + if (adart!=NULL) + { + if (!adart->is_free(Bi) && + !this->mmap->is_marked(adart->beta(Bi), this->mmark_number)) + this->mto_treat.push(adart->beta(Bi)); + } + } + + /// Rewind of the iterator to its beginning. + void rewind() + { + CGAL_assertion(this->mmark_number != -1); + Base::rewind(); + if (!(*this)->is_free(Bi) && + !this->mmap->is_marked((*this)->beta(Bi), + this->mmark_number)) + this->mto_treat.push((*this)->beta(Bi)); + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(this->cont()); + + Base::operator++(); + + if (this->cont()) + { + if (!(*this)->is_free(Bi) && + !this->mmap->is_marked((*this)->beta(Bi), + this->mmark_number)) + this->mto_treat.push((*this)->beta(Bi)); + } + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + }; +#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + //**************************************************************************** + //*************************ITERATORS*NON*BASIC********************************* + //**************************************************************************** + //* Class CMap_non_basic_iterator allows to transform a basic_iterator onto + //* a non basic one, depending if the basic iterator uses mark or not. + template + class CMap_non_basic_iterator; + //**************************************************************************** + template + class CMap_non_basic_iterator: + public Basic_iterator + { + public: + typedef CMap_non_basic_iterator Self; + + typedef typename Basic_iterator::Map Map; + typedef typename Basic_iterator::Dart_handle Dart_handle; + + /// Main constructor. + CMap_non_basic_iterator(Map& amap, Dart_handle adart1): + Basic_iterator(amap, adart1, amap.get_new_mark()) + { CGAL_assertion( Basic_iterator::is_basic_iterator() ); } + + /// Destructor. + ~CMap_non_basic_iterator() + { + if (this->mmark_number != -1) + { + unmark_treated_darts(); + CGAL_assertion( this->mmap->is_whole_map_unmarked + (this->mmark_number) ); + this->mmap->free_mark(this->mmark_number); + } + } + + /// Copy constructor. + CMap_non_basic_iterator(const Self& aiterator): + Basic_iterator(aiterator) + { this->mmark_number = -1; } + + /// Assignment operator. + Self& operator=(const Self& aiterator) + { + if (this != &aiterator) + { + Basic_iterator::operator=(aiterator); + this->mmark_number = -1; + } + return *this; + } + + /// Rewind of the iterator to its beginning. + void rewind() + { + CGAL_assertion(this->mmark_number != -1); + unmark_treated_darts(); + Basic_iterator::rewind(); + } + + using Basic_iterator::operator++; + + /// Postfix ++ operator. + void operator++(int) + { operator ++(); } + + /// Return true iff this iterator is basic + static bool is_basic_iterator() + { return false; } + + protected: + /// Unmark all the marked darts during the iterator. + void unmark_treated_darts() + { + CGAL_assertion(this->mmark_number != -1); + if (this->mmap->is_whole_map_unmarked(this->mmark_number)) return; + + this->mmap->negate_mark(this->mmark_number); + + if (this->mmap->is_whole_map_unmarked(this->mmark_number)) return; + + Basic_iterator::rewind(); + while (this->mmap->number_of_unmarked_darts(this->mmark_number) > 0) + this->operator++(); + this->mmap->negate_mark(this->mmark_number); + CGAL_assertion(this->mmap->is_whole_map_unmarked(this->mmark_number)); + } + }; + //**************************************************************************** + template + class CMap_non_basic_iterator: + public Basic_iterator + { + public: + typedef CMap_non_basic_iterator Self; + typedef typename Basic_iterator::Map Map; + typedef typename Basic_iterator::Dart_handle Dart_handle; + + /// Main constructor. + CMap_non_basic_iterator(Map& amap, Dart_handle adart): + Basic_iterator(amap, adart,-1) + {} + /// Return true iff this iterator is basic + static bool is_basic_iterator() + { return false; } + }; + //**************************************************************************** + #ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + template + class CMap_dart_iterator_of_orbit_generic: + public CMap_non_basic_iterator > + { + public: + typedef CMap_dart_iterator_of_orbit_generic Self; + typedef CMap_non_basic_iterator > Base; + + typedef typename Base::Map Map; + typedef typename Base::Dart_handle Dart_handle; + + /// Main constructor. + CMap_dart_iterator_of_orbit_generic(Map& amap, Dart_handle adart1): + Base(amap, adart1) + {} + }; + //**************************************************************************** + template + class CMap_dart_iterator_of_orbit: + public CMap_dart_iterator_of_orbit_generic + { + public: + typedef CMap_dart_iterator_of_orbit Self; + typedef CMap_dart_iterator_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + + /// Main constructor. + CMap_dart_iterator_of_orbit(Map_& amap, Dart_handle adart): + Base(amap, adart) + {} + }; + #else + //**************************************************************************** + template + class CMap_dart_iterator_of_orbit_generic: + public CMap_non_basic_iterator::type> + { + public: + typedef CMap_dart_iterator_of_orbit_generic Self; + typedef CMap_non_basic_iterator::type> Base; + + typedef typename Base::Map Map; + typedef typename Base::Dart_handle Dart_handle; + + /// Main constructor. + CMap_dart_iterator_of_orbit_generic(Map& amap, Dart_handle adart1): + Base(amap, adart1) + {} + }; + //**************************************************************************** + template + class CMap_dart_iterator_of_orbit: + public CMap_dart_iterator_of_orbit_generic + { + public: + typedef CMap_dart_iterator_of_orbit Self; + typedef CMap_dart_iterator_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + + /// Main constructor. + CMap_dart_iterator_of_orbit(Map& amap, Dart_handle adart): + Base(amap, adart) + {} + }; + #endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + //**************************************************************************** + template + class CMap_dart_iterator_of_cell: + public CMap_non_basic_iterator > + { + public: + typedef CMap_dart_iterator_basic_of_cell Self; + typedef CMap_non_basic_iterator > Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + /// Main constructor. + CMap_dart_iterator_of_cell(Map& amap, Dart_handle adart1): + Base(amap, adart1) + {} + }; + //**************************************************************************** + //********************ITERATOR*INVOLUTION************************************* + //**************************************************************************** + // i-involution iterator in combinatorial map of dimension d, + // 2 + class CMap_dart_iterator_basic_of_involution; + + template + class CMap_dart_iterator_basic_of_involution: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_involution Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart), + mmark_number(amark) + { + CGAL_assertion( d>=3 && d<=Map::dimension ); + CGAL_assertion( i>=3 && i<=Map::dimension ); + if (adart!=NULL) this->mmap->mark(adart, mmark_number); + } + + /// Rewind of the iterator to its beginning. + void rewind() + { + CGAL_assertion(mmark_number != -1); + Base::rewind(); + mto_treat = std::queue(); + this->mmap->mark((*this), mmark_number); + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(mmark_number != -1); + CGAL_assertion(this->cont()); + + Dart_handle nd = NULL; + + for ( unsigned int k=0; k<2; ++k ) + { + if ( this->is_unmarked((*this), k, mmark_number) ) + { + if (nd == NULL) + { + nd = (*this)->beta(k); + CGAL_assertion(nd!=Map::null_dart_handle); + this->mmap->mark(nd, mmark_number); + this->mprev_op = OP_BETAI; + } + else + { + mto_treat.push((*this)->beta(k)); + this->mmap->mark((*this)->beta(k), mmark_number); + } + } + } + + for ( unsigned int k=2; k<=d; ++k ) + { + if ( k!=i-1 && k!=i && k!=i+1 && + this->is_unmarked((*this), k, mmark_number) ) + { + if (nd == NULL) + { + nd = (*this)->beta(k); + CGAL_assertion(nd!=Map::null_dart_handle); + this->mmap->mark(nd, mmark_number); + this->mprev_op = OP_BETAI; + } + else + { + mto_treat.push((*this)->beta(k)); + this->mmap->mark((*this)->beta(k), mmark_number); + } + } + } + + if (nd == NULL) + { + if (!mto_treat.empty()) + { + nd = mto_treat.front(); + mto_treat.pop(); + this->mprev_op = OP_POP; + } + else + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + } + + this->set_current_dart(nd); + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + protected: + /// Queue of darts to process. + std::queue mto_treat; + + /// Index of the used mark. + int mmark_number; + }; + //**************************************************************************** + // i-involution iterator in combinatorial map of dimension d, + // 2 + class CMap_dart_iterator_basic_of_involution_inv: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_involution_inv Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart), + mmark_number(amark) + { + CGAL_assertion( i>=3 && i<=Map::dimension ); + if (adart!=NULL) this->mmap->mark(adart, mmark_number); + } + + /// Rewind of the iterator to its beginning. + void rewind() + { + CGAL_assertion(mmark_number != -1); + Base::rewind(); + mto_treat = std::queue(); + this->mmap->mark((*this), mmark_number); + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(mmark_number != -1); + CGAL_assertion(this->cont()); + + Dart_handle nd = NULL; + + for ( int k=1; k>=0; --k ) + { + if ( this->is_unmarked((*this), k, mmark_number) ) + { + if (nd == NULL) + { + nd = (*this)->beta(k); + CGAL_assertion(nd!=Map::null_dart_handle); + this->mmap->mark(nd, mmark_number); + this->mprev_op = OP_BETAI; + } + else + { + mto_treat.push((*this)->beta(k)); + this->mmap->mark((*this)->beta(k), mmark_number); + } + } + } + for ( unsigned int k=2; k<=d; ++k ) + { + if ( k!=i-1 && k!=i && k!=i+1 && + this->is_unmarked((*this), k, mmark_number) ) + { + if (nd == NULL) + { + nd = (*this)->beta(k); + CGAL_assertion(nd!=Map::null_dart_handle); + this->mmap->mark(nd, mmark_number); + this->mprev_op = OP_BETAI; + } + else + { + mto_treat.push((*this)->beta(k)); + this->mmap->mark((*this)->beta(k), mmark_number); + } + } + } + + if (nd == NULL) + { + if (!mto_treat.empty()) + { + nd = mto_treat.front(); + mto_treat.pop(); + this->mprev_op = OP_POP; + } + else + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + } + + this->set_current_dart(nd); + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + protected: + /// Queue of darts to process. + std::queue mto_treat; + + /// Index of the used mark. + int mmark_number; + }; + //**************************************************************************** + // 1-involution iterator in combinatorial map of dimension d. + // Iterate by using all beta between 3 and d. + template + class CMap_dart_iterator_basic_of_involution: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_involution Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart), + mmark_number(amark) + { if (adart!=NULL) this->mmap->mark(adart, mmark_number); } + + /// Rewind of the iterator to its beginning. + void rewind() + { + CGAL_assertion(mmark_number != -1); + Base::rewind(); + mto_treat = std::queue(); + this->mmap->mark((*this), mmark_number); + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(mmark_number != -1); + CGAL_assertion(this->cont()); + + Dart_handle nd = NULL; + + for ( unsigned int k=3; k<=d; ++k ) + { + if ( this->is_unmarked((*this), k, mmark_number) ) + { + if (nd == NULL) + { + nd = (*this)->beta(k); + CGAL_assertion(nd!=Map::null_dart_handle); + this->mmap->mark(nd, mmark_number); + this->mprev_op = OP_BETAI; + } + else + { + mto_treat.push((*this)->beta(k)); + this->mmap->mark((*this)->beta(k), mmark_number); + } + } + } + + if (nd == NULL) + { + if (!mto_treat.empty()) + { + nd = mto_treat.front(); + mto_treat.pop(); + this->mprev_op = OP_POP; + } + else + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + } + + this->set_current_dart(nd); + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + protected: + /// Queue of darts to process. + std::queue mto_treat; + + /// Index of the used mark. + int mmark_number; + }; + //**************************************************************************** + // 1-involution iterator in combinatorial map of dimension d. + // Iterate by using all beta between 3 and d. + template + class CMap_dart_iterator_basic_of_involution_inv: + public CMap_dart_iterator_basic_of_involution + { + public: + typedef CMap_dart_iterator_basic_of_involution_inv Self; + typedef CMap_dart_iterator_basic_of_involution Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart,amark) + {} + }; + //**************************************************************************** + // 2-involution iterator in combinatorial map of dimension d. + // Iterate by using all beta between 4 and d. + template + class CMap_dart_iterator_basic_of_involution: + public CMap_dart_iterator + { + public: + typedef CMap_dart_iterator_basic_of_involution Self; + typedef CMap_dart_iterator Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart), + mmark_number(amark) + { this->mmap->mark(adart, mmark_number); } + + /// Rewind of the iterator to its beginning. + void rewind() + { + CGAL_assertion(mmark_number != -1); + Base::rewind(); + mto_treat = std::queue(); + this->mmap->mark((*this), mmark_number); + } + + /// Prefix ++ operator. + Self& operator++() + { + CGAL_assertion(mmark_number != -1); + CGAL_assertion(this->cont()); + + Dart_handle nd = NULL; + + for ( unsigned int k=4; k<=d; ++k ) + { + if ( this->is_unmarked((*this), k, mmark_number) ) + { + if (nd == NULL) + { + nd = (*this)->beta(k); + CGAL_assertion(nd!=Map::null_dart_handle); + this->mmap->mark(nd, mmark_number); + this->mprev_op = OP_BETAI; + } + else + { + mto_treat.push((*this)->beta(k)); + this->mmap->mark((*this)->beta(k), mmark_number); + } + } + } + + if (nd == NULL) + { + if (!mto_treat.empty()) + { + nd = mto_treat.front(); + mto_treat.pop(); + this->mprev_op = OP_POP; + } + else + { + this->mprev_op = OP_END; + this->set_current_dart(NULL); + } + } + + this->set_current_dart(nd); + return *this; + } + + /// Postfix ++ operator. + Self operator++(int) + { Self res=*this; operator ++(); return res; } + + protected: + /// Queue of darts to process. + std::queue mto_treat; + + /// Index of the used mark. + int mmark_number; + }; + //**************************************************************************** + // 2-involution iterator in combinatorial map of dimension d. + // Iterate by using all beta between 4 and d. + template + class CMap_dart_iterator_basic_of_involution_inv: + public CMap_dart_iterator_basic_of_involution + { + public: + typedef CMap_dart_iterator_basic_of_involution_inv Self; + typedef CMap_dart_iterator_basic_of_involution Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_true Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart, + int amark): + Base(amap, adart,amark) + {} + }; + //**************************************************************************** + // 1-involution iterator in combinatorial map of dimension 2. + // Empty iterator. + template + class CMap_dart_iterator_basic_of_involution: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_involution Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart, + int /*amark*/): + Base(amap, adart) + {} + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + }; + //**************************************************************************** + // 1-involution iterator in combinatorial map of dimension 2. + // self iterator. + template + class CMap_dart_iterator_basic_of_involution_inv: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_involution_inv Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart, + int /*amark*/): + Base(amap, adart) + {} + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + }; + //**************************************************************************** + // 2-involution iterator in combinatorial map of dimension 2. + // self iterator. + template + class CMap_dart_iterator_basic_of_involution: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_involution Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart, + int /*amark*/): + Base(amap, adart) + {} + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + }; + //**************************************************************************** + // 2-involution iterator in combinatorial map of dimension 2. + // self iterator. + template + class CMap_dart_iterator_basic_of_involution_inv: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_involution_inv Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart, + int /*amark*/): + Base(amap, adart) + {} + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + }; + //**************************************************************************** + // 1-involution iterator in combinatorial map of dimension 3. + // Beta3 iterator. + template + class CMap_dart_iterator_basic_of_involution: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_involution Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart, + int /*amark*/): + Base(amap, adart) + {} + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + }; + //**************************************************************************** + // 1-involution iterator in combinatorial map of dimension 3. + // Beta3 iterator. + template + class CMap_dart_iterator_basic_of_involution_inv: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_involution_inv Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart, + int /*amark*/): + Base(amap, adart) + {} + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + }; + //**************************************************************************** + // 2-involution iterator in combinatorial map of dimension 3. + // Self iterator. + template + class CMap_dart_iterator_basic_of_involution: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_involution Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart, + int /* amark*/): + Base(amap, adart) + {} + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + }; + //**************************************************************************** + // 2-involution iterator in combinatorial map of dimension 3. + // Self iterator. + template + class CMap_dart_iterator_basic_of_involution_inv: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_involution_inv Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart, + int /*amark*/): + Base(amap, adart) + {} + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + }; + //**************************************************************************** + // 1-involution iterator in combinatorial map of dimension 3. + // Beta1 iterator. + template + class CMap_dart_iterator_basic_of_involution: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_involution Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart, + int /*amark*/): + Base(amap, adart) + {} + /// Main constructor. + CMap_dart_iterator_basic_of_involution(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + }; + //**************************************************************************** + // 1-involution iterator in combinatorial map of dimension 3. + // Beta0 iterator. + template + class CMap_dart_iterator_basic_of_involution_inv: + public CMap_dart_iterator_basic_of_orbit_generic + { + public: + typedef CMap_dart_iterator_basic_of_involution_inv Self; + typedef CMap_dart_iterator_basic_of_orbit_generic Base; + + typedef typename Base::Dart_handle Dart_handle; + typedef typename Base::Map Map; + + typedef Tag_false Use_mark; + + public: + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart, + int /*amark*/): + Base(amap, adart) + {} + /// Main constructor. + CMap_dart_iterator_basic_of_involution_inv(Map& amap, + Dart_handle adart): + Base(amap, adart) + {} + }; + //**************************************************************************** + template + class CMap_dart_iterator_of_involution: + public CMap_non_basic_iterator > + { + public: + typedef CMap_dart_iterator_of_involution Self; + typedef CMap_non_basic_iterator > Base; + + /// Main constructor. + CMap_dart_iterator_of_involution(typename Base::Map& amap, + typename Base::Dart_handle adart1): + Base(amap, adart1) + {} + }; + //**************************************************************************** + template + class CMap_dart_iterator_of_involution_inv: + public CMap_non_basic_iterator > + { + public: + typedef CMap_dart_iterator_of_involution_inv Self; + typedef CMap_non_basic_iterator > Base; + + /// Main constructor. + CMap_dart_iterator_of_involution_inv(typename Base::Map& amap, + typename Base::Dart_handle adart1): + Base(amap, adart1) + {} + }; + //**************************************************************************** +} // namespace CGAL +//****************************************************************************** +#endif // CGAL_DART_ITERATORS_HH +//****************************************************************************** diff --git a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_functors.h b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_functors.h new file mode 100644 index 00000000000..f7fed3e586d --- /dev/null +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_functors.h @@ -0,0 +1,992 @@ +// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France). +// All rights reserved. +// +// 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. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Guillaume Damiand +// +#ifndef CGAL_COMBINATORIAL_MAP_FUNCTORS_H +#define CGAL_COMBINATORIAL_MAP_FUNCTORS_H + +#include +#include +#include +#include + +namespace CGAL { + namespace internal { + + /** @file Combinatorial_map_functors.h + * Definition of functors used for dD Combinatorial map. + */ + + template + struct Couple_dart_and_dim + { + Couple_dart_and_dim(Dart_handle ad1,Dart_handle ad2,int adim) : + d1(ad1), d2(ad2), dim(adim) + {} + Dart_handle d1,d2; + int dim; + }; + + + /// Functor used to test if it is possible to i-sew two darts, + /// 2<=i<=dimension + template + struct is_sewable_functor{ + static bool run(const Map& amap, + typename Map::Dart_const_handle adart1, + typename Map::Dart_const_handle adart2) + { + CGAL_assertion(2<=i && i<=Map::dimension); + CGAL_assertion(adart1!=NULL && adart2!=NULL); + + if ( !adart1->is_free(i) || !adart2->is_free(i) || adart1==adart2 ) + return false; + + CMap_dart_const_iterator_of_involution I1(amap, adart1); + CMap_dart_const_iterator_of_involution_inv I2(amap, adart2); + bool res = true; + while (res && I1.cont() && I2.cont()) + { + // We can remove this constraint which is not required for + // combinatorial map definition, but which is quite "normal" + if ( I1==adart2 || I2==adart1 ) res=false; + + // Special case to consider beta0 and beta1 + if ( i>2 ) + { + if ( I1->is_free(0)!=I2->is_free(1) ) res = false; + else if ( I1->is_free(1)!=I2->is_free(0) ) res = false; + } + + // General case + for (unsigned int j=2;res && j<=Map::dimension; ++j) + { + if ( j+1!=i && j!=i && j!=i+1 && + I1->is_free(j)!=I2->is_free(j) ) + { res = false; } + } + ++I1; ++I2; + } + if (I1.cont() != I2.cont()) + res = false; + + return res; + } + }; + + /// Functor used to test if it is possible to 1-sew two darts. + template + struct is_sewable_functor{ + static bool run(const Map& amap, + typename Map::Dart_const_handle adart1, + typename Map::Dart_const_handle adart2) + { + CGAL_assertion(adart1!=NULL && adart2!=NULL); + + if ( !adart1->is_free(1) || !adart2->is_free(0) ) + return false; + + if ( adart1 == adart2 ) return true; + + CMap_dart_const_iterator_of_involution I1(amap, adart1); + CMap_dart_const_iterator_of_involution_inv I2(amap, adart2); + bool res = true; + while (res && I1.cont() && I2.cont()) + { + // We can remove this constraint which is not required for + // combinatorial map definition, but which imposes quite "normal" + // configurations + if ( I1==adart2 || I2==adart1 ) res=false; + + for (unsigned int j=3;res && j<=Map::dimension; ++j) + { + if ( I1->is_free(j)!=I2->is_free(j) ) + { + res = false; + } + } + ++I1; ++I2; + } + if (I1.cont() != I2.cont()) + res = false; + + return res; + } + }; + + /// Functor used to test if it is possible to 0-sew two darts. + template + struct is_sewable_functor{ + static bool run(const Map& amap, + typename Map::Dart_const_handle adart1, + typename Map::Dart_const_handle adart2) + { return is_sewable_functor::run(amap,adart1,adart2); } + }; + + /// Functor used to i-topo_sew two darts, 2<=i<=dimension. + template + struct topo_sew_functor{ + static void run(Map& amap,typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2) + { + CGAL_assertion(2<=i && i<=Map::dimension); + CGAL_assertion( (is_sewable_functor::run(amap,adart1,adart2)) ); + + CMap_dart_iterator_of_involution I1(amap, adart1); + CMap_dart_iterator_of_involution_inv I2(amap, adart2); + while ( I1.cont() ) + { + amap.basic_link_beta(I1, I2, i); + ++I1; ++I2; + } + } + }; + + /// Functor used to 1-topo_sew two darts. + template + struct topo_sew_functor{ + static void run(Map& amap,typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2) + { + CGAL_assertion( (is_sewable_functor::run(amap,adart1,adart2)) ); + + int mark = amap.get_new_mark(); + std::vector dartv; + for (CMap_dart_iterator_basic_of_cell it(amap,adart1,mark); + it.cont(); ++it) + { + amap.mark(*it,mark); + dartv.push_back(*it); + } + + CMap_dart_iterator_of_involution I1(amap, adart1); + CMap_dart_iterator_of_involution_inv I2(amap, adart2); + while ( I1.cont() ) + { + if ( amap.is_marked(*I1,mark) ) amap.template basic_link_beta<1>(*I1, *I2); + else amap.template basic_link_beta<0>(*I1, *I2); + ++I1; ++I2; + } + + for (typename std::vector::iterator + it=dartv.begin(); it!=dartv.end(); ++it) + { amap.unmark(*it,mark); } + CGAL_assertion( amap.is_whole_map_unmarked(mark) ); + amap.free_mark(mark); + } + }; + + /// Functor used to 0-topo_sew two darts. + template + struct topo_sew_functor{ + static void run(Map& amap,typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2) + { topo_sew_functor::run(amap,adart1,adart2); } + }; + + /// Functor used to i-sew two darts, 2<=i<=dimension. + template + struct sew_functor{ + static void run(Map& amap,typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2) + { + CGAL_assertion(2<=i && i<=Map::dimension); + CGAL_assertion( (is_sewable_functor::run(amap,adart1,adart2)) ); + + CMap_dart_iterator_of_involution I1(amap, adart1); + CMap_dart_iterator_of_involution_inv I2(amap, adart2); + while ( I1.cont() ) + { + amap.group_all_attributes_except(I1,I2,i); + ++I1; ++I2; + } + + I1.rewind(); I2.rewind(); + while ( I1.cont() ) + { + amap.basic_link_beta(I1, I2, i); + ++I1; ++I2; + } + } + }; + + /// Functor used to 0-sew two darts. + template + struct sew_functor{ + static void run(Map& amap,typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2) + { + CGAL_assertion( (is_sewable_functor::run(amap,adart1,adart2)) ); + + int mark = amap.get_new_mark(); + std::vector dartv; + for (CMap_dart_iterator_basic_of_cell it(amap,adart1,mark); + it.cont(); ++it) + { + amap.mark(*it,mark); + dartv.push_back(*it); + } + + CMap_dart_iterator_of_involution I1(amap, adart1); + CMap_dart_iterator_of_involution_inv I2(amap, adart2); + while ( I1.cont() ) + { + group_all_attributes_except(*I1,*I2,1); + ++I1; ++I2; + } + + I1.rewind(); I2.rewind(); + while ( I1.cont() ) + { + if ( amap.is_marked(*I1,mark) ) amap.template basic_link_beta<0>(*I1, *I2); + else amap.template basic_link_beta<1>(*I1, *I2); + ++I1; ++I2; + } + + for (typename std::vector::iterator + it=dartv.begin(); it!=dartv.end(); ++it) + { amap.unmark(*it,mark); } + CGAL_assertion( amap.is_whole_map_unmarked(mark) ); + amap.free_mark(mark); + } + }; + + /// Functor used to 1-sew two darts. + template + struct sew_functor{ + static void run(Map& amap,typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2) + { + CGAL_assertion( (is_sewable_functor::run(amap,adart1,adart2)) ); + int mark = amap.get_new_mark(); + std::vector dartv; + for (CMap_dart_iterator_basic_of_cell it(amap,adart1,mark); + it.cont(); ++it) + { + amap.mark(it,mark); + dartv.push_back(it); + } + + CMap_dart_iterator_of_involution I1(amap, adart1); + CMap_dart_iterator_of_involution_inv I2(amap, adart2); + while ( I1.cont() ) + { + amap.group_all_attributes_except(I1,I2,1); + ++I1; ++I2; + } + + I1.rewind(); I2.rewind(); + while ( I1.cont() ) + { + if ( amap.is_marked(I1,mark) ) amap.template basic_link_beta<1>(I1, I2); + else amap.template basic_link_beta<0>(I1, I2); + ++I1; ++I2; + } + + for (typename std::vector::iterator + it=dartv.begin(); it!=dartv.end(); ++it) + { amap.unmark(*it,mark); } + CGAL_assertion( amap.is_whole_map_unmarked(mark) ); + amap.free_mark(mark); + } + }; + + /// Functor used to i-topo_unsew one dart, 2<=i<=dimension. + template + struct topo_unsew_functor{ + static void run(Map& amap,typename Map::Dart_handle adart) + { + CGAL_assertion( adart!=NULL && !adart->is_free(i) ); + CGAL_assertion(2<=i && i<=Map::dimension); + + CMap_dart_iterator_of_involution it(amap, adart); + while ( it.cont() ) + { + amap.unlink_beta(*it, i); + ++it; + } + } + }; + + /// Functor used to 1-topo_unsew one dart. + template + struct topo_unsew_functor{ + static void run(Map& amap,typename Map::Dart_handle adart) + { + CGAL_assertion( adart!=NULL && !adart->is_free(1) ); + + int mark = amap.get_new_mark(); + std::vector dartv; + for (CMap_dart_iterator_basic_of_cell it(amap,adart,mark); + it.cont(); ++it) + { + amap.mark(*it,mark); + dartv.push_back(*it); + } + + { + CMap_dart_iterator_of_involution it(amap, adart); + while ( it.cont() ) + { + if ( amap.is_marked(*it,mark) ) amap.unlink_beta<1>(*it); + else amap.unlink_beta<0>(*it); + ++it; + } + } + + for (typename std::vector::iterator + it=dartv.begin(); it!=dartv.end(); ++it) + { amap.unmark(*it,mark); } + CGAL_assertion( amap.is_whole_map_unmarked(mark) ); + amap.free_mark(mark); + } + }; + + /// Functor used to 1-topo_unsew one dart. + template + struct topo_unsew_functor{ + static void run(Map& amap,typename Map::Dart_handle adart) + { + CGAL_assertion( adart!=NULL && !adart->is_free(0) ); + topo_unsew_functor::run(adart->beta(0)); + } + }; + + /// Functor used to i-unsew one dart, 2<=i<=dimension. + template + struct unsew_functor{ + static void run(Map& amap,typename Map::Dart_handle adart) + { + CGAL_assertion(2<=i && i<=Map::dimension); + CGAL_assertion( adart!=NULL && !adart->is_free(i) ); + + std::stack > todegroup; + + CMap_dart_iterator_of_involution it(amap, adart); + while ( it.cont() ) + { + todegroup.push(Couple_dart_and_dim + (it,it->beta(i),i)); + amap.unlink_beta(it, i); + ++it; + } + + while (!todegroup.empty() ) + { + Couple_dart_and_dim c=todegroup.top(); + todegroup.pop(); + amap.degroup_all_attributes_except(c.d1,c.d2,c.dim); + } + } + }; + + /// Functor used to 1-unsew one dart. + template + struct unsew_functor{ + static void run(Map& amap,typename Map::Dart_handle adart) + { + CGAL_assertion( adart!=NULL && !adart->is_free(1) ); + typename Map::Dart_handle d2 = NULL; + + int mark = amap.get_new_mark(); + std::vector dartv; + for (CMap_dart_iterator_basic_of_cell it(amap,adart,mark); + it.cont(); ++it) + { + amap.mark(*it,mark); + dartv.push_back(*it); + } + + { + CMap_dart_iterator_of_involution it(amap, adart); + while ( it.cont() ) + { + if ( amap.is_marked(*it,mark) ) + { d2 = it->beta(1); amap.template unlink_beta<1>(*it); } + else + { d2 = it->beta(0); amap.template unlink_beta<0>(*it); } + amap.degroup_all_attributes_except(*it,d2,1); + ++it; + } + } + + for (typename std::vector::iterator + it=dartv.begin(); it!=dartv.end(); ++it) + { amap.unmark(*it,mark); } + CGAL_assertion( amap.is_whole_map_unmarked(mark) ); + amap.free_mark(mark); + } + }; + + /// Functor used to 1-unsew one dart. + template + struct unsew_functor{ + static void run(Map& amap,typename Map::Dart_handle adart) + { + CGAL_assertion( adart!=NULL && !adart->is_free(0) ); + typename Map::Dart_handle d2 = NULL; + + int mark = amap.get_new_mark(); + std::vector dartv; + for (CMap_dart_iterator_basic_of_cell it(amap,adart,mark); + it.cont(); ++it) + { + amap.mark(*it,mark); + dartv.push_back(*it); + } + + { + CMap_dart_iterator_of_involution it(amap, adart); + while ( it.cont() ) + { + if ( amap.is_marked(*it,mark) ) + { d2 = it->beta(0); amap.template unlink_beta<0>(*it); } + else + { d2 = it->beta(1); amap.template unlink_beta<1>(*it); } + amap.degroup_all_attributes_except(*it,d2,1); + ++it; + } + } + + for (typename std::vector::iterator + it=dartv.begin(); it!=dartv.end(); ++it) + { amap.unmark(*it,mark); } + CGAL_assertion( amap.is_whole_map_unmarked(mark) ); + amap.free_mark(mark); + } + }; + + /// Functor used to i-link two darts, 2<=i<=dimension. + template + struct basic_link_beta_functor{ + static void run(Map&,typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2) + { + CGAL_assertion(adart1 != NULL && adart2 != NULL && adart1!=adart2); + CGAL_assertion( i>=2 && i<=Map::dimension ); + adart1->basic_link_beta(adart2, i); + adart2->basic_link_beta(adart1, i); + } + }; + + /// Functor used to 0-link two darts. + template + struct basic_link_beta_functor{ + static void run(Map&,typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2) + { + CGAL_assertion(adart1 != NULL && adart2 != NULL ); + adart1->basic_link_beta(adart2, 0); + adart2->basic_link_beta(adart1, 1); + } + }; + + /// Functor used to 1-link two darts. + template + struct basic_link_beta_functor{ + static void run(Map& ,typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2) + { + CGAL_assertion(adart1 != NULL && adart2 != NULL); + adart1->basic_link_beta(adart2, 1); + adart2->basic_link_beta(adart1, 0); + } + }; + + /// Functor used to i-unlink one dart. + template + struct unlink_beta_functor{ + static void run(Map&,typename Map::Dart_handle adart) + { + CGAL_assertion(adart != NULL && !adart->is_free(i)); + CGAL_assertion(2<=i && i<=Map::dimension); + adart->beta(i)->unlink_beta(i); + adart->unlink_beta(i); + } + }; + + /// Functor used to 0-unlink one dart. + template + struct unlink_beta_functor{ + static void run(Map&,typename Map::Dart_handle adart) + { + CGAL_assertion(adart != NULL && !adart->is_free(0)); + adart->beta(0)->unlink_beta(1); + adart->unlink_beta(0); + } + }; + + /// Functor used to 1-unlink one dart. + template + struct unlink_beta_functor{ + static void run(Map&,typename Map::Dart_handle adart) + { + CGAL_assertion(adart != NULL && !adart->is_free(1)); + adart->beta(1)->unlink_beta(0); + adart->unlink_beta(1); + } + }; + + // Functor used to group one attribute of two given darts + template + struct Group_one_attribute_functor + { + static void run(CMap* amap, + typename CMap::Dart_handle adart1, + typename CMap::Dart_handle adart2) + { + CGAL_assertion(amap!=NULL); + amap->template group_enabled_attribute(adart1,adart2); + } + }; + + // Specialization for i-attributes disabled. + template + struct Group_one_attribute_functor + { + static void run(CMap*, + typename CMap::Dart_handle, + typename CMap::Dart_handle) + {} + }; + + // Functor used to degroup one attribute of two given darts + template + struct Degroup_one_attribute_functor + { + static bool run(CMap* amap, + typename CMap::Dart_handle adart1, + typename CMap::Dart_handle adart2) + { + CGAL_assertion(amap!=NULL); + return amap->template degroup_enabled_attribute + (adart1,adart2); + } + }; + + // Specialization for i-attributes disabled. + template + struct Degroup_one_attribute_functor + { + static bool run(CMap*, + typename CMap::Dart_handle, + typename CMap::Dart_handle) + { return false; } + }; + + // Functor used to degroup one attribute of one dart + template + struct Degroup_one_attribute_of_dart_functor + { + static bool run(CMap* amap, + typename CMap::Dart_handle adart1, + typename CMap::Dart_handle adart2) + { + CGAL_assertion(amap!=NULL); + return amap->template degroup_enabled_attribute_of_dart + (adart1,adart2); + } + }; + + // Specialization for i-attributes disabled. + template + struct Degroup_one_attribute_of_dart_functor + { + static bool run(CMap*, + typename CMap::Dart_handle, + typename CMap::Dart_handle) + { return false; } + }; + + /// Functor used to call decrease_attribute_ref_counting + /// on each i-cell attribute enabled + template + struct Decrease_attribute_functor + { + template + static void run(Map* amap, typename Map::Dart_handle adart) + { amap->template + decrease_attribute_ref_counting(adart/*,Tag_true()*/); } + }; + + /// Functor used to call update_dart_of_attribute + /// on each i-cell attribute enabled + template + struct Update_dart_of_attribute_functor + { + template + static void run(Map* amap, typename Map::Dart_handle ah, int amark) + { amap->template update_dart_of_attribute(ah,amark); } + }; + + /// Functor used to reserve one mark for each enabled attribute. + template + struct Reserve_mark_functor + { + template + static void run(const Map* amap, std::vector* marks) + { (*marks)[i] = amap->get_new_mark(); } + }; + + /// Functor used to test if a cell is valid + template + struct Test_is_valid_attribute_functor + { + template + static void run(const Map* amap, + typename Map::Dart_const_handle adart, + std::vector* marks, bool *ares) + { + if (!amap->template is_valid_attribute(adart,(*marks)[i]) ) + { + (*ares)=false; + std::cerr << "Map not valid: a "< + struct Count_cell_functor + { + template + static void run( const Map* amap, + typename Map::Dart_const_handle adart, + std::vector* amarks, + std::vector* ares ) + { + if ( (*amarks)[i]!=-1 && !amap->is_marked(adart, (*amarks)[i]) ) + { + ++ (*ares)[i]; + mark_cell(*amap, adart, (*amarks)[i]); + } + } + }; + + // Functor used to group the two n-attributes of the two darts, except the + // attribute of adim (adim==-1 || 1<=adim<=dimension) + template + struct Group_attribute_functor_run + { + static void run(Map* amap, + typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2, int adim) + { + if ( i!=adim ) + { + amap->template group_enabled_attribute + ::type> + (adart1, adart2); + } + } + }; + + template + struct Group_attribute_functor_run + { + static void run(CMap* amap, + typename CMap::Dart_handle adart1, + typename CMap::Dart_handle adart2, int adim) + { + typename CMap::Dart_handle od = adart1->other_extremity(); + if ( od!=NULL ) + { + amap->template group_enabled_attribute + <0, typename CMap::Helper::template Attribute_type<0>::type> + (od, adart2); + } + + if ( adim!=1 ) + { + od = adart2->other_extremity(); + if ( od!=NULL ) + amap->template group_enabled_attribute + <0, typename CMap::Helper::template Attribute_type<0>::type> + (adart1, od); + } + } + }; + + template + struct Group_attribute_functor + { + template + static void run(Map* amap, + typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2, int adim) + { + CGAL_assertion( adim==-1 || + (1<=adim && (unsigned int)adim<=Map::dimension) ); + Group_attribute_functor_run::run(amap,adart1,adart2,adim); + } + }; + + // Functor used to degroup the two n-attributes of the two darts, except the + // attribute of adim + template + struct Degroup_attribute_functor_run + { + static void run(CMap* amap, + typename CMap::Dart_handle adart1, + typename CMap::Dart_handle adart2, int adim) + { + CGAL_assertion( adim==-1 || + (1<=adim && (unsigned int)adim<=CMap::dimension) ); + if (i!=adim ) + { + amap->template degroup_enabled_attribute + ::type> + (adart1, adart2); + } + } + }; + template + struct Degroup_attribute_functor_run + { + static void run(CMap* amap, + typename CMap::Dart_handle adart1, + typename CMap::Dart_handle adart2, int adim) + { + CGAL_assertion( adim==-1 || + (1<=adim && (unsigned int)adim<=CMap::dimension) ); + typename CMap::Dart_handle od = adart1->other_extremity(); + if ( od!=NULL ) + amap->template degroup_enabled_attribute + <0, typename CMap::Helper::template Attribute_type<0>::type > + (od, adart2); + + if ( adim!=1 ) + { + od = adart2->other_extremity(); + if ( od!=NULL ) + { + amap->template degroup_enabled_attribute + <0, typename CMap::Helper::template Attribute_type<0>::type> + (adart1, od); + } + } + } + }; + template + struct Degroup_attribute_functor + { + template + static void run(Map* amap,typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2, int adim) + { + Degroup_attribute_functor_run::run(amap,adart1,adart2,adim); + } + }; + + // Functor which call operator() on the cell_attribute... + template + struct Apply_cell_functor + { + static void run(Cell_attribute& acell1, Cell_attribute& acell2) + { + Functor() (acell1,acell2); + } + }; + //...except for Null_functor. + template + struct Apply_cell_functor + { + static void run(Cell_attribute&, Cell_attribute&) + {} + }; + + /// Functor used for link_beta to update the attributes of + /// adart2 on the attributes of this dart, except for adimension-attributes. + template + struct Group_attribute_functor_of_dart_run + { + static void run(CMap* amap, + typename CMap::Dart_handle dh1, + typename CMap::Dart_handle dh2, + int adim) + { + CGAL_assertion( adim==-1 || + (0<=adim && (unsigned int)adim<=CMap::dimension) ); + if ( adim!=i ) + { + amap->template group_enabled_attribute_of_dart + ::type> + (dh1, dh2); + } + } + }; + template + struct Group_attribute_functor_of_dart_run + { + static void run(CMap* amap, + typename CMap::Dart_handle dh1, + typename CMap::Dart_handle dh2, + int adim) + { + CGAL_assertion( adim==-1 || + (0<=adim && (unsigned int)adim<=CMap::dimension) ); + + if ( adim!=0 ) + { + typename CMap::Dart_handle od = dh1->other_extremity(); + if ( od!=NULL ) + { + typename CMap::Helper::template Attribute_handle<0>::type + a1=od->template attribute<0>(); + if ( a1!=NULL && a1!=dh2->template attribute<0>() ) + amap->template set_attribute_of_dart<0>(dh2, a1); + } + } + + if ( adim!=1 ) + { + typename CMap::Dart_handle od = dh2->other_extremity(); + if ( od!=NULL && dh1->template attribute<0>()==NULL ) + { + typename CMap::Helper::template Attribute_handle<0>::type + a2=od->template attribute<0>(); + if ( a2!=NULL ) + amap->template set_attribute_of_dart<0>(dh1, a2); + } + } + } + }; + + template + struct Group_attribute_functor_of_dart + { + template + static void run(CMap* amap, + typename CMap::Dart_handle adart1, + typename CMap::Dart_handle adart2, int adim) + { + CGAL_assertion( adim==-1 || + (0<=adim && (unsigned int)adim<=CMap::dimension) ); + Group_attribute_functor_of_dart_run::run(amap,adart1,adart2,adim); + } + }; + + /// Functor used to i-link two darts, 2<=i<=dimension. + template + struct link_beta_functor{ + static void run(CMap& amap,typename CMap::Dart_handle adart1, + typename CMap::Dart_handle adart2) + { + CGAL_assertion(adart1 != NULL && adart2 != NULL && adart1!=adart2 ); + CGAL_assertion( 2<=i && i<=CMap::dimension ); + adart1->basic_link_beta(adart2, i); + adart2->basic_link_beta(adart1, i); + CMap::Helper::template Foreach_enabled_attributes + >::run(&amap,adart1,adart2,i); + } + }; + + /// Functor used to 0-link two darts. + template + struct link_beta_functor{ + static void run(Map& amap,typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2) + { + CGAL_assertion(adart1 != NULL && adart2 != NULL); + adart1->basic_link_beta(adart2,0); + adart2->basic_link_beta(adart1, 1); + Map::Helper::template Foreach_enabled_attributes + >::run(&amap,adart1,adart2,0); + } + }; + + /// Functor used to 1-link two darts. + template + struct link_beta_functor{ + static void run(Map& amap,typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2) + { + CGAL_assertion(adart1 != NULL && adart2 != NULL); + adart1->basic_link_beta(adart2,1); + adart2->basic_link_beta(adart1,0); + Map::Helper::template Foreach_enabled_attributes + >::run(&amap,adart1,adart2,1); + } + }; + + // Functor used to call the On_split functor between the two given darts. + template::type> + struct Call_split_functor + { + static void run(typename Map::Dart_handle adart1, + typename Map::Dart_handle adart2) + { + Apply_cell_functor::type, + typename Map::Helper::template Attribute_type::type::On_split>::run + (*(adart1->template attribute()), + *(adart2->template attribute())); + } + }; + + // Specialization for disabled attributes. + template + struct Call_split_functor + { + static void run(typename Map::Dart_handle, + typename Map::Dart_handle) + {} + }; + + /// Functor for counting the memory occupation of attributes + /// Be careful not reentrant !!! TODO a Foreach_enabled_attributes + /// taking an instance of a functor as argument allowing to compute and return + /// values. + template + struct Count_bytes_one_attribute_functor + { + template + static void run( const Map* amap ) + { + res += amap->template attributes().capacity()* + sizeof(typename Map::template Attribute_type::type); + } + + static typename Map::size_type res; + }; + template + typename Map::size_type Count_bytes_one_attribute_functor::res = 0; + + template + struct Count_bytes_all_attributes_functor + { + static typename Map::size_type run( const Map& amap ) + { + Count_bytes_one_attribute_functor::res = 0; + Map::Helper::template Foreach_enabled_attributes + >::run(&amap); + return Count_bytes_one_attribute_functor::res; + } + }; + + } // namespace internal +} // namespace CGAL + +#endif // CGAL_COMBINATORIAL_MAP_FUNCTORS_H // +// EOF // diff --git a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h new file mode 100644 index 00000000000..1a4eae9c65c --- /dev/null +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h @@ -0,0 +1,1667 @@ +// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France). +// All rights reserved. +// +// 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. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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) : Guillaume Damiand +// +#ifndef CGAL_INTERNAL_COMBINATORIAL_MAP_UTILITY_H +#define CGAL_INTERNAL_COMBINATORIAL_MAP_UTILITY_H 1 + +#include +#include +#include +#include + +#ifdef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES +#include +#include +#endif + + +namespace CGAL +{ + // struct Disabled {}; // If we want to use CGAL::Disabled for disabled attributes + // typedef CGAL::Void Disabled; + // typedef void Disabled; // If we wand to use void, does not compile on windows + + namespace internal + { + // There is a problem on windows to handle tuple containing void. To solve this, we + // transform such a tuple in tuple containing Disabled. + template + struct Convert_void + { typedef T type; }; + + template<> + struct Convert_void + { typedef CGAL::Void type; }; + + #ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + template + struct Convert_tuple_with_void; + + template + struct Convert_tuple_with_void > + { + typedef CGAL::cpp0x::tuple::type... > type; + }; + + template + struct My_length; + template + struct My_length > + { + static const int value = My_length >::value + 1; + }; + + template<> + struct My_length > + { + static const int value = 0; + }; + + +#else //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + template + struct Convert_tuple_with_void; + + template <> + struct Convert_tuple_with_void > + { + typedef CGAL::cpp0x::tuple<> type; + }; + template + struct Convert_tuple_with_void > + { + typedef CGAL::cpp0x::tuple::type > type; + }; + template + struct Convert_tuple_with_void > + { + typedef CGAL::cpp0x::tuple::type, + typename Convert_void::type> type; + }; + template + struct Convert_tuple_with_void > + { + typedef CGAL::cpp0x::tuple::type, + typename Convert_void::type, + typename Convert_void::type> type; + }; + template + struct Convert_tuple_with_void > + { + typedef CGAL::cpp0x::tuple::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type> type; + }; + template + struct Convert_tuple_with_void > + { + typedef CGAL::cpp0x::tuple::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type> type; + }; + template + struct Convert_tuple_with_void > + { + typedef CGAL::cpp0x::tuple::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type> type; + }; + template + struct Convert_tuple_with_void > + { + typedef CGAL::cpp0x::tuple::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type> type; + }; + template + struct Convert_tuple_with_void > + { + typedef CGAL::cpp0x::tuple::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type> type; + }; + template + struct Convert_tuple_with_void > + { + typedef CGAL::cpp0x::tuple::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type, + typename Convert_void::type> type; + }; + template + struct My_length; + + template <> + struct My_length > + { + static const int value = 0; + }; + template + struct My_length > + { + static const int value = 1; + }; + template + struct My_length > + { + static const int value = 2; + }; + template + struct My_length > + { + static const int value = 3; + }; + template + struct My_length > + { + static const int value = 4; + }; + template + struct My_length > + { + static const int value = 5; + }; + template + struct My_length > + { + static const int value = 6; + }; + template + struct My_length > + { + static const int value = 7; + }; + template + struct My_length > + { + static const int value = 8; + }; + template + struct My_length > + { + static const int value = 9; + }; +#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + +#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES +//count the number of time a given type is present in a tuple +template +struct Number_of_type_in_tuple; + +template +struct Number_of_type_in_tuple >{ + static const int value=Number_of_type_in_tuple >::value+1; +}; + +template +struct Number_of_type_in_tuple >{ + static const int value=Number_of_type_in_tuple >::value; +}; + +template +struct Number_of_type_in_tuple >{ + static const int value=0; +}; +#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + +//count the number of different types from Type is present in a tuple +#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES +template +struct Number_of_different_type_in_tuple; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value=Number_of_different_type_in_tuple >::value+1; +}; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value=Number_of_different_type_in_tuple >::value; +}; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value=0; +}; +#else +template +struct Number_of_different_type_in_tuple; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value=0; +}; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value=boost::is_same::value?0:1; +}; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value= (boost::is_same::value?0:1) + Number_of_different_type_in_tuple >::value; +}; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value= (boost::is_same::value?0:1) + Number_of_different_type_in_tuple >::value; +}; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value= (boost::is_same::value?0:1) + Number_of_different_type_in_tuple >::value; +}; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value= (boost::is_same::value?0:1) + Number_of_different_type_in_tuple >::value; +}; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value= (boost::is_same::value?0:1) + Number_of_different_type_in_tuple >::value; +}; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value= (boost::is_same::value?0:1) + Number_of_different_type_in_tuple >::value; +}; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value= (boost::is_same::value?0:1) + Number_of_different_type_in_tuple >::value; +}; + +template +struct Number_of_different_type_in_tuple > +{ + static const int value= (boost::is_same::value?0:1) + Number_of_different_type_in_tuple >::value; +}; +#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + + +#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES +//count the number of time a given type have been found +//within a tuple, until reaching position the k'th type of the tuple. +//dim is the total size of the tuple +template ::value-1> +struct Nb_type_in_tuple_up_to_k; + +template +struct Nb_type_in_tuple_up_to_k,dim>{ + static const int pos= Nb_type_in_tuple_up_to_k,dim>::pos - 1; + + static const int value = + ( pos==k ) ? ( boost::is_same::value ? 0:-dim-1 ) + : ( ( pos::value ? 1:0 ) + + Nb_type_in_tuple_up_to_k,dim >::value) + :0 + ); +}; + +template +struct Nb_type_in_tuple_up_to_k,dim >{ + static const int pos=dim; + static const int value= pos==k? boost::is_same::value?0:-dim-1 : 0; +}; +#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + +//count the number of time a type different from Type have been found +//within a tuple, until reaching position the k'th type of the tuple. +//dim is the total size of the tuple +#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES +template ::value-1> +struct Nb_type_different_in_tuple_up_to_k; + +template +struct Nb_type_different_in_tuple_up_to_k,dim>{ + static const int pos= + Nb_type_different_in_tuple_up_to_k,dim >::pos - 1; + + static const int value = + ( pos==k ) ? ( boost::is_same::value ? -dim-1 : 0 ) + : ( ( pos::value ? 0:1 ) + + Nb_type_different_in_tuple_up_to_k,dim >::value) + :0 + ); +}; + +template +struct Nb_type_different_in_tuple_up_to_k,dim >{ + static const int pos=dim; + static const int value= pos==k? boost::is_same::value?-dim-1:0 : 0; +}; +#else +template ::value-1> +struct Nb_type_different_in_tuple_up_to_k; + +template +struct Nb_type_different_in_tuple_up_to_k,dim >{ + static const int pos=dim; + static const int value= pos==k? boost::is_same::value?-dim-1:0 : 0; +}; + +template +struct Nb_type_different_in_tuple_up_to_k,dim >{ + static const int pos= + Nb_type_different_in_tuple_up_to_k,dim >::pos - 1; + + static const int value = + ( pos==k ) ? ( boost::is_same::value ? -dim-1 : 0 ) + : ( ( pos::value ? 0:1 ) + + Nb_type_different_in_tuple_up_to_k,dim >::value) + :0 + ); +}; + +template +struct Nb_type_different_in_tuple_up_to_k,dim >{ + static const int pos= + Nb_type_different_in_tuple_up_to_k,dim >::pos - 1; + + static const int value = + ( pos==k ) ? ( boost::is_same::value ? -dim-1 : 0 ) + : ( ( pos::value ? 0:1 ) + + Nb_type_different_in_tuple_up_to_k,dim >::value) + :0 + ); +}; + + +template +struct Nb_type_different_in_tuple_up_to_k,dim >{ + static const int pos= + Nb_type_different_in_tuple_up_to_k,dim >::pos - 1; + + static const int value = + ( pos==k ) ? ( boost::is_same::value ? -dim-1 : 0 ) + : ( ( pos::value ? 0:1 ) + + Nb_type_different_in_tuple_up_to_k,dim >::value) + :0 + ); +}; + +template +struct Nb_type_different_in_tuple_up_to_k,dim >{ + static const int pos= + Nb_type_different_in_tuple_up_to_k,dim >::pos - 1; + + static const int value = + ( pos==k ) ? ( boost::is_same::value ? -dim-1 : 0 ) + : ( ( pos::value ? 0:1 ) + + Nb_type_different_in_tuple_up_to_k,dim >::value) + :0 + ); +}; + +template +struct Nb_type_different_in_tuple_up_to_k,dim >{ + static const int pos= + Nb_type_different_in_tuple_up_to_k,dim >::pos - 1; + + static const int value = + ( pos==k ) ? ( boost::is_same::value ? -dim-1 : 0 ) + : ( ( pos::value ? 0:1 ) + + Nb_type_different_in_tuple_up_to_k,dim >::value) + :0 + ); +}; + +template +struct Nb_type_different_in_tuple_up_to_k,dim >{ + static const int pos= + Nb_type_different_in_tuple_up_to_k,dim >::pos - 1; + + static const int value = + ( pos==k ) ? ( boost::is_same::value ? -dim-1 : 0 ) + : ( ( pos::value ? 0:1 ) + + Nb_type_different_in_tuple_up_to_k,dim >::value) + :0 + ); +}; + +template +struct Nb_type_different_in_tuple_up_to_k,dim >{ + static const int pos= + Nb_type_different_in_tuple_up_to_k,dim >::pos - 1; + + static const int value = + ( pos==k ) ? ( boost::is_same::value ? -dim-1 : 0 ) + : ( ( pos::value ? 0:1 ) + + Nb_type_different_in_tuple_up_to_k,dim >::value) + :0 + ); +}; + +template +struct Nb_type_different_in_tuple_up_to_k,dim >{ + static const int pos= + Nb_type_different_in_tuple_up_to_k,dim >::pos - 1; + + static const int value = + ( pos==k ) ? ( boost::is_same::value ? -dim-1 : 0 ) + : ( ( pos::value ? 0:1 ) + + Nb_type_different_in_tuple_up_to_k,dim >::value) + :0 + ); +}; +#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES + +//Convert a tuple of T... to a tuple of Functor::type... +template