merge from next

This commit is contained in:
Sébastien Loriot 2012-07-26 07:24:02 +00:00
commit 40f237b70d
665 changed files with 39165 additions and 15475 deletions

97
.gitattributes vendored
View File

@ -177,6 +177,13 @@ Algebraic_kernel_d/include/CGAL/RS/sign_1.h -text
Algebraic_kernel_d/include/CGAL/RS/sign_1_no_rs.h -text
Algebraic_kernel_d/include/CGAL/RS/sign_1_rs.h -text
Algebraic_kernel_d/include/CGAL/RS/ugcd.h -text
Algebraic_kernel_d/include/CGAL/RS/ugcd/crt.h -text
Algebraic_kernel_d/include/CGAL/RS/ugcd/inverse.h -text
Algebraic_kernel_d/include/CGAL/RS/ugcd/p.h -text
Algebraic_kernel_d/include/CGAL/RS/ugcd/pagealloc.h -text
Algebraic_kernel_d/include/CGAL/RS/ugcd/pp.h -text
Algebraic_kernel_d/include/CGAL/RS/ugcd/primes.h -text
Algebraic_kernel_d/include/CGAL/RS/ugcd/ugcd.h -text
Algebraic_kernel_d/package_info/Algebraic_kernel_d/description.txt -text
Algebraic_kernel_d/package_info/Algebraic_kernel_d/maintainer -text
Algebraic_kernel_d/test/Algebraic_kernel_d/Algebraic_curve_kernel_2.cpp -text
@ -467,6 +474,7 @@ Arrangement_on_surface_2/examples/Arrangement_on_surface_2/Bezier.dat -text
Arrangement_on_surface_2/examples/Arrangement_on_surface_2/Europe.dat -text
Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_curves.cpp -text
Arrangement_on_surface_2/examples/Arrangement_on_surface_2/algebraic_segments.cpp -text
Arrangement_on_surface_2/examples/Arrangement_on_surface_2/arr_inexact_construction_segments.h -text
Arrangement_on_surface_2/examples/Arrangement_on_surface_2/bounded_planar_vertical_decomposition.cpp -text
Arrangement_on_surface_2/examples/Arrangement_on_surface_2/coll_points.dat -text
Arrangement_on_surface_2/examples/Arrangement_on_surface_2/fan_grids.dat -text
@ -476,6 +484,16 @@ Arrangement_on_surface_2/examples/Arrangement_on_surface_2/unb_planar_vertical_d
Arrangement_on_surface_2/include/CGAL/Arr_algebraic_segment_traits_2.h -text
Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_partition_traits_2.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Arr_lm_specified_points_generator.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_edge.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_fictitious_vertex.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_trapezoid.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_vertex.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_dag_node.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_edge.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_fictitious_vertex.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_trapezoid.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_vertex.h -text
Arrangement_on_surface_2/include/CGAL/Arr_point_location/Trapezoidal_decomposition_2_impl.h -text
Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_on_sphere_transformation.h -text
Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_polyhedral_sgm_transformation.h -text
Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_transform_on_sphere.h -text
@ -501,6 +519,10 @@ Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Curve_ren
Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Subdivision_1.h -text
Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/gfx/Subdivision_2.h -text
Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/test/simple_models.h -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_base_test.h -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/IO_test.h -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_dynamic_test.h -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/Point_location_test.h -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/Traits_adaptor_test.h -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_base -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test_with_cmake eol=lf
@ -712,8 +734,25 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/spli
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/vertex -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/vertex.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/linear/segments/xcurves -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/curves/test02.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location/queries/test02.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_circle_segments/curves/test01.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_circle_segments/ops/test01.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_circle_segments/queries/test01.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/curves/test01.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/curves/test03.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/curves/test04.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/ops/test01.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/ops/test02.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/queries/test01.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/queries/test02.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/queries/test03.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/queries/test04.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_linear/xcurves/test02.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/curves/test02.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/ops/test01.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/ops/test10.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test02.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/queries/test10.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/point_location_segments/xcurves/test10.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/compare_y_at_x -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/compare_y_at_x.pt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/polylines/compare_y_at_x.xcv -text
@ -824,6 +863,10 @@ Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_construction/te
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_observer/test01.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/test01.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/data/test_overlay/test02.txt -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location_circle_segments.cmd -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location_dynamic.cpp -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location_dynamic_segments.cmd -text
Arrangement_on_surface_2/test/Arrangement_on_surface_2/point_location_linear.cmd -text
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
@ -1424,9 +1467,12 @@ Convex_decomposition_3/examples/Convex_decomposition_3/list_of_convex_parts.cin
Convex_decomposition_3/test/Convex_decomposition_3/check_decomposition.cin -text
Convex_decomposition_3/test/Convex_decomposition_3/reflex_sedge.cpp -text
Convex_decomposition_3/test/Convex_decomposition_3/star.nef3 -text
Convex_hull_2/benchmark/Convex_hull_2/static_ch2.cpp -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_2/examples/Convex_hull_2/iostream_convex_hull_2.cin -text
Convex_hull_2/test/Convex_hull_2/ch2_projection_3.cpp -text
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
@ -1724,7 +1770,6 @@ Installation/cmake/modules/CGAL_CheckCXXFileRuns.cmake -text
Installation/cmake/modules/CGAL_Common.cmake -text
Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake -text
Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgramQt4.cmake -text
Installation/cmake/modules/CGAL_FindPackageHandleStandardArgs.cmake -text
Installation/cmake/modules/CGAL_GeneratorSpecificSettings.cmake -text
Installation/cmake/modules/CGAL_Locate_CGAL_TAUCS.cmake -text
Installation/cmake/modules/CGAL_Macros.cmake -text
@ -1732,18 +1777,14 @@ Installation/cmake/modules/CGAL_SetupBoost.cmake -text
Installation/cmake/modules/CGAL_SetupDependencies.cmake -text
Installation/cmake/modules/CGAL_SetupFlags.cmake -text
Installation/cmake/modules/CGAL_SetupGMP.cmake -text
Installation/cmake/modules/CGAL_SetupGMPXX.cmake -text
Installation/cmake/modules/CGAL_SetupLEDA.cmake -text
Installation/cmake/modules/CGAL_SetupMPFI.cmake -text
Installation/cmake/modules/CGAL_SetupNTL.cmake -text
Installation/cmake/modules/CGAL_SetupRS.cmake -text
Installation/cmake/modules/CGAL_TweakFindBoost.cmake -text
Installation/cmake/modules/CGAL_UseBLAS.cmake -text
Installation/cmake/modules/CGAL_UseLAPACK.cmake -text
Installation/cmake/modules/CGAL_UseLEDA.cmake -text
Installation/cmake/modules/CGAL_UseMKL.cmake -text
Installation/cmake/modules/CGAL_UseMPFI.cmake -text
Installation/cmake/modules/CGAL_UseNTL.cmake -text
Installation/cmake/modules/CGAL_UseRS.cmake -text
Installation/cmake/modules/CGAL_UseRS3.cmake -text
Installation/cmake/modules/CGAL_UseTAUCS.cmake -text
Installation/cmake/modules/CGAL_VersionUtils.cmake -text
Installation/cmake/modules/FindBLAS.cmake -text
@ -1764,10 +1805,10 @@ Installation/cmake/modules/FindMPFI.cmake -text
Installation/cmake/modules/FindMPFR.cmake -text
Installation/cmake/modules/FindNTL.cmake -text
Installation/cmake/modules/FindOpenGL.cmake -text
Installation/cmake/modules/FindPackageMessage.cmake -text
Installation/cmake/modules/FindQGLViewer.cmake -text
Installation/cmake/modules/FindQt3-patched.cmake -text
Installation/cmake/modules/FindRS.cmake -text
Installation/cmake/modules/FindRS3.cmake -text
Installation/cmake/modules/FindSuperLU.cmake -text
Installation/cmake/modules/FindTAUCS.cmake -text
Installation/cmake/modules/Qt3Macros-patched.cmake -text
@ -1814,7 +1855,7 @@ Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersec
Intersections_3/test/Intersections_3/segment_segment.cpp -text
Intersections_3/test/Intersections_3/triangle_3_triangle_3_intersection.cpp -text
Interval_skip_list/doc_tex/Interval_skip_list/query.png -text
Interval_skip_list/examples/Interval_skip_list/isl_terrain.pts -text
Interval_skip_list/examples/Interval_skip_list/terrain.pts -text
Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h -text
Interval_support/include/CGAL/Test/_test_convert_to_bfi.h -text
Interval_support/package_info/Interval_support/description.txt -text
@ -1870,7 +1911,9 @@ Kernel_23/examples/Kernel_23/MyPointC2_iostream.h -text
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/include/CGAL/_Result_of_kernel.h -text
Kernel_23/test/Kernel_23/overload_bug.cpp -text
Kernel_23/test/Kernel_23/test_result_of.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
@ -1949,9 +1992,11 @@ Largest_empty_rect_2/doc_tex/Inscribed_areas_ref/ler-detail.png -text
Largest_empty_rect_2/doc_tex/Inscribed_areas_ref/ler.png -text
Largest_empty_rect_2/test/Largest_empty_rect_2/cgal_test eol=lf
Largest_empty_rect_2/test/Largest_empty_rect_2/cgal_test_with_cmake eol=lf
Linear_cell_complex/demo/Linear_cell_complex/CreateMenger.ui -text
Linear_cell_complex/demo/Linear_cell_complex/CreateMesh.ui -text
Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3.qrc -text
Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_3_subdivision.cpp -text
Linear_cell_complex/demo/Linear_cell_complex/Linear_cell_complex_pqq_subdivision.cpp -text
Linear_cell_complex/demo/Linear_cell_complex/MainWindow.ui -text
Linear_cell_complex/demo/Linear_cell_complex/about_Linear_cell_complex_3.html svneol=native#text/html
Linear_cell_complex/doc_tex/Linear_cell_complex/Linear_cell_complex.tex -text
@ -2054,6 +2099,7 @@ Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_triangula
Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_viewer_qt.h -text
Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_viewer_vtk.h -text
Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_with_colored_vertices.cpp -text
Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_3_with_mypoint.cpp -text
Linear_cell_complex/examples/Linear_cell_complex/linear_cell_complex_4.cpp -text
Linear_cell_complex/examples/Linear_cell_complex/plane_graph_to_lcc_2.cpp -text
Linear_cell_complex/examples/Linear_cell_complex/voronoi_2.cpp -text
@ -2141,6 +2187,7 @@ Maintenance/infrastructure/cgal.geometryfactory.com/bin/create_release -text
Maintenance/infrastructure/cgal.geometryfactory.com/bin/dump_crontab -text
Maintenance/infrastructure/cgal.geometryfactory.com/bin/update_manual_tools -text
Maintenance/infrastructure/cgal.geometryfactory.com/crontab -text
Maintenance/infrastructure/cgal.geometryfactory.com/partition-table-sda.txt -text
Maintenance/infrastructure/cgal.geometryfactory.com/reference-platforms/boostrap -text
Maintenance/infrastructure/cgal.geometryfactory.com/reference-platforms/common-setup -text
Maintenance/infrastructure/cgal.geometryfactory.com/reference-platforms/i686_Linux-2.6_g++-3.4.6_CentOS-5.1-O2/CMakeCache.txt -text
@ -2196,11 +2243,12 @@ 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/announcement/CGAL-4.0 -text
Maintenance/public_release/announcement/CGAL-4.0-beta1 -text
Maintenance/public_release/announcement/CGAL-4.0.1 -text
Maintenance/public_release/announcement/CGAL-4.0.2 -text
Maintenance/public_release/scripts/precompiled_demos_zips -text
Maintenance/public_release/scripts/prepare_release -text
Maintenance/release_building/BUGFIX_NUMBER -text
@ -3146,7 +3194,11 @@ Polygon/doc_tex/Polygon/polygon.png -text
Polyhedron/demo/Polyhedron/Deform_mesh.ui -text
Polyhedron/demo/Polyhedron/MainWindow.ui -text
Polyhedron/demo/Polyhedron/Polyhedron_3.qrc -text
Polyhedron/demo/Polyhedron/Polyhedron_demo_corefinement_plugin.cpp -text
Polyhedron/demo/Polyhedron/Remeshing_dialog.ui -text
Polyhedron/demo/Polyhedron/Scene_combinatorial_map_item.cpp -text
Polyhedron/demo/Polyhedron/Scene_combinatorial_map_item.h -text
Polyhedron/demo/Polyhedron/Scene_combinatorial_map_item_config.h -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
@ -3226,12 +3278,17 @@ Polyhedron/doc_tex/Polyhedron_ref/fig/add_facet.pdf -text svneol=unset#applicati
Polyhedron/doc_tex/Polyhedron_ref/fig/add_facet1.gif -text svneol=unset#image/gif
Polyhedron/doc_tex/Polyhedron_ref/fig/add_facet2.gif -text svneol=unset#image/gif
Polyhedron/doc_tex/Polyhedron_ref/fig/euler.pdf -text svneol=unset#application/pdf
Polyhedron/doc_tex/Polyhedron_ref/fig/euler.svg -text
Polyhedron/doc_tex/Polyhedron_ref/fig/euler_center.gif -text svneol=unset#image/gif
Polyhedron/doc_tex/Polyhedron_ref/fig/euler_center.pdf -text svneol=unset#application/pdf
Polyhedron/doc_tex/Polyhedron_ref/fig/euler_facet.gif -text svneol=unset#image/gif
Polyhedron/doc_tex/Polyhedron_ref/fig/euler_facet.pdf -text svneol=unset#application/pdf
Polyhedron/doc_tex/Polyhedron_ref/fig/euler_facet.svg -text
Polyhedron/doc_tex/Polyhedron_ref/fig/euler_loop.gif -text svneol=unset#image/gif
Polyhedron/doc_tex/Polyhedron_ref/fig/euler_loop.pdf -text svneol=unset#application/pdf
Polyhedron/doc_tex/Polyhedron_ref/fig/euler_vertex.gif -text svneol=unset#image/gif
Polyhedron/doc_tex/Polyhedron_ref/fig/euler_vertex.pdf -text svneol=unset#application/pdf
Polyhedron/doc_tex/Polyhedron_ref/fig/euler_vertex.svg -text
Polyhedron/doc_tex/Polyhedron_ref/fig/halfedge.gif -text svneol=unset#image/gif
Polyhedron/doc_tex/Polyhedron_ref/fig/halfedge.pdf -text svneol=unset#application/pdf
Polyhedron/doc_tex/Polyhedron_ref/fig/halfedge_small.gif -text svneol=unset#image/gif
@ -3242,6 +3299,15 @@ Polyhedron/examples/Polyhedron/corner.off -text svneol=unset#application/octet-s
Polyhedron/examples/Polyhedron/corner_with_hole.off -text svneol=unset#application/octet-stream
Polyhedron/examples/Polyhedron/corner_with_sharp_edge.off -text svneol=unset#application/octet-stream
Polyhedron/examples/Polyhedron/cross.off -text svneol=unset#application/octet-stream
Polyhedron/include/CGAL/corefinement_operations.h -text
Polyhedron/include/CGAL/internal/corefinement/Combinatorial_map_for_corefinement.h -text
Polyhedron/include/CGAL/internal/corefinement/Polyhedron_constness_types.h -text
Polyhedron/include/CGAL/internal/corefinement/Polyhedron_subset_extraction.h -text
Polyhedron/include/CGAL/internal/corefinement/intersection_coplanar_triangles_3.h -text
Polyhedron/include/CGAL/internal/corefinement/intersection_triangle_segment_3.h -text
Polyhedron/include/CGAL/internal/corefinement/intersection_triangle_segment_3_coplanar.h -text
Polyhedron/include/CGAL/intersection_of_Polyhedra_3.h -text
Polyhedron/include/CGAL/intersection_of_Polyhedra_3_refinement_visitor.h -text
Polynomial/doc_tex/Polynomial/Polynomial.png -text
Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_ConstructCoefficientConstIteratorRange.tex -text
Polynomial/doc_tex/Polynomial_ref/PolynomialTraits_d_ConstructInnermostCoefficientConstIteratorRange.tex -text
@ -3488,10 +3554,14 @@ 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_namespaces.cpp -text
STL_Extension/test/STL_Extension/test_type_traits.cpp -text
Scripts/developer_scripts/autotest_cgal -text
Scripts/developer_scripts/autotest_cgal_with_cmake -text
Scripts/developer_scripts/cgal_build -text
Scripts/developer_scripts/cgal_generate_cmake_script -text
Scripts/developer_scripts/cgal_generate_cmake_script.cmake -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_gpl_files -text
@ -3518,6 +3588,8 @@ Scripts/developer_scripts/remove_package_files_from_build_tree.rb -text
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_CMakeLists -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
@ -4221,6 +4293,7 @@ Testsuite/test/Testsuite/cgal_test_with_cmake eol=lf
Testsuite/test/collect_cgal_testresults_from_cmake -text
Testsuite/test/makefile2 -text
Testsuite/test/run_testsuite_with_cmake -text
Triangulation_2/benchmark/Triangulation_2/CDT_with_intersection_2.cpp -text
Triangulation_2/benchmark/Triangulation_2/Delaunay_remove.cpp -text
Triangulation_2/demo/Triangulation_2/qt3/help/cindex.html svneol=native#text/html
Triangulation_2/demo/Triangulation_2/qt3/help/cinput_point_layer.gif -text svneol=unset#image/gif

62
.gitignore vendored
View File

@ -75,6 +75,7 @@ CGALimageIO/demo/CGALimageIO/cmake_install.cmake
CGALimageIO/demo/CGALimageIO/image_to_vtk_viewer
CGALimageIO/examples/CGALimageIO/*.exe
CGALimageIO/examples/CGALimageIO/Makefile
CGALimageIO/examples/CGALimageIO/cgal_test_with_cmake
CGALimageIO/examples/CGALimageIO/convert_raw_image_to_inr
CGALimageIO/examples/CGALimageIO/makefile
CGALimageIO/examples/CGALimageIO/test_imageio
@ -163,6 +164,17 @@ Installation/auxiliary/gdb/test
Installation/cmake/modules/*.tmp
Installation/test/Installation/cgal_test
Installation/test/Installation/deprecation_warning
Interpolation/demo/Interpolation/cgal_test_with_cmake
Intersections_3/test/Intersections_3/CMakeLists.txt
Intersections_3/test/Intersections_3/bbox_other_do_intersect_test
Intersections_3/test/Intersections_3/cgal_test_with_cmake
Intersections_3/test/Intersections_3/circle_other
Intersections_3/test/Intersections_3/line_line
Intersections_3/test/Intersections_3/segment_segment
Intersections_3/test/Intersections_3/test_intersections_3
Intersections_3/test/Intersections_3/triangle_3_triangle_3_intersection
Intersections_3/test/Intersections_3/triangle_other
Intersections_3/test/Intersections_3/triangle_other_intersection_test
Jet_fitting_3/examples/Jet_fitting_3/*.exe
Jet_fitting_3/examples/Jet_fitting_3/*.sln
Jet_fitting_3/examples/Jet_fitting_3/*.vcproj
@ -504,6 +516,8 @@ Mesh_2/doc_tex/Mesh_2_ref/semantic.cache
Mesh_2/doxygen
Mesh_2/examples/Mesh_2/*.core
Mesh_2/examples/Mesh_2/.*.deps
Mesh_2/examples/Mesh_2/CMakeLists.txt
Mesh_2/examples/Mesh_2/cgal_test_with_cmake
Mesh_2/examples/Mesh_2/conform
Mesh_2/examples/Mesh_2/conforming
Mesh_2/examples/Mesh_2/depends
@ -570,6 +584,7 @@ Mesh_3/examples/Mesh_3/*.png
Mesh_3/examples/Mesh_3/.*.deps
Mesh_3/examples/Mesh_3/Makefile
Mesh_3/examples/Mesh_3/applications
Mesh_3/examples/Mesh_3/cgal_test_with_cmake
Mesh_3/examples/Mesh_3/cgal_to_medit
Mesh_3/examples/Mesh_3/chair-after.mesh
Mesh_3/examples/Mesh_3/chair-after.png
@ -585,6 +600,16 @@ Mesh_3/examples/Mesh_3/implicit_surfaces_mesher_3
Mesh_3/examples/Mesh_3/lanteri
Mesh_3/examples/Mesh_3/lanteri_output_tet_mesh
Mesh_3/examples/Mesh_3/medit_to_cgal
Mesh_3/examples/Mesh_3/mesh_3D_gray_image
Mesh_3/examples/Mesh_3/mesh_3D_image
Mesh_3/examples/Mesh_3/mesh_3D_image_variable_size
Mesh_3/examples/Mesh_3/mesh_implicit_sphere
Mesh_3/examples/Mesh_3/mesh_implicit_sphere_variable_size
Mesh_3/examples/Mesh_3/mesh_optimization_example
Mesh_3/examples/Mesh_3/mesh_optimization_lloyd_example
Mesh_3/examples/Mesh_3/mesh_polyhedral_domain
Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_with_features
Mesh_3/examples/Mesh_3/mesh_two_implicit_spheres_with_balls
Mesh_3/examples/Mesh_3/my_makefile
Mesh_3/examples/Mesh_3/off_to_ghs
Mesh_3/examples/Mesh_3/out*.mesh.*
@ -685,6 +710,8 @@ Min_ellipse_2/.tmp
Min_ellipse_2/Makefile
Min_ellipse_2/bin
Min_ellipse_2/doc_ps
Minkowski_sum_3/test/Minkowski_sum_3/CMakeLists.txt
Minkowski_sum_3/test/Minkowski_sum_3/cgal_test_with_cmake
Modular_arithmetic/doc_html
Modular_arithmetic/doc_pdf
Modular_arithmetic/doc_ps
@ -966,6 +993,28 @@ Ridges_3/test/Ridges_3/*.sln
Ridges_3/test/Ridges_3/*.vcproj
Ridges_3/test/Ridges_3/Makefile
Ridges_3/test/Ridges_3/ridge_test
STL_Extension/test/STL_Extension/CMakeLists.txt
STL_Extension/test/STL_Extension/cgal_test_with_cmake
STL_Extension/test/STL_Extension/test_Cache
STL_Extension/test/STL_Extension/test_Compact_container
STL_Extension/test/STL_Extension/test_Concatenate_iterator
STL_Extension/test/STL_Extension/test_Flattening_iterator
STL_Extension/test/STL_Extension/test_Handle_with_policy
STL_Extension/test/STL_Extension/test_In_place_list
STL_Extension/test/STL_Extension/test_Modifiable_priority_queue
STL_Extension/test/STL_Extension/test_Nested_iterator
STL_Extension/test/STL_Extension/test_Uncertain
STL_Extension/test/STL_Extension/test_complexity_tags
STL_Extension/test/STL_Extension/test_composition
STL_Extension/test/STL_Extension/test_dispatch_output
STL_Extension/test/STL_Extension/test_is_iterator
STL_Extension/test/STL_Extension/test_is_streamable
STL_Extension/test/STL_Extension/test_lexcompare_outputrange
STL_Extension/test/STL_Extension/test_multiset
STL_Extension/test/STL_Extension/test_nth_element
STL_Extension/test/STL_Extension/test_stl_extension
STL_Extension/test/STL_Extension/test_type_traits
STL_Extension/test/STL_Extension/test_vector
Skin_surface_3/.cdtproject
Skin_surface_3/.project
Skin_surface_3/.settings
@ -978,6 +1027,8 @@ Skin_surface_3/test/Skin_surface_3/error.txt
Skin_surface_3/test/Skin_surface_3/makefile
Skin_surface_3/test/Skin_surface_3/msgs.txt
Skin_surface_3/test/Skin_surface_3/subdivision_test
Spatial_sorting/test/Spatial_sorting/CMakeLists.txt
Spatial_sorting/test/Spatial_sorting/cgal_test_with_cmake
Stream_lines_2/demo/Stream_lines_2/*.exe
Stream_lines_2/demo/Stream_lines_2/*.sln
Stream_lines_2/demo/Stream_lines_2/*.vcproj
@ -1186,12 +1237,17 @@ Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/error.txt
Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/poisson_reconstruction_test
Surface_reconstruction_points_3/test/Surface_reconstruction_points_3/release
Testsuite/test/myrun_testsuite_with_cmake
Triangulation_2/CMakeLists.txt
Triangulation_2/cgal_test_with_cmake
Triangulation_2/demo/Triangulation_2/*.exe
Triangulation_2/demo/Triangulation_2/Makefile
Triangulation_2/demo/Triangulation_2/constrained
Triangulation_2/demo/Triangulation_2/constrained_delaunay_triangulation_2
Triangulation_2/demo/Triangulation_2/delaunay_triangulation_2
Triangulation_2/demo/Triangulation_2/regular_triangulation_2
Triangulation_2/examples/Triangulation_2/CMakeLists.txt
Triangulation_2/examples/Triangulation_2/cgal_test_with_cmake
Triangulation_2/examples/Triangulation_2/regular
Triangulation_2/test/Triangulation_2/*.exe
Triangulation_2/test/Triangulation_2/CMakeLists.txt
Triangulation_2/test/Triangulation_2/Makefile
@ -1205,13 +1261,18 @@ Triangulation_2/test/Triangulation_2/test_const_triang_plus_2
Triangulation_2/test/Triangulation_2/test_constrained_triangulation_2
Triangulation_2/test/Triangulation_2/test_delaunay_hierarchy_2
Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_2
Triangulation_2/test/Triangulation_2/test_delaunay_triangulation_proj
Triangulation_2/test/Triangulation_2/test_regular_hierarchy_2
Triangulation_2/test/Triangulation_2/test_regular_triangulation_2
Triangulation_2/test/Triangulation_2/test_structural_filtering_traits
Triangulation_2/test/Triangulation_2/test_triangulation_2
Triangulation_2/test/Triangulation_2/test_triangulation_2_bis
Triangulation_2/test/Triangulation_2/test_triangulation_geom_traits
Triangulation_2/test/Triangulation_2/test_triangulation_tds
Triangulation_2/test/Triangulation_2/vrml_tds*
Triangulation_3/benchmark/Triangulation_3/CMakeLists.txt
Triangulation_3/benchmark/Triangulation_3/cgal_test_with_cmake
Triangulation_3/benchmark/Triangulation_3/simple
Triangulation_3/examples/Triangulation_3/*.exe
Triangulation_3/examples/Triangulation_3/CMakeLists.txt
Triangulation_3/examples/Triangulation_3/adding_handles_3
@ -1247,6 +1308,7 @@ Triangulation_3/test/Triangulation_3/makefile
Triangulation_3/test/Triangulation_3/test_delaunay_3
Triangulation_3/test/Triangulation_3/test_delaunay_hierarchy_3
Triangulation_3/test/Triangulation_3/test_delaunay_hierarchy_3_old
Triangulation_3/test/Triangulation_3/test_dt_deterministic_3
Triangulation_3/test/Triangulation_3/test_regular_3
Triangulation_3/test/Triangulation_3/test_regular_as_delaunay_3
Triangulation_3/test/Triangulation_3/test_regular_remove_3

View File

@ -95,10 +95,10 @@ for which the class \ccc{AABB_tree<AT>} may receive a distance query.
\ccMethod{Closest_point closest_point_object();}{Returns the closest point constructor.}
\ccHasModels
\ccc{AABB_traits<GeomTraits,TrianglePrimitive>}.
\ccc{AABB_traits<GeomTraits,Primitive>}.
\ccSeeAlso
\ccc{AABB_traits<GeomTraits,TrianglePrimitive>}\\
\ccc{AABB_traits<GeomTraits,Primitive>}\\
\ccc{AABB_tree<AT>}
\ccc{AABBPrimitive}

View File

@ -60,8 +60,8 @@ public:
static Scalar scalar_factor(const NT& a, Field_tag) {
return (a == NT(0)) ? NT(0) : NT(1);
}
static Scalar scalar_factor(const NT& a,
const Scalar& d,
static Scalar scalar_factor(const NT& /* a */,
const Scalar& /* d */,
Integral_domain_tag) {
return Scalar(1);
}

View File

@ -13,17 +13,13 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
endif()
endif()
find_package(CGAL QUIET COMPONENTS Core)
find_package(CGAL QUIET COMPONENTS Core MPFI)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include( CGAL_VersionUtils )
find_package( MPFI )
if( MPFI_FOUND )
include( ${MPFI_USE_FILE} )
endif( MPFI_FOUND )
include_directories (BEFORE ../../include)

View File

@ -479,7 +479,6 @@ inline
convert_to_bfi(const internal::Algebraic_real_d_1< Coefficient_, Rational_, HandlePolicy, AlgebraicRealRep_d_1 >& x){
typedef typename Get_arithmetic_kernel<Coefficient_>::Arithmetic_kernel AT;
typedef typename AT::Bigfloat_interval BFI;
typedef internal::Algebraic_real_d_1< Coefficient_, Rational_, HandlePolicy, AlgebraicRealRep_d_1 > ALG;
if (x.is_rational()) return convert_to_bfi(x.rational());

View File

@ -1051,7 +1051,7 @@ public:
* of the isolated polynomial
*
*/
virtual bool is_certainly_simple_root(int i) const {
virtual bool is_certainly_simple_root(int /* i */) const {
return false;
}
@ -1060,7 +1060,7 @@ public:
* of the isolated polynomial
*
*/
virtual bool is_certainly_multiple_root(int i) const {
virtual bool is_certainly_multiple_root(int /* i */) const {
return false;
}
@ -1230,7 +1230,7 @@ public:
* has at most one multiple root over the complex numbers, the roots are
* certainly isolated with success.
*/
Bitstream_descartes(M_k_descartes_tag ,
Bitstream_descartes(M_k_descartes_tag /* t */,
Polynomial f,int m,int k,
Bitstream_descartes_rndl_tree_traits traits
= Bitstream_descartes_rndl_tree_traits(),
@ -1244,7 +1244,7 @@ public:
}
Bitstream_descartes(M_k_descartes_tag t,
Bitstream_descartes(M_k_descartes_tag /* t */,
Polynomial f,int m,int k,
Bitstream_tree tree,
Bitstream_descartes_rndl_tree_traits traits
@ -1299,7 +1299,7 @@ public:
*
*/
template<typename InputIterator>
Bitstream_descartes(Vert_line_adapter_descartes_tag t,
Bitstream_descartes(Vert_line_adapter_descartes_tag /* t */,
InputIterator begin,
InputIterator end,
Bitstream_descartes_rndl_tree_traits traits)

View File

@ -1405,7 +1405,7 @@ public:
if (!is_certainly_zero) ub_log2 = Ceil_log2_abs()(x);
return true; // reported bound is tight
}
bool improve_upper_bound(NT x, long&, bool&) { return true; }
bool improve_upper_bound(NT, long&, bool&) { return true; }
};
/*! \ingroup NiX_Bitstream_descartes_tree

View File

@ -796,8 +796,6 @@ private:
CGAL_precondition(x.is_rational());
Bound r = x.rational();
typedef typename CGAL::Fraction_traits<Poly_coer_1> FT;
int k = degree_of_local_gcd(event_indices(i).fg,x);
Polynomial_2 sres = subresultants(k);
@ -1957,7 +1955,7 @@ create_slice_from_slice_info(size_type id,
switch(it->first) {
case(CGAL::internal::FIRST_CURVE): {
if(event_flag) {
arc_container.push_back(std::make_pair(0,it->second));
arc_container.push_back(Arc_pair(0,it->second));
} else {
int_container.push_back(0);
}
@ -1965,7 +1963,7 @@ create_slice_from_slice_info(size_type id,
}
case(CGAL::internal::SECOND_CURVE): {
if(event_flag) {
arc_container.push_back(std::make_pair(1,it->second));
arc_container.push_back(Arc_pair(1,it->second));
} else {
int_container.push_back(1);
}
@ -1973,7 +1971,7 @@ create_slice_from_slice_info(size_type id,
}
case(CGAL::internal::INTERSECTION): {
CGAL_assertion(event_flag);
arc_container.push_back(std::make_pair(2,it->second));
arc_container.push_back(Arc_pair(2,it->second));
break;
}
case(CGAL::internal::CANDIDATE): {

View File

@ -265,7 +265,6 @@ private:
void intern_decompose( Polynomial P_, ::CGAL::Tag_true){
typename FT_poly::Decompose decompose;
typedef typename FT_poly::Numerator_type Numerator_poly;
typedef typename Numerator_poly::NT Coeff;
typename FT_poly::Numerator_type NumP;
typename FT_poly::Denominator_type dummy;

View File

@ -290,7 +290,7 @@ private:
// X-coordinate of the shear of p
Bound x_sheared(Point p,Integer sh) {
return p.first-s*p.second;
return p.first-sh*p.second;
}
Bound x_sheared(Bound x,Bound y,Integer sh) {
return x-sh*y;

View File

@ -268,12 +268,16 @@ public:
Algebraic_real_1 y() const {
typedef std::vector< Algebraic_real_1 > Roots;
typedef typename Curve_analysis_2::Status_line_1 Key;
typedef Roots Data;
typedef std::map< Key, Data, CGAL::Handle_id_less_than< Key > >
Y_root_map;
// EBEB 2012-07-05 deactivated map for y-roots for not being used
// typedef typename Curve_analysis_2::Status_line_1 Key;
// EBEB 2012-07-05 deactivated map for y-roots for not being used
// typedef Roots Data;
// EBEB 2012-07-05 deactivated map for y-roots for not being used
// typedef std::map< Key, Data, CGAL::Handle_id_less_than< Key > >
// Y_root_map;
static Y_root_map y_root_map;
// EBEB 2012-07-05 deactivated map for y-roots for not being used
//static Y_root_map y_root_map;
if (!this->ptr()->_m_y) {
@ -287,8 +291,9 @@ public:
typename Curve_analysis_2::Status_line_1 line =
curve().status_line_at_exact_x(x());
typename Y_root_map::iterator yit =
y_root_map.find(line);
// EBEB 2012-07-05 deactivated map for y-roots for not being used
//typename Y_root_map::iterator yit =
// y_root_map.find(line);
// TODO: Cache resultant computation
// exacus-related code shouldn't be used here

View File

@ -232,10 +232,6 @@ namespace for_zero_test_bivariate {
template<typename Poly_coer_1,typename Polynomial_1>
void cast_back_utcf(const Poly_coer_1& p,Polynomial_1& q) {
// We can assume that both template arguments are polynomial types
typedef typename CGAL::Polynomial_traits_d<Poly_coer_1>::Coefficient_type
Coercion_type;
typedef typename CGAL::Polynomial_traits_d<Polynomial_1>::Coefficient_type
Coefficient;
typedef CGAL::Fraction_traits<Poly_coer_1> FT;
CGAL_static_assertion((::boost::is_same<typename FT::Is_fraction,
CGAL::Tag_true>::value));
@ -275,8 +271,8 @@ template<typename AlgebraicCurveKernel_2>
bool result;
typedef typename AlgebraicCurveKernel_2::Polynomial_1 Polynomial_1;
#if !CGAL_ACK_USE_NO_REDUCTION_MODULO_RESULTANT
typedef typename AlgebraicCurveKernel_2::Algebraic_real_1 Algebraic_real_1;
//typedef typename AlgebraicCurveKernel_2::Algebraic_real_1 Algebraic_real_1;
typedef typename AlgebraicCurveKernel_2::Bound Bound;
typedef typename AlgebraicCurveKernel_2::Coefficient Coefficient;
typedef typename AlgebraicCurveKernel_2::Polynomial_2 Polynomial_2;
@ -285,8 +281,6 @@ template<typename AlgebraicCurveKernel_2>
typedef typename Coercion::Type Coercion_type;
typedef typename CGAL::Polynomial_traits_d<Polynomial_2>
::template Rebind<Coercion_type,1>::Other::Type Poly_coer_1;
typedef typename CGAL::Polynomial_traits_d<Polynomial_2>
::template Rebind<Coercion_type,2>::Other::Type Poly_coer_2;
typename Coercion::Cast cast;

View File

@ -99,7 +99,6 @@ int descartes(Polynomial& p, const Field& low,const Field& high){
*/
template <class Polynomial, class Field>
bool refine_zero_against(Field& low, Field& high, Polynomial p, Polynomial q) {
typedef typename Polynomial::NT COEFF;
typename Algebraic_structure_traits<Field>::Simplify simplify;
CGAL_precondition(low < high);

View File

@ -24,7 +24,14 @@
#include <CGAL/Polynomial_type_generator.h>
#include <CGAL/RS/functors_1.h>
template <class _C,class _G=CGAL::Rsgcd_1>
template <class _C,
class _G=
#ifdef CGAL_RS_USE_UGCD
CGAL::Modgcd_1
#else
CGAL::Rsgcd_1
#endif
>
struct Algebraic_kernel_rs_1{
typedef _C Coefficient;

View File

@ -25,11 +25,19 @@
namespace CGAL{
#if CGAL_USE_RS3
inline
bool operator<(const Algebraic_1 &n1,const Algebraic_1 &n2){
typedef CGAL::Rsgcd_1 Gcd;
return(CGAL::RS_COMPARE::compare_1<Gcd>(n1,n2)==SMALLER);
}
#else
inline
bool operator<(const Algebraic_1 &n1,const Algebraic_1 &n2){
typedef CGAL::Cgalgcd_1 Gcd;
return(CGAL::RS_COMPARE::compare_1<Gcd>(n1,n2)==SMALLER);
}
#endif
inline
bool operator==(const Algebraic_1 &n1,const Algebraic_1 &n2){

View File

@ -19,13 +19,18 @@
#ifndef CGAL_RS_POLYNOMIAL_1_UTILS_H
#define CGAL_RS_POLYNOMIAL_1_UTILS_H
#include <CGAL/basic.h>
#include <gmp.h>
#include <rs3_fncts.h>
#include <CGAL/RS/polynomial_1.h>
#include <CGAL/RS/polynomial_converter.h>
#include <CGAL/RS/solve_1.h>
#include <CGAL/RS/ugcd.h>
#ifdef CGAL_RS_USE_UGCD
#include <CGAL/RS/ugcd/ugcd.h>
#endif
#include <rs_exports.h>
#ifdef CGAL_USE_RS3
#include <rs3_fncts.h>
#endif
namespace CGAL{
@ -64,6 +69,7 @@ public std::binary_function<RS_polynomial_1,RS_polynomial_1,RS_polynomial_1>{
}
};
#ifdef CGAL_RS_USE_UGCD
// my modular gcd algorithm
struct Modgcd_1:
public std::binary_function<RS_polynomial_1,RS_polynomial_1,RS_polynomial_1>{
@ -85,6 +91,7 @@ public std::binary_function<RS_polynomial_1,RS_polynomial_1,RS_polynomial_1>{
return *result;
}
};
#endif // CGAL_RS_USE_UGCD
// Cont()(c,u) stores in c the gcd of the coefficients of u
struct Cont:

View File

@ -0,0 +1,114 @@
// Copyright (c) 2007 Inria Lorraine (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; either version 3 of the License,
// or (at your option) any later version.
//
// 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: Luis Peñaranda <luis.penaranda@gmx.com>
#ifndef CGAL_RS__CRT_H
#define CGAL_RS__CRT_H
#include "pp.h"
#include <gmp.h>
#include <vector>
#include <boost/multi_array.hpp>
namespace CGAL{
namespace RS_MGCD{
class Crt:public Prime_polynomial{
protected:
// chinese remainder torture (GCL, page 180)
static
void cra(mpz_ptr r,CGALRS_PN * m,CGALRS_PN *u,int n){
int k,i;
CGALRS_PN product,temp;
std::vector<CGALRS_PN> v(n);
v[0]=u[0];
for(k=1;k<n;++k){
p_set_prime(m[k]);
// step 1, gamma_k is p_inv(product)
product=p_convert(m[0]);
for(i=1;i<k;++i)
//product=p_mul(product,p_convert(m[i]));
product=p_mulc(product,m[i]);
// step 2
temp=p_convert(v[k-1]);
for(i=k-2;i>=0;--i)
//temp=p_add(p_convert(v[i]),p_mul(temp,p_convert(m[i])));
temp=p_mulcaddc(temp,m[i],v[i]);
//v[k]=p_mul(p_sub(p_convert(u[k]),temp),p_inv(product));
v[k]=p_convsubdiv(u[k],temp,product);
}
// step 3: operations are done in Zm, not in Z
CGALRS_mpz_set_spn(r,p_pntospn(v[n-1]));
for(k=n-2;k>=0;--k){
CGALRS_mpz_mul_pn(r,r,m[k]);
CGALRS_mpz_add_pn(r,r,v[k]);
}
return;
};
// polynomial chinese remainder algorithm, it is the same:
// m are the modules, and m has size size_y, p is the residue
// vector and also has size size_y, but every one of its elements
// has size size_x (which will be de degree of the output
// polynomial);
// size_y is what is called n in the book
static
void pcra(mpz_t *r,
CGALRS_PN *m,
std::vector<CGALRS_PN* > p,
int size_x,
int size_y){
typedef boost::multi_array<CGALRS_PN,2> pn_matrix;
typedef pn_matrix::index pn_matrix_index;
pn_matrix v(boost::extents[size_x+1][size_y]);
pn_matrix_index i,j,k;
CGALRS_PN product,temp;
for(j=0;j<=size_x;++j){
v[j][0]=p[0][j];
for(k=1;k<size_y;++k){
p_set_prime(m[k]);
// step 1, gamma_k is p_inv(product)
product=p_convert(m[0]);
for(i=1;i<k;++i)
product=p_mulc(product,m[i]);
// step 2
temp=p_convert(v[j][k-1]);
for(i=k-2;i>=0;--i)
temp=p_mulcaddc(temp,m[i],v[j][i]);
v[j][k]=p_convsubdiv(p[k][j],temp,product);
}
}
// step 3
// be careful: operations are done in Zm, not in Z
for(j=0;j<=size_x;++j){
CGALRS_mpz_set_spn(r[j],p_pntospn(v[j][size_y-1]));
for(k=size_y-2;k>=0;--k){
CGALRS_mpz_mul_pn(r[j],r[j],m[k]);
CGALRS_mpz_add_pn(r[j],r[j],v[j][k]);
}
}
};
}; // class Crt
} // namespace RS_MGCD
} // namespace CGAL
#endif // CGAL_RS__CRT_H

View File

@ -0,0 +1,75 @@
// Copyright (c) 2007-2008 Inria Lorraine (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; either version 3 of the License,
// or (at your option) any later version.
//
// 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: Luis Peñaranda <luis.penaranda@gmx.com>
#ifndef CGAL_RS__INVERSE_H
#define CGAL_RS__INVERSE_H
#ifdef _MSC_VER
# define CGALRS_S64 __int64
# define CGALRS_U64 unsigned __int64
# define CGALRS_U32 unsigned __int32
#else
# include <stdint.h>
# define CGALRS_S64 int64_t
# define CGALRS_U64 uint64_t
# define CGALRS_U32 uint32_t
#endif
namespace CGAL{
namespace RS_MGCD{
#define CGALRS_N(A) (A<0?-A:A)
//#define CGALRS_U(A) (A<0?-1:1)
#define CGALRS_U(A,C) (A<0?(C<0?1:-1):(C<0?-1:1))
class Inverse{
protected:
// given a and b, returns s such that gcd(a,b)=s*a+t*b (GCL, page 36)
// s*a+t*q=1 => s is the inverse of a, mod q (pafe 173)
static CGALRS_S64 eea_s(CGALRS_U32 a,CGALRS_U32 b){
CGALRS_S64 c1,d1,r1;//,c2,d2,r2,t,s;
CGALRS_U32 r,c,d;//,q;
// a and b are positive, so a=CGALRS_N(a) and b=CGALRS_N(b)
//c=CGALRS_N(a); d=CGALRS_N(b);
c=a; d=b;
c1=1; d1=0;
//c2=0; d2=1;
while(d){
//q=c/d;
r=c%d;
r1=c1-d1*(c/d); //r2=c2-d2*q;
c=d; c1=d1; //c2=d2;
d=r; d1=r1; //d2=r2;
}
// gcd(a,b) is CGALRS_N(c)
//t=c2/(CGALRS_U(b)*CGALRS_U(c));
// a and c are always positive, so s=c1/CGALRS_U(a,c) equals c1
//s=c1/CGALRS_U(a,c);
//return s;
return c1;
};
}; // class Inverse
#undef CGALRS_N
#undef CGALRS_U
} // namespace RS_MGCD
} // namespace CGAL
#endif // CGAL_RS__INVERSE_H

View File

@ -0,0 +1,148 @@
// Copyright (c) 2007-2008 Inria Lorraine (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; either version 3 of the License,
// or (at your option) any later version.
//
// 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: Luis Peñaranda <luis.penaranda@gmx.com>
#ifndef CGAL_RS__P_H
#define CGAL_RS__P_H
#include <CGAL/RS/basic.h>
#include "inverse.h"
namespace CGAL{
namespace RS_MGCD{
// CGALRS_PN size is 32 bits, the sizes of CGALRS_LPN and CGALRS_SPN must be,
// at least, as twice as the size of CGALRS_PN
#define CGALRS_PN_BITS 32
#define CGALRS_PN CGALRS_U32 // unsigned
#define CGALRS_LPN CGALRS_U64 // unsigned long long
#define CGALRS_SPN CGALRS_S64 // long long
#define CGALRS_mpz_set_pn(A,PN) mpz_set_ui(A,(unsigned long)(PN))
#define CGALRS_mpz_mul_pn(A,B,PN) mpz_mul_ui(A,B,(unsigned long)(PN))
#define CGALRS_mpz_add_pn(A,B,PN) mpz_add_ui(A,B,(unsigned long)(PN))
#define CGALRS_mpz_sub_pn(A,B,PN) mpz_sub_ui(A,B,(unsigned long)(PN))
#define CGALRS_mpz_set_spn(A,SPN) mpz_set_si(A,(long)(SPN))
#define CGALRS_mpz_add_spn(A,B,SPN) \
(SPN<0?CGALRS_mpz_sub_pn(A,B,-(SPN)):CGALRS_mpz_add_pn(A,B,(SPN)))
#define CGALRS_mpz_mul_spn(A,B,SPN) mpz_mul_si(A,B,SPN)
CGALRS_THREAD_ATTR CGALRS_PN prime; class Prime:public Inverse{
protected:
static CGALRS_SPN p_pntospn(CGALRS_PN p){
if(p>(prime-1)/2)
return (CGALRS_SPN)p-prime;
return (CGALRS_SPN)p;
};
static void p_set_prime(CGALRS_PN p){prime=p;};
static CGALRS_PN p_prime(){return prime;};
static CGALRS_PN p_add(CGALRS_PN a,CGALRS_PN b){
CGALRS_LPN c=(CGALRS_LPN)a+b;
return (c<prime?(CGALRS_PN)c:(CGALRS_PN)(c-prime));
};
static CGALRS_PN p_sub(CGALRS_PN a,CGALRS_PN b){
return (a<b?prime-(b-a):a-b);
};
// returns a*b-c*d
static CGALRS_PN p_submuls(CGALRS_PN a,CGALRS_PN b,CGALRS_PN c,CGALRS_PN d){
CGALRS_LPN mul;
CGALRS_PN pnm1,pnm2;
mul=(CGALRS_LPN)a*b;
pnm1=(mul<prime?(CGALRS_PN)mul:(CGALRS_PN)(mul%prime));
mul=(CGALRS_LPN)c*d;
pnm2=(mul<prime?(CGALRS_PN)mul:(CGALRS_PN)(mul%prime));
return (pnm1<pnm2?prime-(pnm2-pnm1):pnm1-pnm2);
};
static CGALRS_PN p_inv(CGALRS_PN a){
CGALRS_SPN c=eea_s(a,prime);
return(c<0?(CGALRS_PN)(c+prime):(CGALRS_PN)c);
};
static CGALRS_PN p_convert(CGALRS_PN a){
return (a<prime?a:a%prime);
};
// define p_mul(A,B) ((CGALRS_PN)(((CGALRS_LPN)A*B)%p_prime()))
static CGALRS_PN p_mul(CGALRS_PN a,CGALRS_PN b){
CGALRS_LPN c=(CGALRS_LPN)a*b;
return (CGALRS_PN)(c<prime?c:c%prime);
};
static CGALRS_PN p_mul3(CGALRS_PN a,CGALRS_PN b,CGALRS_PN c){
CGALRS_LPN d;
if((d=(CGALRS_LPN)a*b)<prime)
d*=c;
else
d=(d%prime)*c;
return (CGALRS_PN)(d<prime?d:d%prime);
};
// returns a*conv(b)
static CGALRS_PN p_mulc(CGALRS_PN a,CGALRS_PN b){
CGALRS_LPN temp=(CGALRS_LPN)a*(b<prime?b:b%prime);
return (temp<prime?(CGALRS_PN)temp:(CGALRS_PN)(temp%prime));
};
// returns a*conv(b)+conv(c)
static CGALRS_PN p_mulcaddc(CGALRS_PN a,CGALRS_PN b,CGALRS_PN c){
CGALRS_LPN temp=(CGALRS_LPN)a*(b<prime?b:b%prime);
temp=(temp<prime?temp:temp%prime)+(c<prime?c:c%prime);
return (temp<prime?(CGALRS_PN)temp:(CGALRS_PN)(temp-prime));
};
// returns (conv(a)-b)*inv(c)
static CGALRS_PN p_convsubdiv(CGALRS_PN a,CGALRS_PN b,CGALRS_PN c){
CGALRS_SPN inv_c=eea_s(c,prime);
CGALRS_PN pninv_c=(inv_c<0?(CGALRS_PN)(inv_c+prime):(CGALRS_PN)inv_c);
CGALRS_PN conv_a=(a<prime?a:a%prime);
CGALRS_LPN mult=
(CGALRS_LPN)(conv_a<b?prime-(b-conv_a):conv_a-b)*pninv_c;
return (CGALRS_PN)(mult<prime?mult:mult%prime);
};
// vzGG, p. 73
static CGALRS_PN p_pow(CGALRS_PN a,CGALRS_PN n){
CGALRS_PN b,i;
i=1<<(CGALRS_PN_BITS-1);
while(!(i&n))
i>>=1;
b=a;
while(i>>=1)
b=(i&n?p_mul3(b,b,a):p_mul(b,b));
return b;
};
#define CGALRS_P_DIV(A,B) (p_mul(A,p_inv(B)))
static CGALRS_PN p_gcd(CGALRS_PN a,CGALRS_PN b){
if(!b)
return a;
return p_gcd(b,a%b);
};
}; // class Prime
} // namespace RS_MGCD
} // namespace CGAL
#endif // CGAL_RS__P_H

View File

@ -0,0 +1,169 @@
// Copyright (c) 2007 Inria Lorraine (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; either version 3 of the License,
// or (at your option) any later version.
//
// 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: Luis Peñaranda <luis.penaranda@gmx.com>
#ifndef CGAL_RS__PAGEALLOC_H
#define CGAL_RS__PAGEALLOC_H
#include <cstdlib>
#include <cstring>
namespace CGAL{
namespace RS_MGCD{
#define CGALRS_PAGESIZE 4194304
#define CGALRS_TABLESIZE 2048
#define CGALRS_PAGES 8
#define CGALRS_VOIDSCAST unsigned long
struct pinfo{
void *start;
size_t size;
};
CGALRS_THREAD_ATTR void** pages_startptr;
CGALRS_THREAD_ATTR size_t pages_max;//=CGALRS_PAGES;
CGALRS_THREAD_ATTR size_t pages_allocated;
CGALRS_THREAD_ATTR size_t pages_current;
CGALRS_THREAD_ATTR size_t page_remainingbytes;
CGALRS_THREAD_ATTR void* page_currentptr;
CGALRS_THREAD_ATTR struct pinfo *nodes_allocated;
CGALRS_THREAD_ATTR size_t nodes_total;
CGALRS_THREAD_ATTR size_t nodes_assigned;
class Page_alloc{
protected:
static
void* meminit(){
pages_startptr=(void**)malloc(CGALRS_PAGES*sizeof(void*));
pages_startptr[0]=malloc(CGALRS_PAGESIZE);
pages_allocated=1;
pages_current=0;
page_remainingbytes=CGALRS_PAGESIZE;
page_currentptr=pages_startptr[0];
nodes_total=CGALRS_TABLESIZE;
nodes_allocated=
(struct pinfo*)malloc(CGALRS_TABLESIZE*sizeof(struct pinfo));
nodes_assigned=0;
return page_currentptr;
};
static
void* newpage(){
void *r;
if(pages_allocated>pages_current+1){
++pages_current;
r=pages_startptr[pages_current];
page_currentptr=r;
page_remainingbytes=CGALRS_PAGESIZE;
return r;
}
// iso c++ forbids to initialize a static member (pages_max),
// so we have to start using pages_max when the amount of
// allocated pages reaches the value CGALRS_PAGES (this is not of
// course the cleanest way to do it)
if(pages_allocated==CGALRS_PAGES)
pages_max=2*CGALRS_PAGES;
else
pages_max=0;
if(pages_allocated==pages_max){
pages_max*=2;
pages_startptr=
(void**)realloc(pages_startptr,pages_max*sizeof(void*));
}
r=malloc(CGALRS_PAGESIZE);
pages_startptr[pages_allocated]=r;
page_currentptr=r;
++pages_allocated;
page_remainingbytes=CGALRS_PAGESIZE;
return r;
};
// if they ask us to allocate a memory size bigger than the page,
// we are lost (we could in that case make a bigger page)
static
void* palloc(size_t size){
void* r;
if(size>page_remainingbytes){
newpage();
return palloc(size);
}
if(nodes_assigned==nodes_total){
nodes_total*=2;
nodes_allocated=(struct pinfo*)realloc
(nodes_allocated,nodes_total*sizeof(struct pinfo));
}
page_remainingbytes-=size;
r=page_currentptr;
page_currentptr=(void*)((CGALRS_VOIDSCAST)page_currentptr+size);
// c++ does not support nodes_allocated[nodes_assigned]={r,s}
nodes_allocated[nodes_assigned].start=r;
nodes_allocated[nodes_assigned].size=size;
++nodes_assigned;
return r;
};
static
void* prealloc(void *ptr,size_t size){
void *dest;
size_t i=0;
while(nodes_allocated[i].start!=ptr)
++i;
if(nodes_allocated[i].size<size){
dest=palloc(size);
nodes_allocated[i].start=dest;
nodes_allocated[i].size=size;
return memcpy(dest,ptr,nodes_allocated[i].size);
}
return ptr;
};
#define CGALRS_PFREE(X) {}
//void CGALRS_PFREE(void* ptr){
// size_t i=0;
// while(nodes_allocated[i].start!=ptr)
// ++i;
// nodes_allocated[i].start=0;
// return;
//};
static
void* memclear(){
pages_current=0;
page_remainingbytes=CGALRS_PAGESIZE;
page_currentptr=pages_startptr[0];
nodes_assigned=0;
return page_currentptr;
}
static
void memrelease(){
size_t i;
for(i=0;i<pages_allocated;++i)
free(pages_startptr[i]);
return;
};
}; // class Page_alloc
} // namespace RS_MGCD
} // namespace CGAL
#endif // CGAL_RS__PAGEALLOC_H

View File

@ -0,0 +1,135 @@
// Copyright (c) 2007 Inria Lorraine (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; either version 3 of the License,
// or (at your option) any later version.
//
// 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: Luis Peñaranda <luis.penaranda@gmx.com>
#ifndef CGAL_RS__PP_H
#define CGAL_RS__PP_H
#include <gmp.h>
#include "p.h"
#include "pagealloc.h"
#include <cstdio>
namespace CGAL{
namespace RS_MGCD{
class Prime_polynomial:public Prime,public Page_alloc{
protected:
static
int pp_from_poly(CGALRS_PN *pp,mpz_t *poly,int n){
int i;
if(!(pp[n]=mpz_fdiv_ui(poly[n],p_prime())))
return -1;
for(i=0;i<n;++i)
pp[i]=mpz_fdiv_ui(poly[i],p_prime());
return n;
};
static
void pp_out_str(FILE *stream,CGALRS_PN* pp,int n){
int i;
for(i=n;i;--i)
fprintf(stream,"%d*x^%d+",pp[i],i);
fprintf(stream,"%d",pp[0]);
return;
};
// Knuth 2; m>=n
static
int pp_pdivrem(CGALRS_PN *r,CGALRS_PN *u,int m,CGALRS_PN *v,int n){
int k,j;
for(k=0;k<=m;++k)
r[k]=u[k];
// division p. 402
//for(k=m-n;k>=0;--k)
// for(j=n+k-1;j>=k;--j)
// r[j]=p_sub(r[j],p_mul(qk,v[j-k]));
// pseudo-division, p. 407
for(k=m-n;k>=0;--k)
for(j=n+k-1;j>=0;--j)
//r[j]=p_sub(
// p_mul(v[n],r[j]),
// p_mul(r[n+k],(j<k?0:v[j-k])));
r[j]=p_submuls(v[n],r[j],r[n+k],(j<k?0:v[j-k]));
--n;
while(!r[n]&&n)
--n;
return n;
};
static
CGALRS_PN pp_pp(CGALRS_PN *pp,CGALRS_PN *p,int dp){
int i;
CGALRS_PN inv,cont=p[dp];
for(i=0;i<dp;++i)
cont=p_gcd(cont,p[i]);
inv=p_inv(cont);
for(i=0;i<=dp;++i)
pp[i]=p_mul(p[i],inv);
return cont;
};
// GCL, page 280; da>=db
static
int pp_gcd(CGALRS_PN *g,CGALRS_PN *a,int da,CGALRS_PN *b,int db){
CGALRS_PN *r0,*r1,*r2;
int i,d0,d1,d2;
d0=da;
r0=(CGALRS_PN*)palloc((1+da)*sizeof(CGALRS_PN));
//for(i=0;i<=da;++i)
// r0[i]=a[i];
pp_pp(r0,a,da);
d1=db;
r1=(CGALRS_PN*)palloc((1+da)*sizeof(CGALRS_PN));
//for(i=0;i<=db;++i)
// r1[i]=b[i];
pp_pp(r1,b,db);
r2=(CGALRS_PN*)palloc((1+da)*sizeof(CGALRS_PN));
d2=pp_pdivrem(r2,r0,d0,r1,d1);
while(d2){
for(i=0;i<=d1;++i)
r0[i]=r1[i];
d0=d1;
//for(i=0;i<=d2;++i)
// r1[i]=r2[i];
pp_pp(r1,r2,d2);
d1=d2;
d2=pp_pdivrem(r2,r0,d0,r1,d1);
}
if(!r2[0]){
//CGALRS_PN inv=p_inv(r1[d1]);
//g[d1]=1;
//for(i=0;i<d1;++i)
// g[i]=p_mul(inv,r1[i]);
for(i=0;i<=d1;++i)
g[i]=r1[i];
}else{
d1=0;
g[0]=1;
}
CGALRS_PFREE(r0);
CGALRS_PFREE(r1);
CGALRS_PFREE(r2);
return d1;
};
}; // class Prime_polynomial
} // namespace RS_MGCD
} // namespace CGAL
#endif // CGAL_RS__PP_H

View File

@ -0,0 +1,142 @@
// Copyright (c) 2007-2008 Inria Lorraine (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; either version 3 of the License,
// or (at your option) any later version.
//
// 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: Luis Peñaranda <luis.penaranda@gmx.com>
#ifndef CGAL_RS__PRIMES_H
#define CGAL_RS__PRIMES_H
#include "crt.h"
// I borrowed these numbers from Fabrice, this leaves us around 250000 primes
#define CGALRS_PR_MIN 2145338339
#define CGALRS_PR_MAX 2147483647
//#define CGALRS_PR_IS_PRIME(N) (pr_fermat(N)?pr_is_prime_bruteforce(N):0)
#define CGALRS_PR_IS_PRIME(N) pr_mrj(N)
#ifdef _MSC_VER
# define CGAL_RS_RANDOM rand
#else
# define CGAL_RS_RANDOM random
#endif
namespace CGAL{
namespace RS_MGCD{
CGALRS_THREAD_ATTR CGALRS_PN currentprime;
class Primes:public Crt{
private:
static int pr_is_prime_bruteforce(CGALRS_PN n){
int i,sqrtn;
sqrtn=(CGALRS_PN)(sqrt((double)n));
for(i=3;i<=sqrtn;++i)
if(!(n%i))
return 0;
return 1;
}
// vzGG, p. 507; returns 0 if n is composite
static int pr_fermat(CGALRS_PN n){
p_set_prime(n);
return(p_pow(2+((CGALRS_PN)CGAL_RS_RANDOM())%(n-4),n-1)==1);
}
// Solovay-Strassen
static int pr_ss(CGALRS_PN n){
CGALRS_PN a,x;
p_set_prime(n);
a=1+(CGALRS_PN)CGAL_RS_RANDOM()%(n-2);
x=CGALRS_P_DIV(a,n);
return(!x||p_pow(a,n>>1)!=x);
}
// Miller-Rabin
static int pr_mr(CGALRS_PN n){
CGALRS_PN s,d,a,x,r;
s=1;
d=(n-1)>>1;
while(!(d&1)){
++s;
d=d>>1;
}
p_set_prime(n);
a=2+(CGALRS_PN)CGAL_RS_RANDOM()%(n-4);
x=p_pow(a,d);
if(x==1||x==n-1)
return 1; // pobably prime
for(r=1;r<s;++r){
x=p_mul(x,x);
if(x==1)
return 0; // composite
if(x==n-1)
return 1; // probably
}
return 0; // composite
}
// Miller-Rabin-Jaeschke
static int pr_mrj(CGALRS_PN n){
CGALRS_PN s,d,a[3],r;//,x;
int index;
a[0]=2;
a[1]=7;
a[2]=61;
s=1;
d=(n-1)>>1;
while(!(d&1)){
++s;
d=d>>1;
}
p_set_prime(n);
index=-1;
start_test:
++index;
//if(index=3)
if(index==3)
return 1; // prime
if(p_pow(a[index],d)==1)
goto start_test;
for(r=0;r<s;++r)
if(p_pow(a[index],(d<<r))==n-1)
goto start_test;
return 0; // composite
}
static CGALRS_PN pr_actual(){
return currentprime;
}
protected:
static int pr_init(){
currentprime=CGALRS_PR_MIN;
return 0;
}
static CGALRS_PN pr_next(){
do{
currentprime+=2;
}while(!CGALRS_PR_IS_PRIME(currentprime));
return currentprime;
}
}; // class Primes
} // namespace RS_MGCD
} // namespace CGAL
#endif // CGAL_RS__PRIMES_H

View File

@ -0,0 +1,197 @@
// Copyright (c) 2007 Inria Lorraine (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; either version 3 of the License,
// or (at your option) any later version.
//
// 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: Luis Peñaranda <luis.penaranda@gmx.com>
#ifndef CGAL_RS__UGCD_H
#define CGAL_RS__UGCD_H
#include <gmp.h>
#include "primes.h"
// let's assume that 300 is enough for degree 500 gcds
#define CGALRS_MOD_QTY 300
namespace CGAL{
namespace RS_MGCD{
class Ugcd:public Primes{
public:
static int ugcd (mpz_t *gcd,mpz_t *Anp,int degA,mpz_t *Bnp,int degB){
mpz_t *A,*B;
mpz_t lcgcd,cA,cB;
mpz_ptr m,bound;
// dG is initialized to zero only to avoid compiler complaints
int dA,dB,dG=0,maxd,i,maxA,maxB;
size_t modsize,modalloc;
std::vector<CGALRS_PN* > p;
CGALRS_PN *mA,*mB,*mG,*mod;
CGALRS_PN lc=0,scaleG;
if(degB>degA){
if(!degA){
mpz_set_ui(gcd[0],1);
return 0;
}else
return ugcd(gcd,Bnp,degB,Anp,degA);
}
if(!degB){
mpz_set_ui(gcd[0],1);
return 0;
}
// initialize the memory
meminit();
A=(mpz_t*)malloc((1+degA)*sizeof(mpz_t));
B=(mpz_t*)malloc((1+degB)*sizeof(mpz_t));
mpz_init_set(cA,Anp[degA]);
for(i=0;i<degA;++i)
mpz_gcd(cA,cA,Anp[i]);
mpz_init_set(cB,Bnp[degB]);
for(i=0;i<degB;++i)
mpz_gcd(cB,cB,Bnp[i]);
for(i=0;i<=degA;++i){
mpz_init(A[i]);
mpz_divexact(A[i],Anp[i],cA);
}
for(i=0;i<=degB;++i){
mpz_init(B[i]);
mpz_divexact(B[i],Bnp[i],cB);
}
// calculate the gcd of the principal coefficients
mpz_init(lcgcd);
mpz_gcd(lcgcd,A[degA],B[degB]);
// find the limit of modular image computation
maxA=degA;
for(i=0;i<degA;++i)
if(mpz_cmpabs(A[i],A[maxA])>0)
maxA=i;
maxB=degB;
for(i=0;i<degB;++i)
if(mpz_cmpabs(B[i],B[maxB])>0)
maxB=i;
mpz_pow_ui(cA,A[maxA],2);
mpz_mul_ui(cA,cA,degA+1);
mpz_mul_2exp(cA,cA,2*degA);
mpz_sqrt(cA,cA);
mpz_pow_ui(cB,B[maxB],2);
mpz_mul_ui(cB,cB,degB+1);
mpz_mul_2exp(cB,cB,2*degB);
mpz_sqrt(cB,cB);
if(mpz_cmp(cA,cB)<0){
bound=(mpz_ptr)cA;
m=(mpz_ptr)cB;
}else{
bound=(mpz_ptr)cB;
m=(mpz_ptr)cA;
}
mpz_mul(bound,bound,lcgcd);
mpz_mul_2exp(bound,bound,1);
mpz_setbit(bound,0);
mA=(CGALRS_PN*)palloc((1+degA)*sizeof(CGALRS_PN));
mB=(CGALRS_PN*)palloc((1+degB)*sizeof(CGALRS_PN));
maxd=degA; // we know that degA>=degB
mG=(CGALRS_PN*)palloc((1+maxd)*sizeof(CGALRS_PN));
pr_init();
mpz_set_ui(m,1);
mod=(CGALRS_PN*)palloc(CGALRS_MOD_QTY*sizeof(CGALRS_PN));
modalloc=CGALRS_MOD_QTY;
modsize=0;
while(mpz_cmp(m,bound)<=0){
do{
p_set_prime(pr_next());
dA=pp_from_poly(mA,A,degA);
if(dA!=-1){
dB=pp_from_poly(mB,B,degB);
if(dB!=-1)
lc=mpz_fdiv_ui(lcgcd,p_prime());
// lc is the image of the principal coefficient
}
}while(dA==-1||dB==-1||!lc
||mpz_divisible_ui_p(A[degA],p_prime())
||mpz_divisible_ui_p(B[degB],p_prime()));
// now we calculate the gcd mod p_prime
dG=pp_gcd(mG,mA,degA,mB,degB);
scaleG=CGALRS_P_DIV(lc,mG[dG]);
mG[dG]=lc;
for(i=0;i<dG;++i)
mG[i]=p_mul(mG[i],scaleG);
if(!dG){ // done, we know that the gcd is constant
mpz_set_ui(gcd[0],1);
dG=0;
goto cleanandexit;
}
if(dG<maxd){
CGALRS_mpz_set_pn(m,p_prime());
maxd=dG;
p.clear();
p.push_back(mG);
mod[0]=p_prime();
modsize=1;
mG=(CGALRS_PN*)palloc((1+maxd)*sizeof(CGALRS_PN));
// TODO: clean the CGALRS_PN* that are in p
}else{
if(dG==maxd){
CGALRS_mpz_mul_pn(m,m,p_prime());
if(modsize==modalloc){
modalloc*=2;
mod=(CGALRS_PN*)
prealloc(mod,modalloc*sizeof(CGALRS_PN));
}
mod[modsize]=p_prime();
++modsize;
p.push_back(mG);
mG=(CGALRS_PN*)palloc((1+maxd)*sizeof(CGALRS_PN));
}
}
}
pcra(gcd,mod,p,maxd,modsize);
cleanandexit:
CGALRS_PFREE(mA);
CGALRS_PFREE(mB);
CGALRS_PFREE(mG);
CGALRS_PFREE(mod);
// TODO: clean the CGALRS_PN* that are in p
for(i=0;i<=degA;++i)
mpz_clear(A[i]);
for(i=0;i<=degB;++i)
mpz_clear(B[i]);
mpz_clear(m);
mpz_clear(bound);
mpz_clear(lcgcd);
free(A);
free(B);
memrelease();
return dG;
};
}; // class Ugcd
} // namespace RS_MGCD
} // namespace CGAL
#endif // CGAL_RS__UGCD_H

View File

@ -1,6 +1,5 @@
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.
# Created by the script cgal_create_CMakeLists
# This is the CMake script for compiling a set of CGAL applications.
project( Algebraic_kernel_d_test )
@ -13,51 +12,59 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
endif()
endif()
find_package(CGAL QUIET COMPONENTS Core )
# CGAL and its components
find_package( CGAL QUIET COMPONENTS Core MPFI RS3)
if ( CGAL_FOUND )
if ( NOT CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
include( CGAL_VersionUtils )
find_package( MPFI )
if( MPFI_FOUND )
include( ${MPFI_USE_FILE} )
endif( MPFI_FOUND )
find_package( RS )
if( RS_FOUND )
include( ${RS_USE_FILE} )
endif( RS_FOUND )
include_directories (BEFORE ../../include)
include_directories (BEFORE include)
create_single_source_cgal_program( "Algebraic_curve_kernel_2.cpp" )
create_single_source_cgal_program( "algebraic_curve_kernel_2_tools.cpp" )
create_single_source_cgal_program( "Algebraic_kernel_d_1_LEDA.cpp" )
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_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" )
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()
message(STATUS "This program requires the CGAL library, and will not be compiled.")
message(STATUS "This project requires the CGAL library, and will not be compiled.")
return()
endif()
# include helper file
include( ${CGAL_USE_FILE} )
include( CGAL_CreateSingleSourceCGALProgram )
# Boost and its components
find_package( Boost REQUIRED )
if ( NOT Boost_FOUND )
message(STATUS "This project requires the Boost library, and will not be compiled.")
return()
endif()
# include for local directory
include_directories( BEFORE include )
# include for local package
include_directories( BEFORE ../../include )
# Creating entries for all .cpp/.C files with "main" routine
# ##########################################################
include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "Algebraic_curve_kernel_2.cpp" )
create_single_source_cgal_program( "algebraic_curve_kernel_2_tools.cpp" )
create_single_source_cgal_program( "Algebraic_kernel_d_1_LEDA.cpp" )
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_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" )
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()

View File

@ -208,7 +208,7 @@ void test_algebraic_kernel_1(const AlgebraicKernel_d_1& ak_1){
typedef std::vector<std::pair<Algebraic_real_1,unsigned int> > ROOTS;
ROOTS roots;
Polynomial_1 p1 = (x-1)*(x-2)*(x-2);
std::back_insert_iterator<ROOTS> biit =
// std::back_insert_iterator<ROOTS> biit =
solve_1(p1,std::back_inserter(roots));
Algebraic_real_1 ar = roots[1].first;
Polynomial_1 p2 = compute_polynomial_1(ar);
@ -355,25 +355,21 @@ void test_algebraic_kernel_1(const AlgebraicKernel_d_1& ak_1){
ss>>CGAL::iformat(alg2); \
assert(alg1==alg2)
const typename Algebraic_kernel_d_1::Construct_algebraic_real_1 construct_algreal_1 =
ak_1.construct_algebraic_real_1_object();
Algebraic_real_1 alg1,alg2;
std::stringstream ss;
CGAL::set_ascii_mode(ss);
// test construction from int, Coefficient and Bound
CGAL_TEST_ALGEBRAIC_REAL_IO(construct_algreal_1(int(2)));
CGAL_TEST_ALGEBRAIC_REAL_IO(construct_algreal_1(Coefficient(2)));
CGAL_TEST_ALGEBRAIC_REAL_IO(construct_algreal_1(Bound(2)));
CGAL_TEST_ALGEBRAIC_REAL_IO(construct_algebraic_real_1(int(2)));
CGAL_TEST_ALGEBRAIC_REAL_IO(construct_algebraic_real_1(Coefficient(2)));
CGAL_TEST_ALGEBRAIC_REAL_IO(construct_algebraic_real_1(Bound(2)));
// construction by index
Polynomial_1 x = CGAL::shift(Polynomial_1(1),1); // the monom x
CGAL_TEST_ALGEBRAIC_REAL_IO(construct_algreal_1(x*x-2,1));
CGAL_TEST_ALGEBRAIC_REAL_IO(construct_algebraic_real_1(x*x-2,1));
// construction by isolating interval
CGAL_TEST_ALGEBRAIC_REAL_IO(construct_algreal_1(x*x-2,Bound(0),Bound(2)));
CGAL_TEST_ALGEBRAIC_REAL_IO(construct_algebraic_real_1(x*x-2,Bound(0),Bound(2)));
#undef CGAL_TEST_ALGEBRAIC_REAL_IO
}
}

View File

@ -14,14 +14,16 @@ if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
endif()
find_package(CGAL QUIET COMPONENTS Core )
find_package(CGAL QUIET COMPONENTS Core GMP MPFR MPFI)
if ( CGAL_FOUND )
include( ${CGAL_USE_FILE} )
include( CGAL_VersionUtils )
find_package( MPFI )
IS_VERSION_LESS("${CGAL_GMP_VERSION}" "4.2.0" _IS_GMP_VERSION_TO_LOW)
get_dependency_version( GMP )
IS_VERSION_LESS("${GMP_VERSION}" "4.2.0" _IS_GMP_VERSION_TO_LOW)
include_directories(../../include)
include_directories(include)

View File

@ -34,3 +34,11 @@ 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.
Version~4.1 introduces a revised implementation of the point location class
via a randomized incremental construction of the trapezoidal map.
The old class was implemented by Oren Nechushtan, while the revamp
was done by Michal Kleinbort and Michael Hemmer. The new class adds support
for unbounded curves and can now guarantee logarithmic query time in all
cases.

View File

@ -126,13 +126,14 @@ choosing points on a grid, are also available; see the
Reference Manual for more details.
%
\item \ccc{Arr_trapezoid_ric_point_location<Arrangement>} implements
Mulmuley's point-location algorithm~\cite{m-fppa-90} (see
a point location algorithm presented by Seidel~\cite{s-sfira-91}, which uses the
randomized incremental construction described by Mulmuley~\cite{m-fppa-90} (see
also~\cite[Chapter~6]{bkos-cgaa-00}). The
arrangement faces are decomposed into simpler cells of constant
complexity known as {\em pseudo-trapezoids} and a search-structure
(a directed acyclic graph) is constructed on top of these cells,
allowing to locate the pseudo-trapezoid (hence the arrangement
cell) containing a query point in expected logarithmic time.
cell) containing a query point in logarithmic time.
\end{itemize}
The main advantage of the first two strategies is that they do not
@ -152,19 +153,35 @@ On the other hand, the landmarks and the trapezoid RIC strategies
require auxiliary data structures on top of the arrangement, which
they need to construct once they are attached to an arrangement
object and need to keep up-to-date as this arrangement changes.
The data structures needed by both strategies can be constructed
The data structure needed by the landmarks strategy can be constructed
in $O(N \log N)$ time (where $N$ is the overall number of edges in
the arrangement),
but the construction needed by the landmark algorithm is in
practice significantly faster. In addition, although both
the arrangement), whereas the construction of the data structure needed
by the trapezoid RIC strategy takes expected $O(N \log N)$, but
may require several rebuilds. As shown in~\cite{hkh-iiplgtds-12}, one can
expect only a small number of rebuilds.
In practice, the construction needed by the landmark algorithm is
significantly faster.
In addition, although both
resulting data structures are asymptotically linear in size, the
\kdtree\ that the landmark algorithm stores needs significantly
less memory. We note that Mulmuley's algorithm guarantees a
logarithmic query time, while the query time for the landmark
strategy is only logarithmic on average --- and we may have
scenarios where the query time can be linear. In practice however,
less memory.
We note that the trapezoid RIC algorithm guarantees a
logarithmic query time for any scenario
making it advantageous comparing to other strategies.
The query time of the landmarks strategy, on the other hand,
is only logarithmic on average --- and we may have
scenarios where the query time can be linear.
In practice, in many scenarios
the query times of both strategies are competitive. For a detailed
experimental comparison, see \cite{cgal:hh-eplca-05}
experimental comparison, see \cite{hh-esplp-08}.
Another advantageous feature of the trapezoid RIC strategy
when compared with other methods
is the unbounded curves support.
Currently, this is the most efficient strategy
suitable for general unbounded subdivisions.
The main drawback in the current implementation of the landmark
strategy, compared to the trapezoidal RIC strategy, is that while
@ -181,12 +198,14 @@ support these extra operations.
It is therefore recommended to use the
\ccc{Arr_landmarks_point_location} class when the application
frequently issues point-location queries on an
arrangement that only seldom changes. If the arrangement is more
frequently issues point-location queries on a bounded
arrangement that only seldom changes. If the arrangement
consists of unbounded curves or is more
dynamic and is frequently going through changes, the
\ccc{Arr_trapezoid_ric_point_location} class should be the
selected point-location strategy.
\subsubsection{An Example\label{arr_sssec:pl_ex}}
%~~~~~~~~~~~~~~~~~~~~~~~~~
@ -270,7 +289,7 @@ void vertical_ray_shooting_query
typename Arrangement_on_surface_2::Halfedge_const_handle e;
typename Arrangement_on_surface_2::Face_const_handle f;
std::cout << "Shooting up from " << q << " : ";
std::cout << "Shooting up from " << q << " : ";
if (CGAL::assign (e, obj)) \{
// We hit an edge:
std::cout << "hit an edge: " << e->curve() << std::endl;
@ -285,8 +304,8 @@ void vertical_ray_shooting_query
else if (CGAL::assign (f, obj)) \{
// We did not hit anything:
CGAL_assertion (f->is_unbounded());
std::cout << "hit nothing." << std::endl;
std::cout << "hit nothing." << std::endl;
\}
else \{
CGAL_assertion_msg (false, "Invalid object.");

View File

@ -18,11 +18,12 @@ The \ccRefName\ class implements the incremental randomized algorithm
introduced by Mulmuley~\cite{m-fppa-90} as presented by
Seidel~\cite{s-sfira-91} (see also~\cite[Chapter~6]{bkos-cgaa-00}).
It subdivides each arrangement face to pseudo-trapezoidal cells, each
of constant complexity, and constructs and maintains a search
of constant complexity, and constructs and maintains a linear-size search
structure on top of these cells, such that each query can be answered
in $O(\log n)$ time, where $n$ is the complexity of the arrangement.
Constructing the search structures takes $O(n \log n)$ time, such that
Constructing the search structures takes $O(n \log n)$ expected time
and may require a small number of rebuilds~\cite{hkh-iiplgtds-12}. Therefore
attaching a trapezoidal point-location object to an existing arrangement
may incur some overhead in running times. In addition, the point-location
object needs to keep its auxiliary data structures up-to-date as the
@ -31,12 +32,30 @@ to use this point-location strategy for static arrangements (or arrangement
that do not alter frequently), and when the number of issued queries
is relatively large.
This strategy supports arbitrary subdivisions, including unbounded ones.
\ccInclude{CGAL/Arr_trapezoid_ric_point_location.h}
\ccIsModel
\ccc{ArrangementPointLocation_2} \\
\ccc{ArrangementVerticalRayShoot_2}
\ccCreation
\ccCreationVariable{pl}
%---------------------
\ccConstructor{Arr_trapezoid_ric_point_location (bool with_guarantees = true);}
{If with\_guarantees is set to true, the cunstruction performs rebuilds in order to guarantee a resulting structure with linear size and logarithmic query time. Otherwise the structure has expected linear size and expected logarithmic query time.}
\ccConstructor{Arr_trapezoid_ric_point_location (const Arrangement& arr, bool with_guarantees = true);}
{Constructs a point location search structure for the given arrangement. If with\_guarantees is set to true, the cunstruction performs rebuilds in order to guarantee a resulting structure with linear size and logarithmic query time. Otherwise the structure has expected linear size and expected logarithmic query time.}
\ccModifiers
%===========
\ccMethod{void with_guarantees (bool with_guarantees);}
{If with\_guarantees is set to true, the structure will guarantee linear size and logarithmic query time, that is, this function may cause a reconstruction of the data structure. }
\end{ccRefClass}
\ccRefPageEnd

View File

@ -0,0 +1,20 @@
#ifndef ARR_INEXACT_CONSTRUCTION_SEGMENTS_H
#define ARR_INEXACT_CONSTRUCTION_SEGMENTS_H
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Arr_non_caching_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT Number_type;
typedef CGAL::Arr_non_caching_segment_traits_2<Kernel> Traits;
typedef Traits::Point_2 Point;
typedef Traits::X_monotone_curve_2 Segment;
typedef CGAL::Arrangement_2<Traits> Arrangement;
typedef Arrangement::Vertex_handle Vertex_handle;
typedef Arrangement::Halfedge_handle Halfedge_handle;
typedef Arrangement::Face_handle Face_handle;
#endif

View File

@ -1,62 +1,39 @@
//! \file examples/Arrangement_on_surface_2/isolated_vertices.cpp
// Constructing an arrangement with isolated vertices.
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include "arr_inexact_construction_segments.h"
#include "arr_print.h"
typedef int Number_type;
typedef CGAL::Simple_cartesian<Number_type> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::X_monotone_curve_2 Segment_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
typedef Arrangement_2::Vertex_handle Vertex_handle;
typedef Arrangement_2::Halfedge_handle Halfedge_handle;
typedef Arrangement_2::Face_handle Face_handle;
int main ()
int main()
{
Arrangement_2 arr;
// Insert isolated points.
Arrangement arr;
Face_handle uf = arr.unbounded_face();
arr.insert_in_face_interior(Point(3, 3), uf);
arr.insert_in_face_interior(Point(1, 5), uf);
arr.insert_in_face_interior(Point(5, 5), uf);
// Insert some isolated points:
Face_handle uf = arr.unbounded_face();
Vertex_handle u1 = arr.insert_in_face_interior (Point_2 (3, 3), uf);
Vertex_handle u2 = arr.insert_in_face_interior (Point_2 (1, 5), uf);
Vertex_handle u3 = arr.insert_in_face_interior (Point_2 (5, 5), uf);
// Insert four segments that form a square-shaped face.
Point p1(1, 3), p2(3, 5), p3(5, 3), p4(3, 1);
Segment s1(p1, p2), s2(p2, p3), s3(p3, p4), s4(p4, p1);
// Insert four segments that form a rectangular face:
Segment_2 s1 (Point_2 (1, 3), Point_2 (3, 5));
Segment_2 s2 (Point_2 (3, 5), Point_2 (5, 3));
Segment_2 s3 (Point_2 (5, 3), Point_2 (3, 1));
Segment_2 s4 (Point_2 (3, 1), Point_2 (1, 3));
Halfedge_handle e1 = arr.insert_in_face_interior (s1, uf);
Halfedge_handle e1 = arr.insert_in_face_interior(s1, uf);
Vertex_handle v1 = e1->source();
Vertex_handle v2 = e1->target();
Halfedge_handle e2 = arr.insert_from_left_vertex (s2, v2);
Halfedge_handle e2 = arr.insert_from_left_vertex(s2, v2);
Vertex_handle v3 = e2->target();
Halfedge_handle e3 = arr.insert_from_right_vertex (s3, v3);
Halfedge_handle e3 = arr.insert_from_right_vertex(s3, v3);
Vertex_handle v4 = e3->target();
Halfedge_handle e4 = arr.insert_at_vertices (s4, v4, v1);
arr.insert_at_vertices(s4, v4, v1);
// Remove the isolated vertices located in the unbounded face.
Arrangement_2::Vertex_iterator curr_v, next_v;
for (curr_v = arr.vertices_begin();
curr_v != arr.vertices_end(); curr_v = next_v)
{
// Store an iterator to the next vertex (as we may delete curr_v and
// invalidate the iterator).
next_v = curr_v;
++next_v;
if (curr_v->is_isolated() && curr_v->face() == uf)
arr.remove_isolated_vertex (curr_v);
Arrangement::Vertex_iterator curr, next = arr.vertices_begin();
for (curr = next++; curr != arr.vertices_end(); curr = next++) {
// Keep an iterator to the next vertex, as curr might be deleted.
if (curr->is_isolated() && curr->face() == uf)
arr.remove_isolated_vertex(curr);
}
print_arrangement (arr);
print_arrangement(arr);
return 0;
}

View File

@ -1,46 +1,26 @@
//! \file examples/Arrangement_on_surface_2/special_edge_insertion.cpp
// Constructing an arrangement using the specialized edge-insertion functions.
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Arr_segment_traits_2.h>
#include <CGAL/Arrangement_2.h>
#include "arr_inexact_construction_segments.h"
#include "arr_print.h"
typedef int Number_type;
typedef CGAL::Simple_cartesian<Number_type> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2;
typedef Traits_2::Point_2 Point_2;
typedef Traits_2::X_monotone_curve_2 Segment_2;
typedef CGAL::Arrangement_2<Traits_2> Arrangement_2;
typedef Arrangement_2::Vertex_handle Vertex_handle;
typedef Arrangement_2::Halfedge_handle Halfedge_handle;
int main ()
int main()
{
Arrangement_2 arr;
Point p0(3, 3), p1(1, 3), p2(3, 5), p3(5, 3), p4(3, 1);
Segment s1(p1, p2), s2(p2, p3), s3(p3, p4), s4(p4, p1);
Segment s5(p1, p0), s6(p0, p3), s7(p4, p0), s8(p0, p2);
Point_2 p0 (3, 3);
Point_2 p1 (1, 3), p2 (3, 5), p3 (5, 3), p4 (3, 1);
Segment_2 s1 (p1, p2);
Segment_2 s2 (p2, p3);
Segment_2 s3 (p3, p4);
Segment_2 s4 (p4, p1);
Segment_2 s5 (p1, p0);
Segment_2 s6 (p0, p3);
Segment_2 s7 (p4, p0);
Segment_2 s8 (p0, p2);
Arrangement arr;
Vertex_handle v0 = arr.insert_in_face_interior(p0, arr.unbounded_face());
Halfedge_handle e1 = arr.insert_in_face_interior(s1, arr.unbounded_face());
Halfedge_handle e2 = arr.insert_from_left_vertex(s2, e1);
Halfedge_handle e3 = arr.insert_from_right_vertex(s3, e2);
Halfedge_handle e4 = arr.insert_at_vertices(s4, e3, e1->twin());
Halfedge_handle e5 = arr.insert_at_vertices(s5, e1->twin(), v0);
Halfedge_handle e6 = arr.insert_at_vertices(s6, e5, e3->twin());
arr.insert_at_vertices(s7, e4->twin(), e6->twin());
arr.insert_at_vertices(s8, e5, e2->twin());
Vertex_handle v0 = arr.insert_in_face_interior (p0, arr.unbounded_face());
Halfedge_handle e1 = arr.insert_in_face_interior (s1, arr.unbounded_face());
Halfedge_handle e2 = arr.insert_from_left_vertex (s2, e1);
Halfedge_handle e3 = arr.insert_from_right_vertex (s3, e2);
Halfedge_handle e4 = arr.insert_at_vertices (s4, e3, e1->twin());
Halfedge_handle e5 = arr.insert_at_vertices (s5, e1->twin(), v0);
Halfedge_handle e6 = arr.insert_at_vertices (s6, e5, e3->twin());
Halfedge_handle e7 = arr.insert_at_vertices (s7, e4->twin(), e6->twin());
Halfedge_handle e8 = arr.insert_at_vertices (s8, e5, e2->twin());
print_arrangement (arr);
print_arrangement(arr);
return 0;
}

View File

@ -65,7 +65,7 @@ public:
// Copy constructor
Arr_algebraic_segment_traits_2 (const Self& s) { /* No state...*/}
Arr_algebraic_segment_traits_2 (const Self& /* s */) { /* No state...*/}
// Assignement operator
const Self& operator= (const Self& s)
@ -312,21 +312,29 @@ public:
segs.push_back(it_seg.trim(start.get(),end.get()));
}
if(left_on_arc && (!right_on_arc)) {
if(!it_seg.is_finite(CGAL::ARR_MAX_END) ||
!equal(start.get(),right(it_seg))) {
X_monotone_curve_2 split1,split2;
it_seg.split(start.get(),split1,split2);
segs.push_back(split2);
if(!it_seg.is_finite(CGAL::ARR_MAX_END) ||
!equal(start.get(),right(it_seg))) {
if(it_seg.is_finite(CGAL::ARR_MIN_END) && equal(start.get(),left(it_seg))) {
segs.push_back(it_seg);
} else {
X_monotone_curve_2 split1,split2;
it_seg.split(start.get(),split1,split2);
segs.push_back(split2);
}
}
}
if((!left_on_arc) && right_on_arc) {
if(!it_seg.is_finite(CGAL::ARR_MIN_END) ||
! equal(left(it_seg),end.get())) {
X_monotone_curve_2 split1,split2;
it_seg.split(end.get(),split1,split2);
segs.push_back(split1);
if(it_seg.is_finite(CGAL::ARR_MAX_END) && equal(end.get(),right(it_seg))) {
segs.push_back(it_seg);
} else {
X_monotone_curve_2 split1,split2;
it_seg.split(end.get(),split1,split2);
segs.push_back(split1);
}
}
}
}
if( (!left_on_arc) && (!right_on_arc)) {
segs.push_back(it_seg);
}

View File

@ -42,12 +42,12 @@ namespace CGAL {
* and the value-type of OutputIterator is pair<Point_2,Object>, where
* the Object represents the arrangement feature containing the points.
*/
template<class GeomTraits, class TopTraits,
class PointsIterator, class OutputIterator>
OutputIterator locate
(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
PointsIterator points_begin, PointsIterator points_end,
OutputIterator oi)
template<typename GeomTraits, typename TopTraits,
typename PointsIterator, typename OutputIterator>
OutputIterator
locate(const Arrangement_on_surface_2<GeomTraits, TopTraits>& arr,
PointsIterator points_begin, PointsIterator points_end,
OutputIterator oi)
{
// Arrangement types:
typedef Arrangement_on_surface_2<GeomTraits, TopTraits> Arr;
@ -68,41 +68,31 @@ OutputIterator locate
// Go over all arrangement edges and collect their associated x-monotone
// curves. To each curve we attach a halfedge handle going from right to
// left.
std::vector<Bpl_x_monotone_curve_2> xcurves_vec (arr.number_of_edges());
std::vector<Bpl_x_monotone_curve_2> xcurves_vec(arr.number_of_edges());
Edge_const_iterator eit;
Halfedge_const_handle he;
unsigned int i = 0;
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit, ++i)
{
for (eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) {
// Associate each x-monotone curve with the halfedge that represent it
// that is directed from right to left.
if (eit->direction() == ARR_RIGHT_TO_LEFT)
he = eit;
else
he = eit->twin();
xcurves_vec[i] = Bpl_x_monotone_curve_2 (eit->curve(), he);
Halfedge_const_handle he =
(eit->direction() == ARR_RIGHT_TO_LEFT) ? eit : eit->twin();
xcurves_vec[i++] = Bpl_x_monotone_curve_2(eit->curve(), he);
}
// Go over all isolated vertices and collect their points. To each point
// we attach its vertex handle.
std::vector<Bpl_point_2> iso_pts_vec (arr.number_of_isolated_vertices());
std::vector<Bpl_point_2> iso_pts_vec(arr.number_of_isolated_vertices());
Vertex_const_iterator vit;
Vertex_const_handle iso_v;
i = 0;
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit, ++i)
{
if (vit->is_isolated())
{
iso_v = vit;
iso_pts_vec[i] = Bpl_point_2 (vit->point(), iso_v);
for (vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {
if (vit->is_isolated()) {
Vertex_const_handle iso_v = vit;
iso_pts_vec[i++] = Bpl_point_2(vit->point(), iso_v);
}
}
// Obtain a extended traits-class object.
GeomTraits *geom_traits = const_cast<GeomTraits*> (arr.geometry_traits());
GeomTraits* geom_traits = const_cast<GeomTraits*>(arr.geometry_traits());
/* We would like to avoid copy construction of the geometry traits class.
* Copy construction is undesired, because it may results with data
@ -121,16 +111,16 @@ OutputIterator locate
ex_traits(*geom_traits);
// Define the sweep-line visitor and perform the sweep.
Bpl_visitor visitor (&arr, &oi);
Bpl_visitor visitor(&arr, &oi);
Basic_sweep_line_2<typename Bpl_visitor::Traits_2,
Bpl_visitor,
typename Bpl_visitor::Subcurve,
typename Bpl_visitor::Event>
sweep_line (&ex_traits, &visitor);
sweep_line(&ex_traits, &visitor);
sweep_line.sweep (xcurves_vec.begin(), xcurves_vec.end(), // Curves.
iso_pts_vec.begin(), iso_pts_vec.end(), // Action points.
points_begin, points_end); // Query points.
sweep_line.sweep(xcurves_vec.begin(), xcurves_vec.end(), // Curves.
iso_pts_vec.begin(), iso_pts_vec.end(), // Action points.
points_begin, points_end); // Query points.
return (oi);
}

View File

@ -151,7 +151,7 @@ public:
* arrangement (a vertex, halfedge, or face handle).
* \return The nearest landmark point.
*/
virtual Point_2 closest_landmark (Point_2 p, Object &obj)
virtual Point_2 closest_landmark (const Point_2& p, Object &obj)
{
CGAL_assertion(updated);
return (nn.find_nearest_neighbor(p, obj));

View File

@ -128,18 +128,14 @@ protected:
// Create N random landmarks. If N was not given to the constructor,
// set it to be the number of vertices in the arrangement.
CGAL::Random random;
double px, py;
unsigned int i;
if (num_landmarks == 0)
num_landmarks = arr->number_of_vertices();
for (i = 0; i < num_landmarks; i++)
{
px = random.get_double(x_min, x_max);
py = random.get_double(y_min, y_max);
points.push_back (Point_2 (px, py));
CGAL::Random random;
for (unsigned int i = 0; i < num_landmarks; ++i) {
double px = (x_min == x_max) ? x_min : random.get_double(x_min, x_max);
double py = (y_min == y_max) ? y_min : random.get_double(y_min, y_max);
points.push_back(Point_2 (px, py));
}
}

View File

@ -48,7 +48,7 @@ Object Arr_trapezoid_ric_point_location<Arrangement_2>
// typedef the Locate_type
typename TD::Locate_type td_lt;
const X_curve_plus& cv = td.locate(p,td_lt).top();
Td_map_item& tr = td.locate(p,td_lt);
CGAL_TRAP_PRINT_DEBUG("after td.locate");
@ -57,8 +57,10 @@ Object Arr_trapezoid_ric_point_location<Arrangement_2>
if (td_lt==TD::UNBOUNDED_TRAPEZOID)
{
CGAL_TRAP_PRINT_DEBUG("UNBOUNDED_TRAPEZOID");
Face_const_handle ubf = _get_unbounded_face(tr, p, Are_all_sides_oblivious_tag());
//check isolated vertices
Face_const_handle ubf = this->arrangement()->unbounded_face();
Isolated_vertex_const_iterator iso_verts_it;
for (iso_verts_it = ubf->isolated_vertices_begin();
iso_verts_it != ubf->isolated_vertices_end();
@ -73,54 +75,48 @@ Object Arr_trapezoid_ric_point_location<Arrangement_2>
return (CGAL::make_object (ubf));
}
Halfedge_const_handle h = cv.get_parent();
switch(td_lt)
{
case TD::POINT:
{
//p is interior so it should fall on Td_active_vertex
Td_active_vertex& v (boost::get<Td_active_vertex>(tr));
CGAL_TRAP_PRINT_DEBUG("POINT");
if (m_traits->equal_2_object()(h->target()->point(), p))
{
Vertex_const_handle vh = h->target();
return (CGAL::make_object (vh));
}
if (m_traits->equal_2_object()(h->source()->point(), p))
{
Vertex_const_handle vh = h->source();
return (CGAL::make_object (vh));
}
else
CGAL_error();
break;
CGAL_assertion(!v.vertex()->is_at_open_boundary());
return (CGAL::make_object(v.vertex()));
}
break;
case TD::CURVE:
{
Td_active_edge& e (boost::get<Td_active_edge>(tr));
Halfedge_const_handle h = e.halfedge();
CGAL_TRAP_PRINT_DEBUG("CURVE");
if ( m_traits->is_in_x_range_2_object()(cv,p) &&
m_traits->compare_y_at_x_2_object()(p,cv) == EQUAL)
return (CGAL::make_object(h));
else
if ( m_traits->is_in_x_range_2_object()(h->curve(),p) &&
m_traits->compare_y_at_x_2_object()(p,h->curve()) == EQUAL)
{
//ixx
std::cerr << "curve is: "<<cv<<" point is: "<<p <<std::endl;
CGAL_error();
return (CGAL::make_object(h));
}
break;
else
CGAL_error();
}
break;
case TD::TRAPEZOID:
{
Td_active_trapezoid t (boost::get<Td_active_trapezoid>(tr));
Halfedge_const_handle h = t.top();
CGAL_TRAP_PRINT_DEBUG("TRAPEZOID");
if (!(((m_traits->is_in_x_range_2_object()(h->curve(),p)) &&
(m_traits->compare_y_at_x_2_object()(p, h->curve()) == LARGER)) ==
(m_traits->compare_x_2_object()(h->source()->point(),
h->target()->point()) == SMALLER)
))
bool is_p_above_h = (m_traits->is_in_x_range_2_object()(h->curve(),p))
&& (m_traits->compare_y_at_x_2_object()
(p, h->curve()) == LARGER) ;
bool is_h_ltr = (h->direction() == ARR_LEFT_TO_RIGHT);
if (is_p_above_h != is_h_ltr) //if not, take the twin halfedge
{
h = h->twin();
Face_const_handle fh = h->face();
}
Face_const_handle fh = h->face();
//check isolated vertices
Isolated_vertex_const_iterator iso_verts_it;
for (iso_verts_it = fh->isolated_vertices_begin();
@ -135,6 +131,7 @@ Object Arr_trapezoid_ric_point_location<Arrangement_2>
return (CGAL::make_object(fh));
}
break;
default:
CGAL_TRAP_PRINT_DEBUG("DEFAULT");
CGAL_error();
@ -145,6 +142,113 @@ Object Arr_trapezoid_ric_point_location<Arrangement_2>
return Object();
}
/*! gets the unbounded face that contains the point when the trapezoid is unbounded
*/
template <class Arrangement>
typename Arr_trapezoid_ric_point_location<Arrangement>::Face_const_handle
Arr_trapezoid_ric_point_location<Arrangement>::
_get_unbounded_face(const Td_map_item& item, const Point_2& p,
Arr_all_sides_oblivious_tag) const
{
//there's only one unbounded face
return this->arrangement()->unbounded_faces_begin();
}
/*! gets the unbounded face that contains the point when the trapezoid
* is unbounded
*/
template <class Arrangement>
typename Arr_trapezoid_ric_point_location<Arrangement>::Face_const_handle
Arr_trapezoid_ric_point_location<Arrangement>::
_get_unbounded_face(const Td_map_item& item,const Point_2& p,
Arr_not_all_sides_oblivious_tag) const
{
Td_active_trapezoid tr (boost::get<Td_active_trapezoid>(item));
// Halfedge_const_handle h = tr.top();
if (!tr.is_on_top_boundary() || !tr.is_on_bottom_boundary()) {
//if one of top or bottom edges is defined
Halfedge_const_handle h =
(!tr.is_on_top_boundary()) ? tr.top() : tr.bottom();
bool is_p_above_h = (m_traits->is_in_x_range_2_object()(h->curve(),p)) &&
(m_traits->compare_y_at_x_2_object()(p, h->curve()) == LARGER);
bool is_h_ltr = (h->direction() == ARR_LEFT_TO_RIGHT);
if (is_p_above_h != is_h_ltr) //if not, take the twin halfedge
h = h->twin();
return h->face();
}
else if (!tr.is_on_left_boundary()) {
//if top & bottom edges are not defined but the left() curve end is defined
//there are different internal compiler errors if we
// typedef the Locate_type
typename TD::Locate_type td_lt;
//locate the degenerate trapezoid containing tr.left()
Td_map_item& left_v_item = td.locate(tr.left(),td_lt);
CGAL_assertion(td_lt == TD::POINT);
Halfedge_const_handle he;
if (boost::get<Td_active_vertex>(&left_v_item) != NULL) {
Td_active_vertex v(boost::get<Td_active_vertex>(left_v_item));
he = v.cw_he();
}
else {
Td_active_fictitious_vertex
v(boost::get<Td_active_fictitious_vertex>(left_v_item));
he = v.cw_he();
}
//cw_he() holds the "smallest" curve clockwise starting from 12 o'clock
CGAL_assertion_code(Halfedge_const_handle invalid_he);
CGAL_assertion(he != invalid_he);
//the Halfedge_handle source is left_ee.
// this way the face on it's left is the desired one
//MICHAL: maybe add a verification that the above occures
return he->face();
}
else if (!tr.is_on_right_boundary()) {
//if top, bottom, left edges are not defined but the right() curve end
// is defined
//there are different internal compiler errors if we
// typedef the Locate_type
typename TD::Locate_type td_lt;
//locate the degenerate trapezoid of tr.right().
Td_map_item& right_v_item = td.locate(tr.right(),td_lt);
CGAL_assertion(td_lt == TD::POINT);
Halfedge_const_handle he;
if (boost::get<Td_active_vertex>(&right_v_item)!= NULL) {
Td_active_vertex v(boost::get<Td_active_vertex>(right_v_item));
he = v.cw_he();
}
else {
Td_active_fictitious_vertex
v(boost::get<Td_active_fictitious_vertex>(right_v_item));
he = v.cw_he();
}
//its cw_he() holds the "smallest" curve clockwise starting from
// 12 o'clock
CGAL_assertion_code(Halfedge_handle invalid_he);
CGAL_assertion(he != invalid_he);
//the Halfedge_handle source is right_ee.
// this way the face on it's left is the desired one
//MICHAL: maybe add a verification that the above occures
return he->face();
}
//else, on all boundaries (top, bottom, left, right - are not defined),
// this is the only trapezoid in the map
return this->arrangement()->unbounded_faces_begin();
}
//-----------------------------------------------------------------------------
// Locate the arrangement feature which a vertical ray emanating from the
// given point hits, considering isolated vertices.
@ -157,57 +261,58 @@ Object Arr_trapezoid_ric_point_location<Arrangement>
typename TD::Locate_type td_lt;
Halfedge_const_handle invalid_he;
X_curve_plus cv = td.vertical_ray_shoot(p, td_lt, shoot_up);
Td_map_item& item = td.vertical_ray_shoot(p, td_lt, shoot_up);
// treat special case, where trapezoid is unbounded.
// for then get_parent() is not defined
if (td_lt==TD::UNBOUNDED_TRAPEZOID)
{
return (_check_isolated_for_vertical_ray_shoot(invalid_he, p, shoot_up));
return (_check_isolated_for_vertical_ray_shoot(invalid_he, p, shoot_up, item));
}
Halfedge_const_handle h = cv.get_parent();
switch(td_lt)
{
case TD::POINT:
if (m_traits->equal_2_object()(h->target()->point(), p))
{
Vertex_const_handle vh = h->target();
return (CGAL::make_object (vh));
//p fell on Td_active_vertex
Td_active_vertex& v (boost::get<Td_active_vertex>(item));
return (CGAL::make_object(v.vertex()));
}
if (m_traits->equal_2_object()(h->source()->point(), p))
{
Vertex_const_handle vh = h->source();
return (CGAL::make_object (vh));
}
else
CGAL_error();
break;
case TD::CURVE:
if ((shoot_up && h->direction() == ARR_LEFT_TO_RIGHT) ||
{
Td_active_edge& e (boost::get<Td_active_edge>(item));
Halfedge_const_handle h = e.halfedge();
if ((shoot_up && h->direction() == ARR_LEFT_TO_RIGHT) ||
(!shoot_up && h->direction() == ARR_RIGHT_TO_LEFT))
h=h->twin();
return (CGAL::make_object(h));
{
h=h->twin();
}
return (CGAL::make_object(h));
}
break;
case TD::TRAPEZOID:
if (!(((m_traits->is_in_x_range_2_object()(h->curve(),p)) &&
(m_traits->compare_y_at_x_2_object()(p, h->curve()) == LARGER)) ==
(m_traits->compare_x_2_object()(h->source()->point(),
h->target()->point()) == SMALLER)
))
{
Td_active_trapezoid trpz (boost::get<Td_active_trapezoid>(item));
Halfedge_const_handle h = (shoot_up) ? trpz.top() : trpz.bottom();
bool is_p_above_h = (m_traits->is_in_x_range_2_object()(h->curve(),p))
&& (m_traits->compare_y_at_x_2_object()
(p, h->curve()) == LARGER) ;
bool is_h_ltr = (h->direction() == ARR_LEFT_TO_RIGHT);
if (is_p_above_h != is_h_ltr) //if not, take the twin halfedge
h = h->twin();
return (_check_isolated_for_vertical_ray_shoot(h, p, shoot_up));
return (_check_isolated_for_vertical_ray_shoot(h, p, shoot_up, item));
}
break;
default:
{
CGAL_error();
}
break;
}
return (_check_isolated_for_vertical_ray_shoot(invalid_he, p, shoot_up));
return (_check_isolated_for_vertical_ray_shoot(invalid_he, p, shoot_up, item));
}
//-----------------------------------------------------------------------------
@ -219,7 +324,8 @@ template <class Arrangement>
Object Arr_trapezoid_ric_point_location<Arrangement>::
_check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found,
const Point_2& p,
bool shoot_up) const
bool shoot_up,
const Td_map_item& tr) const
{
const Comparison_result point_above_under = (shoot_up ? SMALLER : LARGER);
typename Geometry_traits_2::Compare_x_2 compare_x =
@ -238,7 +344,7 @@ _check_isolated_for_vertical_ray_shoot (Halfedge_const_handle halfedge_found,
// If the closest feature is a valid halfedge, take its incident face.
// Otherwise, take the unbounded face.
if (halfedge_found == invalid_he)
face = this->arrangement()->unbounded_face();
face = _get_unbounded_face(tr, p, Are_all_sides_oblivious_tag());
else
face = halfedge_found->face();

View File

@ -0,0 +1,292 @@
// 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
// 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 uactivese 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: svn+ssh://balasmic@scm.gforge.inria.fr/svn/cgal/branches/features/Arrangement_on_surface_2-RIC_pl_for_unbounded-balasmic/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_edge.h $
// $Id: Td_active_edge.h 65793 2011-10-10 17:04:38Z balasmic $
//
//
// Author(s) : Oren Nechushtan <theoren@math.tau.ac.il>
// updated by: Michal Balas <balasmic@post.tau.ac.il>
#ifndef CGAL_TD_ACTIVE_EDGE_H
#define CGAL_TD_ACTIVE_EDGE_H
/*! \file
* Defintion of the Td_active_edge<Td_traits> class.
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <boost/shared_ptr.hpp>
#ifdef CGAL_TD_DEBUG
#define CGAL_TD_INLINE
#else
#define CGAL_TD_INLINE inline
#endif
namespace CGAL {
/*! \class
* Implementation of a pseudo-trapezoid as two halfedges(top,bottom)
* and two curve-ends(left,right).
* Trapezoids are represented as two curve-ends called right and left and
* two halfedges called top and bottom. The curve-ends (points) lie on the
* right and left boundaries of the trapezoid respectively and the halfedges
* bound the trapezoid from above and below.
* There exist degenerate trapezoids called infinite trapezoid; this happens
* when one of the four sides is on the parameter space boundary.
* Trapezoids are created as active and become inactive when Remove() member
* function called.
* Each trapezoid has at most four neighbouring trapezoids.
* X_trapezoid structure can represent a real trapezoid, a Td-edge or an
* edge-end (end point).
*/
template <class Td_traits_>
class Td_active_edge : public Handle
{
public:
//type of traits class
typedef Td_traits_ Traits;
//type of point (Point_2)
typedef typename Traits::Point Point;
//type of X_monotone_curve_2
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
//type of Curve_end
typedef typename Traits::Curve_end Curve_end;
//type of Halfedge_const_handle (trapezoid edge)
typedef typename Traits::Halfedge_const_handle Halfedge_const_handle;
//type of Vertex_const_handle (trapezoid vertex)
typedef typename Traits::Vertex_const_handle Vertex_const_handle;
//type of Td_active_edge (Self)
typedef typename Traits::Td_active_edge Self;
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
//type of In face iterator
typedef typename TD::In_face_iterator In_face_iterator;
//type of Trapezoidal map search structure
typedef typename TD::Dag_node Dag_node;
//friend class declarations:
friend class Trapezoidal_decomposition_2<Traits>;
#ifdef CGAL_PM_FRIEND_CLASS
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#elif defined(__GNUC__)
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#else
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#endif
#else
friend class In_face_iterator;
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_active_edge<Td_traits_>;
public:
//c'tors
Data (Halfedge_const_handle _he,
const Td_map_item& _next,
Dag_node* _p_node)
: he(_he),next(_next),p_node(_p_node)
{ }
~Data() { }
protected:
Halfedge_const_handle he;
Td_map_item next;
Dag_node* p_node;
};
private:
Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG
#ifdef CGAL_PM_FRIEND_CLASS
protected:
#else
public: // workaround
#endif
#else //CGAL_TD_DEBUG
public:
#endif //CGAL_TD_DEBUG
//Dag_node* m_dag_node; //pointer to the search structure (DAG) node
/*! Initialize the trapezoid's neighbours. */
inline void init_neighbours(boost::optional<Td_map_item&> next)
{
set_next((next) ? *next : Td_map_item(0));
}
/*! Set the DAG node. */
CGAL_TD_INLINE void set_dag_node(Dag_node* p)
{
ptr()->p_node = p;
//m_dag_node = p;
//#ifdef CGAL_TD_DEBUG
//
// CGAL_assertion(!p || **p == *this);
//
//#endif
}
///*! Set the trapezoid's bottom (Halfedge_const_handle). */
CGAL_TD_INLINE void set_halfedge(Halfedge_const_handle he)
{
if (halfedge() != Traits::empty_he_handle() &&
halfedge()->direction() != he->direction())
{
ptr()->he = he->twin();
}
else
{
ptr()->he = he;
}
}
/*! Set next edge fragment. */
inline void set_next( const Td_map_item& next) { ptr()->next = next; }
public:
/// \name Constructors.
//@{
Td_active_edge ()
{
PTR = new Data
(Traits::empty_he_handle(), Td_map_item(0), NULL);
//m_dag_node = NULL;
}
/*! Constructor given Vertex & Halfedge handles. */
Td_active_edge (Halfedge_const_handle he ,
Dag_node* node = 0,
boost::optional<Td_map_item&> next = boost::none)
{
PTR = new Data(he, (next) ? *next : Td_map_item(0), node);
//m_dag_node = node;
}
/*! Copy constructor. */
Td_active_edge(const Self& tr) : Handle(tr)
{
// m_dag_node = tr.m_dag_node;
}
//@}
/// \name Operator overloading.
//@{
/*! Assignment operator.
* operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace)
*/
CGAL_TD_INLINE Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
/*! Operator==. */
CGAL_TD_INLINE bool operator== (const Self& t2) const
{
return (ptr() == t2.ptr());
}
/*! Operator!=. */
CGAL_TD_INLINE bool operator!= (const Self& t2) const
{
return !(operator==(t2));
}
//@}
/// \name Access methods.
//@{
CGAL_TD_INLINE Self& self()
{
return *this;
}
CGAL_TD_INLINE const Self& self() const
{
return *this;
}
/*! Access the trapezoid id (PTR). */
CGAL_TD_INLINE unsigned long id() const
{
return (unsigned long) PTR;
}
inline Halfedge_const_handle halfedge() const
{
return ptr()->he;
}
/*! Access next edge fragment. */
Td_map_item& next() const { return ptr()->next; }
/*! Access DAG node. */
Dag_node* dag_node() const {return ptr()->p_node; } //m_dag_node;}
//@}
};
} //namespace CGAL
#endif

View File

@ -0,0 +1,309 @@
// 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
// 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: svn+ssh://balasmic@scm.gforge.inria.fr/svn/cgal/branches/features/Arrangement_on_surface_2-RIC_pl_for_unbounded-balasmic/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_fictitious_vertex.h $
// $Id: Td_active_fictitious_vertex.h 65793 2011-10-10 17:04:38Z balasmic $
//
//
// Author(s) : Oren Nechushtan <theoren@math.tau.ac.il>
// updated by: Michal Balas <balasmic@post.tau.ac.il>
#ifndef CGAL_TD_ACTIVE_FICTITIOUS_VERTEX_H
#define CGAL_TD_ACTIVE_FICTITIOUS_VERTEX_H
/*! \file
* Defintion of the Td_active_fictitious_vertex<Td_traits> class.
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <boost/shared_ptr.hpp>
#ifdef CGAL_TD_DEBUG
#define CGAL_TD_INLINE
#else
#define CGAL_TD_INLINE inline
#endif
namespace CGAL {
/*! \class
* Implementation of a pseudo-trapezoid as two halfedges(top,bottom)
* and two curve-ends(left,right).
* Trapezoids are represented as two curve-ends called right and left and
* two halfedges called top and bottom. The curve-ends (points) lie on the
* right and left boundaries of the trapezoid respectively and the halfedges
* bound the trapezoid from above and below.
* There exist degenerate trapezoids called infinite trapezoid; this happens
* when one of the four sides is on the parameter space boundary.
* Trapezoids are created as active and become inactive when Remove() member
* function called.
* Each trapezoid has at most four neighbouring trapezoids.
* X_trapezoid structure can represent a real trapezoid, a Td-edge or an
* edge-end (end point).
*/
template <class Td_traits_>
class Td_active_fictitious_vertex : public Handle
{
public:
//type of traits class
typedef Td_traits_ Traits;
//type of point (Point_2)
typedef typename Traits::Point Point;
//type of X_monotone_curve_2
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
//type of Curve_end
typedef typename Traits::Curve_end Curve_end;
//type of Halfedge_const_handle (trapezoid edge)
typedef typename Traits::Halfedge_const_handle Halfedge_const_handle;
//type of Vertex_const_handle (trapezoid vertex)
typedef typename Traits::Vertex_const_handle Vertex_const_handle;
//type of Halfedge_around_vertex_const_circulator
typedef typename Traits::Halfedge_around_vertex_const_circulator
Halfedge_around_vertex_const_circulator;
//type of Td_active_fictitious_vertex (Self)
typedef typename Traits::Td_active_fictitious_vertex Self;
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
//type of In face iterator
typedef typename TD::In_face_iterator In_face_iterator;
//type of Trapezoidal map search structure
typedef typename TD::Dag_node Dag_node;
//friend class declarations:
friend class Trapezoidal_decomposition_2<Traits>;
#ifdef CGAL_PM_FRIEND_CLASS
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#elif defined(__GNUC__)
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#else
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#endif
#else
friend class In_face_iterator;
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_active_fictitious_vertex<Td_traits_>;
public:
//c'tors
Data (Vertex_const_handle _v,
Halfedge_const_handle _cw_he,
Dag_node* _p_node)
: v(_v),cw_he(_cw_he),p_node(_p_node)
{ }
~Data() { }
protected:
Vertex_const_handle v;
Halfedge_const_handle cw_he; //holds the first edge going cw starting at 12 o'clock
Dag_node* p_node;
};
private:
Data* ptr() const { return (Data*)(PTR); }
Curve_end vtx_to_ce(Vertex_const_handle v) const
{
//the circulator is of incoming halfedges
Halfedge_around_vertex_const_circulator he = v->incident_halfedges();
//if the vertex is associated with a point on the bounded coords,
// we can take any incident halfedge. o/w if the vertex lies at infinity,
// it has 2 fictitious incident halfedges
if (v->is_at_open_boundary() && he->source()->is_at_open_boundary()) ++he;
if (v->is_at_open_boundary() && he->source()->is_at_open_boundary()) ++he;
return Curve_end(he->curve(),
(he->direction() == ARR_RIGHT_TO_LEFT)?
ARR_MIN_END : ARR_MAX_END);
}
#ifndef CGAL_TD_DEBUG
#ifdef CGAL_PM_FRIEND_CLASS
protected:
#else
public: // workaround
#endif
#else //CGAL_TD_DEBUG
public:
#endif //CGAL_TD_DEBUG
/*! Set the DAG node. */
inline void set_dag_node(Dag_node* p)
{
ptr()->p_node = p;
}
/*! Set the vertex handle (Vertex_const_handle). */
inline void set_vertex(Vertex_const_handle v)
{
ptr()->v = v;
}
/*! Set the first he going clockwise starting at 12 o'clock (Halfedge_const_handle). */
inline void set_cw_he(Halfedge_const_handle he)
{
if (cw_he() != Traits::empty_he_handle() &&
cw_he()->direction() != he->direction())
{
ptr()->cw_he = he->twin();
}
else
{
ptr()->cw_he = he;
}
}
public:
/// \name Constructors.
//@{
Td_active_fictitious_vertex ()
{
PTR = new Data
(Traits::empty_vtx_handle(), Traits::empty_he_handle(), NULL);
}
/*! Constructor given Vertex & Halfedge handles. */
Td_active_fictitious_vertex (Vertex_const_handle v,
Halfedge_const_handle cw_he,
Dag_node* node = 0)
{
PTR = new Data(v, cw_he, node);
}
/*! Copy constructor. */
Td_active_fictitious_vertex (const Self& tr) : Handle(tr)
{
}
//@}
/// \name Operator overloading.
//@{
/*! Assignment operator.
* operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace)
*/
inline Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
/*! Operator==. */
inline bool operator== (const Self& t2) const
{
return (ptr() == t2.ptr());
}
/*! Operator!=. */
inline bool operator!= (const Self& t2) const
{
return !(operator==(t2));
}
//@}
/// \name Access methods.
//@{
inline Self& self()
{
return *this;
}
inline const Self& self() const
{
return *this;
}
/*! Access the trapezoid id (PTR). */
inline unsigned long id() const
{
return (unsigned long) PTR;
}
/*! Access trapezoid left.
* filters out the infinite case which returns predefined dummy values
*/
inline Vertex_const_handle vertex() const
{
return ptr()->v;
}
Curve_end curve_end() const
{
return vtx_to_ce(vertex());
}
/*! Access the first he starting at 12 o'clock clockwise.
*/
inline Halfedge_const_handle cw_he () const
{
return ptr()->cw_he;
}
/*! Access DAG node. */
Dag_node* dag_node() const {return ptr()->p_node; } //m_dag_node;}
//@}
};
} //namespace CGAL
#endif

View File

@ -0,0 +1,429 @@
// 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
// 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.
//trapezoid
// 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: svn+ssh://balasmic@scm.gforge.inria.fr/svn/cgal/branches/features/Arrangement_on_surface_2-RIC_pl_for_unbounded-balasmic/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_trapezoid.h $
// $Id: Td_active_trapezoid.h 65793 2011-10-10 17:04:38Z balasmic $
//
//
// Author(s) : Oren Nechushtan <theoren@math.tau.ac.il>
// updated by: Michal Balas <balasmic@post.tau.ac.il>
#ifndef CGAL_TD_ACTIVE_TRAPEZOID_H
#define CGAL_TD_ACTIVE_TRAPEZOID_H
/*! \file
* Defintion of the Td_active_trapezoid<Td_traits> class.
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <CGAL/tuple.h>
#include <boost/variant.hpp>
#include <boost/optional.hpp>
#ifdef CGAL_TD_DEBUG
#define CGAL_TD_INLINE
#else
#define CGAL_TD_INLINE inline
#endif
namespace CGAL {
/*! \class
* Implementation of an active trapezoid as two halfedges(top,bottom)
* and two vertices(left,right).
* Trapezoids are represented as two vertices called right and left and
* two halfedges called top and bottom. The curve-ends (points) lie on the
* right and left boundaries of the trapezoid respectively and the halfedges
* bound the trapezoid from above and below.
* There exist degenerate trapezoids called infinite trapezoid; this happens
* when one of the four sides is on the parameter space boundary.
* Each trapezoid has at most four neighbouring trapezoids.
*/
template <typename Td_traits_>
class Td_active_trapezoid : public Handle
{
public:
//type of traits class
typedef Td_traits_ Traits;
//type of point (Point_2)
typedef typename Traits::Point Point;
//type of X_monotone_curve_2
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
//type of Curve_end
typedef typename Traits::Curve_end Curve_end;
//type of Halfedge_const_handle (trapezoid edge)
typedef typename Traits::Halfedge_const_handle Halfedge_const_handle;
//type of Vertex_const_handle (trapezoid vertex)
typedef typename Traits::Vertex_const_handle Vertex_const_handle;
//type of Td_active_trapezoid (Self)
typedef typename Traits::Td_active_trapezoid Self;
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
//type of In face iterator
typedef typename TD::In_face_iterator In_face_iterator;
//type of Trapezoidal map search structure
typedef typename TD::Dag_node Dag_node;
//friend class declarations:
friend class Trapezoidal_decomposition_2<Traits>;
#ifdef CGAL_PM_FRIEND_CLASS
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#elif defined(__GNUC__)
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#else
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#endif
#else
friend class In_face_iterator;
#endif
#endif
protected:
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_active_trapezoid<Td_traits_>;
public:
//c'tors
Data (Vertex_const_handle _left_v,
Vertex_const_handle _right_v,
Halfedge_const_handle _bottom_he,
Halfedge_const_handle _top_he,
const Td_map_item& _lb,
const Td_map_item& _lt,
const Td_map_item& _rb,
const Td_map_item& _rt,
Dag_node* _p_node)
: left_v(_left_v), right_v(_right_v),
bottom_he(_bottom_he), top_he(_top_he),
lb(_lb), lt(_lt), rb(_rb), rt(_rt), p_node(_p_node)
{ }
~Data() { }
protected:
Vertex_const_handle left_v;
Vertex_const_handle right_v;
Halfedge_const_handle bottom_he;
Halfedge_const_handle top_he;
Td_map_item lb;
Td_map_item lt;
Td_map_item rb;
Td_map_item rt;
Dag_node* p_node;
};
private:
Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG
#ifdef CGAL_PM_FRIEND_CLASS
protected:
#else
public: // workaround
#endif
#else //CGAL_TD_DEBUG
public:
#endif //CGAL_TD_DEBUG
//Dag_node* m_dag_node; //pointer to the search structure (DAG) node
/*! Initialize the trapezoid's neighbours. */
inline void init_neighbours(boost::optional<Td_map_item&> lb,
boost::optional<Td_map_item&> lt,
boost::optional<Td_map_item&> rb,
boost::optional<Td_map_item&> rt)
{
set_lb((lb) ? *lb : Td_map_item(0));
set_lt((lt) ? *lt : Td_map_item(0));
set_rb((rb) ? *rb : Td_map_item(0));
set_rt((rt) ? *rt : Td_map_item(0));
}
/*! Set the DAG node. */
inline void set_dag_node(Dag_node* p)
{
ptr()->p_node = p;
// m_dag_node = p;
//
//#ifdef CGAL_TD_DEBUG
//
// CGAL_assertion(!p || **p == *this);
//
//#endif
}
/*! Set the trapezoid's left (Vertex_const_handle). */
inline void set_left(Vertex_const_handle v) { ptr()->left_v = v; }
/*! Set the trapezoid's right (Vertex_const_handle). */
inline void set_right(Vertex_const_handle v) { ptr()->right_v = v; }
/*! Set the trapezoid's bottom (Halfedge_const_handle). */
inline void set_bottom(Halfedge_const_handle he)
{
if (!is_on_bottom_boundary() && (bottom()->direction() != he->direction()))
{
ptr()->bottom_he = he->twin();
}
else
{
ptr()->bottom_he = he;
}
}
/*! Set the trapezoid's top (Halfedge_const_handle). */
inline void set_top(Halfedge_const_handle he)
{
if (!is_on_top_boundary() && (top()->direction() != he->direction()))
{
ptr()->top_he = he->twin();
}
else
{
ptr()->top_he = he;
}
}
/*! Set left bottom neighbour. */
inline void set_lb(const Td_map_item& lb) { ptr()->lb = lb; }
/*! Set left top neighbour. */
inline void set_lt(const Td_map_item& lt) { ptr()->lt = lt; }
/*! Set right bottom neighbour. */
inline void set_rb(const Td_map_item& rb) { ptr()->rb = rb; }
/*! Set right top neighbour. */
inline void set_rt(const Td_map_item& rt) { ptr()->rt = rt; }
public:
/// \name Constructors.
//@{
/*! Default constructor. */
Td_active_trapezoid()
{
//define the initial trapezoid: left, right, btm, top are at infinity.
// has no neighbours
PTR = new Data(Traits::empty_vtx_handle(),
Traits::empty_vtx_handle(),
Traits::empty_he_handle(),
Traits::empty_he_handle(),
Td_map_item(0), Td_map_item(0) ,
Td_map_item(0), Td_map_item(0), NULL);
//m_dag_node = 0;
}
/*! Constructor given Vertex & Halfedge handles. */
Td_active_trapezoid (Vertex_const_handle l, Vertex_const_handle r,
Halfedge_const_handle b, Halfedge_const_handle t,
boost::optional<Td_map_item&> lb = boost::none,
boost::optional<Td_map_item&> lt = boost::none,
boost::optional<Td_map_item&> rb = boost::none,
boost::optional<Td_map_item&> rt = boost::none,
Dag_node* node = 0)
{
PTR = new Data(l, r, b, t, (lb) ? *lb : Td_map_item(0),
(lt) ? *lt : Td_map_item(0), (rb) ? *rb : Td_map_item(0),
(rt) ? *rt : Td_map_item(0), node);
//m_dag_node = node;
}
/*! Copy constructor. */
Td_active_trapezoid (const Self& tr) : Handle(tr)
{
//m_dag_node = tr.m_dag_node;
}
//@}
/// \name Operator overloading.
//@{
/*! Assignment operator.
* operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace)
*/
inline Self& operator=(const Self& t2)
{
Handle::operator=(t2);
return *this;
}
/*! Operator==. */
inline bool operator==(const Self& t2) const
{
return (ptr() == t2.ptr());
}
/*! Operator!=. */
inline bool operator!=(const Self& t2) const
{
return !(operator==(t2));
}
//@}
/// \name Access methods.
//@{
inline Self& self() { return *this; }
inline const Self& self() const { return *this; }
/*! Access the trapezoid id (PTR). */
inline unsigned long id() const { return (unsigned long) PTR; }
/*! Access trapezoid left.
* filters out the infinite case which returns predefined dummy values
*/
inline Vertex_const_handle left() const { return ptr()->left_v; }
/*! Access trapezoid right.
* filters out the infinite case which returns predefined dummy values
*/
inline Vertex_const_handle right() const { return ptr()->right_v; }
/*! Access trapezoid bottom.
* filters out the infinite case which returns predefined dummy values
*/
inline Halfedge_const_handle bottom() const { return ptr()->bottom_he; }
/*! Access trapezoid top.
* filters out the infinite case which returns predefined dummy values
*/
inline Halfedge_const_handle top() const { return ptr()->top_he; }
/*! Access is on left boundary. */
inline bool is_on_left_boundary() const
{ return (left() == Traits::empty_vtx_handle()); }
/*! Access is on right boundary. */
inline bool is_on_right_boundary() const
{ return (right() == Traits::empty_vtx_handle()); }
/*! Access is on bottom boundary. */
inline bool is_on_bottom_boundary() const
{ return (bottom() == Traits::empty_he_handle()); }
/*! Access is on top boundary. */
inline bool is_on_top_boundary() const
{ return (top() == Traits::empty_he_handle()); }
/*! Access is on at least one boundary. */
inline bool is_on_boundaries() const
{
return (is_on_left_boundary() || is_on_right_boundary() ||
is_on_bottom_boundary() || is_on_top_boundary());
}
/*! Access left bottom neighbour. */
Td_map_item& lb() const { return ptr()->lb; }
/*! Access left top neighbour. */
Td_map_item& lt() const { return ptr()->lt; }
/*! Access right bottom neighbour. */
Td_map_item& rb() const { return ptr()->rb; }
/*! Access right top neighbour. */
Td_map_item& rt() const { return ptr()->rt; }
/*! Access DAG node. */
Dag_node* dag_node() const {return ptr()->p_node; }
void clear_neighbors()
{
set_lb(Td_map_item(0));
set_lt(Td_map_item(0));
set_rb(Td_map_item(0));
set_rt(Td_map_item(0));
}
//@}
// Merge this trapezoid with the input trapezoid.
// Precondition:
// Both trapezoids are active and have the same bounding edges from
// above and below and the trapezoids are adjacent to one another
// with the first to the left.
// Postcondition:
// This trapezoid is the union of the old this trapezoid and the input
// trapezoid.
inline void merge_trapezoid(Self& right)
{
//precondition: the left trapezoid is not on the right boundary
CGAL_assertion(!is_on_right_boundary());
// bool on_right_boundary = right.is_on_right_boundary();
ptr()->left_v = left();
ptr()->right_v = right.right();
ptr()->bottom_he = bottom();
ptr()->top_he = top();
ptr()->lb = lb();
ptr()->lt = lt();
ptr()->rb = right.rb();
ptr()->rt = right.rt();
Td_map_item item (*this);
if (ptr()->rb.which() != 0)
{
Self tr(boost::get<Self>(rb()));
tr.set_lb(item);
}
if (ptr()->rt.which() != 0)
{
Self tr(boost::get<Self>(rt()));
tr.set_lt(item);
}
CGAL_assertion(is_on_right_boundary() == right.is_on_right_boundary());
}
};
} //namespace CGAL
#endif

View File

@ -0,0 +1,311 @@
// 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
// 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: svn+ssh://balasmic@scm.gforge.inria.fr/svn/cgal/branches/features/Arrangement_on_surface_2-RIC_pl_for_unbounded-balasmic/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_active_vertex.h $
// $Id: Td_active_vertex.h 65793 2011-10-10 17:04:38Z balasmic $
//
//
// Author(s) : Oren Nechushtan <theoren@math.tau.ac.il>
// updated by: Michal Balas <balasmic@post.tau.ac.il>
#ifndef CGAL_TD_ACTIVE_VERTEX_H
#define CGAL_TD_ACTIVE_VERTEX_H
/*! \file
* Defintion of the Td_active_vertex<Td_traits> class.
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <boost/shared_ptr.hpp>
#ifdef CGAL_TD_DEBUG
#define CGAL_TD_INLINE
#else
#define CGAL_TD_INLINE inline
#endif
namespace CGAL {
/*! \class
* Implementation of a pseudo-trapezoid as two halfedges(top,bottom)
* and two curve-ends(left,right).
* Trapezoids are represented as two curve-ends called right and left and
* two halfedges called top and bottom. The curve-ends (points) lie on the
* right and left boundaries of the trapezoid respectively and the halfedges
* bound the trapezoid from above and below.
* There exist degenerate trapezoids called infinite trapezoid; this happens
* when one of the four sides is on the parameter space boundary.
* Trapezoids are created as active and become inactive when Remove() member
* function called.
* Each trapezoid has at most four neighbouring trapezoids.
* X_trapezoid structure can represent a real trapezoid, a Td-edge or an
* edge-end (end point).
*/
template <class Td_traits_>
class Td_active_vertex : public Handle
{
public:
//type of traits class
typedef Td_traits_ Traits;
//type of point (Point_2)
typedef typename Traits::Point Point;
//type of X_monotone_curve_2
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
//type of Curve_end
typedef typename Traits::Curve_end Curve_end;
//type of Halfedge_const_handle (trapezoid edge)
typedef typename Traits::Halfedge_const_handle Halfedge_const_handle;
//type of Vertex_const_handle (trapezoid vertex)
typedef typename Traits::Vertex_const_handle Vertex_const_handle;
//type of Halfedge_around_vertex_const_circulator
typedef typename Traits::Halfedge_around_vertex_const_circulator
Halfedge_around_vertex_const_circulator;
//type of Td_active_vertex (Self)
typedef typename Traits::Td_active_vertex Self;
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
//type of In face iterator
typedef typename TD::In_face_iterator In_face_iterator;
//type of Trapezoidal map search structure
typedef typename TD::Dag_node Dag_node;
//friend class declarations:
friend class Trapezoidal_decomposition_2<Traits>;
#ifdef CGAL_PM_FRIEND_CLASS
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#elif defined(__GNUC__)
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#else
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#endif
#else
friend class In_face_iterator;
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_active_vertex<Td_traits_>;
public:
//c'tors
Data (Vertex_const_handle _v,
Halfedge_const_handle _cw_he,
Dag_node* _p_node)
: v(_v),cw_he(_cw_he),p_node(_p_node)
{ }
~Data() { }
protected:
Vertex_const_handle v;
Halfedge_const_handle cw_he; //holds the first edge going cw starting at 12 o'clock
Dag_node* p_node;
};
private:
Data* ptr() const { return (Data*)(PTR); }
Curve_end vtx_to_ce(Vertex_const_handle v) const
{
//the circulator is of incoming halfedges
Halfedge_around_vertex_const_circulator he = v->incident_halfedges();
//if the vertex is associated with a point on the bounded coords,
// we can take any incident halfedge. o/w if the vertex lies at infinity,
// it has 2 fictitious incident halfedges
if (v->is_at_open_boundary() && he->source()->is_at_open_boundary()) ++he;
if (v->is_at_open_boundary() && he->source()->is_at_open_boundary()) ++he;
return Curve_end(he->curve(),
(he->direction() == ARR_RIGHT_TO_LEFT)?
ARR_MIN_END : ARR_MAX_END);
}
#ifndef CGAL_TD_DEBUG
#ifdef CGAL_PM_FRIEND_CLASS
protected:
#else
public: // workaround
#endif
#else //CGAL_TD_DEBUG
public:
#endif //CGAL_TD_DEBUG
/*! Set the DAG node. */
inline void set_dag_node(Dag_node* p)
{
ptr()->p_node = p;
}
/*! Set the vertex handle (Vertex_const_handle). */
inline void set_vertex(Vertex_const_handle v)
{
ptr()->v = v;
}
/*! Set the first he going clockwise starting at 12 o'clock (Halfedge_const_handle). */
inline void set_cw_he(Halfedge_const_handle he)
{
if (cw_he() != Traits::empty_he_handle() &&
cw_he()->direction() != he->direction())
{
ptr()->cw_he = he->twin();
}
else
{
ptr()->cw_he = he;
}
}
public:
/// \name Constructors.
//@{
Td_active_vertex ()
{
PTR = new Data
(Traits::empty_vtx_handle(), Traits::empty_he_handle(), NULL);
}
/*! Constructor given Vertex & Halfedge handles. */
Td_active_vertex (Vertex_const_handle v,
Halfedge_const_handle cw_he,
Dag_node* node = 0)
{
PTR = new Data (v, cw_he, node);
}
/*! Copy constructor. */
Td_active_vertex(const Self& tr) : Handle(tr)
{
}
//@}
/// \name Operator overloading.
//@{
/*! Assignment operator.
* operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace)
*/
inline Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
/*! Operator==. */
inline bool operator== (const Self& t2) const
{
return (ptr() == t2.ptr());
}
/*! Operator!=. */
inline bool operator!= (const Self& t2) const
{
return !(operator==(t2));
}
//@}
/// \name Access methods.
//@{
inline Self& self()
{
return *this;
}
inline const Self& self() const
{
return *this;
}
/*! Access the trapezoid id (PTR). */
inline unsigned long id() const
{
return (unsigned long) PTR;
}
inline Vertex_const_handle vertex() const
{
return ptr()->v;
}
Curve_end curve_end() const
{
return vtx_to_ce(vertex());
}
inline const Point& point() const
{
return vertex()->point();
}
/*! Access the first he starting at 12 o'clock clockwise.
*/
inline Halfedge_const_handle cw_he () const
{
return ptr()->cw_he;
}
/*! Access DAG node. */
Dag_node* dag_node() const {return ptr()->p_node; }
//@}
};
} //namespace CGAL
#endif

View File

@ -0,0 +1,582 @@
// Author(s) : Michal Balas <balasmic@post.tau.ac.il>
// (based on old version by Iddo Hanniel & Oren Nechushtan)
/* Directed acyclic binary graph template class */
#ifndef CGAL_TD_DAG_NODE_H
#define CGAL_TD_DAG_NODE_H
#include <CGAL/basic.h>
#include <CGAL/number_utils.h>
#include <CGAL/kernel_assertions.h>
#include <CGAL/Handle.h>
#include <cstdlib>
#include <iostream>
#include <list>
#include <functional>
#include <boost/variant.hpp>
namespace CGAL {
/*! \class
* Trapezoidal decomposition DAG node base class derived from Handle
*/
template<class Traits>
class Td_dag_node_base : public Handle
{
protected:
void init() { PTR = 0; } //MICHAL: I think it is not used - so need to be removed
public:
//c'tors
Td_dag_node_base() { init(); }
Td_dag_node_base(const Td_dag_node_base<Traits>& x) : Handle(x) { }
//operators overloading
Td_dag_node_base& operator=(const Td_dag_node_base<Traits> & x)
{
Handle::operator=(x);
return *this;
}
//bool operator!() const { return PTR == 0; } //MICHAL: maybe use ptr(), and also can change to is_null or something similar
bool is_null() const { return PTR == 0; }
protected:
Rep * ptr() const { return (Rep*) PTR; }
//Rep *& ptr() { return (Rep*) PTR; }
void set_ptr(Rep* rep) { PTR = rep; }
};
/*! \class
* Trapezoidal decomposition DAG node class derived from
* Td_dag_node_base class
*/
template<class Traits>
class Td_dag_node : public Td_dag_node_base<Traits>
{
public:
//type of base class
typedef Td_dag_node_base<Traits> Td_dag_node_handle;
typedef Td_dag_node_base<Traits> Base;
//type of Td_dag_node (Self)
typedef Td_dag_node<Traits> Self;
//type of td_map_item
typedef typename Traits::Td_map_item Td_map_item;
//type of Td_active_trapezoid
typedef typename Traits::Td_active_trapezoid Td_active_trapezoid;
#ifndef CGAL_CFG_USING_BASE_MEMBER_BUG_2
public:
//using Td_dag_node_handle::PTR;
//using Td_dag_node_handle::operator!;
#endif //CGAL_CFG_USING_BASE_MEMBER_BUG_2
protected:
/*! \class
* Inner class Node derived from Rep class
*/
class Node : public Rep
{
friend class Td_dag_node<Traits>;
public:
class clear_neighbors_visitor : public boost::static_visitor< void >
{
public:
void operator()(Td_active_trapezoid& t) const
{
t.clear_neighbors();
}
template < typename Tp >
void operator()(Tp& t) const
{
}
};
//c'tors
Node(const Td_map_item& e,unsigned long depth=0) :
m_data(e), m_left_child(), m_right_child(),
m_depth(depth), m_visited(false)
{}
Node(const Td_map_item& e, const Td_dag_node_handle& left,
const Td_dag_node_handle& right, unsigned long depth=0) :
m_data(e), m_left_child(left), m_right_child(right),
m_depth(depth), m_visited(false)
{}
//d'tor
~Node()
{
boost::apply_visitor(clear_neighbors_visitor(), m_data);
}
bool is_inner_node() const //MICHAL: a node with only left child (like removed node) will be concidered as a leaf
{
//return !!m_left_child && !!m_right_child;
return (!m_left_child.is_null() && !m_right_child.is_null());
}
bool visited() const { return m_visited; }
protected:
//protected data members
//information stored in node
Td_map_item m_data;
//left & right child nodes
Td_dag_node_handle m_left_child;
Td_dag_node_handle m_right_child;
//depth of the node in the DAG
mutable unsigned long m_depth;
//visited flag for traversing the DAG
mutable bool m_visited;
};
public:
//c'tors
Td_dag_node() { }
Td_dag_node(const Td_dag_node_handle& dag) : Td_dag_node_handle(dag) { }
Td_dag_node(const Self& dag) : Td_dag_node_handle(dag) { }
Td_dag_node(const Td_map_item& rootValue){ this->set_ptr(new Node(rootValue)); }
Td_dag_node(const Td_map_item& rootValue, unsigned long depth)
{ this->set_ptr(new Node(rootValue, depth)); }
Td_dag_node(const Td_map_item& rootValue, const Self& left, const Self& right)
{
this->set_ptr(new Node( rootValue, left, right));
depth_propagation();
}
Td_dag_node(const Td_map_item& rootValue, const Self& left, const Self& right,
unsigned long depth)
{
this->set_ptr(new Node( rootValue, left, right, depth));
depth_propagation();
}
//d'tor
~Td_dag_node() { }
//information retrieval
const Self& left_child() const
{
CGAL_precondition(!this->is_null());
return *(const Self*)&this->node()->m_left_child;
}
Self& left_child()
{
CGAL_precondition(!this->is_null());
return (Self &)this->node()->m_left_child;
}
const Self& right_child() const
{
CGAL_precondition(!this->is_null());
return *(const Self*)&this->node()->m_right_child;
}
Self& right_child()
{
CGAL_precondition(!this->is_null());
return (Self &)this->node()->m_right_child;
}
Td_map_item& get_data() const
{
CGAL_precondition(!this->is_null());
return node()->m_data;
}
Td_map_item& operator*() const
{
return this->get_data();
}
Td_map_item* data_ptr() const
{
CGAL_precondition(!this->is_null());
return &operator*();
}
Td_map_item* operator->() const
{
return this->data_ptr();
}
bool is_inner_node() const
{
return !this->is_null() && this->node()->is_inner_node();
}
unsigned long size_inaccurate() const //exponential
{
init_visited();
unsigned long res = recursive_size_inaccurate();
init_visited();
return res;
}
unsigned long size() const
{
init_visited();
unsigned long res = recursive_size();
init_visited();
return res;
}
unsigned long rec_depth() const //exponential
{
init_visited();
unsigned long res = recursive_depth();
init_visited();
return res;
}
#if 0
unsigned long rec_check(unsigned long rec_bound) const //exponential
{
unsigned long res = recursive_check(1,rec_bound);
return res;
}
#endif //0
unsigned long max_depth() const
{
init_visited();
unsigned long res = rec_max_depth();
init_visited();
return res;
}
const unsigned long& depth() const
{
return node()->m_depth;
}
unsigned long& depth()
{
return node()->m_depth;
}
bool operator==(const Self& b) const
{
return this->ptr() == b.ptr();
}
bool operator!=(const Self& b) const
{
return !operator==(b);
}
//dynamic management:
//Shallow copy
Self& operator=(const Self& b)
{
Handle::operator=(b);
return *this;
}
void set_data(const Td_map_item& data)
{
if (!this->is_null())
node()->m_data = data;
else
operator=(Self(data));
}
void set_left_child(Self& left)
{
CGAL_precondition(!this->is_null());
node()->m_left_child = left;
if (left.depth() < depth()+1)
left.depth() = depth()+1;
left.depth_propagation();
// does nothing if left is a leaf
}
void set_right_child(Self& right)
{
CGAL_precondition(!this->is_null());
node()->m_right_child = right;
if (right.depth() < depth()+1)
right.depth() = depth()+1;
right.depth_propagation();
// does nothing if right is a leaf
}
void replace(const Td_map_item& data, Self& left, Self& right)
{
set_data(data);
set_left_child(left);
set_right_child(right);
}
// Td_dag implementation not thread safe!
void init_visited() const
{
if (this->is_null() || node()->m_visited == false)
return;
node()->m_visited = false;
left_child().init_visited();
right_child().init_visited();
}
void visit_node() const
{
if (!this->is_null())
node()->m_visited = true;
}
/* -----output ---------------*/
#ifdef CGAL_PRE_IN_POST_ORDER
void preorder() const //exponential
{
if (!is_null())
{
std::cout << operator*() << '\t';
left_child().preorder();
right_child().preorder();
}
}
void inorder() const //exponential
{
if (!is_null())
{
left_child().inorder();
std::cout << operator*() << '\t';
right_child().inorder();
}
}
void postorder() const //exponential
{
if (!is_null())
{
left_child().postorder();
right_child().postorder();
std::cout << operator*() << '\t';
}
}
#endif //CGAL_PRE_IN_POST_ORDER
template <class Container,class Predicate>
Container& filter(Container& c,const Predicate& pr) const
{
init_visited();
Container& res = recursive_filter(c,pr);
init_visited();
return res;
}
protected:
//
//Propagating depth for left child & right child if they exist
//
void depth_propagation() //exponential
{
if (!is_inner_node())
return;
if (left_child().depth() < depth() + 1)
{
left_child().depth() = depth() + 1;
left_child().depth_propagation();
}
if (right_child().depth() < depth() + 1)
{
right_child().depth() = depth() + 1;
right_child().depth_propagation();
}
}
unsigned long recursive_depth() const
{
if (this->is_null() || node()->visited())
return 0;
return 1 + (std::max)(left_child().recursive_depth(),
right_child().recursive_depth());
}
#if 0
unsigned long recursive_check(unsigned long curr_rec_depth, unsigned long rec_bound) const
{
if (is_null())
return 0;
//std::cout << curr_rec_depth << "," << std::flush;
if ( curr_rec_depth > rec_bound + 30)
{
std::cout << "passed " << rec_bound + 30 << ", stopping\n";
return 0;
}
return 1 + (std::max)(left_child().recursive_check(curr_rec_depth + 1, rec_bound),
right_child().recursive_check(curr_rec_depth + 1, rec_bound));
}
#endif //0
unsigned long rec_max_depth() const
{
if (this->is_null() || node()->visited())
return 0;
visit_node();
if (is_inner_node())
return std::max(left_child().rec_max_depth(),
right_child().rec_max_depth());
else
return depth();
}
unsigned long recursive_size_inaccurate() const
{
if (!this->is_null() && !node()->visited())
return 1+ left_child().recursive_size_inaccurate() + right_child().recursive_size_inaccurate();
return 0;
}
unsigned long recursive_size() const
{
if (this->is_null() || node()->visited())
return 0;
visit_node();
return (1 + left_child().recursive_size() + right_child().recursive_size());
}
template <class Container,class Predicate>
Container& recursive_filter(Container& c,const Predicate& pr) const
{
if (this->is_null() || node()->visited())
return c;
if (pr(operator*()))
c.insert(c.end(),operator*());
visit_node();
left_child().recursive_filter(c, pr);
right_child().recursive_filter(c, pr);
return c;
}
private:
Node* node() const { return (Node*)Base::PTR; }
};
/*
//io methods
template<class T,class Traits>
std::ostream& write (std::ostream& out,
const Td_dag_node<T>& t,
const Traits& traits)
{
static int depth;
int i;
if (!t.is_null())
{
out << "\n";
for(i=0; i<depth; i++) out << ">";
out << "Data=";
write(out,*t,traits);
{
depth++;
out << "\n";
for(i=0; i<depth; i++) out << ">";
out << "left_child=";
write(out,t.left_child(),traits);
out << "\n";
for(i=0; i<depth; i++) out << ">";
out << "right_child=";
write(out,t.right_child(),traits);
depth--;
}
}
else
{
out << "Empty";
}
return out ;
}
template<class T>
std::ostream& operator<< (std::ostream& out,
const Td_dag_node<T>& t)
{
static int depth;
int i;
if (!t.is_null())
{
out << "\n";
for(i=0; i<depth; i++) out << ">";
out << "Data=" << *t;
{
depth++;
out << "\n";
for(i=0; i<depth; i++) out << ">";
out << "left_child=" << t.left_child();
out << "\n";
for(i=0; i<depth; i++) out << ">";
out << "right_child=" <<t.right_child();
depth--;
}
}
else
{
out << "Empty";
}
return out ;
}
*/
} //namespace CGAL
#endif //CGAL_TD_DAG_NODE_H
/*
tech notes:
The code is Handle designed.
left_child(),right_child() are designed to cope with Handle(Handle& x)
precondition x.PTR!=0
operator=() performs shallow copy
operator*() returns data type
output is done as a binary tree.
*/

View File

@ -0,0 +1,246 @@
// 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
// 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: svn+ssh://balasmic@scm.gforge.inria.fr/svn/cgal/branches/features/Arrangement_on_surface_2-RIC_pl_for_unbounded-balasmic/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_edge.h $
// $Id: Td_inactive_edge.h 65793 2011-10-10 17:04:38Z balasmic $
//
//
// Author(s) : Oren Nechushtan <theoren@math.tau.ac.il>
// updated by: Michal Balas <balasmic@post.tau.ac.il>
#ifndef CGAL_TD_INACTIVE_EDGE_H
#define CGAL_TD_INACTIVE_EDGE_H
/*! \file
* Defintion of the Td_inactive_edge<Td_traits> class.
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#include <boost/shared_ptr.hpp>
#ifdef CGAL_TD_DEBUG
#define CGAL_TD_INLINE
#else
#define CGAL_TD_INLINE inline
#endif
namespace CGAL {
/*! \class
* Implementation of a pseudo-trapezoid as two halfedges(top,bottom)
* and two curve-ends(left,right).
* Trapezoids are represented as two curve-ends called right and left and
* two halfedges called top and bottom. The curve-ends (points) lie on the
* right and left boundaries of the trapezoid respectively and the halfedges
* bound the trapezoid from above and below.
* There exist degenerate trapezoids called infinite trapezoid; this happens
* when one of the four sides is on the parameter space boundary.
* Trapezoids are created as active and become inactive when Remove() member
* function called.
* Each trapezoid has at most four neighbouring trapezoids.
* X_trapezoid structure can represent a real trapezoid, a Td-edge or an
* edge-end (end point).
*/
template <class Td_traits_>
class Td_inactive_edge : public Handle
{
public:
//type of traits class
typedef Td_traits_ Traits;
//type of point (Point_2)
typedef typename Traits::Point Point;
//type of X_monotone_curve_2
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
//type of Curve_end
typedef typename Traits::Curve_end Curve_end;
//type of Halfedge_const_handle (trapezoid edge)
typedef typename Traits::Halfedge_const_handle Halfedge_const_handle;
//type of Vertex_const_handle (trapezoid vertex)
typedef typename Traits::Vertex_const_handle Vertex_const_handle;
//type of Td_inactive_edge (Self)
typedef typename Traits::Td_inactive_edge Self;
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
//type of In face iterator
typedef typename TD::In_face_iterator In_face_iterator;
//type of Trapezoidal map search structure
typedef typename TD::Dag_node Dag_node;
//friend class declarations:
friend class Trapezoidal_decomposition_2<Traits>;
#ifdef CGAL_PM_FRIEND_CLASS
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#elif defined(__GNUC__)
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#else
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#endif
#else
friend class In_face_iterator;
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_inactive_edge<Td_traits_>;
public:
//c'tors
Data (boost::shared_ptr<X_monotone_curve_2>& _cv, Dag_node* _p_node)
: cv(_cv), p_node(_p_node) //, lb(_lb),lt(_lt),rb(_rb),rt(_rt)
{ }
~Data() { }
protected:
boost::shared_ptr<X_monotone_curve_2> cv;
Dag_node* p_node;
};
private:
Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG
#ifdef CGAL_PM_FRIEND_CLASS
protected:
#else
public: // workaround
#endif
#else //CGAL_TD_DEBUG
public:
#endif //CGAL_TD_DEBUG
/*! Set the DAG node. */
inline void set_dag_node(Dag_node* p)
{
ptr()->p_node = p;
}
/*! Set the x_monotone_curve_2 for removed edge degenerate trapezoid. */
CGAL_TD_INLINE void set_curve(boost::shared_ptr<X_monotone_curve_2>& cv)
{
ptr()->cv = cv;
}
public:
/// \name Constructors.
//@{
/*! Constructor given Vertex & Halfedge handles. */
Td_inactive_edge (boost::shared_ptr<X_monotone_curve_2>& cv, Dag_node* node = NULL)
{
PTR = new Data(cv,node);
}
/*! Copy constructor. */
Td_inactive_edge (const Self& tr) : Handle(tr)
{
}
//@}
/// \name Operator overloading.
//@{
/*! Assignment operator.
* operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace)
*/
inline Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
/*! Operator==. */
inline bool operator== (const Self& t2) const
{
return (ptr() == t2.ptr());
}
/*! Operator!=. */
inline bool operator!= (const Self& t2) const
{
return !(operator==(t2));
}
//@}
/// \name Access methods.
//@{
inline Self& self()
{
return *this;
}
inline const Self& self() const
{
return *this;
}
/*! Access the trapezoid id (PTR). */
inline unsigned long id() const
{
return (unsigned long) PTR;
}
inline X_monotone_curve_2& curve() const
{
X_monotone_curve_2* cv_ptr = (ptr()->cv).get();
CGAL_assertion(cv_ptr != NULL);
return *cv_ptr;
}
/*! Access DAG node. */
Dag_node* dag_node() const {return ptr()->p_node; }
//@}
};
} //namespace CGAL
#endif

View File

@ -0,0 +1,275 @@
// 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
// 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: svn+ssh://balasmic@scm.gforge.inria.fr/svn/cgal/branches/features/Arrangement_on_surface_2-RIC_pl_for_unbounded-balasmic/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_fictitious_vertex.h $
// $Id: Td_inactive_fictitious_vertex.h 65793 2011-10-10 17:04:38Z balasmic $
//
//
// Author(s) : Oren Nechushtan <theoren@math.tau.ac.il>
// updated by: Michal Balas <balasmic@post.tau.ac.il>
#ifndef CGAL_TD_INACTIVE_FICTITIOUS_VERTEX_H
#define CGAL_TD_INACTIVE_FICTITIOUS_VERTEX_H
/*! \file
* Defintion of the Td_inactive_fictitious_vertex<Td_traits> class.
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#ifdef CGAL_TD_DEBUG
#define CGAL_TD_INLINE
#else
#define CGAL_TD_INLINE inline
#endif
namespace CGAL {
/*! \class
* Implementation of a pseudo-trapezoid as two halfedges(top,bottom)
* and two curve-ends(left,right).
* Trapezoids are represented as two curve-ends called right and left and
* two halfedges called top and bottom. The curve-ends (points) lie on the
* right and left boundaries of the trapezoid respectively and the halfedges
* bound the trapezoid from above and below.
* There exist degenerate trapezoids called infinite trapezoid; this happens
* when one of the four sides is on the parameter space boundary.
* Trapezoids are created as active and become inactive when Remove() member
* function called.
* Each trapezoid has at most four neighbouring trapezoids.
* X_trapezoid structure can represent a real trapezoid, a Td-edge or an
* edge-end (end point).
*/
template <class Td_traits_>
class Td_inactive_fictitious_vertex : public Handle
{
public:
//type of traits class
typedef Td_traits_ Traits;
//type of point (Point_2)
typedef typename Traits::Point Point;
//type of X_monotone_curve_2
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
//type of Curve_end
typedef typename Traits::Curve_end Curve_end;
//type of Halfedge_const_handle (trapezoid edge)
typedef typename Traits::Halfedge_const_handle Halfedge_const_handle;
//type of Vertex_const_handle (trapezoid vertex)
typedef typename Traits::Vertex_const_handle Vertex_const_handle;
//type of Halfedge_around_vertex_const_circulator
typedef typename Traits::Halfedge_around_vertex_const_circulator
Halfedge_around_vertex_const_circulator;
//type of Td_inactive_fictitious_vertex (Self)
typedef typename Traits::Td_inactive_fictitious_vertex Self;
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
//type of In face iterator
typedef typename TD::In_face_iterator In_face_iterator;
//type of Trapezoidal map search structure
typedef typename TD::Dag_node Dag_node;
//friend class declarations:
friend class Trapezoidal_decomposition_2<Traits>;
#ifdef CGAL_PM_FRIEND_CLASS
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#elif defined(__GNUC__)
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#else
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#endif
#else
friend class In_face_iterator;
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_inactive_fictitious_vertex<Td_traits_>;
public:
//c'tors
Data (const X_monotone_curve_2& _cv,
Arr_curve_end _ce,
Dag_node* _p_node): cv(_cv),ce(_ce),p_node(_p_node)
{ }
~Data() { }
protected:
X_monotone_curve_2 cv;
Arr_curve_end ce;
Dag_node* p_node;
};
private:
Data* ptr() const { return (Data*)(PTR); }
Curve_end vtx_to_ce(Vertex_const_handle v) const
{
//the circulator is of incoming halfedges
Halfedge_around_vertex_const_circulator he = v->incident_halfedges();
//if the vertex is associated with a point on the bounded coords,
// we can take any incident halfedge. o/w if the vertex lies at infinity,
// it has 2 fictitious incident halfedges
if (v->is_at_open_boundary() && he->source()->is_at_open_boundary()) ++he;
if (v->is_at_open_boundary() && he->source()->is_at_open_boundary()) ++he;
return Curve_end(he->curve(),
(he->direction() == ARR_RIGHT_TO_LEFT)?
ARR_MIN_END : ARR_MAX_END);
}
#ifndef CGAL_TD_DEBUG
#ifdef CGAL_PM_FRIEND_CLASS
protected:
#else
public: // workaround
#endif
#else //CGAL_TD_DEBUG
public:
#endif //CGAL_TD_DEBUG
/*! Set the DAG node. */
inline void set_dag_node(Dag_node* p)
{
ptr()->p_node = p;
}
inline void set_curve_end(Vertex_const_handle v_before_rem)
{
Curve_end v_ce(vtx_to_ce(v_before_rem));
ptr()->cv(v_ce.cv());
ptr()->ce(v_ce.ce());
}
public:
/// \name Constructors.
//@{
/*! Constructor given Vertex & Halfedge handles. */
Td_inactive_fictitious_vertex (Vertex_const_handle v_before_rem, Dag_node* node = NULL)
{
Curve_end v_ce(vtx_to_ce(v_before_rem));
PTR = new Data( v_ce.cv(), v_ce.ce(), node);
}
/*! Copy constructor. */
Td_inactive_fictitious_vertex (const Self& tr) : Handle(tr)
{
}
//@}
/// \name Operator overloading.
//@{
/*! Assignment operator.
* operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace)
*/
inline Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
/*! Operator==. */
inline bool operator== (const Self& t2) const
{
return (ptr() == t2.ptr());
}
/*! Operator!=. */
inline bool operator!= (const Self& t2) const
{
return !(operator==(t2));
}
//@}
/// \name Access methods.
//@{
inline Self& self()
{
return *this;
}
inline const Self& self() const
{
return *this;
}
/*! Access the trapezoid id (PTR). */
inline unsigned long id() const
{
return (unsigned long) PTR;
}
inline Curve_end curve_end() const
{
return Curve_end(ptr()->cv, ptr()->ce);
}
/*! Access DAG node. */
Dag_node* dag_node() const
{
return ptr()->p_node;
}
//@}
};
} //namespace CGAL
#endif

View File

@ -0,0 +1,54 @@
// 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
// 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: svn+ssh://balasmic@scm.gforge.inria.fr/svn/cgal/branches/features/Arrangement_on_surface_2-RIC_pl_for_unbounded-balasmic/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_trapezoid.h $
// $Id: Td_inactive_trapezoid.h 65793 2011-10-10 17:04:38Z balasmic $
//
//
// Author(s) : Oren Nechushtan <theoren@math.tau.ac.il>
// updated by: Michal Balas <balasmic@post.tau.ac.il>
#ifndef CGAL_TD_INACTIVE_TRAPEZOID_H
#define CGAL_TD_INACTIVE_TRAPEZOID_H
/*! \file
* Defintion of the Td_inactive_trapezoid class.
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#ifdef CGAL_TD_DEBUG
#define CGAL_TD_INLINE
#else
#define CGAL_TD_INLINE inline
#endif
namespace CGAL {
/*! \class
*/
class Td_inactive_trapezoid
{
public:
/*! Operator==. */
inline bool operator== (const Td_inactive_trapezoid& t2) const
{
return (this == &t2);
}
};
} //namespace CGAL
#endif

View File

@ -0,0 +1,248 @@
// 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
// 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: svn+ssh://balasmic@scm.gforge.inria.fr/svn/cgal/branches/features/Arrangement_on_surface_2-RIC_pl_for_unbounded-balasmic/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_inactive_vertex.h $
// $Id: Td_inactive_vertex.h 65793 2011-10-10 17:04:38Z balasmic $
//
//
// Author(s) : Oren Nechushtan <theoren@math.tau.ac.il>
// updated by: Michal Balas <balasmic@post.tau.ac.il>
#ifndef CGAL_TD_INACTIVE_VERTEX_H
#define CGAL_TD_INACTIVE_VERTEX_H
/*! \file
* Defintion of the Td_inactive_vertex<Td_traits> class.
*/
#include <CGAL/Arr_point_location/Trapezoidal_decomposition_2.h>
#include <boost/variant.hpp>
#ifdef CGAL_TD_DEBUG
#define CGAL_TD_INLINE
#else
#define CGAL_TD_INLINE inline
#endif
namespace CGAL {
/*! \class
* Implementation of a pseudo-trapezoid as two halfedges(top,bottom)
* and two curve-ends(left,right).
* Trapezoids are represented as two curve-ends called right and left and
* two halfedges called top and bottom. The curve-ends (points) lie on the
* right and left boundaries of the trapezoid respectively and the halfedges
* bound the trapezoid from above and below.
* There exist degenerate trapezoids called infinite trapezoid; this happens
* when one of the four sides is on the parameter space boundary.
* Trapezoids are created as active and become inactive when Remove() member
* function called.
* Each trapezoid has at most four neighbouring trapezoids.
* X_trapezoid structure can represent a real trapezoid, a Td-edge or an
* edge-end (end point).
*/
template <class Td_traits_>
class Td_inactive_vertex : public Handle
{
public:
//type of traits class
typedef Td_traits_ Traits;
//type of point (Point_2)
typedef typename Traits::Point Point;
//type of X_monotone_curve_2
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
//type of Curve_end
typedef typename Traits::Curve_end Curve_end;
//type of Halfedge_const_handle (trapezoid edge)
typedef typename Traits::Halfedge_const_handle Halfedge_const_handle;
//type of Vertex_const_handle (trapezoid vertex)
typedef typename Traits::Vertex_const_handle Vertex_const_handle;
//type of Td_inactive_vertex (Self)
typedef typename Traits::Td_inactive_vertex Self;
typedef typename Traits::Td_map_item Td_map_item;
//type of Trapezoidal decomposition
typedef Trapezoidal_decomposition_2<Traits> TD;
//type of In face iterator
typedef typename TD::In_face_iterator In_face_iterator;
//type of Trapezoidal map search structure
typedef typename TD::Dag_node Dag_node;
//friend class declarations:
friend class Trapezoidal_decomposition_2<Traits>;
#ifdef CGAL_PM_FRIEND_CLASS
#if defined(__SUNPRO_CC) || defined(__PGI) || defined(__INTEL_COMPILER)
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#elif defined(__GNUC__)
#if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)))
friend typename Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#else
friend class Trapezoidal_decomposition_2<Traits>::In_face_iterator;
#endif
#else
friend class In_face_iterator;
#endif
#endif
/*! \class
* Inner class Data derived from Rep class
*/
class Data : public Rep
{
friend class Td_inactive_vertex<Td_traits_>;
public:
//c'tors
Data (Point _p, Dag_node* _p_node): p(_p),p_node(_p_node)
{ }
~Data() { }
protected:
Point p;
Dag_node* p_node;
};
private:
Data* ptr() const { return (Data*)(PTR); }
#ifndef CGAL_TD_DEBUG
#ifdef CGAL_PM_FRIEND_CLASS
protected:
#else
public: // workaround
#endif
#else //CGAL_TD_DEBUG
public:
#endif //CGAL_TD_DEBUG
/*! Set the DAG node. */
inline void set_dag_node(Dag_node* p)
{
ptr()->p_node = p;
}
inline void set_point(Vertex_const_handle v_before_rem)
{
ptr()->p = v_before_rem->point();
}
public:
/// \name Constructors.
//@{
/*! Constructor given Vertex & Halfedge handles. */
Td_inactive_vertex (Vertex_const_handle v_before_rem, Dag_node* node = NULL)
{
PTR = new Data(v_before_rem->point(), node);
}
/*! Copy constructor. */
Td_inactive_vertex (const Self& tr) : Handle(tr)
{
}
//@}
/// \name Operator overloading.
//@{
/*! Assignment operator.
* operator= should not copy m_dag_node (or otherwise update
* Dag_node::replace)
*/
inline Self& operator= (const Self& t2)
{
Handle::operator=(t2);
return *this;
}
/*! Operator==. */
inline bool operator== (const Self& t2) const
{
return (ptr() == t2.ptr());
}
/*! Operator!=. */
inline bool operator!= (const Self& t2) const
{
return !(operator==(t2));
}
//@}
/// \name Access methods.
//@{
inline Self& self()
{
return *this;
}
inline const Self& self() const
{
return *this;
}
/*! Access the trapezoid id (PTR). */
inline unsigned long id() const
{
return (unsigned long) PTR;
}
inline Point& point() const
{
return ptr()->p;
}
/*! Access DAG node. */
Dag_node* dag_node() const
{
return ptr()->p_node;
}
//@}
};
} //namespace CGAL
#endif

View File

@ -29,45 +29,45 @@ namespace CGAL {
template < class Td_traits> class Trapezoidal_decomposition_2;
template <class X_trapezoid>
struct Td_active_trapezoid : public std::unary_function<X_trapezoid,bool>
{
bool operator()(const X_trapezoid& tr) const
{
return tr.is_active();
}
};
////MICHAL: not in use
//template <class map_item>
//struct Td_active_map_item : public std::unary_function<map_item,bool>
//{
// bool operator()(const map_item& item) const
// {
// return item.is_active();
// }
//};
template <class X_trapezoid,class Traits>
struct Td_active_non_degenerate_trapezoid :
public std::unary_function<X_trapezoid,bool>
{
Td_active_non_degenerate_trapezoid(Traits& t) : traits(t) {}
bool operator()(const X_trapezoid& tr) const
{
return tr.is_active() && !traits.is_degenerate(tr);
}
protected:
const Traits& traits;
};
////MICHAL: not in use
//template <class X_trapezoid,class Traits>
//struct Td_active_non_degenerate_trapezoid :
//public std::unary_function<X_trapezoid,bool>
//{
// Td_active_non_degenerate_trapezoid(Traits& t) : traits(t) {}
// bool operator()(const X_trapezoid& tr) const
// {
// return tr.is_active() && !traits.is_degenerate(tr);
// }
//protected:
// const Traits& traits;
//};
template <class X_trapezoid,class Traits>
struct Td_active_right_degenerate_curve_trapezoid:
public std::unary_function<X_trapezoid,bool>
template <class map_item,class Traits>
struct Td_active_edge_item:
public std::unary_function<map_item,bool>
{
typedef const Traits& const_Traits_ref;
Td_active_right_degenerate_curve_trapezoid(const_Traits_ref t) : traits(t) {}
bool operator()(const X_trapezoid& tr) const
Td_active_edge_item(const Traits& t) : traits(t) {}
bool operator()(const map_item& item) const
{
return tr.is_active() && traits.is_degenerate_curve(tr) &&
!tr.right_bottom_neighbour();
return traits.is_active(item) && traits.is_td_edge(item);
}
protected:
const Traits& traits;
};
template <class _Tp>
struct Trapezoid_handle_less : public std::binary_function<_Tp, _Tp, bool>
struct Td_map_item_handle_less : public std::binary_function<_Tp, _Tp, bool>
{
bool operator()(const _Tp& __x, const _Tp& __y) const {
return __x->id() < __y->id(); }

View File

@ -23,58 +23,12 @@
namespace CGAL {
template <class Traits,class X_curve_plus>
const typename Td_traits<Traits,X_curve_plus>::Point&
Td_traits<Traits,X_curve_plus>::point_at_left_top_infinity(){
/*
static typename Td_traits<Traits,X_curve_plus>::Point
Td_traits<Traits,X_curve_plus>::POINT_AT_LEFT_TOP_INFINITY;
return Td_traits<Traits,X_curve_plus>::POINT_AT_LEFT_TOP_INFINITY;
*/
// static Point POINT_AT_LEFT_TOP_INFINITY;
if (!POINT_AT_LEFT_TOP_INFINITY)
POINT_AT_LEFT_TOP_INFINITY = new Point();
return *POINT_AT_LEFT_TOP_INFINITY;
}
template <class Traits,class Arrangement_on_surface_2>
typename Td_traits<Traits,Arrangement_on_surface_2>::Vertex_const_handle
Td_traits<Traits,Arrangement_on_surface_2>::m_empty_vtx_handle = Vertex_const_handle();
template <class Traits,class X_curve_plus>
const typename Td_traits<Traits,X_curve_plus>::Point&
Td_traits<Traits,X_curve_plus>::point_at_right_bottom_infinity(){
/*
static typename Td_traits<Traits,X_curve_plus>::Point
Td_traits<Traits,X_curve_plus>::POINT_AT_RIGHT_BOTTOM_INFINITY;
return Td_traits<Traits,X_curve_plus>::POINT_AT_RIGHT_BOTTOM_INFINITY;
*/
// static Point POINT_AT_RIGHT_BOTTOM_INFINITY;
if (!POINT_AT_RIGHT_BOTTOM_INFINITY)
POINT_AT_RIGHT_BOTTOM_INFINITY = new Point();
return *POINT_AT_RIGHT_BOTTOM_INFINITY;
}
template <class Traits,class X_curve_plus>
const typename Td_traits<Traits,X_curve_plus>::X_curve&
Td_traits<Traits,X_curve_plus>::curve_at_infinity(){
/*
static typename typename Traits::X_curveTraits::X_curve
Td_traits<Traits,X_curve_plus>::CURVE_AT_INFINITY;
return Td_traits<Traits,X_curve_plus>::CURVE_AT_INFINITY;
*/
// static X_curve CURVE_AT_INFINITY;
if (!CURVE_AT_INFINITY)
CURVE_AT_INFINITY = new X_curve();
return *CURVE_AT_INFINITY;
}
template <class Traits,class X_curve_plus>
typename Td_traits<Traits,X_curve_plus>::Point *
Td_traits<Traits,X_curve_plus>::POINT_AT_LEFT_TOP_INFINITY = 0;
template <class Traits,class X_curve_plus>
typename Td_traits<Traits,X_curve_plus>::Point *
Td_traits<Traits,X_curve_plus>::POINT_AT_RIGHT_BOTTOM_INFINITY = 0;
template <class Traits,class X_curve_plus>
typename Td_traits<Traits,X_curve_plus>::X_curve *
Td_traits<Traits,X_curve_plus>::CURVE_AT_INFINITY = 0;
template <class Traits,class Arrangement_on_surface_2>
typename Td_traits<Traits,Arrangement_on_surface_2>::Halfedge_const_handle
Td_traits<Traits,Arrangement_on_surface_2>::m_empty_he_handle = Halfedge_const_handle();
} //namespace CGAL

View File

@ -47,7 +47,7 @@ template < class Traits>
std::ostream& operator<<(
std::ostream &out,const Trapezoidal_decomposition_2<Traits>& td)
{
return write(out,td.data_structure(),td.get_traits());
return write(out,td.dag_root(),td.get_traits());
}
template < class Traits>
@ -59,14 +59,16 @@ std::ostream& write(std::ostream &out,const Td_X_trapezoid<Traits>& t,
typedef X_trapezoid* pointer;
bool pad=false;
//MICHAL: this may fail for inactive trapezoids
out << "(";
if (!t.is_left_unbounded()) out << t.left(); else out << "-oo";
if (!t.is_on_left_boundary()) out << t.left(); else out << "-oo"; //MICHAL: this may fail for removed point
out << ",";
if (!t.is_right_unbounded()) out << t.right(); else out << "+oo";
if (!t.is_on_right_boundary()) out << t.right(); else out << "+oo";
out << "," << std::flush;
if (!t.is_bottom_unbounded()) out << t.bottom(); else out << "-oo";
if (!t.is_on_bottom_boundary()) out << t.bottom(); else out << "-oo";
out << ",";
if (!t.is_top_unbounded()) out << t.top(); else out << "+oo";
if (!t.is_on_top_boundary()) out << t.top(); else out << "+oo";
out << ",neighbours(" << std::flush;
// debug neighbours equivalence relation
@ -76,11 +78,11 @@ std::ostream& write(std::ostream &out,const Td_X_trapezoid<Traits>& t,
X_trapezoid* value[] =
{
0,
(X_trapezoid*)CGAL_TRAPEZOIDAL_DECOMPOSITION_2_DELETE_SIGNATURE,
t.left_bottom_neighbour(),
t.left_top_neighbour(),
t.right_bottom_neighbour(),
t.right_top_neighbour()
(X_trapezoid*)CGAL_TD_DELETE_SIGNATURE,
t.lb(),
t.lt(),
t.rb(),
t.rt()
};
typedef char debug_string[256];
debug_string name[]=
@ -114,32 +116,32 @@ std::ostream& write(std::ostream &out,const Td_X_trapezoid<Traits>& t,
else pad=true;
out << name[j];
// identify neighbours
if (traits.is_degenerate_point(t) && value[j])
if (traits.is_td_vertex(t) && value[j])
out << "=" << value[j]->top();
}
out << ")" << std::flush;
if (t.is_active())
{
if (!traits.is_degenerate(t))
if (traits.is_td_trapezoid(t))
{
if (t.is_unbounded())
{
out << ",U=";
if (t.is_left_unbounded()) out << ")";
if (t.is_bottom_unbounded()) {
if (t.is_top_unbounded())
if (t.is_on_left_boundary()) out << ")";
if (t.is_on_bottom_boundary()) {
if (t.is_on_top_boundary())
out << "/\\/";
else
out << "/\\";
}
else if (t.is_top_unbounded()) out << "\\/";
if (t.is_right_unbounded()) out << "(";
else if (t.is_on_top_boundary()) out << "\\/";
if (t.is_on_right_boundary()) out << "(";
}
else
out << ",T";
}
else if (traits.is_degenerate_curve(t))
else if (traits.is_td_edge(t))
out << ",C";
else // if (t.is_degenerate_point())
out << ",P";
@ -170,14 +172,16 @@ std::ostream& operator<<(std::ostream &out,const Td_X_trapezoid<Traits>& t)
typedef X_trapezoid* pointer;
Traits traits;
//MICHAL: this may fail for inactive trapezoids
out << "(";
if (!t.is_left_unbounded()) out << t.left(); else out << "-oo";
if (!t.is_on_left_boundary()) out << t.left(); else out << "-oo";
out << ",";
if (!t.is_right_unbounded()) out << t.right(); else out << "+oo";
if (!t.is_on_right_boundary()) out << t.right(); else out << "+oo";
out << "," << std::flush;
if (!t.is_bottom_unbounded()) out << t.bottom(); else out << "-oo";
if (!t.is_on_bottom_boundary()) out << t.bottom(); else out << "-oo";
out << ",";
if (!t.is_top_unbounded()) out << t.top(); else out << "+oo";
if (!t.is_on_top_boundary()) out << t.top(); else out << "+oo";
out << ",neighbours(" << std::flush;
// debug neighbours equivalence relation
@ -187,11 +191,11 @@ std::ostream& operator<<(std::ostream &out,const Td_X_trapezoid<Traits>& t)
X_trapezoid* value[] =
{
0,
(X_trapezoid*)CGAL_TRAPEZOIDAL_DECOMPOSITION_2_DELETE_SIGNATURE,
t.left_bottom_neighbour(),
t.left_top_neighbour(),
t.right_bottom_neighbour(),
t.right_top_neighbour()
(X_trapezoid*)CGAL_TD_DELETE_SIGNATURE,
t.lb(),
t.lt(),
t.rb(),
t.rt()
};
typedef char debug_string[256];
debug_string name[]=
@ -223,7 +227,7 @@ std::ostream& operator<<(std::ostream &out,const Td_X_trapezoid<Traits>& t)
{
out << name[j];
// identify neighbours
if (traits.is_degenerate_point(t) && value[j])
if (traits.is_td_vertex(t) && value[j])
out << "=" << value[j]->top();
out << " ";
}
@ -231,24 +235,24 @@ std::ostream& operator<<(std::ostream &out,const Td_X_trapezoid<Traits>& t)
if (t.is_active())
{
if (!traits.is_degenerate(t))
if (traits.is_td_trapezoid(t))
{
if (t.is_unbounded())
{
out << ",U";
if (t.is_left_unbounded())
if (t.is_on_left_boundary())
out << (char) 174;
if (t.is_bottom_unbounded())
if (t.is_on_bottom_boundary())
out << (char) 25;
if (t.is_top_unbounded())
if (t.is_on_top_boundary())
out << (char) 24;
if (t.is_right_unbounded())
if (t.is_on_right_boundary())
out << (char) 175;
}
else
out << ",T";
}
else if (traits.is_degenerate_curve(t))
else if (traits.is_td_edge(t))
out << ",C";
else // if (t.is_degenerate_point())
out << ",P";

View File

@ -21,31 +21,37 @@
#ifndef CGAL_TRAPEZOIDAL_DECOMPOSITION_2_MISC_H
#define CGAL_TRAPEZOIDAL_DECOMPOSITION_2_MISC_H
#ifndef CGAL_TD_TENTUPLE_H
#include <CGAL/Handle.h>
#include <CGAL/Arr_point_location/Td_ninetuple.h>
#endif
#ifndef CGAL_TD_DAG_H
#include <CGAL/Arr_point_location/Td_dag.h>
#include <CGAL/Arr_point_location/Td_dag_node.h>
#endif
#define CGAL_TRAPEZOIDAL_DECOMPOSITION_2_DELETE_SIGNATURE 0xffffffff
#define CGAL_TRAPEZOIDAL_DECOMPOSITION_2_LEFT_UNBOUNDED 0x1
#define CGAL_TRAPEZOIDAL_DECOMPOSITION_2_RIGHT_UNBOUNDED 0x2
#define CGAL_TRAPEZOIDAL_DECOMPOSITION_2_BOTTOM_UNBOUNDED 0x4
#define CGAL_TRAPEZOIDAL_DECOMPOSITION_2_TOP_UNBOUNDED 0x8
#define CGAL_TRAPEZOIDAL_DECOMPOSITION_2_TOTALLY_UNBOUNDED \
(CGAL_TRAPEZOIDAL_DECOMPOSITION_2_LEFT_UNBOUNDED| \
CGAL_TRAPEZOIDAL_DECOMPOSITION_2_RIGHT_UNBOUNDED| \
CGAL_TRAPEZOIDAL_DECOMPOSITION_2_BOTTOM_UNBOUNDED| \
CGAL_TRAPEZOIDAL_DECOMPOSITION_2_TOP_UNBOUNDED)
#define CGAL_TRAPEZOIDAL_DECOMPOSITION_2_BOUNDED 0
#define CGAL_TD_DEFAULT_DEPTH_THRESHOLD 2
#define CGAL_TD_DEFAULT_SIZE_THRESHOLD 2
//#define CGAL_TD_DELETE_SIGNATURE 0xffffffff
//
////type
//#define CGAL_TD_VERTEX 0
//#define CGAL_TD_EDGE 0x1
//#define CGAL_TD_TRAPEZOID 0x2
//#define CGAL_TD_TYPE_MASK 0x3
//
//#define CGAL_TD_ON_LEFT_BOUNDARY 0x4
//#define CGAL_TD_ON_RIGHT_BOUNDARY 0x8
//#define CGAL_TD_ON_BOTTOM_BOUNDARY 0x10
//#define CGAL_TD_ON_TOP_BOUNDARY 0x20
//#define CGAL_TD_ON_ALL_BOUNDARIES
// (CGAL_TD_ON_LEFT_BOUNDARY | CGAL_TD_ON_RIGHT_BOUNDARY |
// CGAL_TD_ON_BOTTOM_BOUNDARY| CGAL_TD_ON_TOP_BOUNDARY)
//#define CGAL_TD_INTERIOR 0
//
//#define CGAL_TD_CV_MIN_END 0
//#define CGAL_TD_CV_MAX_END 0x1
#define CGAL_TD_DEFAULT_DEPTH_THRESHOLD 60
#define CGAL_TD_DEFAULT_SIZE_THRESHOLD 12
#ifndef _MSC_VER
#if !defined __GNUC__ || __GNUC__>2 || __GNUC__==2 && __GNUC_MINOR__>=95
#if !defined __GNUC__ || __GNUC__> 3 || ((__GNUC__== 3) && (__GNUC_MINOR__> 4))
#define CGAL_PM_FRIEND_CLASS
#endif
#endif

View File

@ -192,16 +192,19 @@ public:
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;
typedef typename BFI_traits::Bound BF;
long precision = 16;
Rational error_bound = CGAL::ipower(Rational(1,2),r);
while (true)
{
set_precision(precision);
BF eps = CGAL::ipower(BF(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
@ -213,11 +216,14 @@ public:
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 )
if (CGAL::compare(
CGAL::width(y_bfi),
CGAL::lower(CGAL::abs(y_bfi)) * eps)
== SMALLER)
return std::make_pair(Bound(CGAL::lower(y_bfi)),
Bound(CGAL::upper(y_bfi)));
return std::make_pair(
Bound(CGAL::lower(y_bfi)),
Bound(CGAL::upper(y_bfi)));
}
else precision*=2;
}
@ -258,7 +264,10 @@ private:
{
typename BFI_traits::Set_precision set_precision;
typename BFI_polynomial_traits::Evaluate evaluate;
Rational error_bound = CGAL::ipower(Rational(1,2),a);
typedef typename BFI_traits::Bound BF;
BF eps = CGAL::ipower(BF(1)/2,a);
while (true)
{
set_precision(precision);
@ -273,9 +282,11 @@ private:
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)) );
if (CGAL::width(y_bfi) < eps )
return std::make_pair(
Bound(CGAL::lower(y_bfi)),
Bound(CGAL::upper(y_bfi)));
}
else precision*=2;
}

View File

@ -607,9 +607,7 @@ public:
/*!
*/
template <class Geometry_traits_2,
#ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM
template <class T>
#endif
class T_Dcel = Arr_polyhedral_sgm_arr_dcel>
class Arr_polyhedral_sgm :
public Arr_spherical_gaussian_map_3<Geometry_traits_2, T_Dcel>
@ -621,11 +619,7 @@ public:
typedef typename Geometry_traits_2::Point_3 Point_3;
typedef typename Geometry_traits_2::Vector_3 Vector_3;
#ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM
typedef T_Dcel<Geometry_traits_2> Dcel;
#else
typedef typename T_Dcel::template Dcel<Geometry_traits_2> Dcel;
#endif
// For some reason MSVC barfs on the friend statement below. Therefore,
// we declare the Base to be public to overcome the problem.

View File

@ -331,18 +331,12 @@ protected:
* embedded on the sphere.
*/
template <class T_Traits,
#ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM
template <class T>
#endif
class T_Dcel = Arr_default_dcel>
class Arr_spherical_gaussian_map_3 :
public Arrangement_on_surface_2<T_Traits,
Arr_spherical_topology_traits_2<T_Traits,
#ifndef CGAL_CFG_NO_TMPL_IN_TMPL_PARAM
T_Dcel<T_Traits>
#else
typename T_Dcel::template Dcel<T_Traits>
#endif
>
>
{

View File

@ -33,59 +33,6 @@
namespace CGAL {
/*!
* \class
* Mapping of an x-monotone curve to the halfedge associated with it.
*/
template <class Arrangement_>
class PL_X_curve_plus: public Arrangement_::X_monotone_curve_2
{
public:
typedef Arrangement_ Arrangement_2;
typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2;
typedef typename Arrangement_2::Traits_adaptor_2 Traits_adaptor_2;
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
typedef typename Arrangement_2::X_monotone_curve_2 X_monotone_curve_2;
protected:
//Data members
Halfedge_handle parent; // The halfedge associated with the curve.
public:
/*! Default constructor. */
PL_X_curve_plus() :
X_monotone_curve_2(),
parent()
{}
/*! Constructor from a curve and a halfedge. */
PL_X_curve_plus (const X_monotone_curve_2& cv,
const Halfedge_handle& p) :
X_monotone_curve_2(cv),
parent(p)
{}
/*! Constrtuctor from a halfedge only. */
PL_X_curve_plus(const Halfedge_handle& p) :
X_monotone_curve_2(p->curve()),
parent(p)
{}
/*! Constrtuctor from a curve only. */
PL_X_curve_plus(const X_monotone_curve_2 &cv) :
X_monotone_curve_2(cv),
parent()
{}
/*! Get the parent halfedge. */
Halfedge_handle get_parent() const
{
return (parent);
}
};
/*! \class
* A class that answers point-location and queries
@ -96,90 +43,167 @@ template <class Arrangement_>
class Arr_trapezoid_ric_point_location : public Arr_observer <Arrangement_>
{
public:
//type of arrangement on surface
typedef Arrangement_ Arrangement_on_surface_2;
typedef Arrangement_ Arrangement_2;
typedef typename Arrangement_2::Geometry_traits_2 Geometry_traits_2;
typedef typename Arrangement_2::Traits_adaptor_2 Traits_adaptor_2;
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle;
typedef typename Arrangement_2::Face_const_handle Face_const_handle;
typedef typename Arrangement_2::Vertex_handle Vertex_handle;
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
typedef typename Arrangement_2::Face_handle Face_handle;
typedef typename Arrangement_2::Halfedge_iterator Halfedge_iterator;
typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator;
typedef typename Arrangement_2::Edge_const_iterator Edge_const_iterator;
typedef typename Arrangement_2::Hole_const_iterator Hole_const_iterator;
typedef typename Arrangement_2::Halfedge_const_iterator
Halfedge_const_iterator;
typedef typename Arrangement_2::Halfedge_around_vertex_const_circulator
Halfedge_around_vertex_const_circulator;
typedef typename Arrangement_2::Ccb_halfedge_const_circulator
Ccb_halfedge_const_circulator;
typedef typename Arrangement_2::Ccb_halfedge_circulator
Ccb_halfedge_circulator;
typedef typename Arrangement_2::Isolated_vertex_const_iterator
//type of geometry traits
typedef typename Arrangement_on_surface_2::Geometry_traits_2
Geometry_traits_2;
//type of traits adaptor
typedef typename Arrangement_on_surface_2::Traits_adaptor_2
Traits_adaptor_2;
//type of vertex handle
typedef typename Arrangement_on_surface_2::Vertex_handle
Vertex_handle;
//type of vertex const handle
typedef typename Arrangement_on_surface_2::Vertex_const_handle
Vertex_const_handle;
//type of halfedge handle
typedef typename Arrangement_on_surface_2::Halfedge_handle
Halfedge_handle;
//type of halfedge const handle
typedef typename Arrangement_on_surface_2::Halfedge_const_handle
Halfedge_const_handle;
//type of face const handle
typedef typename Arrangement_on_surface_2::Face_const_handle
Face_const_handle;
//type of edge const iterator
typedef typename Arrangement_on_surface_2::Edge_const_iterator
Edge_const_iterator;
//type of isolated vertex const iterator
typedef typename Arrangement_on_surface_2::Isolated_vertex_const_iterator
Isolated_vertex_const_iterator;
//type of point
typedef typename Geometry_traits_2::Point_2 Point_2;
typedef typename Geometry_traits_2::X_monotone_curve_2 X_monotone_curve_2;
typedef std::list<Halfedge_const_handle> Edge_list;
typedef typename Edge_list::iterator Std_edge_iterator;
typedef PL_X_curve_plus<Arrangement_2> X_curve_plus;
typedef CGAL::Td_traits<Traits_adaptor_2, X_curve_plus> Td_traits;
typedef Trapezoidal_decomposition_2<Td_traits> Trapezoidal_decomposition;
typedef std::vector<Halfedge_const_handle> Halfedge_handle_container;
typedef typename Halfedge_handle_container::iterator
Halfedge_handle_iterator;
//type of x-monotone curve
typedef typename Geometry_traits_2::X_monotone_curve_2
X_monotone_curve_2;
//type of trapezoidal decomposition traits class
typedef CGAL::Td_traits<Traits_adaptor_2, Arrangement_on_surface_2>
Td_traits;
//type of trapezoidal decomposition class
typedef Trapezoidal_decomposition_2<Td_traits>
Trapezoidal_decomposition;
//!types of Td_map_item-s
typedef typename Trapezoidal_decomposition::Td_map_item
Td_map_item;
typedef typename Trapezoidal_decomposition::Td_active_vertex
Td_active_vertex;
typedef typename Trapezoidal_decomposition::Td_active_fictitious_vertex
Td_active_fictitious_vertex;
typedef typename Trapezoidal_decomposition::Td_active_edge
Td_active_edge;
typedef typename Trapezoidal_decomposition::Td_active_trapezoid
Td_active_trapezoid;
//!type of side tags
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;
protected:
protected:
//type of trapezoidal decomposition class
typedef Trapezoidal_decomposition TD;
typedef typename Arr_are_all_sides_oblivious_tag<
Left_side_category, Bottom_side_category,
Top_side_category, Right_side_category >::result
Are_all_sides_oblivious_tag;
// Data members:
const Traits_adaptor_2 *m_traits; // Its associated traits object.
TD td; // instance of trapezoidal decomposition
const Td_traits* td_traits;// instance of the TD traits
//for the notification functions
X_monotone_curve_2 m_curve_before_split;
X_monotone_curve_2 m_curve_before_merge1;
X_monotone_curve_2 m_curve_before_merge2;
const Traits_adaptor_2 *m_traits; // Its associated traits object.
TD td; // instance of trapezoidal decomposition
bool m_with_guarantees;
//for the notification functions
X_monotone_curve_2 m_cv_before_split;
Halfedge_handle m_he_after_merge;
//X_monotone_curve_2 m_cv_before_merge1;
//X_monotone_curve_2 m_cv_before_merge2;
public:
/*! Default constructor. */
Arr_trapezoid_ric_point_location (bool rebuild = true) :
m_traits (NULL),
td_traits(NULL)
Arr_trapezoid_ric_point_location (bool with_guarantees = true,
double depth_thrs = CGAL_TD_DEFAULT_DEPTH_THRESHOLD,
double size_thrs = CGAL_TD_DEFAULT_SIZE_THRESHOLD)
: m_traits (NULL), m_with_guarantees(with_guarantees)
{
td.set_needs_update(rebuild);
td.set_with_guarantees(with_guarantees);
td.depth_threshold(depth_thrs);
td.size_threshold(size_thrs);
}
/*! Constructor given an arrangement. */
Arr_trapezoid_ric_point_location (const Arrangement_2& arr) :
Arr_observer<Arrangement_2> (const_cast<Arrangement_2 &>(arr))
Arr_trapezoid_ric_point_location (const Arrangement_on_surface_2& arr,
bool with_guarantees = true,
double depth_thrs = CGAL_TD_DEFAULT_DEPTH_THRESHOLD,
double size_thrs = CGAL_TD_DEFAULT_SIZE_THRESHOLD) :
Arr_observer<Arrangement_on_surface_2>
(const_cast<Arrangement_on_surface_2 &>(arr)),
m_with_guarantees(with_guarantees)
{
m_traits = static_cast<const Traits_adaptor_2*> (arr.traits());
td_traits = new Td_traits(*m_traits);
td.init_traits(td_traits);
build_trapezoid_ric();
m_traits = static_cast<const Traits_adaptor_2*> (arr.geometry_traits());
td.set_with_guarantees(with_guarantees);
td.init_arrangement_and_traits(&arr);
td.depth_threshold(depth_thrs);
td.size_threshold(size_thrs);
_construct_td();
}
/*! Destructor. */
~Arr_trapezoid_ric_point_location ()
~Arr_trapezoid_ric_point_location () { }
/*! defines whether the underlying search structure guarantees logarithmic
* query time and linear size */
void with_guarantees (bool with_guarantees)
{
if (td_traits)
delete (td_traits);
//if with_guarantees was changed from false to true - reconstruct
// the search structure with guarantees
td.set_with_guarantees(with_guarantees);
if (with_guarantees && !m_with_guarantees)
{
td.clear();
_construct_td();
}
m_with_guarantees = with_guarantees;
}
/*! returns the depth of the underlying search structure
* (the longest path in the DAG)
*/
unsigned long depth() //longest_dag_path()
{
return td.largest_leaf_depth() + 1;
}
/*! returns the longest query path in the underlying search structure */
unsigned long longest_query_path_length()
{
return td.longest_query_path_length();
}
#ifdef CGAL_TD_DEBUG
//void locate_and_print (std::ostream& out, const Point_2& p) const
//{
// td.locate_and_print(out, p);
//}
void print_dag(std::ostream& out) const
{
td.print_dag(out);
}
#endif
/*!
* Locate the arrangement feature containing the given point.
* \param p The query point.
@ -219,50 +243,48 @@ public:
// base observer.
//@{
virtual void before_assign (const Arrangement_2& arr)
virtual void before_assign (const Arrangement_on_surface_2& arr)
{
clear_trapezoid_ric();
m_traits = static_cast<const Traits_adaptor_2*> (arr.traits());
td.clear();
m_traits = static_cast<const Traits_adaptor_2*> (arr.geometry_traits());
td.init_arrangement_and_traits(&arr, false);
}
virtual void after_assign ()
{
build_trapezoid_ric();
_construct_td();
}
virtual void before_clear ()
{
clear_trapezoid_ric ();
td.clear();
}
virtual void after_clear ()
{
build_trapezoid_ric();
_construct_td();
}
virtual void before_attach (const Arrangement_2& arr)
virtual void before_attach (const Arrangement_on_surface_2& arr)
{
clear_trapezoid_ric();
m_traits = static_cast<const Traits_adaptor_2*> (arr.traits());
td_traits = new Td_traits(*m_traits);
td.init_traits(td_traits);
td.clear();
m_traits = static_cast<const Traits_adaptor_2*> (arr.geometry_traits());
td.init_arrangement_and_traits(&arr);
}
virtual void after_attach ()
{
build_trapezoid_ric();
_construct_td();
}
virtual void before_detach ()
{
clear_trapezoid_ric();
td.clear();
}
virtual void after_create_edge (Halfedge_handle e)
{
// Postcondition: h->curve() with a reference back to h
// is inserted into TD.
td.insert(X_curve_plus(e));
td.insert(e);
}
//TODO IDIT OREN: what can be done in order to avoid the need
@ -271,96 +293,102 @@ public:
//curve it lies on, which is the curve that was split, and then remove
//this curve.
virtual void before_split_edge (Halfedge_handle e,
Vertex_handle /* v */,
const X_monotone_curve_2& /* c1 */,
const X_monotone_curve_2& /* c2 */)
Vertex_handle /* v */,
const X_monotone_curve_2& cv1 ,
const X_monotone_curve_2& cv2 )
{
//save this curve for the "after" function.
m_curve_before_split = e->curve();
////MICHAL: commented due to inefficient depth update, remove and insert instead
////save the curve for the "after" function.
//m_cv_before_split = e->curve();
//td.before_split_edge(m_cv_before_split, cv1, cv2);
td.remove(e);
}
virtual void after_split_edge (Halfedge_handle e1,
Halfedge_handle e2)
{
td.split_edge(X_curve_plus(m_curve_before_split),
X_curve_plus(e1),
X_curve_plus(e2));
//MICHAL: commented due to inefficient depth update, remove and insert instead
//td.split_edge(m_cv_before_split,e1,e2);
td.insert(e1);
td.insert(e2);
}
//TODO IDIT OREN: create a merged X_curve_plus withput a halfedge,
// and in the "after" function update the halfedge.
// think ...
virtual void before_merge_edge (Halfedge_handle e1,
Halfedge_handle e2,
const X_monotone_curve_2& /* c */)
const X_monotone_curve_2& cv)
{
//save the curves for the "after" function.
m_curve_before_merge1 = e1->curve();
m_curve_before_merge2 = e2->curve();
//save the halfedge handle for the "after" function.
m_he_after_merge = e1;
td.merge_edge (e1, e2, cv);
}
virtual void after_merge_edge (Halfedge_handle e)
{
td.merge_edge(X_curve_plus(m_curve_before_merge1),
X_curve_plus(m_curve_before_merge2),
X_curve_plus(e));
td.after_merge_edge(e, m_he_after_merge);
}
virtual void before_remove_edge (Halfedge_handle e)
{
//called before combinatoric deletion
td.remove(X_curve_plus(e));
td.remove(e);
}
//@}
public:
#ifdef CGAL_TD_DEBUG
void debug()
{
td.debug();
}
#endif
//#ifdef CGAL_TD_DEBUG
// void debug()
// {
// td.debug();
// }
//#endif
protected:
/*! Clear the trapezoidal decomposition. */
inline void clear_trapezoid_ric ()
{
td.clear();
}
/*! Construct the trapezoidal decomposition. */
void build_trapezoid_ric ()
void _construct_td ()
{
td.clear();
Halfedge_handle_container c;
Edge_const_iterator eit;
Halfedge_const_handle hh;
Arrangement_2 *arr = this->arrangement();
std::vector<Halfedge_const_handle> he_container;
Edge_const_iterator eit;
Halfedge_const_handle he_cst;
Arrangement_on_surface_2 *arr = this->arrangement();
//collect the arrangement halfedges
for (eit = arr->edges_begin(); eit != arr->edges_end(); ++eit)
{
hh = eit;
c.push_back(hh);
he_cst = eit;
he_container.push_back(he_cst);
}
// Random shuffle of the halfedges.
std::random_shuffle (c.begin (), c.end ());
Halfedge_handle_iterator cit;
Halfedge_handle he;
for (cit = c.begin(); cit < c.end(); cit++)
{
hh = *cit;
he = arr->non_const_handle(hh);
td.insert(X_curve_plus(he));
}
//container insertion
td.insert(he_container.begin(), he_container.end());
}
/*! gets the unbounded face that contains the point when the trapezoid is unbounded
* \param tr The unbounded trapezoid whose face we should get
* \param p The query point.
* \param Arr_all_sides_oblivious_tag
* \return A Face_const_handle representing the arrangement unbounded face in which
* the point p lies
*/
Face_const_handle _get_unbounded_face (const Td_map_item& tr,
const Point_2& p,
Arr_all_sides_oblivious_tag) const;
/*! gets the unbounded face that contains the point when the trapezoid is unbounded
* \param tr The unbounded trapezoid whose face we should get
* \param p The query point.
* \param Arr_not_all_sides_oblivious_tag
* \return A Face_const_handle representing the arrangement unbounded face in which
* the point p lies
*/
Face_const_handle _get_unbounded_face (const Td_map_item& tr,
const Point_2& p,
Arr_not_all_sides_oblivious_tag) const;
/*!
* Locate the arrangement feature which a vertical ray emanating from the
* given point hits, considering isolated vertices.
@ -379,7 +407,8 @@ protected:
*/
Object _check_isolated_for_vertical_ray_shoot
(Halfedge_const_handle halfedge_found,
const Point_2& p, bool shoot_up) const;
const Point_2& p, bool shoot_up,
const Td_map_item& tr) const;
};
} //namespace CGAL

View File

@ -1135,8 +1135,8 @@ public:
}
Comparison_result comp_x_on_bnd(const Point_2&,
const X_monotone_curve_2& xcv,
Arr_curve_end ce,
const X_monotone_curve_2& /* xcv */,
Arr_curve_end /* ce */,
Arr_use_dummy_tag) const
{
CGAL_error();
@ -1153,10 +1153,10 @@ public:
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,
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();

View File

@ -731,6 +731,7 @@ public:
return (DFace_const_iter (Base::isolated_vertex()->face()));
}
private:
// Blocking access to inherited functions from the Dcel::Vertex.

View File

@ -3234,7 +3234,7 @@ public:
return is_equal(arc2);
}
#if defined(_MSC_VER)
#if defined(_MSC_VER) || defined(__clang__)
// befriending the kernel point
friend typename Curved_kernel_via_analysis_2::Point_2;
@ -3246,19 +3246,19 @@ public:
friend typename Curved_kernel_via_analysis_2::Z; \
friend typename Curved_kernel_via_analysis_2_Functors:: \
Z<Curved_kernel_via_analysis_2>
#else
#else // defined(_MSC_VER) || defined(__clang__) || defined(__INTEL_COMPILER)
// befriending the kernel point
friend class Curved_kernel_via_analysis_2::Point_2;
//friend class Curved_kernel_via_analysis_2::Point_2;
// befriending the kernel arc
friend class Curved_kernel_via_analysis_2::Arc_2;
//friend class Curved_kernel_via_analysis_2::Arc_2;
// befriending the functors
#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
#endif // defined(_MSC_VER) || defined(__clang__) || defined(__INTEL_COMPILER)
//Curved_kernel_via_analysis_2_functors<
// Curved_kernel_via_analysis_2> >;
@ -3348,8 +3348,8 @@ std::istream& operator>> (
CGAL_precondition(CGAL::is_ascii(is));
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
typedef Rep_ Rep;
//typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
//typedef Rep_ Rep;
arc.read(is);

View File

@ -1600,9 +1600,8 @@ public:
CGAL_precondition(cv.compare_y_at_x(p) == CGAL::EQUAL);
// check that p is not an end-point of the arc
CGAL_precondition_code(
cv._same_arc_compare_xy(cv._minpoint(), p) != CGAL::EQUAL &&
cv._same_arc_compare_xy(cv._maxpoint(), p) != CGAL::EQUAL);
CGAL_precondition(cv._same_arc_compare_xy(cv._minpoint(), p) != CGAL::EQUAL);
CGAL_precondition(cv._same_arc_compare_xy(cv._maxpoint(), p) != CGAL::EQUAL);
CERR("\nsplit\n");
c1 = cv._replace_endpoints(

View File

@ -279,7 +279,7 @@ public:
template <class SweepCurvesAdaptor_2, class Rep_>
std::ostream& operator << (std::ostream& os,
const Generic_arc_2<SweepCurvesAdaptor_2, Rep_>& arc) {
const Generic_arc_2<SweepCurvesAdaptor_2, Rep_>& arc) {
os << arc.id() << "@";
if(arc.is_degenerate())
@ -291,7 +291,7 @@ std::ostream& operator << (std::ostream& os,
template <class SweepCurvesAdaptor_2, class Rep_>
std::istream& operator >> (std::istream& is,
Generic_arc_2<SweepCurvesAdaptor_2, Rep_>& arc) {
Generic_arc_2<SweepCurvesAdaptor_2, Rep_>& /* arc */) {
std::cerr << "bogus >> call for generic_arc\n";
return is;

View File

@ -200,7 +200,7 @@ public:
template <class SweepCurvesAdaptor_2, class Rep_>
std::ostream& operator << (std::ostream& os,
const Generic_point_2<SweepCurvesAdaptor_2, Rep_>& pt) {
const Generic_point_2<SweepCurvesAdaptor_2, Rep_>& pt) {
os << pt.id() << "@";
if(pt.is_finite())
@ -213,7 +213,7 @@ std::ostream& operator << (std::ostream& os,
template <class SweepCurvesAdaptor_2, class Rep_>
std::istream& operator >> (std::istream& is,
Generic_point_2<SweepCurvesAdaptor_2, Rep_>& pt) {
Generic_point_2<SweepCurvesAdaptor_2, Rep_>& /* pt */) {
std::cerr << "bogus >> call for generic_point\n";
return is;

View File

@ -784,15 +784,14 @@ public:
// befriending the functors
#if defined(_MSC_VER)
#if defined(_MSC_VER) || defined(__clang__)
#define CGAL_BEFRIEND_CKvA_2_FUNCTOR(Z) \
friend typename Curved_kernel_via_analysis_2::Z; \
friend typename Curved_kernel_via_analysis_2_Functors::Z< Curved_kernel_via_analysis_2 >
#else
#else // defined(_MSC_VER) || defined(__clang__) || defined(__INTEL_COMPILER)
#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
#endif // defined(_MSC_VER) || defined(__clang__) || defined(__INTEL_COMPILER)
CGAL_BEFRIEND_CKvA_2_FUNCTOR(Construct_point_2);
CGAL_BEFRIEND_CKvA_2_FUNCTOR(Compare_x_2);
@ -824,8 +823,8 @@ std::istream& operator>> (
CGAL_precondition(CGAL::is_ascii(is));
typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
typedef Rep_ Rep;
//typedef CurvedKernelViaAnalysis_2 Curved_kernel_via_analysis_2;
//typedef Rep_ Rep;
pt.read(is);

View File

@ -593,8 +593,9 @@ public:
* lexicographic order of endpoints is ensured automatically, hence no
* special handling is required
*/
result_type operator()(const Arc_2& cv, const Point_2& p,
const Point_2& q) const {
result_type operator()(const Arc_2& cv,
const Point_2& /* p */,
const Point_2& /* q */) const {
SCA_CERR("\n\nWARNING!! New_endpoints_opposite_2: cv: " << cv <<
"\n p: " << p << "\n q: " << q << std::endl);
CGAL_error_msg("New_endpoints_opposite_2 deprecated and must not be \

View File

@ -218,9 +218,12 @@ void Basic_sweep_line_2<Tr, Vis, Subcv, Evnt, Alloc>::_init_structures()
{
CGAL_assertion(m_queue->empty());
CGAL_assertion((m_statusLine.size() == 0));
// Allocate all of the Subcurve objects as one block.
m_subCurves = m_subCurveAlloc.allocate(m_num_of_subCurves);
// Allocate all of the Subcurve objects as one block. Don't allocate
// anything when there are no subcurves.
if (m_num_of_subCurves > 0) {
m_subCurves = m_subCurveAlloc.allocate(m_num_of_subCurves);
}
return;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,285 @@
#ifndef CGAL_IO_TEST_H
#define CGAL_IO_TEST_H
#include <iostream>
#include <vector>
#include <sstream>
#include <string>
#include "IO_base_test.h"
template <typename T_Traits>
class IO_test : public IO_base_test<T_Traits> {
public:
typedef T_Traits Traits;
typedef IO_base_test<Traits> Base;
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 std::vector<Point_2> Points_vector;
typedef typename std::vector<X_monotone_curve_2> Xcurves_vector;
typedef typename std::vector<Curve_2> Curves_vector;
/*! Constructor */
IO_test();
/*! Destructor */
virtual ~IO_test();
bool read_xcurves(const char* filename, Xcurves_vector& xcurves);
bool read_points(const char* filename, Points_vector& points);
bool read_curves(const char* filename, Curves_vector& curves);
/*! Set the file names */
void set_filenames(const char* points_filename,
const char* xcurves_filename,
const char* curves_filename);
/*! Parse the command line */
virtual bool parse(int argc, char* argv[]);
/*! Initialize the data structure */
virtual bool init();
/*! Clear the data structures */
virtual void clear();
protected:
/*! Skip comments */
std::istream& skip_comments(std::istream& is, std::string& line);
/*! Remove blanks */
std::string remove_blanks(char* str);
/*! Print an error message */
void print_error(const std::string& msg)
{ std::cerr << "Error: " << msg.c_str() << std::endl; }
/*! Print the end-of-line */
void print_eol()
{
std::cout << std::endl;
m_eol_printed = true;
}
/*! Print information */
void print_info(std::string& info,
bool start_line = true, bool end_line = true)
{
if (start_line && !m_eol_printed) print_eol();
std::cout << info.c_str();
if (end_line) print_eol();
}
/*! Print final results */
void print_result(bool result)
{
std::string result_str((result) ? "Passed" : "Failed");
print_info(result_str, false);
}
/*! Print expected answer and real answer */
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));
}
/*! Indicates whether the end-of-line has been printed */
bool m_eol_printed;
/*! The input data file of points*/
std::string m_filename_points;
/*! The input data file of curves*/
std::string m_filename_curves;
/*! The input data file of xcurves*/
std::string m_filename_xcurves;
/*! The container of input points */
Points_vector m_points;
/*! The container of input curves */
Curves_vector m_curves;
/*! The container of x-monotone curves */
Xcurves_vector m_xcurves;
};
/*!
* Constructor.
* Accepts test data file name.
*/
template <typename T_Traits>
IO_test<T_Traits>::IO_test() : m_eol_printed(true) {}
/*!
* Destructor.
*/
template <typename T_Traits>
IO_test<T_Traits>::~IO_test() { clear(); }
/*! Set the file names */
template <typename T_Traits>
void IO_test<T_Traits>::set_filenames(const char* points_filename,
const char* xcurves_filename,
const char* curves_filename)
{
m_filename_points.assign(points_filename);
m_filename_xcurves.assign(xcurves_filename);
m_filename_curves.assign(curves_filename);
}
template <typename T_Traits>
bool IO_test<T_Traits>::parse(int argc, char* argv[])
{
if (argc < 4) {
print_info(std::string("Usage: ").append(argv[0]).
append(" points_file xcurves_file curves_file"));
return false;
}
m_filename_points.assign(argv[1]);
m_filename_xcurves.assign(argv[2]);
m_filename_curves.assign(argv[3]);
return true;
}
/*! Initialize the data structure */
template <typename T_Traits>
bool IO_test<T_Traits>::init()
{
if (!read_points(m_filename_points.c_str(), m_points)) return false;
if (!read_xcurves(m_filename_xcurves.c_str(), m_xcurves)) return false;
if (!read_curves(m_filename_curves.c_str(), m_curves)) return false;
return true;
}
/*! Clear the data structures */
template <typename T_Traits>
void IO_test<T_Traits>::clear()
{
m_filename_points.clear();
m_filename_xcurves.clear();
m_filename_curves.clear();
m_points.clear();
m_curves.clear();
m_xcurves.clear();
}
/*!
* Skip comments. Comments start with the '#' character and extend to the
* end of the line
*/
template <typename T_Traits>
std::istream& IO_test<T_Traits>::skip_comments(std::istream& is,
std::string& line)
{
while (std::getline(is, line))
if ((line[0] != '#') && !line.empty()) break;
return is;
}
/*!
*/
template <typename T_Traits>
std::string IO_test<T_Traits>::remove_blanks(char* str)
{
std::string result = "";
bool flag = false;
//only alphanumeric characters and underscores are allowed
for (; *str != '\0'; ++str) {
if ((*str >= '0' && *str <= '9') || //digits
(*str >= 'A' && *str <= 'Z') || //upper case letters
(*str >= 'a' && *str <= 'z') || //lower case letters
*str == '_') //underscores
{
if (!flag)
flag = true;
result += *str;
}
if (*str == ' ' && flag) break;
}
return result;
}
/*! */
template <typename T_Traits>
bool IO_test<T_Traits>::read_points(const char* filename, Points_vector& points)
{
typedef T_Traits Traits;
// read points from file into associative container
std::ifstream p_stream(filename);
if (!p_stream.is_open()) {
std::cerr << "Cannot open file " << filename << "!" << std::endl;
return false;
}
std::string line;
while (skip_comments(p_stream, line)) {
std::istringstream line_stream(line);
typename Traits::Point_2 p;
this->read_point(line_stream, p);
points.push_back(p);
line_stream.clear();
}
return true;
}
/*! */
template <typename T_Traits>
bool
IO_test<T_Traits>::read_xcurves(const char* filename, Xcurves_vector& xcurves)
{
typedef T_Traits Traits;
// read x-monotone curves from file into associative container
std::ifstream xcv_stream(filename);
if (!xcv_stream.is_open()) {
std::cerr << "Cannot open file " << filename << "!" << std::endl;
return false;
}
std::string line;
while (skip_comments(xcv_stream, line)) {
std::istringstream line_stream(line);
typename Traits::X_monotone_curve_2 xcv;
this->read_xcurve(line_stream, xcv);
xcurves.push_back(xcv);
line_stream.clear();
}
return true;
}
/*! */
template <typename T_Traits>
bool
IO_test<T_Traits>::read_curves(const char* filename, Curves_vector& curves)
{
typedef T_Traits Traits;
// Read curves from file into associative container
std::ifstream cv_stream(filename);
if (!cv_stream.is_open()) {
std::cerr << "Cannot open file " << filename << "!" << std::endl;
return false;
}
std::string line;
while (skip_comments(cv_stream, line)) {
std::istringstream line_stream(line);
typename Traits::Curve_2 cv;
this->read_curve(line_stream, cv);
curves.push_back(cv);
line_stream.clear();
}
return true;
}
#endif

View File

@ -0,0 +1,150 @@
#ifndef CGAL_POINT_LOCATION_DYNAMIC_TEST_H
#define CGAL_POINT_LOCATION_DYNAMIC_TEST_H
#include <CGAL/basic.h>
#include "Point_location_test.h"
/*! Point location test */
template <typename T_Traits>
class Point_location_dynamic_test : public Point_location_test<T_Traits> {
private:
typedef T_Traits Traits;
typedef Point_location_test<Traits> Base;
public:
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::Arrangement_2 Arrangement_2;
/*! Destructor */
virtual ~Point_location_dynamic_test()
{
this->deallocate_arrangement();
clear();
this->deallocate_pl_strategies();
}
/*! Clear the data structures */
virtual void clear();
void set_filenames(const char* points_filename, const char* xcurves_filename,
const char* curves_filename, const char* commands_filename,
const char* queries_filename)
{
Base::set_filenames(points_filename, xcurves_filename,
curves_filename, queries_filename);
m_filename_commands.assign(commands_filename);
}
bool construct_arrangement();
private:
bool read_perform_opts(std::istream& is);
bool remove(const X_monotone_curve_2& xcv);
/*! The input data file of commands*/
std::string m_filename_commands;
};
/*! Clear the data structures */
template<class T_Traits>
void Point_location_dynamic_test<T_Traits>::clear()
{
Base::clear();
m_filename_commands.clear();
}
template <typename T_Traits>
bool Point_location_dynamic_test<T_Traits>::construct_arrangement()
{
std::ifstream in_com(this->m_filename_commands.c_str());
if (!in_com.is_open()) {
this->print_error(std::string("cannot open file ").append(this->m_filename_commands));
return false;
}
if (!read_perform_opts(in_com)) {
in_com.close();
return false;
}
in_com.close();
// Print the size of the arrangement.
std::cout << "V = " << this->m_arr->number_of_vertices()
<< ", E = " << this->m_arr->number_of_edges()
<< ", F = " << this->m_arr->number_of_faces() << std::endl;
return true;
}
template <typename T_Traits>
bool Point_location_dynamic_test<T_Traits>::read_perform_opts(std::istream& is)
{
bool rc = true;
CGAL::Timer timer;
timer.reset();
timer.start();
std::string sline;
while (this->skip_comments(is, sline)) {
std::istringstream line(sline);
char cmd;
line >> cmd;
if (cmd == 'a') {
// Insert all into the arrangement
CGAL::insert(*(this->m_arr), this->m_xcurves.begin(), this->m_xcurves.end());
// insert(*(this->m_arr), m_points.begin(), m_points.end());
CGAL::insert(*(this->m_arr), this->m_curves.begin(), this->m_curves.end());
continue;
}
unsigned int id;
line >> id;
if (id >= this->m_xcurves.size()) {
std::cerr << "Index of x-monotone curve " << id << " is out of range ("
<< this->m_xcurves.size() << ") in " << "m_filename_commands"
<< "!" << std::endl;
rc = false;
continue;
}
if (cmd == 'i') CGAL::insert(*(this->m_arr), this->m_xcurves[id]);
if (cmd == 'd') {
if (!remove(this->m_xcurves[id])) rc = false;
}
}
timer.stop(); ///END
std::cout << "Arrangement aggregate construction took "
<< timer.time() << std::endl;
return rc;
}
template <typename T_Traits>
bool Point_location_dynamic_test<T_Traits>::remove(const X_monotone_curve_2& xcv)
{
typedef T_Traits Traits;
bool rc = false; // be pasimistic, assume nothing is removed.
const Traits* traits = this->m_arr->geometry_traits();
typename Traits::Equal_2 equal = traits->equal_2_object();
typename Arrangement_2::Edge_iterator eit;
for (eit = this->m_arr->edges_begin(); eit != this->m_arr->edges_end(); ++eit) {
const X_monotone_curve_2& xcv_arr = eit->curve();
if (equal(xcv, xcv_arr)) {
this->m_arr->remove_edge(eit);
rc = true; // found a curve to remove.
break;
}
}
return rc;
}
#endif

View File

@ -0,0 +1,742 @@
#ifndef CGAL_POINT_LOCATION_TEST_H
#define CGAL_POINT_LOCATION_TEST_H
#include <CGAL/basic.h>
#include <CGAL/Timer.h>
#include <CGAL/Arrangement_2.h>
#include <CGAL/Arr_naive_point_location.h>
#include <CGAL/Arr_simple_point_location.h>
#include <CGAL/Arr_walk_along_line_point_location.h>
#include <CGAL/Arr_landmarks_point_location.h>
#include <CGAL/Arr_trapezoid_ric_point_location.h>
#include <CGAL/Arr_point_location/Arr_lm_random_generator.h>
#include <CGAL/Arr_point_location/Arr_lm_grid_generator.h>
#include <CGAL/Arr_point_location/Arr_lm_halton_generator.h>
#include <CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h>
#include <CGAL/Arr_point_location/Arr_lm_specified_points_generator.h>
//#include <CGAL/Arr_triangulation_point_location.h>
#include "IO_test.h"
/*! Point location test */
template <typename T_Traits>
class Point_location_test : public IO_test<T_Traits> {
private:
typedef T_Traits Traits;
typedef IO_test<Traits> Base;
public:
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::Points_vector Points_vector;
typedef typename Base::Xcurves_vector Xcurves_vector;
typedef typename Base::Curves_vector Curves_vector;
typedef CGAL::Arrangement_2<Traits> Arrangement_2;
typedef typename Arrangement_2::Halfedge_handle Halfedge_handle;
typedef typename Arrangement_2::Edge_const_iterator Edge_const_iterator;
typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator;
typedef typename Points_vector::iterator Point_iterator;
typedef std::vector<CGAL::Object> Objects_vector;
typedef Objects_vector::iterator Object_iterator;
protected:
typedef typename CGAL::Arr_naive_point_location<Arrangement_2>
Naive_point_location;
typedef typename CGAL::Arr_simple_point_location<Arrangement_2>
Simple_point_location;
typedef typename CGAL::Arr_walk_along_line_point_location<Arrangement_2>
Walk_point_location;
typedef typename CGAL::Arr_landmarks_point_location<Arrangement_2>
Lm_point_location;
typedef typename CGAL::Arr_random_landmarks_generator<Arrangement_2>
Random_lm_generator;
typedef typename CGAL::Arr_landmarks_point_location<Arrangement_2,
Random_lm_generator>
Lm_random_point_location;
typedef typename CGAL::Arr_grid_landmarks_generator<Arrangement_2>
Grid_lm_generator;
typedef typename CGAL::Arr_landmarks_point_location<Arrangement_2,
Grid_lm_generator>
Lm_grid_point_location;
typedef typename CGAL::Arr_halton_landmarks_generator<Arrangement_2>
Halton_lm_generator;
typedef typename CGAL::Arr_landmarks_point_location<Arrangement_2,
Halton_lm_generator>
Lm_halton_point_location;
typedef typename CGAL::Arr_middle_edges_landmarks_generator<Arrangement_2>
Middle_edges_generator;
typedef typename CGAL::Arr_landmarks_point_location<Arrangement_2,
Middle_edges_generator>
Lm_middle_edges_point_location;
typedef typename CGAL::Arr_landmarks_specified_points_generator<Arrangement_2>
Specified_points_generator;
typedef typename CGAL::Arr_landmarks_point_location<Arrangement_2,
Specified_points_generator>
Lm_specified_points_point_location;
typedef typename CGAL::Arr_trapezoid_ric_point_location<Arrangement_2>
Trapezoid_ric_point_location;
// typedef CGAL::Arr_triangulation_point_location<Arrangement_2>
// Triangulation_point_location;
// ===> Add new point location type here <===
Naive_point_location* m_naive_pl; // 0
Simple_point_location* m_simple_pl; // 1
Walk_point_location* m_walk_pl; // 2
Lm_point_location* m_lm_pl; // 3
Lm_random_point_location* m_random_lm_pl; // 4
Lm_grid_point_location* m_grid_lm_pl; // 5
Lm_halton_point_location* m_halton_lm_pl; // 6
Lm_middle_edges_point_location* m_middle_edges_lm_pl; // 7
Lm_specified_points_point_location* m_specified_points_lm_pl; // 8
// Triangulation_point_location m_triangulation_pl; // 9
Trapezoid_ric_point_location* m_trapezoid_ric_pl; // 10
Trapezoid_ric_point_location* m_trapezoid_ric_no_grnt_pl; // 11
Random_lm_generator* m_random_g;
Grid_lm_generator* m_grid_g;
Halton_lm_generator* m_halton_g;
Middle_edges_generator* m_middle_edges_g;
Specified_points_generator* m_specified_points_g;
// // ===> Change the number of point-location startegies
// // when a new point location is added. <===
#define MAX_NUM_POINT_LOCATION_STRATEGIES 11
public:
/*! Constructor */
Point_location_test();
/*! Destructor */
virtual ~Point_location_test()
{
deallocate_arrangement();
clear();
deallocate_pl_strategies();
}
void set_filenames(const char* points_filename, const char* xcurves_filename,
const char* curves_filename, const char* queries_filename);
/*! Initialize the data structures */
virtual bool init();
/*! Perform the test */
virtual bool perform();
/*! Clear the data structures */
virtual void clear();
bool allocate_arrangement();
void deallocate_arrangement();
bool construct_arrangement();
void clear_arrangement();
bool allocate_pl_strategies();
bool construct_pl_strategies();
bool attach_pl_strategies();
void deallocate_pl_strategies();
template <typename Point_location,
typename InputIterator, typename OutputIterator>
void query(Point_location& pl, const char* type,
InputIterator begin, InputIterator end, OutputIterator oi)
{
typedef InputIterator Input_iterator;
CGAL::Timer timer;
timer.reset(); timer.start();
Input_iterator piter;
for (piter = begin; piter != end; ++piter) {
Point_2 q = (*piter);
CGAL::Object obj = pl.locate(q);
*oi++ = obj;
}
timer.stop();
std::cout << type << " location took " << timer.time() << std::endl;
}
/*! The arrangement */
Arrangement_2* m_arr;
private:
/*! The input data file of the query points*/
std::string m_filename_queries;
/*! The query points */
Points_vector m_query_points;
};
/*!
* Constructor.
* Accepts test data file name.
*/
template <typename T_Traits>
Point_location_test<T_Traits>::Point_location_test() :
m_naive_pl(NULL),
m_simple_pl(NULL),
m_walk_pl(NULL),
m_lm_pl(NULL),
m_random_lm_pl(NULL),
m_grid_lm_pl(NULL),
m_halton_lm_pl(NULL),
m_middle_edges_lm_pl(NULL),
m_specified_points_lm_pl(NULL),
// m_triangulation_pl(NULL),
m_trapezoid_ric_pl(NULL),
m_trapezoid_ric_no_grnt_pl(NULL),
m_random_g(NULL),
m_grid_g(NULL),
m_halton_g(NULL),
m_middle_edges_g(NULL),
m_specified_points_g(NULL),
m_arr(NULL)
{}
/*! Set the file names */
template <typename T_Traits>
void Point_location_test<T_Traits>::set_filenames(const char* points_filename,
const char* xcurves_filename,
const char* curves_filename,
const char* queries_filename)
{
Base::set_filenames(points_filename, xcurves_filename, curves_filename);
m_filename_queries.assign(queries_filename);
}
/*! Initialize the data structures */
template <typename T_Traits>
bool Point_location_test<T_Traits>::init()
{
if (!Base::init()) return false;
// Read the query points
if (!this->read_points(m_filename_queries.c_str(), m_query_points))
return false;
return true;
}
/*! Clear the data structures */
template<class T_Traits>
void Point_location_test<T_Traits>::clear()
{
Base::clear();
m_query_points.clear();
m_filename_queries.clear();
}
/*! Clear the data structures */
template<class T_Traits>
void Point_location_test<T_Traits>::deallocate_pl_strategies()
{
if (m_naive_pl) {
delete m_naive_pl;
m_naive_pl = NULL;
}
if (m_simple_pl) {
delete m_simple_pl;
m_simple_pl = NULL;
}
if (m_walk_pl) {
delete m_walk_pl;
m_walk_pl = NULL;
}
#if (TEST_TRAITS == SEGMENT_TRAITS) || (TEST_TRAITS == LINEAR_TRAITS)
if (m_lm_pl) {
delete m_lm_pl;
m_lm_pl = NULL;
}
if (m_random_lm_pl) {
delete m_random_lm_pl;
m_random_lm_pl = NULL;
}
if (m_grid_lm_pl) {
delete m_grid_lm_pl;
m_grid_lm_pl = NULL;
}
if (m_halton_lm_pl) {
delete m_halton_lm_pl;
m_halton_lm_pl = NULL;
}
if (m_middle_edges_lm_pl) {
delete m_middle_edges_lm_pl;
m_middle_edges_lm_pl = NULL;
}
if (m_specified_points_lm_pl) {
delete m_specified_points_lm_pl;
m_specified_points_lm_pl = NULL;
}
// Free Generators
if (m_random_g) {
delete m_random_g;
m_random_g = NULL;
}
if (m_grid_g) {
delete m_grid_g;
m_grid_g = NULL;
}
if (m_halton_g) {
delete m_halton_g;
m_halton_g = NULL;
}
if (m_middle_edges_g) {
delete m_middle_edges_g;
m_middle_edges_g = NULL;
}
if (m_specified_points_g) {
delete m_specified_points_g;
m_specified_points_g = NULL;
}
#endif
// if (m_triangulation_pl) {
// delete m_triangulation_pl;
// m_triangulation_pl = NULL;
// }
if (m_trapezoid_ric_pl) {
delete m_trapezoid_ric_pl;
m_trapezoid_ric_pl = NULL;
}
if (m_trapezoid_ric_no_grnt_pl) {
delete m_trapezoid_ric_no_grnt_pl;
m_trapezoid_ric_no_grnt_pl = NULL;
}
}
template <typename T_Traits>
bool Point_location_test<T_Traits>::allocate_arrangement()
{
if (!(m_arr = new Arrangement_2())) return false;
return true;
}
template <typename T_Traits>
void Point_location_test<T_Traits>::deallocate_arrangement()
{
if (m_arr) {
delete m_arr;
m_arr = NULL;
}
}
template <typename T_Traits>
bool Point_location_test<T_Traits>::construct_arrangement()
{
// Insert all into the arrangement
CGAL::insert(*m_arr, this->m_xcurves.begin(), this->m_xcurves.end());
// insert(*m_arr, m_points.begin(), m_points.end());
CGAL::insert(*m_arr, this->m_curves.begin(), this->m_curves.end());
// Print the size of the arrangement.
std::cout << "V = " << m_arr->number_of_vertices()
<< ", E = " << m_arr->number_of_edges()
<< ", F = " << m_arr->number_of_faces() << std::endl;
return true;
}
template <typename T_Traits>
void Point_location_test<T_Traits>::clear_arrangement()
{
if (m_arr) m_arr->clear();
}
template <typename T_Traits>
bool Point_location_test<T_Traits>::allocate_pl_strategies()
{
// Allocate all point location strategies.
if (!(m_naive_pl = new Naive_point_location())) return false;
if (!(m_simple_pl = new Simple_point_location())) return false;
if (!(m_walk_pl = new Walk_point_location())) return false;
#if (TEST_TRAITS == SEGMENT_TRAITS) || (TEST_TRAITS == LINEAR_TRAITS)
if (!(m_lm_pl = new Lm_point_location())) return false;
if (!(m_random_lm_pl = new Lm_random_point_location())) return false;
if (!(m_grid_lm_pl = new Lm_grid_point_location())) return false;
if (!(m_halton_lm_pl = new Lm_halton_point_location())) return false;
if (!(m_middle_edges_lm_pl = new Lm_middle_edges_point_location()))
return false;
if (!(m_specified_points_lm_pl = new Lm_specified_points_point_location()))
return false;
// if (!(m_triangulation_pl = new Triangulation_point_location()))
// return false;
#endif
if (!(m_trapezoid_ric_pl = new Trapezoid_ric_point_location())) return false;
if (!(m_trapezoid_ric_no_grnt_pl = new Trapezoid_ric_point_location()))
return false;
// ===> Add new point location instance here. <===
return true;
}
template <typename T_Traits>
bool Point_location_test<T_Traits>::construct_pl_strategies()
{
typedef T_Traits Traits;
// Initialize all point location strategies.
CGAL::Timer timer;
m_naive_pl = new Naive_point_location(*m_arr); // 0
m_simple_pl = new Simple_point_location(*m_arr); // 1
m_walk_pl = new Walk_point_location(*m_arr); // 2
#if (TEST_TRAITS == SEGMENT_TRAITS) || (TEST_TRAITS == LINEAR_TRAITS)
timer.reset(); timer.start();
m_lm_pl = new Lm_point_location(*m_arr); // 3
timer.stop();
std::cout << "Lm (vert) construction took " << timer.time() << std::endl;
timer.reset(); timer.start();
m_random_g = new Random_lm_generator(*m_arr);
m_random_lm_pl = new Lm_random_point_location(*m_arr, m_random_g); // 4
timer.stop();
std::cout << "Random lm construction took " << timer.time() << std::endl;
timer.reset(); timer.start();
m_grid_g = new Grid_lm_generator(*m_arr);
m_grid_lm_pl = new Lm_grid_point_location(*m_arr, m_grid_g); // 5
timer.stop();
std::cout << "Grid lm construction took " << timer.time() << std::endl;
timer.reset(); timer.start();
m_halton_g = new Halton_lm_generator(*m_arr);
m_halton_lm_pl = new Lm_halton_point_location(*m_arr, m_halton_g); // 6
timer.stop();
std::cout << "Halton lm construction took " << timer.time() << std::endl;
timer.reset(); timer.start();
m_middle_edges_g = new Middle_edges_generator(*m_arr);
m_middle_edges_lm_pl =
new Lm_middle_edges_point_location(*m_arr, m_middle_edges_g); // 7
timer.stop();
std::cout << "Middle edges lm construction took " << timer.time()
<< std::endl;
timer.reset(); timer.start();
m_specified_points_g = new Specified_points_generator(*m_arr);
m_specified_points_lm_pl =
new Lm_specified_points_point_location(*m_arr, m_specified_points_g); // 8
timer.stop();
std::cout << "Specified_points lm construction took "
<< timer.time() << std::endl;
// timer.reset(); timer.start();
// m_triangulation_pl = new Triangulation_point_location(*m_arr); // 9
// timer.stop();
// std::cout << "Triangulation lm construction took "
// << timer.time() << std::endl;
#endif
timer.reset(); timer.start();
m_trapezoid_ric_pl = new Trapezoid_ric_point_location(*m_arr); // 10
timer.stop();
std::cout << "Trapezoid RIC construction took " << timer.time() << std::endl;
timer.reset(); timer.start();
m_trapezoid_ric_no_grnt_pl =
new Trapezoid_ric_point_location(*m_arr, false); // 11
timer.stop();
std::cout << "Trapezoid RIC without-guarantees construction took "
<< timer.time() << std::endl;
std::cout << std::endl;
// ===> Add new point location instance here. <===
return true;
}
template <typename T_Traits>
bool Point_location_test<T_Traits>::attach_pl_strategies()
{
typedef T_Traits Traits;
// Initialize all point location strategies.
CGAL::Timer timer;
m_naive_pl->attach(*m_arr);
m_simple_pl->attach(*m_arr);
m_walk_pl->attach(*m_arr);
#if (TEST_TRAITS == SEGMENT_TRAITS) || (TEST_TRAITS == LINEAR_TRAITS)
timer.reset(); timer.start();
m_lm_pl->attach(*m_arr);
timer.stop();
std::cout << "Lm (vert) construction took " << timer.time() << std::endl;
timer.reset(); timer.start();
m_random_g = new Random_lm_generator(*m_arr);
m_random_lm_pl->attach(*m_arr, m_random_g);
timer.stop();
std::cout << "Random lm construction took " << timer.time() << std::endl;
timer.reset(); timer.start();
m_grid_g = new Grid_lm_generator(*m_arr);
m_grid_lm_pl->attach(*m_arr, m_grid_g);
timer.stop();
std::cout << "Grid lm construction took " << timer.time() << std::endl;
timer.reset(); timer.start();
m_halton_g = new Halton_lm_generator(*m_arr);
m_halton_lm_pl->attach(*m_arr, m_halton_g);
timer.stop();
std::cout << "Halton lm construction took " << timer.time() << std::endl;
timer.reset(); timer.start();
m_middle_edges_g = new Middle_edges_generator(*m_arr);
m_middle_edges_lm_pl->attach(*m_arr, m_middle_edges_g);
timer.stop();
std::cout << "Middle edges lm construction took " << timer.time()
<< std::endl;
timer.reset(); timer.start();
m_specified_points_g = new Specified_points_generator(*m_arr);
m_specified_points_lm_pl->attach(*m_arr, m_specified_points_g);
timer.stop();
std::cout << "Specified_points lm construction took "
<< timer.time() << std::endl;
// timer.reset(); timer.start();
// m_location triangulation_lm_pl->attach(*m_arr);
// timer.stop();
// std::cout << "Triangulation lm construction took "
// << timer.time() << std::endl;
#endif
timer.reset(); timer.start();
m_trapezoid_ric_pl->attach(*m_arr);
timer.stop();
std::cout << "Trapezoid RIC construction took " << timer.time() << std::endl;
timer.reset(); timer.start();
m_trapezoid_ric_no_grnt_pl->with_guarantees(false);
m_trapezoid_ric_no_grnt_pl->attach(*m_arr);
timer.stop();
std::cout << "Trapezoid RIC without-guarantees construction took "
<< timer.time() << std::endl;
std::cout << std::endl;
// ===> Add new point location instance here. <===
return true;
}
// Perform the test
template <typename T_Traits>
bool Point_location_test<T_Traits>::perform()
{
Objects_vector objs[MAX_NUM_POINT_LOCATION_STRATEGIES];
typename Arrangement_2::Vertex_const_handle vh_ref, vh_curr;
typename Arrangement_2::Halfedge_const_handle hh_ref, hh_curr;
typename Arrangement_2::Face_const_handle fh_ref, fh_curr;
// Locate the points in the list using all point location strategies.
// std::cout << "Time in seconds" << std::endl;
std::cout << std::endl;
unsigned int pl_index = 0;
query(*m_naive_pl, "Naive", m_query_points.begin(), m_query_points.end(),
std::back_inserter(objs[pl_index++])); // Naive
query(*m_simple_pl, "Simple", m_query_points.begin(), m_query_points.end(),
std::back_inserter(objs[pl_index++])); // Simple
query(*m_walk_pl, "Walk", m_query_points.begin(), m_query_points.end(),
std::back_inserter(objs[pl_index++])); // Walk
#if (TEST_TRAITS == SEGMENT_TRAITS) || (TEST_TRAITS == LINEAR_TRAITS)
query(*m_lm_pl, "Landmarks (vertices)",
m_query_points.begin(), m_query_points.end(),
std::back_inserter(objs[pl_index++])); // Landmarks (vertices)
query(*m_random_lm_pl, "Landmarks random",
m_query_points.begin(), m_query_points.end(),
std::back_inserter(objs[pl_index++])); // Landmarks random
query(*m_grid_lm_pl, "Landmarks grid",
m_query_points.begin(), m_query_points.end(),
std::back_inserter(objs[pl_index++])); // Landmarks grid
query(*m_halton_lm_pl, "Landmarks Halton",
m_query_points.begin(), m_query_points.end(),
std::back_inserter(objs[pl_index++])); // Landmarks Halton
query(*m_middle_edges_lm_pl, "Landmarks middle edges",
m_query_points.begin(), m_query_points.end(),
std::back_inserter(objs[pl_index++])); // Landmarks middle edges
query(*m_specified_points_lm_pl, "Landmarks specified points",
m_query_points.begin(), m_query_points.end(),
std::back_inserter(objs[pl_index++])); // Landmarks specified points
// Triangulation
// query(*m_triangulation_pl, "Triangulation",
// m_query_points.begin(), m_query_points.end(),
// std::back_inserter(objs[pl_index++])); // Triangulation
#endif
query(*m_trapezoid_ric_pl, "Trapezoidal RIC",
m_query_points.begin(), m_query_points.end(),
std::back_inserter(objs[pl_index++])); // Trapezoidal RIC
// Trapezoidal RIC without guarantees
query(*m_trapezoid_ric_no_grnt_pl, "Trapezoidal RIC without guarantees",
m_query_points.begin(), m_query_points.end(),
std::back_inserter(objs[pl_index++]));
std::cout << std::endl;
// ===> Add a call to operate the new point location. <===
// Number of point location strategies used.
unsigned int pls_num = pl_index;
std::cout << "Number of strategies is " << pls_num << std::endl;
// End Location
int result = 0;
//init all obejct iterators
Object_iterator ob_iter[MAX_NUM_POINT_LOCATION_STRATEGIES];
for (pl_index = 0; pl_index < pls_num; ++pl_index)
ob_iter[pl_index] = objs[pl_index].begin();
// get size of objects
unsigned int size = objs[0].size();
std::cout << "size is " << size << std::endl;
for (pl_index = 0; pl_index < pls_num; ++pl_index) {
if (size != objs[pl_index].size()) {
std::cout << "Error: size of pl number " << pl_index << " is "
<< objs[pl_index].size() << std::endl;
result = -1;
}
}
// Assign and check results
unsigned int qi; //qi is the query point index
for (qi = 0; qi < size; ++qi) {
// Assign object to a face
if (CGAL::assign(fh_ref, ob_iter[0][qi])) {
for (unsigned int pl_index = 1; pl_index < pls_num; ++pl_index) {
if (! CGAL::assign(fh_curr, ob_iter[pl_index][qi])) {
std::cout << "Error in point location number " << pl_index;
if (CGAL::assign(fh_curr, ob_iter[pl_index][qi])) {
std::cout << ", an halfedge returned instead of a face"
<< std::endl;
}
else if (CGAL::assign(hh_curr, ob_iter[pl_index][qi])) {
std::cout << ", a vertex returned instead of a face"
<< std::endl;
}
else {
std::cout << ", an unknowen object returned instead of a face"
<< std::endl;
}
result = -1;
}
else if (fh_curr != fh_ref) {
std::cout << "Error: point location number "
<< pl_index << " return a different face" << std::endl;
result = -1;
}
}
//if (fh_ref->is_unbounded())
// std::cout << "Unbounded face." << std::endl;
//else
// std::cout << "Face." << std::endl;
}
// Assign object to a halfedge
else if (CGAL::assign (hh_ref, ob_iter[0][qi])) {
std::cout << "Halfedge: " << hh_ref->curve() << std::endl;
for (unsigned int pl_index = 1; pl_index < pls_num; ++pl_index) {
if (! CGAL::assign(hh_curr, ob_iter[pl_index][qi])) {
std::cout << "Error in point location number " << pl_index;
if (CGAL::assign(fh_curr, ob_iter[pl_index][qi])) {
std::cout << ", a face returned instead of an halfedge"
<< std::endl;
}
else if (CGAL::assign(hh_curr, ob_iter[pl_index][qi])) {
std::cout << ", a vertex returned instead of an halfedge"
<< std::endl;
}
else {
std::cout << ", an unknowen object returned instead of an halfedge"
<< std::endl;
}
result = -1;
}
else if ((hh_curr != hh_ref) && (hh_curr->twin() != hh_ref)) {
std::cout << "Error: point location number "
<< pl_index << " return a different halfedge" << std::endl;
std::cout << "Halfedge (curr): " << hh_curr->curve() << std::endl;
result = -1;
}
}
}
// Assign object to a vertex
else if (CGAL::assign(vh_ref, ob_iter[0][qi])) {
for (unsigned int pl_index = 1; pl_index < pls_num; ++pl_index) {
if (! CGAL::assign(vh_curr, ob_iter[pl_index][qi])) {
std::cout << "Error in point location number " << pl_index;
if (CGAL::assign(fh_curr, ob_iter[pl_index][qi])) {
std::cout << ", a face returned instead of a vertex"<< std::endl;
}
else if (CGAL::assign(hh_curr, ob_iter[pl_index][qi])) {
std::cout << ", an halfedge returned instead of a vertex"
<< std::endl;
}
else {
std::cout << ", an unknown object returned instead of a vertex"
<< std::endl;
}
result = -1;
}
else if (vh_curr != vh_ref) {
std::cout << "Error: point location number "
<< pl_index << " return a different vertex"<< std::endl;
result = -1;
}
}
std::cout << "Vertex: "<< vh_ref->point() << std::endl;
}
else {
std::cout << "Illegal point-location result." << std::endl;
result = -1;
}
}
return (result == 0);
}
#endif

View File

@ -8,11 +8,8 @@
#include <list>
template <class Traits>
class Segment_reader
{
class Segment_reader {
public:
typedef typename Traits::Kernel Kernel;
typedef typename Kernel::FT NT;
typedef typename Traits::Point_2 Point_2;
@ -20,8 +17,8 @@ public:
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;
template<class OutputIterator>
int read_data(const char * filename, OutputIterator curves_out,
CGAL::Bbox_2 & bbox)
int read_data(const char* filename, OutputIterator curves_out,
CGAL::Bbox_2& bbox)
{
std::ifstream inp(filename);
if (!inp.is_open()) {
@ -35,8 +32,7 @@ public:
NT x1, y1, x2, y2;
int i;
for (i = 0; i < count; i++)
{
for (i = 0; i < count; i++) {
inp >> x1 >> y1 >> x2 >> y2;
//std::cout << "x1 ="<<x1<< "x2 ="<<x2<< "y1 ="<<y1<< "y2 ="<<y2<<std::endl;
@ -50,9 +46,9 @@ public:
CGAL::Bbox_2 curve_bbox = curve.bbox();
if (i == 0)
bbox = curve_bbox;
bbox = curve_bbox;
else
bbox = bbox + curve_bbox;
bbox = bbox + curve_bbox;
}
inp.close();
return 0;

View File

@ -3,13 +3,13 @@
#include "Traits_base_test.h"
template <class T_Traits>
template <typename T_Traits>
class Traits_adaptor_test : public Traits_base_test<T_Traits> {
private:
/*! A map between (strings) commands and (member functions) operations */
typedef bool (Traits_adaptor_test::* Wrapper)(std::istringstream &);
typedef std::map<std::string, Wrapper> Wrapper_map;
typedef typename Wrapper_map::iterator Wrapper_iter;
typedef std::map<std::string, Wrapper> Wrapper_map;
typedef typename Wrapper_map::iterator Wrapper_iter;
Wrapper_map m_wrappers;
virtual bool exec(std::istringstream & str_stream,
@ -49,7 +49,7 @@ private:
public:
/*! Constructor */
Traits_adaptor_test(int argc, char * argv[]);
Traits_adaptor_test();
/*! Destructor */
virtual ~Traits_adaptor_test();
@ -59,9 +59,8 @@ public:
* Constructor.
* Accepts test data file name.
*/
template <class T_Traits>
Traits_adaptor_test<T_Traits>::Traits_adaptor_test(int argc, char * argv[]) :
Traits_base_test<T_Traits>(argc, argv)
template <typename T_Traits>
Traits_adaptor_test<T_Traits>::Traits_adaptor_test()
{
typedef T_Traits Traits;
@ -85,10 +84,10 @@ Traits_adaptor_test<T_Traits>::Traits_adaptor_test(int argc, char * argv[]) :
* Destructor.
* Declares as virtual.
*/
template <class T_Traits>
template <typename T_Traits>
Traits_adaptor_test<T_Traits>::~Traits_adaptor_test() {}
template <class T_Traits>
template <typename T_Traits>
bool Traits_adaptor_test<T_Traits>::
ta_compare_y_at_x_left_wrapper(std::istringstream & str_stream)
{
@ -96,15 +95,15 @@ ta_compare_y_at_x_left_wrapper(std::istringstream & str_stream)
return ta_compare_y_at_x_left_wrapper_imp(str_stream, Has_left_category());
}
template <class T_Traits>
template <typename T_Traits>
bool Traits_adaptor_test<T_Traits>::
ta_compare_y_at_x_left_wrapper_imp (std::istringstream &, CGAL::Tag_false)
ta_compare_y_at_x_left_wrapper_imp(std::istringstream &, CGAL::Tag_false)
{
CGAL_error();
return false;
}
template <class T_Traits>
template <typename T_Traits>
bool
Traits_adaptor_test<T_Traits>::
ta_compare_y_at_x_left_wrapper_imp(std::istringstream & str_stream,
@ -124,7 +123,7 @@ ta_compare_y_at_x_left_wrapper_imp(std::istringstream & str_stream,
return this->compare(exp_answer, real_answer);
}
template <class T_Traits>
template <typename T_Traits>
bool Traits_adaptor_test<T_Traits>::
ta_is_in_x_range_wrapper(std::istringstream & str_stream)
{
@ -149,7 +148,7 @@ ta_is_in_x_range_wrapper(std::istringstream & str_stream)
return this->compare(exp_answer, real_answer);
}
template <class T_Traits>
template <typename T_Traits>
bool Traits_adaptor_test<T_Traits>::
ta_compare_y_position_wrapper(std::istringstream & str_stream)
{
@ -165,7 +164,7 @@ ta_compare_y_position_wrapper(std::istringstream & str_stream)
return this->compare(exp_answer, real_answer);
}
template <class T_Traits>
template <typename T_Traits>
bool Traits_adaptor_test<T_Traits>::
ta_is_between_cw_wrapper(std::istringstream & str_stream)
{
@ -192,7 +191,7 @@ ta_is_between_cw_wrapper(std::istringstream & str_stream)
return this->compare(exp_answer, real_answer);
}
template <class T_Traits>
template <typename T_Traits>
bool Traits_adaptor_test<T_Traits>::
ta_compare_cw_around_point_wrapper(std::istringstream & str_stream)
{
@ -218,7 +217,7 @@ ta_compare_cw_around_point_wrapper(std::istringstream & str_stream)
return this->compare(exp_answer, real_answer);
}
template <class T_Traits>
template <typename T_Traits>
bool Traits_adaptor_test<T_Traits>::
ta_are_mergeable_wrapper(std::istringstream & str_stream)
{
@ -226,7 +225,7 @@ ta_are_mergeable_wrapper(std::istringstream & str_stream)
return ta_are_mergeable_wrapper_imp(str_stream, Has_merge_category());
}
template <class T_Traits>
template <typename T_Traits>
bool
Traits_adaptor_test<T_Traits>::
ta_are_mergeable_wrapper_imp(std::istringstream &, CGAL::Tag_false)
@ -235,7 +234,7 @@ ta_are_mergeable_wrapper_imp(std::istringstream &, CGAL::Tag_false)
return false;
}
template <class T_Traits>
template <typename T_Traits>
bool Traits_adaptor_test<T_Traits>::
ta_are_mergeable_wrapper_imp (std::istringstream & str_stream, CGAL::Tag_true)
{
@ -251,7 +250,7 @@ ta_are_mergeable_wrapper_imp (std::istringstream & str_stream, CGAL::Tag_true)
return this->compare(exp_answer, real_answer);
}
template <class T_Traits>
template <typename T_Traits>
bool Traits_adaptor_test<T_Traits>::ta_merge_wrapper
(std::istringstream & str_stream)
{
@ -259,19 +258,19 @@ bool Traits_adaptor_test<T_Traits>::ta_merge_wrapper
return ta_merge_wrapper_imp(str_stream, Has_merge_category());
}
template <class T_Traits>
template <typename T_Traits>
bool
Traits_adaptor_test<T_Traits>::
ta_merge_wrapper_imp (std::istringstream &, CGAL::Tag_false)
ta_merge_wrapper_imp(std::istringstream &, CGAL::Tag_false)
{
CGAL_error();
return false;
}
template <class T_Traits>
template <typename T_Traits>
bool
Traits_adaptor_test<T_Traits>::
ta_merge_wrapper_imp (std::istringstream & str_stream, CGAL::Tag_true)
ta_merge_wrapper_imp(std::istringstream & str_stream, CGAL::Tag_true)
{
typedef T_Traits Traits;
typedef typename Traits::X_monotone_curve_2 X_monotone_curve_2;

View File

@ -237,7 +237,7 @@ private:
public:
/*! Constructor */
Traits_test(int argc, char * argv[]);
Traits_test();
/*! Destructor */
~Traits_test();
@ -248,8 +248,7 @@ public:
* Accepts test data file name.
*/
template <typename T_Traits>
Traits_test<T_Traits>::Traits_test(int argc, char * argv[]) :
Traits_base_test<T_Traits>(argc, argv)
Traits_test<T_Traits>::Traits_test()
{
typedef T_Traits Traits;

View File

@ -186,8 +186,8 @@ run_trapped_test()
else
run_test $1 $2 $3 $4 $5 $6 &
WPID=$!
trap "kill -HUP $WPID" INT
(sleep 1200; kill -HUP $WPID) > /dev/null 2>&1 &
trap "kill -9 $WPID" INT
(sleep 1200; kill -9 $WPID) > /dev/null 2>&1 &
SPID=$!
wait $WPID > /dev/null 2>&1
# RES=$?
@ -707,6 +707,126 @@ test_spherical_arcs_traits_adaptor()
clean_tests
}
#---------------------------------------------------------------------#
# point location with segments
#---------------------------------------------------------------------#
test_point_location_segments()
{
compile_test point_location $CGAL_GMPQ_NT $CARTESIAN_KERNEL $SEGMENT_TRAITS point_location_segments
if [ ${res} -eq 0 ] ; then
echo " ERROR: not executed point location of segments" >> $ERRORFILE
else
OUTPUTFILE=ProgramOutput.point_location_segments.$PLATFORM
rm -f $OUTPUTFILE
COMMAND="./point_location"
if [ -f point_location_segments.cmd ] ; then
COMMAND="$COMMAND `cat point_location_segments.cmd`"
fi
if [ -f point_location_segments.cin ] ; then
COMMAND="cat point_location_segments.cin | $COMMAND"
fi
echo "Executing point location of segments ..."
echo
ulimit -t 3600 2> /dev/null
if eval $COMMAND > $OUTPUTFILE 2>&1 ; then
echo " successful execution of point location of segments" >> $ERRORFILE
else
echo " ERROR: execution of point location of segments" >> $ERRORFILE
fi
fi
clean_tests
}
#---------------------------------------------------------------------#
# point location with segments
#---------------------------------------------------------------------#
test_point_location_dynamic_segments()
{
compile_test point_location_dynamic $CGAL_GMPQ_NT $CARTESIAN_KERNEL $SEGMENT_TRAITS point_location_dynamic_segments
if [ ${res} -eq 0 ] ; then
echo " ERROR: not executed point location of segments" >> $ERRORFILE
else
OUTPUTFILE=ProgramOutput.point_location_dynamic_segments.$PLATFORM
rm -f $OUTPUTFILE
COMMAND="./point_location_dynamic"
if [ -f point_location_dynamic_segments.cmd ] ; then
COMMAND="$COMMAND `cat point_location_dynamic_segments.cmd`"
fi
if [ -f point_location_dynamic_segments.cin ] ; then
COMMAND="cat point_location_dynamic_segments.cin | $COMMAND"
fi
echo "Executing point location of segments ..."
echo
ulimit -t 3600 2> /dev/null
if eval $COMMAND > $OUTPUTFILE 2>&1 ; then
echo " successful execution of point location of segments" >> $ERRORFILE
else
echo " ERROR: execution of point location of segments" >> $ERRORFILE
fi
fi
clean_tests
}
#---------------------------------------------------------------------#
# point location with circle segments
#---------------------------------------------------------------------#
test_point_location_circle_segments()
{
compile_test point_location $CGAL_GMPQ_NT $CARTESIAN_KERNEL $CIRCLE_SEGMENT_TRAITS point_location_circle_segments
if [ ${res} -eq 0 ] ; then
echo " ERROR: not executed point_location of circle segments" >> $ERRORFILE
else
OUTPUTFILE=ProgramOutput.point_location_circle_segments.$PLATFORM
rm -f $OUTPUTFILE
COMMAND="./point_location"
if [ -f point_location_circle_segments.cmd ] ; then
COMMAND="$COMMAND `cat point_location_circle_segments.cmd`"
fi
if [ -f point_location_circle_segments.cin ] ; then
COMMAND="cat point_location_circle_segments.cin | $COMMAND"
fi
echo "Executing point_location of circle segments ..."
echo
ulimit -t 3600 2> /dev/null
if eval $COMMAND > $OUTPUTFILE 2>&1 ; then
echo " successful execution of point_location of circle segments" >> $ERRORFILE
else
echo " ERROR: execution of point_location of circle segments" >> $ERRORFILE
fi
fi
clean_tests
}
#---------------------------------------------------------------------#
# point location with linear objects
#---------------------------------------------------------------------#
test_point_location_linear()
{
compile_test point_location $CGAL_GMPQ_NT $CARTESIAN_KERNEL $LINEAR_TRAITS point_location_linear
if [ ${res} -eq 0 ] ; then
echo " ERROR: not executed point_location of linear objects" >> $ERRORFILE
else
OUTPUTFILE=ProgramOutput.point_location_linear.$PLATFORM
rm -f $OUTPUTFILE
COMMAND="./point_location"
if [ -f point_location_linear.cmd ] ; then
COMMAND="$COMMAND `cat point_location_linear.cmd`"
fi
if [ -f point_location_linear.cin ] ; then
COMMAND="cat point_location_linear.cin | $COMMAND"
fi
echo "Executing point_location of linear objects ..."
echo
ulimit -t 3600 2> /dev/null
if eval $COMMAND > $OUTPUTFILE 2>&1 ; then
echo " successful execution of point_location of linear objects" >> $ERRORFILE
else
echo " ERROR: execution of point_location of linear objects" >> $ERRORFILE
fi
fi
clean_tests
}
#---------------------------------------------------------------------#
# segment traits
#---------------------------------------------------------------------#
@ -1118,7 +1238,6 @@ if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then
configure
fi
if [ "${TEST_WITH_CMAKE}" != "FALSE" ]; then
compile_and_run construction_test_suite_generator
fi
@ -1145,19 +1264,21 @@ test_algebraic_traits_core
test_algebraic_traits_gmp
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
compile_and_run test_iso_verts
compile_and_run test_vert_ray_shoot_vert_segments
compile_and_run test_construction
compile_and_run test_overlay
compile_and_run point_location
test_point_location_segments
test_point_location_circle_segments
test_point_location_linear
test_point_location_dynamic_segments
compile_and_run test_dual
compile_and_run test_do_intersect

View File

@ -1,34 +0,0 @@
33
0/1 0/1 1000000/1 0/1
0/1 1/1 1000000/1 1/1
0/1 2/1 1000000/1 2/1
0/1 3/1 1000000/1 3/1
0/1 4/1 1000000/1 4/1
0/1 5/1 1000000/1 5/1
0/1 6/1 1000000/1 6/1
0/1 7/1 1000000/1 7/1
0/1 8/1 1000000/1 8/1
0/1 9/1 1000000/1 9/1
0/1 10/1 1000000/1 10/1
0/1 0/1 0/1 1/1
0/1 1/1 0/1 2/1
0/1 2/1 0/1 3/1
0/1 3/1 0/1 4/1
0/1 4/1 0/1 5/1
0/1 5/1 0/1 6/1
0/1 6/1 0/1 7/1
0/1 7/1 0/1 8/1
0/1 8/1 0/1 9/1
0/1 9/1 0/1 10/1
1000000/1 0/1 1000000/1 1/1
1000000/1 1/1 1000000/1 2/1
1000000/1 2/1 1000000/1 3/1
1000000/1 3/1 1000000/1 4/1
1000000/1 4/1 1000000/1 5/1
1000000/1 5/1 1000000/1 6/1
1000000/1 6/1 1000000/1 7/1
1000000/1 7/1 1000000/1 8/1
1000000/1 8/1 1000000/1 9/1
1000000/1 9/1 1000000/1 10/1
0/1 10/1 500000/1 11/1
500000/1 11/1 1000000/1 10/1

View File

@ -1,18 +0,0 @@
16
0/1 0/1 10/1 0/1
10/1 0/1 10/1 10/1
10/1 10/1 0/1 10/1
0/1 10/1 0/1 0/1
4/1 4/1 5/1 5/1
5/1 5/1 6/1 4/1
6/1 4/1 4/1 4/1
7/1 4/1 5/1 5/1
5/1 5/1 7/1 6/1
7/1 6/1 7/1 4/1
6/1 8/1 5/1 5/1
5/1 5/1 4/1 8/1
4/1 8/1 6/1 8/1
3/1 6/1 5/1 5/1
5/1 5/1 3/1 4/1
3/1 4/1 3/1 6/1

View File

@ -1,10 +0,0 @@
9
-1/1 0/1 0/1 1/1
0/1 1/1 1/1 0/1
1/1 0/1 0/1 -1/1
0/1 -1/1 -1/1 0/1
0/1 2/1 2/1 0/1
2/1 0/1 0/1 -2/1
0/1 -2/1 -2/1 0/1
-2/1 0/1 -5/9 1/2
-5/9 1/2 0/1 2/1

View File

@ -0,0 +1,4 @@
S 0/1 0/1 0/1 1/1
S 0/1 1/1 1/1 1/1
S 1/1 1/1 1/1 0/1
S 1/1 0/1 0/1 0/1

View File

@ -0,0 +1,3 @@
L 1 0 1
L 1 0 0
L 1 0 -1

View File

@ -0,0 +1,8 @@
-2 10
5 20
2 5
2 -1
7 5
9 -1
14 -1
22 10

View File

@ -0,0 +1,3 @@
1/1 -1/10
1/1 1/2
1/2 1/2

View File

@ -0,0 +1,9 @@
7
-2/1 0/1
-1/1 0/1
-1/2 0/1
0/1 0/1
1/2 0/1
1/1 0/1
2/1 0/1

View File

@ -0,0 +1,4 @@
S 0 10 6 8
S 10 5 20 5
S 12 0 18 0
S 4 2 8 2

Some files were not shown because too many files have changed in this diff Show More